Author Topic: Can you use a voltage divider to translate UP?  (Read 1777 times)

0 Members and 1 Guest are viewing this topic.

Offline alank2Topic starter

  • Super Contributor
  • ***
  • Posts: 2200
Can you use a voltage divider to translate UP?
« on: August 12, 2020, 01:03:26 am »
I've got a project where I am translating 5V to 3.3V for SPI.  MOSI/SS/CLK could use a voltage divider to tap a 3.3V signal from a 5V signal.  Can this also work in the opposite direction? 

Quick aside: I thought about using a SN74AHCT125 - but got some odd results from it.  I'm feeding it 5V and have a 104 cap on it.  If I start at 5V and go down in 0.1V steps:
1.6V it becomes unstable
0.4 goes low!
Then back up in 0.1V steps:
1.6V it becomes unstable
4.4V goes high!

I tried to different gates on it with the same results.  Should it for sure be HIGH at 2V or above?  LOW at 0.8V or lower?

Back to a voltage divider question.  If a SD card is 3.3V and I want to make sure it can set the AVR input pin high, the AVR says 5 *0.6 = 3V which  is a little close.  Can I bias it by using a voltage divider so that instead of being 0-3.3V is is more like 0.9-4.2V by adding 0.9V to it?  A divider with 5V - 10K - MISO - 2K - GND.  Would that be a problem for MISO, it being raised up.
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2248
  • Country: us
Re: Can you use a voltage divider to translate UP?
« Reply #1 on: August 12, 2020, 01:47:45 am »
I'm not sure what's happening with your 74AHCT125, but it may be that you're not meeting the transition time requirements - i.e. changing the inputs too slowly.

I don't think the divider will work to bring the voltage up.  The SD card output is pretty low impedance, so to have any effect on the voltage, you would need to insert a series resistor in the MISO line ahead of your divider.  But that just complicates things for both high and low.

All of the microSD modules you find on Ebay and elsewhere use a translator to drop 5V to 3.3V for MOSI, SCK and CS, but they send MISO back to the processor at 3.3V, which seems to work fine even for 5V processors.  I'd suggest you try that first to see if it works for you.
 

Offline alank2Topic starter

  • Super Contributor
  • ***
  • Posts: 2200
Re: Can you use a voltage divider to translate UP?
« Reply #2 on: August 12, 2020, 02:56:18 am »
I'm going to try using a TXB0104D and see how it does.
 

Offline OM222O

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Can you use a voltage divider to translate UP?
« Reply #3 on: August 12, 2020, 03:36:23 am »
There's a reason it's called a divider, not a transformer or amplifier: you CAN'T get higher voltages out of it. Only lower. If you want bi directional level shifting then you're better off with a dedicated IC. If you need only one way level shifting then you can use an inverter (not gate) connected the desired output level and invert the signal twice.

In a more general case: you must use an op amp to increase the voltage.
 

Online ledtester

  • Super Contributor
  • ***
  • Posts: 3286
  • Country: us
Re: Can you use a voltage divider to translate UP?
« Reply #4 on: August 12, 2020, 04:03:21 am »
Simply addressing the subject of this thread...

A variac is an example of a "voltage divider" which can boost the voltage. However it does so with AC power. The variable resistor in a conventional DC voltage divider is replaced with a variable inductor in the variac.
 

Online ledtester

  • Super Contributor
  • ***
  • Posts: 3286
  • Country: us
Re: Can you use a voltage divider to translate UP?
« Reply #5 on: August 12, 2020, 04:10:55 am »
I've got a project where I am translating 5V to 3.3V for SPI.  MOSI/SS/CLK could use a voltage divider to tap a 3.3V signal from a 5V signal.  Can this also work in the opposite direction? 

Just use a voltage level translator (also called level shifters):

https://learn.sparkfun.com/tutorials/bi-directional-logic-level-converter-hookup-guide/all

Also worth reading:

https://pdfserv.maximintegrated.com/en/an/AN1159.pdf

https://www.ti.com/logic-circuit/voltage-level-translation/overview.html


 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Can you use a voltage divider to translate UP?
« Reply #6 on: August 12, 2020, 06:28:08 am »
Simply addressing the subject of this thread...

A variac is an example of a "voltage divider" which can boost the voltage. However it does so with AC power. The variable resistor in a conventional DC voltage divider is replaced with a variable inductor in the variac.

A variac isn't a divider in the traditional sense though, it's a variable transformer. The output still can't be higher than the voltage across the entire winding. "Voltage divider" refers specifically to a structure of resistors used to divide voltage.
 

Offline ejeffrey

  • Super Contributor
  • ***
  • Posts: 4034
  • Country: us
Re: Can you use a voltage divider to translate UP?
« Reply #7 on: August 12, 2020, 06:48:17 am »
Simply addressing the subject of this thread...

A variac is an example of a "voltage divider" which can boost the voltage. However it does so with AC power. The variable resistor in a conventional DC voltage divider is replaced with a variable inductor in the variac.

A variac is not a voltage divider.  It is a transformer.  You can make an inductive voltage divider with two inductors (possibly variable) but it won't boost voltages and as a divider it won't keep the output voltage constant under applied load.  A variac (like all transformers) works because the multiple coils or coil sections are wound on the same core allowing them to exchange energy.
 
The following users thanked this post: tooki

Offline gooligumelec

  • Contributor
  • Posts: 34
  • Country: au
    • Gooligum Electronics
Re: Can you use a voltage divider to translate UP?
« Reply #8 on: August 12, 2020, 07:41:19 am »
I've got a project where I am translating 5V to 3.3V for SPI.  MOSI/SS/CLK could use a voltage divider to tap a 3.3V signal from a 5V signal.  Can this also work in the opposite direction? 

"It depends"...

You can quite possibly connect the 3.3V output directly to the 5V input and it will work just fine (you need the divider in the other direction to avoid damage to the 3.3V device).

What does it depend on?  Input threshold voltage on the 5V device, and minimum "high" output on the 3.3V device.

E.g. good old fashioned "TTL" (what we used to use in days of yore) only needed to see 2V or more to register a "high", and since the "3.3V" output is likely to be at least 2.7V, you could plug them together with room to spare.  But it's common these days to see the minimum high specified as 0.8 Vdd, which is 4V, and your 3.3V chip will never get there.

The data sheet will tell you, but if this is a one-off you're very unlikely to damage anything by trying a direct (from 3.3V out to 5V in) connection and seeing if it works.

If not, it's common to use a FET and a resistor as a "pull-up".  Yes, you can buy fancy level shifters or use op amps or comparators or whatever is lying around, but a transistor+resistor would do just as well here.

David Meiklejohn
www.gooligum.com.au
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Can you use a voltage divider to translate UP?
« Reply #9 on: August 12, 2020, 09:23:17 am »
Not sure why people are saying no... you can divide towards +V just fine. ???
https://www.seventransistorlabs.com/Calc/ResDiv.html#three
This calculates both as a general case.  If you enter an unreasonable value, you will get a negative resistance somewhere.  Which is still very reasonable: if you had a negative resistor, that's exactly what value you would need.  Negative resistance means you need active gain, rather than passive attenuation (which is all a positive-resistance divider can do).  Negative resistances can be implemented with op-amps, though that probably won't be very fast, which is annoying for a logic translation application, and a traditional level shifter would be better.

For example, if you enter V_IH = 3.3, V_IL = 0, V_OH = 4, V_OL = 2.06, Vs = 5, Rs = 470; you get 671 (close enough to 680) and 2.28M (close enough to infinity).  This shows that increasing the high threshold is feasible, but that it comes at great expense to the low threshold.

A compromise closer to V_IH(min) for 5V CMOS (typically 3.5V) should give a much more reasonable V_IL as well.  (Looks like 3.73 and 1.27V are near the minimum.)

You're better off with a traditional level shifter circuit, perhaps a common-base / gate transistor and pullup, or a proper logic gate (74HCT will also do, no need for the speed of AHC family).

The divider for the opposite direction (5 to 3.3V) of course is straightforward, or a series resistor and clamp schottky can be used.

If the signal must be bidirectional (which I don't think is the case for SPI mode, but SD mode I think so?), I recommend adding a direction control pin and using a bus interface chip.  Those "automatic" translators (TXBxxxx) are janky and far less behaved than the 74AHCT125 already.  This is just such an application they are designed for, but you must obey their requirements; keep lead lengths short.

And yeah, static testing the AHCT was probably oscillating, so the values read were averages of some waveform, meaningless as thresholds.  Check with an oscilloscope.  Try again after installing it on copper clad (dead bug style, etc.) with bypass and stable (resistive) sources and loads.

Tim
« Last Edit: August 12, 2020, 09:25:52 am by T3sl4co1l »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Online ledtester

  • Super Contributor
  • ***
  • Posts: 3286
  • Country: us
Re: Can you use a voltage divider to translate UP?
« Reply #10 on: August 12, 2020, 12:07:51 pm »
Simply addressing the subject of this thread...

A variac is an example of a "voltage divider" which can boost the voltage. However it does so with AC power. The variable resistor in a conventional DC voltage divider is replaced with a variable inductor in the variac.

A variac is not a voltage divider.  It is a transformer.  You can make an inductive voltage divider with two inductors (possibly variable) but it won't boost voltages and as a divider it won't keep the output voltage constant under applied load.  A variac (like all transformers) works because the multiple coils or coil sections are wound on the same core allowing them to exchange energy.

Mathematically it operates the same as a resistive voltage divider which is my rationale for calling it a "voltage divider".

It is used to boost an AC voltage, e.g.:

https://www.circuitspecialists.com/blog/variables-of-a-variac/

It doesn't keep the output constant under applied load but neither does a resistive voltage divider.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20363
  • Country: gb
  • 0999
Re: Can you use a voltage divider to translate UP?
« Reply #11 on: August 12, 2020, 12:19:00 pm »
Simply addressing the subject of this thread...

A variac is an example of a "voltage divider" which can boost the voltage. However it does so with AC power. The variable resistor in a conventional DC voltage divider is replaced with a variable inductor in the variac.

A variac is not a voltage divider.  It is a transformer.  You can make an inductive voltage divider with two inductors (possibly variable) but it won't boost voltages and as a divider it won't keep the output voltage constant under applied load.  A variac (like all transformers) works because the multiple coils or coil sections are wound on the same core allowing them to exchange energy.

Mathematically it operates the same as a resistive voltage divider which is my rationale for calling it a "voltage divider".
Except it doesn't.
 

Offline alank2Topic starter

  • Super Contributor
  • ***
  • Posts: 2200
Re: Can you use a voltage divider to translate UP?
« Reply #12 on: August 12, 2020, 12:21:09 pm »
Not sure why people are saying no... you can divide towards +V just fine. ???
https://www.seventransistorlabs.com/Calc/ResDiv.html#three
This calculates both as a general case.  If you enter an unreasonable value, you will get a negative resistance somewhere.  Which is still very reasonable: if you had a negative resistor, that's exactly what value you would need.  Negative resistance means you need active gain, rather than passive attenuation (which is all a positive-resistance divider can do).  Negative resistances can be implemented with op-amps, though that probably won't be very fast, which is annoying for a logic translation application, and a traditional level shifter would be better.

Interesting; I wondered if it is possible even if it isn't ideal.

Those "automatic" translators (TXBxxxx) are janky and far less behaved than the 74AHCT125 already.

I found a test TXB0104 I had ordered but never tried because like you said, I've read about them being janky, but after the SN74AHCT125 fail I thought why not.  It actually worked well with the same test I tried on the SN74AHCT125.  I would say an AVR output should be plenty strong to push SS, MOSI, and SCK towards the SD card, but until the SD card outputs MISO I suppose the direction there will be undefined.  Hopefully the output of the SD is strong enough for that (that TXB0104 datasheet says it has to be able to output 2mA).  There is an OE pin on it that they show pulled down to ground and then driven with a uC pin, to HiZ the connections during power up and power down, but I'm not sure if that is completely necessary or if it can just be tied high to I think it was VCCa.  I saw a board one of the board makers put together with this IC and they used a solder jumper to do exactly that.

And yeah, static testing the AHCT was probably oscillating, so the values read were averages of some waveform, meaningless as thresholds.  Check with an oscilloscope.  Try again after installing it on copper clad (dead bug style, etc.) with bypass and stable (resistive) sources and loads.

It was, I at first was looking at its output on a LED, but noticed different brightness levels so I connected a scope.  It was oscillating around 27M.  I wasn't surprised that it was oscillating at certain voltages, but I expected them to be within the 0.8V-2V range, not 0.4V-4.4V range.

I was using a DP832 output channel to change the voltage and one thing I noticed even with the TXB0104 is that there was quite a transition phase (around 20ms) or so of noise with the TXB0104 between transitions.  If I simply connected the input to GND or VCC, it was a nice clean switch from low to high or vice versa, but not when I changed it from the power supply.  Perhaps this has something to do with the AHCT range being wider, but I don't see how it wouldn't stabilize eventually.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Can you use a voltage divider to translate UP?
« Reply #13 on: August 12, 2020, 01:57:00 pm »
Yeah, clip leads on a power supply, or something like that, and a part either just completely loose in the air, or on a breakout board or breadboard with no ground plane, bypass or termination -- those leads aren't connections, they are transmission lines, rather high impedance at that (~200 ohm Zo?).

Such connections make great resonant stubs, with which to amplify the voltage from, say, power or ground pin to input.  Plenty of opportunity for feedback.

Whether it eventually stabilizes, or oscillates over some voltage range and with some amplitude, is impossible to say.  You'd need to measure the setup for the mutual inductances and all that; but it's useless because a mere shake of the leads and the setup is completely different.

Putting resistors at the ends of those wires might help -- trying to terminate those transmission lines, so they at least don't resonate so strongly.  But really, you need a ground plane with supply bypass, so the chip is in its intended environment, signals fed in and out along terminated coax cables, say.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline alank2Topic starter

  • Super Contributor
  • ***
  • Posts: 2200
Re: Can you use a voltage divider to translate UP?
« Reply #14 on: August 12, 2020, 02:39:10 pm »
Thanks Tim - I'll play with it some more and see if shorter leads change the way it behaves.  I was using some 3" leads with push pins on the end of them in a breadboard so maybe that is the problem.  I did give it a bypass cap though.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf