Detecting 8ch 0V/12V with 3.3v MCU - Page 1
Forum section: electronics / projects

author: okw
author_rank: Frequent Contributor
timestamp: November 30, 2022, 03:11:36 pm
content: Hello! I want to detect high/low on 7 or 8 signals. They can span from 8 to 15V, but ideally they should be 12V (I will put 12v-ish zeners on each signal). It's for automotive.Is a ULN2803 or UDN2981 a good choice (inverted or not doesn't matter(?) as I'll take care of it in SW)? I was thinking individual transistors and resistors, but with it takes too much space / too much assembly.How do I design it? Do I feed the 12V directly into the inputs and VCC, and voltage divide on the output? Or is there an easier way / less components / more reliable?Any suggestions and tips are appreciated.

author: ledtester
author_rank: Super Contributor
timestamp: November 30, 2022, 03:34:05 pm
content: Here's a related thread:https://www.eevblog.com/forum/beginners/circuit-to-convert-from-12v-automotive-into-a-microcontroller-voltage/and also these:https://www.eevblog.com/forum/beginners/how-to-detect-automotive-brake-12v-signal-for-feeding-into-microcontroller/https://www.eevblog.com/forum/beginners/12v-arduino-digital-input/

author: Ian.M
author_rank: Super Contributor
timestamp: November 30, 2022, 04:03:40 pm
content: There's no avoiding the big(ish) individual resistors as tiny SMD resistor arrays simply don't have the pulse power or voltage ratings required to survive automotive transients. Other elements of the circuit may be possible to combine e.g. rather than a Zener per input, it may be possible to use a TVS diode array to handle four or eight inputs in one part.

author: srb1954
author_rank: Super Contributor
timestamp: November 30, 2022, 08:15:40 pm
content: Quote from: okw on November 30, 2022, 03:11:36 pmAn ULN2803 has open collector outputs so you will need pull-up resistors to Vcc to provide the correct logic levels to your processor. The ULN2803 also has Darlington outputs so it will struggle to provide a sufficiently low logic low signal to your processor if you are using a 3.3V supply or lower. The UDN2981 has open emitter outputs and will require pull-down resistors. It is even worse for providing suitable logic levels to your processor.Have you considered using RS-232 receivers for conditioning your 12V inputs to your logic levels?These are generally specified to safely handle +/- 30V inputs and will therefore withstand the automotive environment better than most ICs. Some are rated for 5kV ESD transients as well and many have buit-in noise filtering so will reject some of the noise typically found in the automotive environment. If you are using a 5V logic supply the venerable 1489 quad receiver would do the job although if you are using a 3.3V logic supply the range of suitable devices shrinks considerably and you may need to look at the more modern CMOS devices that incorporate drivers as well as receivers.

author: Siwastaja
author_rank: Super Contributor
timestamp: November 30, 2022, 08:53:54 pm
content: Quote from: Ian.M on November 30, 2022, 04:03:40 pmOf course there is - power is by U^2/R -> increase R to get power down!There are consequences, of course - to prevent false triggering from noise, you must then add C, and with large R, comes long time constant. But OP did not specify the required bandwidth. Maybe detection within tens or even hundreds of milliseconds is OK, or such filtration even desirable? If yes, then relatively large C + large R provides decent EM immunity, ESD protection, protection against voltage surges - all within modest package size. 0603 resistors rated to 200V are available and will survive load dump voltage, as long as resistance is high enough to keep power dissipation down.

author: Ian.M
author_rank: Super Contributor
timestamp: November 30, 2022, 09:48:22 pm
content: As you point out, it *can* be done with 0603 resistors at the top of the input attenuators, however for the O.P's eight channels, that's still a minimum of eight individual resistors and around 37 mm2of board area even closely packed, before you even consider the area and parts count required for the lower resistors (possibly in tiny arrays of four as the lower resistors in a clamped divider don't have to withstand severe transients), filter capacitors and any input clamping required.As the O.P. was concerned about the space and assembly work required and was looking for a single chip solution, I doubt they are going to be happy with our suggestions.

author: okw
author_rank: Frequent Contributor
timestamp: November 30, 2022, 10:02:29 pm
content: I'm actually happy about every suggestion hereI'm currently reading all the posts suggested, and others.I don't have space issues on the PCB, but no need to waste space, components, etc, unless it adds redundancy against the harsh automotive environment.I would like a redundant, but it's a compromise between cost / assembly / bom count / etc.I initially said 3.3V, but if 5V increases my options (e.g. MC1489) or more redundant solution I'm open to that.