ESP8266 with 5V level

776 views
Skip to first unread message

Tim Eastwood

unread,
May 25, 2016, 10:04:34 PM5/25/16
to Connected Community HackerSpace
Hi all,

I am wanting to use an ESP8266 with a 5V level arduino but only for serial comms. Will a resistor on the 5V arduino TX line be 'sufficient' or do I need some fancy level shifting magic going on? For what it's worth, it works anyway just hooking the 5V straight up but I don't want to cook the ESP over time. Or is the 8266 actually 5V tolerant on the digital pins? The arduino seems to accept the 3.3v TX from the 8266 so I figure that's fine as-is. 

Cheers,
Tim

Geoff

unread,
May 25, 2016, 11:00:51 PM5/25/16
to Connected Community HackerSpace
Hope this helps:

All digital I/O pins are protected from over-voltage by means of a snap-back circuit between the pin and ground. The output devices are also protected from reverse voltages with diodes. This suggests that the ESP may be 5V-tolerant, but official guidance from Espressif says to stick to 3.3V to prevent damaging the chip. Note: I have accidentally connected 5V to my ESP’s GPIO without any noticeable damage.

For info on basic level shifting:

Clifford Heath

unread,
May 25, 2016, 11:39:02 PM5/25/16
to Connected Community HackerSpace
On 26 May 2016, at 1:00 PM, Geoff <geoff.le...@gmail.com> wrote:
> Hope this helps:
> All digital I/O pins are protected from over-voltage by means of a snap-back circuit between the pin and ground.

If they claim to have deliberately implemented snapback (avalanche)
protection, the chip should survive as long as you use a current-limiting resistor.

The main issue with over-voltage (apart obviously from actually blowing
things up) is latch-up and charge injection into the substrate. The former
can burn up the chip (in CMOS it shorts power and ground), so avalanche
protection should be expected to stop it. The latter can just make the chip
go haywire. The avalanche protection may not be designed to stop this,
rather just to save the chip from destruction; but it will normally recover
without a power cycle (unlike latchup).

If you do trigger the latchup circuit, the chip will see a low logic level,
not a high-clamped one, since the protection pulls the pin to ground.
So even with a protection resistor, you should use an external clamp
diode as well.

> Note: I have accidentally connected 5V to my ESP’s GPIO without any noticeable damage.

That makes it seem likely that the avalanche is set higher than 5V, but
process variation might mean that some trigger lower.

Clifford Heath.

Angus Gratton

unread,
May 25, 2016, 11:45:42 PM5/25/16
to connected-commu...@googlegroups.com
Hi Tim,

ESP8266es seem to not die immediately if you apply 5V, but it's not recommended by Espressif (you end up pumping a lot of current through the port's protection diode, and eventually something will probably give out.)

I think a series resistor should be alright as lo-fi protection, maybe 1K-2K or so. Limits the current through the protection diode to something that's unlikely to cause issues. This will limit your max baud rate a bit, but probably not so you'd really notice (unless you're also running a very long cable or something, 115200bps should be no big deal). You could use a resistor voltage divider if you want to be properly careful not to exceed 3.3V.

I'd recommend putting a resistor on both RX and TX pins - so if you accidentally drive the Arduino RX pin high then it can't do any damage that way either.

(TL;DR: If it was me doing a quick hack then I'd probably use 2K series resistors.)

Cheers,


Angus
> --
> You received this message because you are subscribed to the Google Groups "Connected Community HackerSpace" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to connected-community-h...@googlegroups.com.
> To post to this group, send an email to connected-commu...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/connected-community-hackerspace/689259e2-4859-44f7-93f5-483e718eba66%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Clifford Heath

unread,
May 25, 2016, 11:55:16 PM5/25/16
to connected-commu...@googlegroups.com
On 26 May 2016, at 1:45 PM, Angus Gratton <g...@projectgus.com> wrote:
> ESP8266es seem to not die immediately if you apply 5V, but it's not recommended by Espressif (you end up pumping a lot of current through the port's protection diode,

It's not a diode, but a triggered clamp to ground.
If you don't trigger it, no problem.
If you do (even with a resistor), you can't read a logic "1".

> and eventually something will probably give out.)

not if you use a resistor.

> I think a series resistor should be alright as lo-fi protection, maybe 1K-2K or so.

If the trigger fires, you won't get data.

If not, typical pin capacitance of say 20pF through 1K will not
limit your data rate - that's a TC of 140ns - should be good
even above 1Mbps.

> You could use a resistor voltage divider if you want to be properly careful not to exceed 3.3V.

Yes, or a resister and a clamp diode.

Clifford Heath.

Angus Gratton

unread,
May 26, 2016, 12:41:05 AM5/26/16
to connected-commu...@googlegroups.com
Hi Clifford,

On Thu, May 26, 2016 at 01:55:11PM +1000, Clifford Heath wrote:
> On 26 May 2016, at 1:45 PM, Angus Gratton <g...@projectgus.com> wrote:
> > ESP8266es seem to not die immediately if you apply 5V, but it's not recommended by Espressif (you end up pumping a lot of current through the port's protection diode,
>
> It's not a diode, but a triggered clamp to ground.
> If you don't trigger it, no problem.
> If you do (even with a resistor), you can't read a logic "1".

I didn't see your post before I sent mine, but I'm almost certain the snapback doesn't trigger at 5V. I accidentally left a USB/TTL adapter set to 5V for weeks plugged into an ESP, and serial comms never had a problem.

I just had a quick play with one now, a 5V serial output pushes >20mA into the RX pin on the ESP but serial comms still works.

That said, I think you are right about there not being a protection diode - the voltage on the ESP pin (driven from a 5V logic gate) seems to be pulled right down to 3.3V (VCC). Maybe you have some knowledge of what's happening there - perhaps there is some snapback current, but the clamp hasn't fully triggered?

> If not, typical pin capacitance of say 20pF through 1K will not
> limit your data rate - that's a TC of 140ns - should be good
> even above 1Mbps.

On a PCB, yes. With loose wires... probably? I guess as long as the series resistor is at the receiving end you can't have a problem.


Angus

Clifford Heath

unread,
May 26, 2016, 1:12:23 AM5/26/16
to connected-commu...@googlegroups.com
On 26 May 2016, at 2:40 PM, Angus Gratton <g...@projectgus.com> wrote:
> I didn't see your post before I sent mine, but I'm almost certain the snapback doesn't trigger at 5V.

From what you're saying below, it probably has triggered,
but instead of shorting the input to ground, it pulls to Vdd,
or possibly even activates a protection FET to provide a
low-impedance path to Vdd. If so, full marks to ESP for
attention to detail - especially if the clamp releases quickly.

You should be safe to use just a single resistor then.

20mA with a 5->3.2V drop is only 90 ohms. It's not uncommon
for MCU outputs to have that much, so the input could be quite
low impedance - especially since you're seeing Vdd, perhaps
nearly a dead short - which sounds like a protection FET.

> I just had a quick play with one now, a 5V serial output pushes >20mA into the RX pin on the ESP but serial comms still works.
>
> That said, I think you are right about there not being a protection diode - the voltage on the ESP pin (driven from a 5V logic gate) seems to be pulled right down to 3.3V (VCC). Maybe you have some knowledge of what's happening there - perhaps there is some snapback current, but the clamp hasn't fully triggered?

>> If not, typical pin capacitance of say 20pF through 1K will not
>> limit your data rate - that's a TC of 140ns - should be good
>> even above 1Mbps.
> On a PCB, yes. With loose wires... probably? I guess as long as the series resistor is at the receiving end you can't have a problem.

Right. It depends on the total capacitance. I was assuming
fairly close connections.

BTW, my nomograph is good for quickly evaluating these
things: <http://polyplex.org/electronics/nomograph/>.
Just move your mouse to the 1kohm, 20pF line, and read
off the frequency. Same deal for RL and RC networks.

Clifford Heath.

Geoff

unread,
May 26, 2016, 2:29:32 AM5/26/16
to Connected Community HackerSpace
I find having some "fancy level shifting magic" on hand saves time when breadboarding stuff (if that's what you're doing). Here is a short list of breadboard friendly level shifting:

 3V to 5V
 74AHCT125

5V to 3.3
74LVC245 
 
Bi-directional Logic Level shifter
What Clifford and Angus are saying is interesting and good to know. But in general, I find having the above on hand, I use a level shifter first then later I may look if it is needed. Better to let the white smoke out of some cheap IC that are readily available.    
  

On Thursday, 26 May 2016 12:04:34 UTC+10, Tim Eastwood wrote:

Tim Eastwood

unread,
May 26, 2016, 5:26:36 AM5/26/16
to Connected Community HackerSpace
I just tested on mine and the ESP does indeed pull the line down to 3.3v when connected to a 'high' output pin on a 5v arduino... cool design! In goes a 2K resistor to keep it happy :) Thanks guys!!
Reply all
Reply to author
Forward
0 new messages