ESP8266 to Arduino IO matching

The Plan

Up to this point, I have been using a R divider to interface between my 5V Arduino to my 3.3V ESP8266.  This has been working but I still fear that I am stressing the ESP8266 on it’s TX side since it is getting pulled up to 5V by the Arduino.  To address this, I bought a NTE4050B Hex Buffer/Converter.  The datasheet is here: .  I would have like to have a true level shifter IC, but not easy to find at local electronics stores in the Roseville, CA area and didn’t want to wait ordering on-line.  The NTE4050B datasheet says… “These devices are intended for use as COS/MOS to DTL/TTL converters”.  This is the plan… for now.

The Setup


Ardiuno Sketch

 Software serial test
 Receives from the hardware serial, sends to software serial.
 Receives from software serial, sends to hardware serial.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(7, 6); // RX, TX

void setup() 
 // Open serial communications and wait for port to open:


void loop() // run over and over
 while (mySerial.available()>0 )
 while (Serial.available()>0 ){

Testing / Results

I connected everything and probed the voltage levels at the IO pins to ensure everything was working as expected…

  • Both the ESP8266 TX and RX pins are at 3.3V which was my main goal to make sure the ESP8266 did not eventually die from stress on the IO pins.
  • The Arduino SW TX pin (pin 6)  was still at 5V, but was 3.3V on the other side of the buffer which is as expected.
  • The Arduino SW RX pin (pin 7) was only at 3.3V to my surprise.  I disconnected the wire to buffer and saw that the Arduino RX pin was 5V when not connected.  This must be because there is an internal pull up resistor on that pin.  Once the buffer output is connected, it must be sinking enough current to bring it down to the 3.3V output level.  This should be ok since the Vih of the Arduino should be lower than 3.3V.

I ran the above Arduino serial pass through code and can reliably communicate with the ESP8266.

If you have been following the posts, I spent some time to find that I needed to add a 100 msec delay between characters when using R divider to do level shifting or I would lose the characters when sending more than 1 character at a time.  Just for the fun of it, I removed the 100 msec delay between characters to see if the buffer was able to clean the signal up enough.  To my surprise, the communication is still very solid and much faster.  I am wondering if I might even be able to boost up the baud rate once I start trying to do more.  Will try when needed.

I declare this addition to be a success!


One more positive side effect using this buffer.  I can now power cycle the ESP8266 without having to disconnect the IO’s from the Arduino.  Not sure exactly why, but not going to question a good thing.

Follow Up Question

I had a follow up question to provide a little more details regarding the 4050 to Arduino wiring.  The attached code has the Uno SW UART assigned to digital IO 6 and 7.

  • IO 6 is assigned to be the UART transmit (Output).
  • IO 7 is assigned to be the UART receive (Input).

The NTE4050 is connected up accordingly.  I put together a diagram to help illustrate.



2 thoughts on “ESP8266 to Arduino IO matching

  1. I have a question about how the 4050 is wired up. I probably misunderstand how this is supposed to work, but some clarification would be great. According to the datasheet pin 2 is output, pin 14 is input, pin 3 is input and pin 15 is output. So I expected that the UNO would be wired to pins 3 and pin 14 and the ESP to be wired to pins 2 and 15. However you have the UNO wired to pins 2 and 14. I have wired mine like you have and it does work so clearly this is the correct wiring, but I don’t undertand why. Can you clarify this for me please?



Leave a Reply

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

You are commenting using your 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