I'm also going to use the original little board with the 8 pin header, because I have them sitting around and because the project I'm planning only needs one I/O pin. I don't recommend buying this module anymore, it's not really significantly cheaper than the ones with a ton of I/O broken out, so unless you have some specific use for one with almost no I/O buy the bigger modules.
I watched several videos and looked at a few wiring diagrams, there's a lot of info out there. I don't have anything original here, I'm just recording what worked for me, as much for my own memory as anything else. As such I hope this is useful to you but it's not a very polished article.
You need a USB to serial converter board that supports 3.3V - don't try to use a 5V one. I recommend one with the CH340 chip. I bought this sweet looking board off eBay for about $3.50:
I don't know if Windows is now loading CH340 drivers, or they came in via Arduino. In any case if you plug yours in and it doesn't register as a com port, try this driver (I haven't tried it, it's just a link I found):
Installing LUA on your boardTo hook the converter to the ESP8266, you need to wire things up like so:
|Image from Arduino.cc|
- Attach RX to TX on your converter and TX to RX on your converter
- Attach VCC and CH_PD to +3.3V supply
- if you're using a separate 3.3V supply, attach the ground of the supply to this ground also, for a common reference.
I had to use an external 3.3v power supply to run the ESP8266 board, it just draws too much power and the USB to serial converter just kept resetting and causing trouble.
To install LUA on your board, you need to download the software to do it at this location:
Unzip that wherever you like.
Connecting GPIO0 to ground before applying power causes the ESP8266 to enter bootloader mode, which will make it sit and wait for you to upload new firmware to it when you turn it on. Plug your USB to serial converter and if you don't already know what port it's on, look in device manager to see what serial port just appeared:
In the NodeMCU-Flasher that you extracted from the ZIP before, Go into the Win64/release or Win32/release directory as appropriate and run the ESP8266Flasher.exe program. Make sure the correct COM port (discovered above) is selected and click the "Flash" button. You should get a pair of MAC addresses and it should start programming LUA into your ESP8266. Let it finish. You'll get a nice green check in the lower left when it's done.
Now in order to begin using LUA on your board, remove power from it and move the GPIO0 pin to VCC (3.3v) and power it back up again.
The program I found worked for me for experimenting with LUA is LUA Uploader, here's a video intro from the author:
From the links on that video, here's the URL for grabbing a copy:
Click on the latest version, then click the "Raw" button to download the ZIP. Extract that wherever you like.
When you run that you can connect to the COM port and start playing with LUA.
Here's a page that also covers everything I've said here and also has good example code for controlling a couple of LEDs from a web page. This is a really good thing to do for your first project, it's very straightforward and shows some useful functionality that you can expand on.
For my actual project, I wanted to create a temperature monitor. I had a HELL of a time getting the board to talk to a DS18B20 temp sensor, there is some rather flaky example code out there that is just broken, but finally I found some that worked.
Here's a photo of the board I made. The power goes in the left, the programmer (when needed) plugs in the top row of 5 pins. The DS18B20 attaches up top there. There's a switch under the board that connects GPIO0 to ground for initial firmware flashing.
and with the programmer plugged in:
Hitting the server with the example code:
Here's the code that I finally got working: