Can you use a voltage divider to translate UP? - Page 1
Forum section: electronics / projects

author: alank2
author_rank: Super Contributor
timestamp: August 12, 2020, 01:03:26 am
content: 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 unstable0.4 goes low!Then back up in 0.1V steps:1.6V it becomes unstable4.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.

author: Peabody
author_rank: Super Contributor
timestamp: August 12, 2020, 01:47:45 am
content: 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.

author: alank2
author_rank: Super Contributor
timestamp: August 12, 2020, 02:56:18 am
content: I'm going to try using a TXB0104D and see how it does.

author: OM222O
author_rank: Frequent Contributor
timestamp: August 12, 2020, 03:36:23 am
content: 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.

author: ledtester
author_rank: Super Contributor
timestamp: August 12, 2020, 04:03:21 am
content: 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.

author: ledtester
author_rank: Super Contributor
timestamp: August 12, 2020, 04:10:55 am
content: Quote from: alank2 on August 12, 2020, 01:03:26 amJust use a voltage level translator (also called level shifters):https://learn.sparkfun.com/tutorials/bi-directional-logic-level-converter-hookup-guide/allAlso worth reading:https://pdfserv.maximintegrated.com/en/an/AN1159.pdfhttps://www.ti.com/logic-circuit/voltage-level-translation/overview.html

author: james_s
author_rank: Super Contributor
timestamp: August 12, 2020, 06:28:08 am
content: Quote from: ledtester on August 12, 2020, 04:03:21 amA 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.

author: ejeffrey
author_rank: Super Contributor
timestamp: August 12, 2020, 06:48:17 am
content: Quote from: ledtester on August 12, 2020, 04:03:21 amA 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.

author: gooligumelec
author_rank: Contributor
timestamp: August 12, 2020, 07:41:19 am
content: Quote from: alank2 on August 12, 2020, 01:03:26 am"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.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: August 12, 2020, 09:23:17 am
content: Not sure why people are saying no... you can divide towards +V just fine.https://www.seventransistorlabs.com/Calc/ResDiv.html#threeThis 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

author: ledtester
author_rank: Super Contributor
timestamp: August 12, 2020, 12:07:51 pm
content: Quote from: ejeffrey on August 12, 2020, 06:48:17 amMathematically 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.

author: Zero999
author_rank: Super Contributor
timestamp: August 12, 2020, 12:19:00 pm
content: Quote from: ledtester on August 12, 2020, 12:07:51 pmExcept it doesn't.

author: alank2
author_rank: Super Contributor
timestamp: August 12, 2020, 12:21:09 pm
content: Quote from: T3sl4co1l on August 12, 2020, 09:23:17 amInteresting; I wondered if it is possible even if it isn't ideal.Quote from: T3sl4co1l on August 12, 2020, 09:23:17 amI 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.Quote from: T3sl4co1l on August 12, 2020, 09:23:17 amIt 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.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: August 12, 2020, 01:57:00 pm
content: 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

author: alank2
author_rank: Super Contributor
timestamp: August 12, 2020, 02:39:10 pm
content: 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.