2018 General Helpful and Reference Info and Notes

General Helpful and Reference Info

  • To set up a new ESP8266 for use with your robot:
    • Install the Arduino IDE
    • Add the ESP8266 board to the Arduino IDE

    • Add Servo, Adafruit Unified Sensor, and Adafruit DHT sensor libraries using Arduino IDE Libraries Manager.
    • Download our custom code, load it into the Arduino IDE, then upload it to the ESP8266 via USB
  • WiFi:
    • Your ESP8266 will automatically attempt to connect to the AmazingRobots.net wireless network.
    • If that network is not found, the device will enter WiFi Configuration mode:
      • A wireless network named for your device will appear.
      • Connecting to that network will allow you to use a web browser to configure your ESP8266 to connect to your home network!
  • ESP8266 info
    • Comparison of ES8266 DevBoard versions
    • ESP8266 (ESP-12E) DevBoard diagram:
    • Motor Shield manual
    • MotorShield diagram:

      • Below the blue headers are markings: A-/A+, B-/B+, VM/GND, VIN/GND.
        • A-/A+ are for one motor
        • B-/B+ are for the other motor
        • VM/GND would be for a power source dedicated to motors
        • VIN/GND would be for a power source dedicated to the brain.
        • Remember to jumper using only one of these connections.
        • Remember to un-jumper if using a separate power supply for the motors.
    •  Power:
      • The ESP8266 requires at least 3.3v but not more than 9v.
      • The motors requires at least 4.5v but could handle up to 12v.
      • It is possible to have different power sources for the motors and the brain.
        • You could have a 3.3v battery source for the brain and a different, higher-voltage power source for the motors.
        • If using different power source, place the jumper beside the power switch over “VM” and “NC” (or, use no jumper).
      • It is also possible to use the same power source for the motors and the brain, as long as that power source is between 4.5v and 9v.
        • If using the same power source, place a jumper on the motor controller beside the power switch to connect the pins “VIN” and “VM”.
    • ESP8266 to NodeMCU and Arduino to ESP8266 Pin mapping:
        • ESP8266 to NodeMCU pin mappings (from this page):
      NodeMCU ESP8266 GPIO Functions
      D1 GPIO5 I2C-SCL or CLK
      D2 GPIO4 I2C-SDA
      D3 GPIO0 SPI-RES or RST
      D4 GPIO2 SPI-DC
      D5 GPIO14 SPI-SCL or CLK
      D6 GPIO12 SPI-MISO
      D7 GPIO13 SPI-SDA or MOSI
      D8 GPIO15 SPI-CS or SS
      D9 GPIO3 Serial RX0
      D10 GPIO1 Serial TX0
      D11 GPIO9
      D12 GPIO10
        • Pin numbers written on the board itself do not correspond to ESP8266 GPIO pin numbers. In the Arduino IDE, constants are defined to make using this board easier:
          static const uint8_t D0 = 16;
          static const uint8_t D1 = 5;
          static const uint8_t D2 = 4;
          static const uint8_t D3 = 0;
          static const uint8_t D4 = 2;
          static const uint8_t D5 = 14;
          static const uint8_t D6 = 12;
          static const uint8_t D7 = 13;
          static const uint8_t D8 = 15;
          static const uint8_t D9 = 3;
          static const uint8_t D10 = 1;

        • For example, if you want to use NodeMCU pin 5, use D5 for pin number, and it will be translated to ‘real’ GPIO pin 14.
        • Another way to define Arduino friendly names to the ESP8266 GPIO pins is to use
          the C/C++ pre-processor directive #define as shown here:
          #define D0 16
          #define D1 5 // I2C Bus SCL (clock)
          #define D2 4 // I2C Bus SDA (data)
          #define D3 0
          #define D4 2 // Same as "LED_BUILTIN", but inverted logic
          #define D5 14 // SPI Bus SCK (clock)
          #define D6 12 // SPI Bus MISO
          #define D7 13 // SPI Bus MOSI
          #define D8 15 // SPI Bus SS (CS)
          #define D9 3 // RX0 (Serial console)
          #define D10 1 // TX0 (Serial console)


  • Manually sending a compiled bin to the nodemcu (instead of the normal Arduino IDE process which recompiles every time…)
    • In Arduino IDE, select Sketch, Export compiled binary. This places a “.bin” file in the project’s home
    • Change to the project’s folder
    • On Windows:
      • (use the correct path to esptool.exe, obviously! Be in the path with the bin, or use the whole path to the .bin…)
      • c:UsersmikeAppDataLocalArduino15packagesesp8266toolsesptool.4.13esptool.exe -vv -cd nodemcu -cb 115200 -cp com3 -bz 4M -ca 0x00000 -cf "AmazingRobot2018.05.ino.nodemcu.bin"