ESP8266 driver using the NodeMCU interface

Dependencies:   BufferedSerial

Dependents:   esp8266_nodeMCU1 esp8266_2_thingspeak1 Solarator_0-0-2 IoTBurglar_and_Fire_AlarmSystem ... more

Fork of ESP8266Interface by ESP8266

This is an alternative implementation of the ESP8266 driver that uses the NodeMCU firmware. The NodeMCU firmware provides a slightly larger feature set than the default firmware through a Lua interpreter.


This library is currently in Alpha. It is not feature complete and has some bugs, proceed with caution. Fixes and patches are welcome!

Interface changes

  • SSID and passphrase moved out of ESP8266Interface constructor and to ESP8266Interface::connect
  • ESP8266Interface constructor provides optional timeout parameter to specify how long to wait for network operations


NodeMCU defaults to a baud rate of 9600 instead of 115200 used by the default firmware.


To install the NodeMCU firmware, follow the instructions on the Firmware Update wiki page using the nodemcu_integer_0.9.6-dev_20150406.bin binary at address 0x00000 instead of boot_v1.1.bin and user1.bin.

Since the NodeMCU firmware defaults to a baud rate of 9600, the Serial Passthrough program can be used to get direct access to the Lua interpreter running on the ESP8266.


Working features:

  • TCP Client
  • UDP Client Transmit (Currently only UDP Server can recieve messages)
  • Single Connection at a time
  • Station Mode (Connects to AP)
  • DNS Lookups

To be implemented:

  • TCP Server
  • UDP Server
  • UDP Client recieve
  • Multiple Connections tracked through Lua variables
  • AP Mode (Act as access point)
  • IPV6 support (Existing issue with NodeMCU)


RevisionDateWhoCommit message
48:6031f70e3914 2015-06-04 geky Fix for not using full buffer in TCP recieve default tip
47:04632d22a723 2015-06-04 geky Merged rev 46/45
46:4abb80f0a920 2015-06-04 geky Seperated sent messages into chunks to keep from overflowing the Lua buffer
45:3cfb7406d993 2015-06-04 geky Sanitized both transmitted and recieved strings
44:16da10e7b3f7 2015-06-03 geky Reimplemented ESP8266 driver using the Nodemcu firmware
43:2e326d95fe2c 2015-05-07 mbedAustin added warning about sending messages > 2048 bytes
42:3f62103a4f3c 2015-05-07 mbedAustin enabled TCPConnection debug messages, made tcpconnection and socket messages more verbose (file and line number included in output)
41:264902b160ea 2015-05-07 mbedAustin cleaned up DBG printf messages, made print pretty
40:0a83315aea0a 2015-05-04 sam_grove Update so close exits transparent mode without depending on state from the application
39:89e259295728 2015-05-02 mbedAustin trying to merge a previous rev
38:86e75901efc1 2015-05-02 mbedAustin trying to merge things together...
37:6887e61cf674 2015-05-02 mbedAustin Updated UDP LIbrary sentto command to initialize endpoint flag. was lost in a previous commit on accident.
36:e1545c6c2cb3 2015-05-02 mbedAustin updated debug command prints
35:22d30e936e4c 2015-05-01 mbedAustin Schenaniganz
34:7ccda5d68a00 2015-05-01 mbedAustin safety commit
33:727aac1996b8 2015-04-30 mbedAustin Fixed problem TCP.connect() command, the return values were 0/1 when it should have been -1/0 . Tested to work with TCP Test
32:cf071dc33972 2015-04-30 mbedAustin TCP Send / Recieve Working
31:fd0eaf273b11 2015-04-30 mbedAustin safety commit
30:c035696b9397 2015-04-29 mbedAustin Safety Save
29:939372104145 2015-04-28 mbedAustin Added IP Function, made all Serials RAWSerials;
28:91e65e22e63a 2015-04-28 mbedAustin aquiring IP Address correctly, but not returning it from inner call level. Safety commit before mucking around
27:9c6cefc12f0c 2015-04-20 michaeljkoster Blocking
26:0d5bcb3903e2 2014-12-30 michaeljkoster set baud rate and remove printf from rx handler
25:8e2b04473830 2014-12-30 michaeljkoster Starting AT v0.2 support for ESP8266
24:03585a13ff3b 2014-12-11 michaeljkoster Added hardware reset
23:de9221771e96 2014-12-08 michaeljkoster Added CWMODE command to join()
22:c4360e61486a 2014-12-02 michaeljkoster Add state.cmdMode and some cleanup
21:690526f05fe6 2014-12-02 michaeljkoster Fix recieveFrom loop to have 2 stage timeout in non-blocking case, return 0 bytes
20:d764237405c2 2014-12-01 michaeljkoster cleanup
19:fb8d5bff2076 2014-12-01 michaeljkoster sync
18:60422852e99c 2014-12-01 michaeljkoster sending stuff
17:d11fa4c3ac65 2014-12-01 michaeljkoster working sort of
16:3f0efaa57a12 2014-12-01 michaeljkoster sync
15:37a7a56a424f 2014-11-30 michaeljkoster reorganize
14:4d1128f72e00 2014-11-30 michaeljkoster Add getIPAddress
13:41098c907200 2014-11-30 michaeljkoster First commit function templates for lightweight UDP client interface to ESP8266
12:c5f0eac67a8a 2014-10-08 michaeljkoster Debug
11:fc3d86645d23 2014-06-03 screamer More merges
10:131675c17372 2014-06-03 screamer Merge
9:f2439377c172 2014-04-08 screamer Documentation improvements
8:04afe20d7927 2014-04-08 screamer Merge
7:3152fcc74390 2013-11-08 lz307 Added delay to accommodate slow speed on the seeed wifi shield.
6:5176e0864078 2013-10-17 screamer Fixed @ return documentation tags
5:81e264dbbf03 2013-10-17 screamer Fixed documentation tags
4:0bcec6272784 2012-12-20 samux proper join after reboot - increase size flush
3:9aa05e19c62e 2012-12-20 samux add reboot method - reboot module for accept (tcp server)
2:8e54830d0df7 2012-11-24 samux set dns server name (now able to use "open host port")
1:fb4494783863 2012-08-24 samux first commit
0:302ec35139ec 2012-08-24 mbed_official mbed official WiflyInterface