Maker Pro
Maker Pro

how to bring 12V fluctuant signal to mcu input port

One option is to use optocoupler, can I instead use voltage devider to lower 12V signal to 5V (for instance R1=10k and R2=7k) + diode to cut off the voltage peaks above 12V?

I know nothing about diodes, I start reading in wikipedia and if I am getting right I need zener in reverse biased with Vz of 5V. Maybe this one BZX55C4V7?
 
Yes, presumably both methods, though it's hard to know for sure what you're trying to say (& do) here.

I try to understand how should a 12V range fluctant signal be brought to the PIC controler's input.

Do I use optocoupler, voltage devider (10k/7k), or 5V zener?
Diagrams are helpful, those are made by me (fell free to corretct/coment them)
attachment.php

attachment.php
 

Attachments

  • Capture.JPG
    Capture.JPG
    14.4 KB · Views: 2,763
  • htg.JPG
    htg.JPG
    16.9 KB · Views: 3,610
Last edited:
Diagrams are absolutely useful, but what do you mean by fluctuant?
From your solutions I presume it's digital in nature, but what frequencies/ speeds are involved/ needed?
Ckt.1: Ok.
Ckt.2: Line to MCU should of course come from emitter/pull-down.
Ckt.3: Ok.
Ckt.4: Zener is drawn upside down (forward biased), and needs a resistor in series at the 12V side.
All methods apply, but optocouplers are normally only used if signal ground is not the same as MCU ground, or if spikes can occur along the ground line.
 
Diagrams are absolutely useful, but what do you mean by fluctuant?
This will be alarm unit connected to car electrical system. Some say that durring cranking or other high power consumption voltage spikes of up to 60V can be formated.
My alarm unit will be using 8bit PIC mcu (I thought some of 16F8xx). Those PICs allready have internal pull up resistors and protective diodes. (can I bring 12V signal directly to MCU?)



From your solutions I presume it's digital in nature, but what frequencies/ speeds are involved/ needed?
I will only use 12V signals from door's latch switches, and 12V lock/unlock pulse from central convinience unit.

Ckt.4: Zener is drawn upside down (forward biased), and needs a resistor in series at the 12V side.
So zener must be rotated by 180° - so it will be reverse biased?
Resisor in series? You mean I should connect 5V reverse biased zener to the voltage divider (left diagram)

All methods apply, but optocouplers are normally only used if signal ground is not the same as MCU ground, or if spikes can occur along the ground line.
I though that using multichanel (4) optocoupler would be the simplest way of putting all to the PCB. Would fotodiode inside optocoupler sustain the voltage spikes that are normal in car electrical system?

Thanks for helping!
 
This will be alarm unit connected to car electrical system. Some say that durring cranking or other high power consumption voltage spikes of up to 60V can be formed.
Those spikes, if they get that high, won't be present at all points in the car, and they will be very narrow and easily suppressed.
Welding jobs on cars are frequently reputed to kill electronics so it's nevertheless useful with some degree of protection.

My alarm unit will be using 8bit PIC mcu (I thought some of 16F8xx). Those PICs allready have internal pull up resistors and protective diodes. (can I bring 12V signal directly to MCU?)
Port B seems to have an optional weak pull-up with a current of up to 0.4mA, which must be accounted for to make sure that a low input gets no higher than 0.75V. The protection diodes can handle up to 20mA. So no, not directly, but a series resistor, zener, & a capacitor may suffice.
Do a search of pic 87xx input protection.

I will only use 12V signals from door's latch switches, and 12V lock/unlock pulse from central convinience unit.
Ok, that will count as slow digital signals.

So zener must be rotated by 180° - so it will be reverse biased?
Resisor in series? You mean I should connect 5V reverse biased zener to the voltage divider (left diagram).
Yes, like you said you read on Wikipedia. A forward biased diode of any kind will conduct with a voltage drop of only 0.5-1V, effectively shorting the 12V to ground (especially w/o a resistor).
A reverse biased zener will conduct at the zener voltage, and w/o a resistor in series it will either fry or make the car's circuits malfunction.

I though that using multichanel (4) optocoupler would be the simplest way of putting all to the PCB. Would fotodiode inside optocoupler sustain the voltage spikes that are normal in car electrical system?
LED's have a reverse bias voltage limit of a few volts, so if the spikes were severe enough they could damage them as well, although the PIC would be protected.
Optocouplers are used as "level-shifters" where the control-line (input) and the controlled line (output) are not at the same level. They are also frequently used in high-powered pulsed lasers for example, where kiloVolt & kiloAmp pulses can induce voltage spikes between one ground point & another.
 
Last edited:
Top