For those of you who have lived under a rock I will first explain what an ESP 8266 is.
Most of you know what an Arduino is. It is a small processor which runs at 16Mhz has 32K of memory and a lot of I/O pins. This all for a great value for the money.
Now about a year ago a new processor came on the market. Actually it has been around longer but last year it became very affordable , we are talking 4 dollar, and had an accompaning programming environment. Not only that, it runs at 80Mhz and has loads of memory and depending on what version you purchase lots of I/O pins. Best of all: it has wifi on board. And this last feature makes it interesting for many projects and IOT (Internet of Things) gadgets.
Just think about a small, 4 dollar costing module that enables you to put the lights in your home (or coffeemachine, or blinds or sprinkler or whatever) on or off from any place in the world......
So the version which is the cheapest and therefore has the lowest specifications is the ESP-8266-01. It has all the memory, the fast processor and Wifi but just 2 I/O pins.
Now 2 I/O pins is not a lot. However sufficient to put a sensor on or some buttons or a bunch of Neopixels (WS2812 leds). Even with this limited amount of I/O pins there are numerous projects to build with this little marvel.
But how do you program it......
How to program the ESP-8266-01
This is the actual module. On the left you can see there are 8 pins. 2 Pins for the power supply (3.3 Volts), 2 pins for I/O, 2 pins for TX and RX serial communication, a Reset pin and a chip select pin.
So directly connecting it to your computer is out of the question. So what you'll need is a serial to USB adapter and that is called an FTDI.
For your information: there is a special version of the ESP8266 that includes an USB port and has the full I/O pins available. It is called NodeMCU. You will find more information on this version on this weblog.
Now besides the need for a FTDI there is another problem.
As you can see the ESP 8266-01 is not exactly breadboard friendly.
The first picture shows that you can not put the ESP8266-01 on the breadboard in this way because all pins would short-circuit. The second picture is the normal way we would put a circuit on the breadboard. However the ESP 8266-01 has 2 rows of pins. So that's no option either.
So a while ago I bought some female breadboard cables. These can be attached to the ESP 8266-01.
That looks good, but how am I going to attach that on a breadboard. Well you can plug a male cable into the female ones like this.
And now we can complete the circuit.
As you can see it works. However I had some issues. Sometimes it would not work. The led on the ESP would not turn on or was very faint. And I saw power consumption run high. What could be wrong.....
Just look at the mess in the picture above. Loose connections and short circuits are definitely going to happen.
As I am planning to use the ESP 8266-01 in many projects I need a proper solution. And that is easily made by putting the complete circuit on a breadboard. This also gave me some extra possibillities. Lets look at the circuit first.
The top 4 pins of the ESP-8266-01 are from left to right:
Ground, I/O 2, I/O 0 and RX
The bottom 4 pins are from left to right:
TX, Chip-select, Reset and VCC
So the circuit connects the ground and VCC to the FTDI module. The TX of the ESP to the RX of the FTDI and vice-versa.
The Chip Select pin is permanently wired to the VCC (+3.3volt) line. And the VCC, Ground and both I/O pins are connected to a female header. This makes it easy to connect the program,ming board to a breadboard for further expansion and use of the I/O ports.
The extra options are a Reset button and a Program button which are both connected to ground.
The only tricky thing here is that the Program button is connected to ground and to I/O 0. So we can use the I/O pins as a normal I/O pin. But when we need to flash the ESP 8266-01 with a new operating system you'll press the program button at boot time.
Why would you reprogram the ESP 8266-01. Well just have a look at the extended list of 'operating systems we have for this chip'. We can use it with the standard AT set of commands, you can use it with the LUA programming language. You can use it with the Arduino IDE, there is a Python version available and there is ESP-Basic.
So if you want to use any of these you will need to reflash the operating system and therefore you will need the program button.
I used a strip PCB for making my programming board and put female headers on it so I can easily switch the FTDI and ESP8266-01 and have headers for connecting the I/O ports with a breadboard.
As there are multiple kinds of stripboards available I will not show you how I made mine. However by following the circuit above you will surely have no trouble in designing your own. I just present you here the looks of mine.
So this last picture shows you how my ESP8266-01 programming board is actually used. Is is attached to a string of Neopixels (WS2812 leds) of which you can control loads with just 1 pin of your controller. Compare that to the mess with female and male cables above and you'll immediately know why making this programming board is worth the effort.
So make this board. You are definitely going to have much profit of it as we'll be using this little processor for many projects in the future.
Till next time
Have fun
Luc Volders