How to use ESP8266 ESP-01 as a SENSOR web client

I’m not going to explain in detail what is ESP8266 because if you have found this post I’m sure you already know it. But just in case, it is an awesome cheap board (less than 4$) with built-in wifi communication (802.11 b/g/n), and SPI, UART. You can also use its processor to run your code.

Wiring:

Use FTDI with 3V3 output. If you face problems with this running on Windows check this link: Unbrick FTDI 232R

Burning LuaFirmware

Download Coolterm http://freeware.the-meiers.org/ (putty like app but much cooler)
Check that your ESP8266 has some firmware through coolterm
Enter with coolterm at 115200 (most probable default speed)
Once in, type AT+GMR, my firmware was based on 00160901

After burning it, GPIO0 pin should be disconnected from ground in order to reboot in normal mode. Otherwise it will be reboot in UPLOAD mode. So power it OFF, disconnect GPIO0 pin from ground… and voilà! you’ve got a ESP8266 with LUA Firmware

BasicCoding

Now with a burned LUA Firmware, we should reconfigure CoolTerm at 9600bps to be able to communicate with the board.
Connect and type this basic code to check the wifi connectivity:

Like this:

Related

80 Comments on “How to use ESP8266 ESP-01 as a SENSOR web client”

[…] firmware, opening the doors to an Internet of Things based around an ESP8266. [Marc] and [Xavi] just wrote up a quick tutorial on how to turn the ESP8266 into a WiFi sensor platform that will relay the state of a GPIO pin to […]

[…] firmware, opening the doors to an Internet of Things based around an ESP8266. [Marc] and [Xavi] just wrote up a quick tutorial on how to turn the ESP8266 into a WiFi sensor platform that will relay the state of a GPIO pin to […]

I had this issue, and worked around it by choosing a different firmware binary file. For my ESP-01 module, I was able to load version 0.9.5 (20150106.bin), and it seems to work, but requires lua source code (no more AT commands).

[…] firmware, opening the doors to an Internet of Things based around an ESP8266. [Marc] and [Xavi] just wrote up a quick tutorial on how to turn the ESP8266 into a WiFi sensor platform that will relay the state of a GPIO pin to […]

Is it possible for you to create a simple temperature reporter using a TMP36 sensor.
Using a identity for the individual board to be able to use several at the same time but identify the reported temperatures.
Having it to report the temperature every 10 minutes.
Configuring the WLAN ssid in a changable way ( maybe over the serial)

That was my plan next summer. Create a bunch of solar charged temp, humidity, water meters for my greenhouse. Make each sensor create a random SSID and an app to connect to each for naming, pairing. I was originally using the Synaptics python mondules but they where bloody expensive at $50 a pop.

@OP Would you consider running a smaller scale test and measure power consumption over a 10m/100m/250m distances? I ordered my boards but with Christmas coming and new Hong Kong export regs im afraid I will be waiting a long while…

[…] firmware, opening the doors to an Internet of Things based around an ESP8266. [Marc] and [Xavi] just wrote up a quick tutorial on how to turn the ESP8266 into a WiFi sensor platform that will relay the state of a GPIO pin to […]

when ever i issue a node.restart() device crashing and device is not responding after restarting the esp8266 . i picked firmware from https://github.com/nodemcu/nodemcu-firmware and loaded nodemcu_512k.bin at 0x00000 . Can anyone help me out

when ever i issue a node.restart() device crashing and device is not responding after restarting the esp8266 . i picked firmware from https://github.com/nodemcu/nodemcu-firmware and loaded nodemcu_512k.bin at 0x00000 . Can anyone help me out

SIr, i have my esp8266 working already after I load some code, then if I unplug the supply it it will not work anymore. Is there a possible ways of making it a stand alone esp without any reuploading of code.

I need this information too. Who Know how to do auto-refresh page? And one more question. Does any bodie do page (web-server) of input SSID and PASS forms, and then after send its, reconnect to wi-fi local?

Hi, I was uploading the firmware ESP_8266_BIN0.92.bin and restarted after it… but
1. the ESP is communicating still in 115200 baud not at 9600 as you mention in the tutorial… and if I copy/paste any LUA command, it says Error
I am using CoolTerm on a Mac…
Thanks in advance….

marc,
Thanks for the tutorial. Got my 8266-01 flashed to 0.9.5 20150106.bin, which seems to require lua code/commands to work properly. I can write the contents of a lua code file to the 8266 using coolterm (connection/send textfile…), and the program works (mostly). My problem is that a power cycle clears the program from memory. Your post implies that writing lua commands to the 8266 should remain after a power cycle: (“Congrats, now each time you power it on back again, it will remember last wifi connection wifi setup.”)
This has not been my experience, however. I’m looking for a way to write my lua program to flash memory, but LuaLoader is not working for me. Any thoughts?
Also, is the GPIO0 pin grounding exclusively for flashing expressif firmware, or for any code going to non-volatile memory?

i am trying to establish client server communication in full duplex mode but it does not seems to work . i tried in simplex mode and it works properly. i am using lua in nodemcu firmware.
please help me out

Just getting started with nodemcu and trying to learn the statement syntax etc. I came here for examples, and tried to do the basic communication…
print(wifi.sta.getip())
–0.0.0.0
wifi.setmode(wifi.STATION)
wifi.sta.config("SSID","password")
print(wifi.sta.getip())
–192.168.18.110

@john, Greetings from another John starting out. I’m using Esplorer as a serial communications terminal and that code works for me. I do know from trial and error that some terminal programs don’t work as well as others. Esplorer has some great features if you haven’t tried it you might want to check it out. It is more of an IDE than just a terminal.You can copy/paste code into it, type in like command line, or there are multiple “buttons” that simply send some quick commands like restart, chip id heap and more.

Hello, I am using an ESP 7 module, with the latest download of nodemcu (as of 10/05/15). I’d hoped to use this as an exercise to learn how to connect to wifi with the module. I am using Esplorer to interface with the module. I’ve done some uploads to the module, to test gpio pins successfully, but this code generates errors on every line when I try to upload it. Could it be the versions of nodemcu have changed syntax? I’m new at this so I’m not sure what is going on…..Thanks for any help…..

All you should do is to use the best chiropractic service. Patently wait for the result of chiropractic treatment for you will ahieve drug free,
and restorative of your spine. That is the reason it is important to know the symptoms of TMJ and differentiate it with simple head aches in order to avoid
further harm.

One particular steam opening in between, don’t assume all the way over
like Colossal or Dinar or HAAN. This running water will in fact speed
up your removal of the water and with a simple flip of the
valve can add water to the fish tank. Linoleum has had its day, but today’s buyers are not interested in it, particularly if it is old, faded, yellowed or curling.

What you wrote was very logical. However, think about this, what if you wrote a catchier
post title? I ain’t saying your content is not good, however suppose you added a
headline that makes people desire more? I mean How
to use ESP8266 ESP-01 as a SENSOR web client | import <hack> is kinda
plain. You ought to glance at Yahoo’s home page
and note how they write news headlines to get viewers to click.
You might try adding a video or a related pic or two to get readers interested about everything’ve written. Just
my opinion, it might bring your website a little livelier.

I have ESP-01 and CH340 ttl adapter. Can’t make it work. If I connect CH_PD cable to the ESP the adapter just disappears from devices. Tried in Linux and Windows – same result. Windows says that “the connected device is not recognized”. I used that adapter before for communication with a router and it worked just great. Any ideas what can be wrong?

Thanks for help! I use this adapter http://goo.gl/uv2fJi but I figured out what’s wrong already!
The trouble was – the ESP-01 requires exactly 3.3v to work. I experimented with a few sources which had 3.25 volts and probably were not powerful enough. Once I used ATX power supply it started responding normally. Not sure why it caused the adapter to stop working though.

Having read this I thought it was rather informative.
I appreciate you spending some time and effort to put
this short article together. I once again find myself spending a significant
amount of time both reading and leaving comments.
But so what, it was still worthwhile!