ESP8266 Native

Exploring running native applications on the ESP8266 modules

Similar projects worth following
Exploring the use of the EspressIf sdk to write native apps on the ESP8266 modules

I've got a couple of ESP8266 modules. Tried to use them with the AT command set. They work, but it's not a very good interface.

Once the SDK was released, I downloaded it and tried the sample apps. I was able to get the IoT app working - now to explore further...

I want to see if I can use these are wireless sensor nodes.

  • More modules

    Matt Callow04/04/2015 at 11:40 0 comments

    I bought a couple of esp-12 modules with breakout board from ebay recently.

    These modules have the same pinout at the esp-07 but have PCB antenna instead of the chip antenna.

    The breakout boards work, but they have a couple of problems:

    • No pinouts for decoupling caps for the LDO
    • They are wide! Which means that they will fit on a standard breadboard, but they cover all the holes.

  • Back to the original SDK

    Matt Callow03/17/2015 at 08:17 0 comments

    It doesn't seem like there is much support/updates for the RTOS sdk, so I'm going to switch back to the original SDK.

    There are a number of things I'd still like to explore:

    • Using the RAM in the RTC to store data
    • Using MQTT
    • Using the ADC
    • SPI slave mode (maybe)

    I've also been making some mods to the makefiles to make them easier to use.

  • Working with FreeRTOS

    Matt Callow12/17/2014 at 10:08 0 comments

    I've been re-compiling my demo apps with the new FreeRTOS SDK. This is a lot easier to use for network access, if you are used to a BSD style socket interface (which I am).

    So far, so good. One thing I've noticed is the lack of support for reading from the UART. I've written some code to handle the uart rx interrupt and read the received data. Seems to be working so far...

    Updated code is in github

  • Temperature Measurements

    Matt Callow12/11/2014 at 11:19 0 comments

    I've updated the lua code to read the temperature from a 1-wire temp sensor using the code provided with the nodemcu firmware

    Results are on the same thingspeak channel

    I'm quite impressed with the nodemcu firmware. It makes it very easy to write simple scripts like this. Still don't like the upload method though!

  • nodemcu firmware

    Matt Callow12/10/2014 at 12:30 1 comment

    I did some testing with the nodemcu lua firmware.

    This is a handy scripting language for quick tests. Not sure I'd like to write a lot of code using it though. For one thing, I don't know lua, and also the upload process is a bit painful (I used this tool

    Anyway, I hacked a script to run at startup and do the following:

    • Connect to my wifi
    • Wait for valid IP
    • log the boot time to thingspeak
    • Sleep for 5 minutes

    Now I can measure the time required to re-connect to wifi and send an http message after a boot.

    Results are here

    (it's about 5 or 6 seconds)

    So, I can re-do my earlier calculations:

    • Sleep current: 50uA
    • Wake current: 100mA
    • Wake interval: 5 minutes
    • Wake time: 6 seconds

    Each hour, the device would be awake 12 times for 6 seconds at a time, (72 seconds or 0.02 hours) and asleep for the remainder of the time (0.998 hours). So average current consumption in any given hour is (100*0.02) + (0.05*0.998) = 2.05mA

    So the 890mAh battery would last about 434 hours, or 18 days. That's not great, but better than my original estimates.

    One issue still to resolve is the inconsistent sleep current. This varies from about 50uA to over 1mA!

  • New SDK version released

    Matt Callow12/09/2014 at 23:30 0 comments

    I've just seen that espressif have released their SDK on github

    Now with FreeRTOS integration!

    This looks like a big step forward in terms of ease of use. The demo application included uses a standard socket interface to send/receive data

    I'm going to install this and update my examples.

  • Deep Sleep

    Matt Callow12/09/2014 at 05:50 2 comments

    I've been testing the deep sleep mode on the ESP-03. I loaded the frankenstein firmware from here onto the module to test the deep sleep mode.

    Note, you need to tie gpio15 to GND in order to boot any firmware on this module as shown in this table

    LLHUARTDownload code from UART
    LHHFlashBoot from SPI Flash
    HxxSDIOBoot from SD-card

    On the ESP-01 modules, GPIO15 must be tied to GND on the board. But on this module because the pin is broken out, you need to make sure that it's grounded at boot.

    So, with the firmware running, I connect GPIO16 and RESET together and send the module into a deep sleep...

     === Press enter to activate this console === 
    (c) Andrew 'Necromant' Andrianov 2014 
    This is free software (where possible), published under the terms of GPLv2
    frankenstein > deepsleep 10000000
    Frankenstein ESP8266 Firmware
    Powered by Antares 0.2-rc1, Insane Mushroom

    While the module is awake, current draw is round 70mA. In deep sleep this drops to 600uA which rather high (stated deep sleep current is <10uA) I try it again, and this time the current drops to 45uA, which is a lot better.

    What I'd like to do, is create a battery powered sensor running of a old Nokia 890mAh 3.7v LiPo

    Some quick calculations:

    • Sleep current: 50uA
    • Wake current: 100mA
    • Wake interval: 5 minutes
    • Wake time: 30 seconds

    So each hour, the device would be awake 12 times an hour for 30 seconds at a time, (360 seconds or 0.1 hours) and asleep for the remainder of the time (0.9 hours). So average current consumption in any given hour is (100*0.1) + (0.05*0.9) = 10.045mA

    So the 890mAh battery would only last 89 hours, or less than 4 days. That's not really good enough for a battery sensor. (Compare this to some other battery sensors that I've build using NRF24L01+ modules which get about 10 weeks life out of the same battery)

    I'll do some experiments to validate my estimates (especially the awake time) to see if this can be improved.

  • New Modules

    Matt Callow12/09/2014 at 03:03 0 comments

    I got a couple of new module types recently and have started to experiment with them. On the left is the ESP-03, and on the right is the ESP-07. Both modules have 2mm pin spacing, so are not breadboard friendly.

    I built a breakout board for the ESP-03. it brings out the pins to 0.1" pitch headers and also adds a 3.3V LDO

    Although several sources list this module as having a RESET pin, it is not broken out to the headers. Is is available on a small pad near the antenna. I wired this to the NC pin next to GND.

    I also chose not to breakout the external WiFi antenna pin at this stage.

    The ESP-07 modules look very interesting. They have all the pins I need to make an wireless sensor board, including:

    • RESET and GPIO16 - to allow deep sleep mode
    • ADC pin - to monitor battery voltage
    • Other GPIOs to connect sensors.

  • Demo Apps

    Matt Callow11/21/2014 at 05:19 0 comments

    I wrote some demo apps based on the SDK. They are available on github

    There are 7 so far:

    01blinky - simple blinking LED on gpio2

    02blink2 - as above, but using timers

    03helloworld - Guess what this one does! (Connect to the device at 9600 baud after programming)

    04sysinfo - prints out some system information (again connect at 9600)

    05i2cdemo - This one is not working yet. I've copied the i2c_master files from the IoT example, but still needs more work

    06thingspeak - This one actually uses WiFi! It will connect to thingspeak and update a channel with an internal counter. Optionally, it can be configured to use the thingspeak talkback commands to remotely control an LED on gpio2

    07switch - basically a copy of the IoT example - a work in progress. I plan to simplify this somewhat

View all 9 project logs

Enjoy this project?



Dave wrote 03/22/2015 at 22:04 point

Matt, Love these modules but I cannot get your arduino version to work. It goes through to connect to server but comes up with err 3 every time. I've tried 01, 03, 05 , 12 variants and the same error. Any idea's ?


  Are you sure? yes | no

Matt Callow wrote 03/23/2015 at 00:09 point

Hi Dave, I've not used that sketch for a while now.  I've taken a quick look and err 3 seems to be a timeout. So I expect that the module is not returning the string that the sketch expects (in this case "Linked").

What version of the SDK and AT command firmware are you using? The AT command firmware has been updated quite a lot since I wrote the sketch and I wouldn't be surprised if the data it returns has changed (That's one reason I stopped using it)


  Are you sure? yes | no

Rajendra Khope wrote 12/12/2014 at 08:12 point
Here is my effort to add responsive GUI for ESP web server

  Are you sure? yes | no

matt wrote 12/10/2014 at 08:46 point
Have you considered the MMQT IoT protocol? There are are linux, node.js, and adruino versions. I was thinking of using these modules as clients using the arduino. Perhaps if we are lucky there will be a linux port soon for these.

  Are you sure? yes | no

Matt Callow wrote 12/10/2014 at 09:59 point
Yes, I've been thinking of porting MQTT. More tempted now that espressif have released the SDK with FreeRTOS support

  Are you sure? yes | no

timonsku wrote 12/05/2014 at 21:14 point
This is great! I love simple reduced examples, always the best way to learn something new.
Would be cool if you could make some Wifi Hello World examples as it seems that sending TCP or UDP packets is a tad more complicated than using the GPIOs. The thingspeak demo is nice but a bit much for learning to use Wifi. Just sending a simple string as a TCP and UDP packet to a server would be nice to see. Same for the other direction.

  Are you sure? yes | no

Willem Wouters wrote 12/06/2014 at 14:03 point
What are you thinking about with Wifi Hello World?? What kind of example projects is a need for (esp8266 firmware)?
Then ill post some on my github.

ESP8266 AP <---TCP REQUEST (ie. wget)--- PC
ESP8266 AP ------- UART HELLO -------------> PC

ESP8266 AP <-------------TCP REQUEST (ie. wget)----------- PC
ESP8266 AP -------- TCP RESPONSE HELLO (ie. nc) -----> PC

ESP8266 AP <-----------UART REQUEST -------------- PC
ESP8266 AP ----------- TCP POST HELLO ---------> external webserver

ESP8266 AP <-----------UART REQUEST ------------ PC
ESP8266 AP --------------- TCP GET ----------------> external webserver
ESP8266 AP -----------UART RESPONSE -------------> PC

  Are you sure? yes | no

Matt Callow wrote 12/09/2014 at 04:18 point
I'l try to add some more examples soon. I'm not sure that sending a string over a TCP connection would be much simpler than the thingspeak example. After all, the HTTP request is just sending a string over a TCP connection!

  Are you sure? yes | no

Willem Wouters wrote 12/05/2014 at 19:26 point
Looks very nice. I'm going to fork some of your code ;). I also have some example projects on my
Examples with webserver. TCP send on interrupt. Sdk 0.9.3 lwip stack. At the moment busy with ap-igmp server side. Lots of problems with multicast UDP send, used in softAP+dhcp. Anyone experience with that? I will update new code soon(have some pending)

  Are you sure? yes | no


[this comment has been deleted]

Matt Callow wrote 11/21/2014 at 05:11 point
Sorry, I'm using Linux.
In fact i use the Linux VirtualBox image that EspressIf provided

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates