Go Down

Topic: Favourite way to bring 5 Volt signals down to 3,3 Volt (Read 3266 times) previous topic - next topic

Zealot

My first idea would be to simply build a voltage divider (with a 1k and 2k resistor).

How do you guys usually do this? For example when you want to connect via USB to a ESP8266.


robtillaart

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

mcufan

My first idea would be to simply build a voltage divider (with a 1k and 2k resistor).

How do you guys usually do this? For example when you want to connect via USB to a ESP8266.


For unidirectional level shifting, usually 74HC4050.
For voltage regulator any LDO under 1.5V voltage drop is suitable.

You can use voltage divider, however that is not quite reliable with high speed signals.

keeper63

Ok, Zealot - your idea would work - but it has issues. The main issue is the fact that resistors change resistance slightly due to environmental effects (heat, humidity, etc). For most use cases, this isn't a big deal - but in the case of a logic-level signal, where the difference in voltage is only a couple of volts - it might be a huge deal. Best would be to use high-precision SMT resistors, and perhaps encapsulate the whole thing in epoxy or something. For a breadboard test environment, it would probably be OK, though (but I wouldn't use such a solution on anything critical).

There is also an issue with speed - using a voltage divider introduces a small amount of signal lag in the system, which will limit your top speed when communicating with the device (this is mainly an issue with an SPI bus - but can still be an issue with a TTL serial bus which may limit the top end of your baud rate).

Instead - it is better to use some kind of logic-level conversion IC or mosfet-based system. There are more than a few such breakout boards available, offering anywhere from 4 to 8 (maybe more) signal lines to convert; alternatively there are some DIP CMOS ICs that can be coaxed into doing the same thing.

What robtillaart is recommending - and may be needed for your project - is a means to provide 3.3 volt power to the ESP8266; because it needs around 800 mA (depending on what's being used) - the Arduino's 3.3 volt regulator won't be big enough and you'll need a separate power supply for it. A low-dropout regulator or some kind of switching power supply supplying around 1 amp is best for this.
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

CrossRoads

I've been using 74HC4050 for SCK, MOSI, CS to devices, and 74HC125 (or one of the 1-gate variants if space is tight) to buffer MISO coming back, with its OE controlled by CS. Keeps 5V signals off the 3.3V device's data-out pin (example during bootloader installation), and also keeps any badly behaving devices off the SPI bus when their CS is not active.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


MarkT

These days all resistors are made to 1% tolerance or better I find, the "5%" ones
are the 1% rejects so typically 1.5% or so, you can basically trust resistor values
unless they are old-fashioned carbon composition (avoid these, metal film every
time).

For logic signal shifting 74HCT series powered from 5V will take 3.3V signals
to 5V cleanly and reliably.  74LCX series powered from 3.3V have 5V tolerant
inputs so can map from 5V to 3V3 (although of course they are more sensitive
not having protection diodes).  Both off these families will go upto any max
frequency you are likely to encounter and consume no power for static signals.

Resistor divider from 5V ro 3V3 can be made from 1k and 2k2, this is reasonable
quick and I have successfully interfaced to microSD cards this way, although its
not advised...

If you want to reduce power consumption resistor dividers are best avoided.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

jboyton

I found the following approach on a shield I bought, for 5 to 3.3V SPI bus level shifting:



I've run the shield at 8MHz without errors, but I do wonder what an oscilloscope would reveal. So I run it at 1MHz just to be safe.

When I tried breadboarding this solution with longish wires I got some errors. I shortened some of the wires and it improved but I still got a couple of odd errors, about 1 in 10^5 bytes transferred. So I chickened out and (barely) squeezed a 4050 chip into my project.

Later I went back and cleaned up the breadboard (it was actually bridging two breadboards) and it then ran at 8MHz without errors, to better than 1 in 10^6 bytes. Lacking an oscilloscope, I then substituted Schottky diodes, just for peace of mind.

It's probably better to use an IC though.

MarkT

Change that 10k to 1k ohms and it will be 10 times more robust to noise and
switch much faster, at a cost of 3mA
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

jboyton

It's a tradeoff though. I needed three of those shifters (9mA) for a component that draws ~650uA when running at maximum speed.

Zealot

Thanks for all your recommendations. I just ordered some 74HC4050.


Another option: Run my ATmega328 at 8MHz and power it with a 3,6V LiPo (3,3V are hard to find). Would that work without any power regulator or logic-level conversion IC? Or is the output of a LiPoly to flaky?


The ESP8266 IO pins take a max of 3.6V.

mcufan

I you work with in maximum level conditions, you should expect failure of the device very soon.

You can use at least some Shotky diode (low reverse voltage, around 0.2-0.3V) to get close inside 3.3V region.
I would recommend to use some LDO regulator instead, there is some with very low LDO value, such as 0.25V.

Zealot

... use some LDO regulator instead, there is some with very low LDO value, such as 0.25V.
Speaking of LDO: I still haven't found the "perfect" one. I recently found this one: TPS7150
http://www.ti.com/product/tps7150
"...Because the PMOS device behaves as a low-value resistor, the dropout voltage is very low (maximum of 32 mV at an output current of 100 mA for the TPS7150)... ". Sound really good. What do you guys think?

Which LDO would you recommend?

MarkT

If the dropout is very low its likely some of the other parameters are below
par, since nothing comes for free.  Start with your requirements and do a filtered search
at one of the distributers' websites that allows parametric search.  Things like
input voltage, drop-out, max current, quiescent current drain, cost, whether it is resistant
to back-powering, etc etc - there are 100's of regulators out there!
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

JimboZA

Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

Go Up