Hooking the ESP8266 up to the Arduino

As I mentioned in my post Battle of the Voltages there are a bunch of things that you need to consider while connecting your ESP8266 to your Arduino.

Pinout

First lets show the pinout of the ESP8266.

esp8266_pinout

The inside row

RX – Recieve. When connecting to a Serial interface this should be connected to the TX pin. When connecting to an Arduino however the connection should be made to the Arduino RX pin.
GPIO 0 – General Input Output 0. When flashing the chip this pin need to be connected to ground (GND) while the chip boots. Otherwise you can use this to send or recieve data from sensors and/or light LEDs etc with it.
GPIO 2 – General Input Output 2 (what happened to GPIO 1?). You can use this pin to send or recieve data from sensors and or light LEDs etc.
GND – Ground. Connect this to ground or in case of using batteries to the negative terminal of the battery.

The outside row

VCC – Power in. Connect this to the VCC of your power source. In case you are using battries the connect this to the positive terminal of the battery. This requires 3.3V . Using more than 3.6V may fry the chip. I have used 3X AA at 3.9V successfully.
RESET – Put this high to reset the chip
CH_PD – Chip Power-Down. This is required to be pulled high while the chip is in use.
TX – Transmit. When connectiing to a Serial interface this should be connected to the RX pin. When connection to an Arduino however the connection should be made to the Arduino TX pin.

One of the first things you may notice is that the placement of the differen pins probably could not be any worse. VCC and GND are placed as far away from each other as humanly possible and on different sides. Same with RX (recieve) and TX (transmit). Making it very hard to connect things to it in an easy manner.

Doing it all wrong

So how did I connect my ESP8266? Well, of course I did everything wrong… or rather. I did a lot of messing around. I tried making a voltage divider by using 3x 220Ohm resistors. It worked great when I checked the voltage with my multimeter… but when I connected VCC and CH_PD the voltage halved and it failed miserably. I think it may have to do with the resistors being to low and that using 3x 10kOhm resistors may work out better. I have not tried that yet thought.

CH_PD up

In order to make the chip run at all you apparently need to send 3.3V to the CH_PD pin. I have read that some people simply solder the two pins together, others use a 10k resistor between the VCC and the CH_PD pin. In my attempts I connected the 3.3V power supply to both VCC and CH_PD and it worked.

Speaking is not shouting

As I mentioned in the War of the Voltages the ESP require 3.3V with a max current of 250mA. The Arduino however only supply 50mA on its 3.3V pin… BUT it seems as if you are “only” talking to the ESP through your serial interface then the 3.3V pin on your arduio is good enought to get things rolling. I suspect that the network part won’t work very well however.

TX to RX and RX to TX or TX to TX and RX to RX?

There is a title for you! Makes your eyes pop just trying to read it… but it is a valid question. I have read on multiple posts that you need to connect TX (Transmit) to RX (Recieve) on your serial interface, and vise versa… but apparently this is not the way when you use an Arduino as a intermediat. When using the Arduino as the serial interface the only way I got it to work was to connect TX to TX and RX to RX… Honestly it seems like different people have different experiences here so it may be up for grabs what works for you if you ever try it.

Arduino as a Serial interface

The arduino can act as a serial interface (FTDI) and it is possible that I may have ruined my Arduino in my trials to flash the ESP to NodeMCU. At first I could not get the flashing procedure to work, but then I read a post where they mentioned that you could get it working by removing the ATMEGA328P chip from the Arduino, basicly turning it from a “smart” Micro Controller to a “stupid” serial interface. And that actually made it work… The strange thing is that after I pulled the ATMEGA chip from the Arduino and replaced it the connection to my chip still works like when it was removed… so as I said, I don’t know if my Arduino is messed up or not, but it seem to be working now.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s