5V to 3.3V ADC via dividers, with selectable thermistor pullup - Will this work? - Page 1
Forum section: electronics / beginners

author: moonie223
author_rank: Contributor
timestamp: April 14, 2019, 11:51:41 pm
content: Hello again!I am working on a digital gauge for my car, it's powered by a teensy 3.6 and interfaces with a megasquirt 3 ECU. I've designed and built a PCB (or three revisions!!!) and I still haven't got it 100%...One of the features on my board is a 10 bit ADC, MCP3008. I would like to have selectable thermistor pullups via board jumpers on four of the 8 inputs.First I tried interfacing the ADC with 5V VREF and 3.3V VDD, that set off protection diodes and pulled my linear regulated 3.3V up to ~4V! (revision 1!)So I went back and added a simple voltage divider for all inputs. This works, but it broke my simple 2 pin jumper that pulled the input up to 5V via a 2.49K resistor. Having anything other than a thermistor grounding the input will bias the reading so far as to be useless with such low ADC resolution. I found I can decrease the pullup resistance, but this seems wasteful!Instead I came up with the thought to have a three pin jumper instead. If one side of the jumper is active, the input will be pulled up to 3.3V(!) and the grounded half of the voltage divider will be defeated. When the other side of the jumper is active, the pullup will be disconnected and the 2nd divider resistor will be reconnected. If no jumper is connected and more than 3.3V is input, magic smoke!!Assuming I add some additional input protection to prevent the third "option" is this a feasible approach? Board space is tight, so I would prefer to not use opamps if I could.Here are some quick and dirty schematics.The current schematicThe proposed revisionsThanks for looking, and any advise!

author: Ian.M
author_rank: Super Contributor
timestamp: April 15, 2019, 12:52:23 am
content: Sounds like a real mess. If you need a 0-5V input range run the MCP3008 at 5V Vdd and level shift the SPI interface to the Teensy 3.6. Its only three lines to up-shift from 3.3V to 5V levels and one to down-shift.N.B. the MCP3008 datasheet has the min. guaranteed logic '1' threshold at 3.5V with 5V VDD. Although you *MAY* find it works on the bench without upwards level shifters, don't bet on that remaining true in a noisy automotive environment over an extended temperature range.

author: moonie223
author_rank: Contributor
timestamp: April 15, 2019, 02:18:28 am
content: I did the bench test a while back and found it to not work on 3.3V logic.I think I remember having some issues using BSS138 bi-directional level shifters, but it's been a while since I tried that. It looks like max bus speed is either 3.6MHz or 1.35MHz. Can you recommend any particular level shifting that would work well in this application?Thanks!

author: Ian.M
author_rank: Super Contributor
timestamp: April 15, 2019, 02:52:50 am
content: BSS138 and similar single MOSFET bidirectional level shifters are really only for relatively slow open drain + pullup buses like I2C. The risetime even with current source pullups + clamping, and minimum bus length and thus capacitance is inadequate for fast SPI.For reasonably fast unidirectional level shifting (or bidirectional with a separate direction control signal) 74LVC1T45 and 74LVC2T45 are convenient. They have separate Vcc pins for their two side, and either side can be powered anywhere in the range 1.65V to 5.5V independently. They also support partial powerdown, tristating the still powered side. With 5.5ns worst case propagation delay, and >24mA drive, they are usabe for signals up to several tens of MHz. The single gate '1T45 is available in packages as small as 1mm square DFN, though for manual assembly I'd go for one of its slightly larger leaded SOT packages.If you need to tristate MISO on the 3.3V side to support other 3.3V SPI devices sharing a bus, you'll need something else. 74LVC1G125 non-inverting tristate buffer with active low enable will do the job. Run it at 3.3V with its /OE driven from the same /CS as the ADC.