| Electronics > Beginners |
| Sensing 12v line with 5v MCU |
| << < (3/6) > >> |
| vmallet:
Thanks for the feedback. Looks like maybe something like this would work pretty safely: And the nice thing here is that there would be no current draw when the switch is open (definitely good when the car is off). |
| digsys:
--- Quote from: agehall --- ... Can't you just sense 0V in the car via a diode and an internal pull-up on the MCU? --- End quote --- There are over 100 ways to skin a cat :-) but to answer your question specifically - Car electrics is notoriously "dangerous", mainly due to 0V ground faults / currents, HV spikes etc etc Wiring ANYTHING directly to a logic / CPUs etc is never a good idea. You can do it, but the amount of protection required is extensive. Not worth it. Optos are by FAR the most preferable method. Perfect isolation. IF you need analogue sense, usually you provide some sort of isolation barrier. ie a linear opto |
| GeorgeOfTheJungle:
--- Quote from: vmallet on April 24, 2019, 07:25:01 am ---Thanks for the feedback. Looks like maybe something like this would work pretty safely: And the nice thing here is that there would be no current draw when the switch is open (definitely good when the car is off). --- End quote --- Note that that, unlike the other circuit, will sense the relay as ON even if there's no relay. |
| agehall:
--- Quote from: digsys on April 24, 2019, 08:19:51 am --- --- Quote from: agehall --- ... Can't you just sense 0V in the car via a diode and an internal pull-up on the MCU? --- End quote --- There are over 100 ways to skin a cat :-) but to answer your question specifically - Car electrics is notoriously "dangerous", mainly due to 0V ground faults / currents, HV spikes etc etc Wiring ANYTHING directly to a logic / CPUs etc is never a good idea. You can do it, but the amount of protection required is extensive. Not worth it. Optos are by FAR the most preferable method. Perfect isolation. IF you need analogue sense, usually you provide some sort of isolation barrier. ie a linear opto --- End quote --- That does make perfect sense. |
| magic:
--- Quote from: digsys on April 24, 2019, 08:19:51 am ---Wiring ANYTHING directly to a logic / CPUs etc is never a good idea. You can do it, but the amount of protection required is extensive. Not worth it. Optos are by FAR the most preferable method. Perfect isolation. --- End quote --- Sure, but a transient could blow the opto, couldn't it? Particularly one of reverse polarity. :-// With a CMOS gate, I would think a 1M 1kV series resistor plus the IC's built-in protection diodes should be good enough. And with, say, 10pF input capacitance, that's still less than 1ms delay. I have seen a car component which monitored engine RPM by sensing the ignition switch (peak voltage ~200V). In front of some IC there was only an RC filter with 300k series resistance and some unidentified capacitor. It worked for years and never failed. |
| Navigation |
| Message Index |
| Next page |
| Previous page |