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
-
- Follow instructions at https://github.com/esp8266/Arduino
-
- 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.
- To configure your bot’s WiFi settings, attach USB cable to the bot then use the Arduino IDE’s Serial Monitor, your operating system’s serial terminal (for Windows, try TinyTerminal), or this web-based terminal.
- Select your Com port. Serial bit rate for the console is 9600 or 115200. Data format (parity) is N81.
- Reset the bot (using the RST button on the ESP8266) then follow the menus provided by our custom code to connect to WiFi.
- ESP8266 info
- Comparison of ES8266 DevBoard versions
- ESP8266 (ESP-12E) DevBoard diagram:
- Motor Shield manual
- MotorShield diagram:
- ESP8266 to NodeMCU and Arduino to ESP8266 Pin mapping:
-
- ESP8266 to NodeMCU pin mappings (from this page):
NodeMCU ESP8266 GPIO Functions D0 GPIO16 LED_BUILTIN or BUILTIN_LED 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)
- 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:
-
- Manually sending a compiled bin to the nodemcu (instead of the normal Arduino IDE process which recompiles every time…)
- Windows (change paths, obviously! Be in the path with the bin, or use the whole path…):
C:UsersmikeAppDataLocalArduino15packagesesp8266toolsesptool.4.9esptool.exe -vv -cd nodemcu -cb 115200 -cp com3 -bz 4M -ca 0x00000 -cf "AmazingRobot2017.14d.bin"
- Windows (change paths, obviously! Be in the path with the bin, or use the whole path…):