Tuesday, 24 March 2015

ESP8266 - Hooking up via FTDI and flashing the firmware

Okay so you've sourced your ESP8266 Module, FTDI USB to TTL Adapter (also referred to as a UART Programmer) and associated parts as per the previous blog post. Now onto flashing the firmware.

Prior to flashing the firmware on your ESP8266 Module you will need to hook this up to your USB to TTL Adapter via Jumper Cables. In order to go about doing this the following pinouts will need to be observed and carefully followed (so as not to damage anything).

ESP8266 pinout:


ESP8266 ESP-01 (component side).


On the component side of the ESP8266 Module the pin layout is as follows (whilst hooking up to a USB to TTL Adapter and PSU rails please ensure the pin layout observed is from the component side and not the side with no components on):

Pin layout of an ESP8266 ESP-01 (component side).




FTDI USB to TTL pinout:


On the solder side of the FTDI USB to TTL Adapter that I've sourced the manufacturer's have conveniently labelled the pinout of each of the pins. The pin layout seems to vary from manufacturer to manufacturer though therefore please make sure to check what the exact pin layout is for the USB to TTL Adapter you've bought.

Note: Take great care not to hook up your ESP8266 to the +5v rail:

A FTDI USB to TTL Adapter.

The wiring that needs to be followed in order to hook-up both an ESP8266 and a USB to TTL Adapter is as follows (a 3.3v PSU is recommended; Please refer to Note 2 as below):

ESP8266 > USB to TTL Adapter

RX > TX
TX > RX
CH_PD > +3.3V
GPIO 0 > GND
+3.3V > +3.3V
GND > GND

Note 1:

GPIO 0 is only connected to GND for flash programming the ESP8266. Once the firmware on your ESP8266 has been flashed this GPIO pin can be left unconnected unless of course you are using both of the GPIO pins.

Note 2:

Despite wiring up the ESP8266 and USB to TTL Adapter that I'd bought as above it was observed that there were difficulties in getting the flash programming software to work the USB to TTL Adapter's virtual COM Port would more often than not disconnect immediately after flash programming. To get around this problem a MB-102 3.3v / 5v Breadboard Power Supply (PSU) Module with external 800mA AC/DC Adapter was added and the problems immediately disappeared. Flash programming worked flawlessly and the USB to TTL Adapter's virtual COM Port no longer disconnected.


The wiring was basically the same as above but instead of the +3.3V pin on the ESP8266 being connected to the +3.3V pin on the USB to TTL Adapter it was connected to the +3.3V power-rail (the +3.3V pin on the USB to TTL Adapter was disconnected from the +3.3V pin on the USB to TTL Adapter). At a guess the +3.3V pin on the USB to TTL Adapter was supplying an inadequate amount of current for the ESP8266 to work reliably.

MB-102 3.3v / 5v Breadboard Power Supply (PSU) Module


From what has been understood the ESP8266 Module needs a reasonable amount of current depending on what operating mode it is in to function correctly. Because of this I'd strongly recommend using a minimum of a 300mA - 500mA AC/DC Adapter to provide power.

Note 3:

You will more than likely conclude that an ESP8266 ESP-01 is not Breadboard friendly off the shelf so to speak. A contributor on the ESP8266 forum has designed their own ESP8266 Breadboard Adapter and many hobbyists have made their own using a small piece of veroboard. There is an excellent tutorial submitted by 'technochatter' on instructibles.com that can be found here. Instead of using an ESP8266 Breadboard Adapter you could just use Male to Female jumper wires which is the method I'd opted for. These are cheaper than buying and making your own adapter.


ESP8266 with Male to Female Jumper Wires attached.

Connecting the parts together step by step:

1). Assuming you are using a MB-102 3.3v / 5v Breadboard Power Supply (PSU) Module connect the +3.3v power rail (denoted with a red line on an MB-102) to VCC and CH_PD pins on your ESP8266 with Male to Female jumper wires.

ESP8266 VCC and CH_PD hooked-up to +3.3v power rail.

2). Connect the 0v power rail (denoted with a blue line on an MB-102) to GND and GPIO 0 pins on your ESP8266 with Male to Female jumper wires.

ESP8266 GND and GPIO 0 hooked-up to 0v power rail.

3). Connect the TX pin on the USB to TTL Adapter to the RX pin on the ESP8266 using a Male to Male jumper wire.

4). Connect the RX pin on the USB to TTL Adapter to the TX pin on the ESP8266 using a Male to Male jumper wire.

5). Connect the 0v power rail (denoted with a blue line on an MB-102) to GND on the USB to TTL Adapter using a Male to Male jumper wire.

Installing NodeMCU Firmware:


You are now ready to flash upgrade your ESP8266. The custom ROM firmware installed in this tutorial is NodeMCU. There is other firmware that is installable on an ESP8266 but I've no knowledge on the latter as this is still new to me to be completely honest.

1). Download Node-MCUFlasher from Github.com by clicking on the download zip link on the right of the page or by clicking here.

2). Unzip the downloaded .zip file taking a note of where it has unzipped to.

3). Select the 32-bit or 64-bit version depending on what version of operating system you are using. You can determine this by navigating to 'Control Panel\All Control Panel Items\System' in Explorer.

4). Assuming the required FTDI drivers have downloaded and installed successfully make a note of what virtual COM Port has been assigned to your USB to TTL Adapter.

5). Double-click on the MCUFlasher .exe file.

NodeMCU Firmware Programmer.
6). On the proviso the Com Port shown that corresponds to your USB to TTL Adapter (in this example it is Com Port 5) click on 'Flash(F)' and a progress indication should be shown. Once the flash programming has completed there should be a green tick in the checkbox on the bottom left of the window.

7). Now that your ESP8266 has NodeMCU firmware running on it I'd strongly recommend you disconnect GPIO 0 from GND (this will allow for the ESP8266 to boot normally as opposed to booting into flash mode). GPIO 0 only needs to be connected to GND in order for firmware to be flash programmed onto the device.

Your ESP8266 is now ready to play with :).


ESP8266 - First thing's first.

First thing's first.

A big auction site seems to be full to the brim with ESP8266 modules and there are several models that can be bought too. To get started on using an ESP8266 the route I'd gone down was to buy a model ESP-01.

Other parts that are recommended to get started with an ESP8266 are as follows. Links provided against several of the parts are direct links on dx.com but you can of course buy these from your preferred source by all means:

1). An ESP8266 ESP-01
- Please note that according to dx.com (24th Mar '15) the working voltage is 5v. It's 3.3v. Using 5v will destroy the device. A 'report error' submission has been sent to them. Hopefully they will amend the product information correcting this error otherwise they will more than likely find a lot of customers complaining about damaged devices.



2). A USB to TTL Converter
- Important; Make sure the one you buy has a 3.3v line as 5v will render your ESP8266 inoperable (these devices are not by any means 'voltage tolerant').

3). An MB-102 Breadboard
- An electronics prototyping block that allows for prototypes to be made up quickly without the need for a soldering iron.

4). An MB-102 3.3v / 5v Breadboard Power Supply (PSU) Module

5). Some Breadboard Jumper Cables
- Suggested buy's are a pack of male to male and female to male cables.

6). Two 470 ohm resistors

7). Two LEDs - 3mm or 5mm - Depending on your preference. What colour LED you use is up to you too. Initially I used some 5mm green or red LEDs (cannot remember which) but am using Rainbow Colour Changing LEDs in the example(s) posted on this blog.

8).  A USB Extension Cable - I've recommended buying one of these because you will otherwise need to situate your ESP8266, USB to TTL Converter in very close proximity to your PCs nearest available USB Port. With a USB Extension Cable you can put these somewhere more manageable so to speak.

Upon receiving your ESP8266 you will more than likely need to flash the firmware to a more recent version.

You can by all accounts use an Arduino to communicate with and flash the firmware on an ESP8266 but I've not got any experience with using an Arduino therefore personally opted to use an FTDI USB to TTL Converter. I'd also discovered that using a USB to UART Bridge with a Prolific chipset such as a CP2102 is permissible but again it's very important to note that this must have a 3.3v line as using 5v will render your ESP8266 inoperable.











Decided to get blogging again.

Decided to get blogging again. The intention is to blog about personal experiences with generally 'tinkering' with electronics.

To get started I'd like to post some blog entries on something that I've quite recently discovered (as have many electronics hobbyists) that is known as an ESP8266 Module. Granted I'm by no means an early-starter with this device but never the less think it's fascinating.

http://www.instructables.com/id/Using-the-ESP8266-module/

The ESP8266 is basically a WiFi microcontroller (typically costing about $5.00 USD) that has GPIO for switching on and off for example that runs on 3.3v and can be controlled via a web-browser (please do not try to use with 5v as these modules are not 'voltage tolerant').

Hope the posts are of interest. Thank you for visiting :).