Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

microcontroler inputs

Status
Not open for further replies.

grekson

New Member
Can you bring 12V signal directly to the MCU port? If I am not mistaken MCUs have its internal resistance, and we musn't overide maximum current through MCU's. So can we bring 12V directly to MCU, maybe adding simple resistor or do we need optocoupler in case when signals are higher than MCU operating voltage (5V).
 
Can you bring 12V signal directly to the MCU port? If I am not mistaken MCUs have its internal resistance, and we musn't overide maximum current through MCU's. So can we bring 12V directly to MCU, maybe adding simple resistor or do we need optocoupler in case when signals are higher than MCU operating voltage (5V).


It depends on the MCU. Some have internal protection for over voltage. Most often we use two resistors to make a voltage divider to reduce the voltage.
 
It depends on the MCU. Some have internal protection for over voltage. Most often we use two resistors to make a voltage divider to reduce the voltage.

Can you tell more about this. I am makeing a car alarm unit and firstly I thought to bring all 12 signals through optocoupler, but if it is possible I would like my unit to be as simple as possible.

I can use mostly any 8 bit PIC mcu, from 10 to 40 pin in DIP or SDIP housing, since I can use my development board to flash it, but I was thinking of 28SDIP like PIC16F882.
 
The link tells how voltage dividers work.

I have seen your link.
So if I use 1k for R1 and 700ohm for R2 the output will be 4.9V according to Vout = Vin* R2 / (R1+R2).

But as you mentioned that some MCUs have over voltage protection, can I use 12V signals directly to PIC (16Fxxx)?

How I see it is that current not voltage damages the circuit and voltage is in relation with current and resistance by R=V/I. MCUs have huge internal resistance - and they must if you can directly drive 5V signals to it and current through would only be few micro amps. So why can't bring directly, do I need a voltage divider?
 
When running the voltage is 14+V not 12V and have been know to have spikes in the 60V range.

The datasheets tend to be vague about the protection diodes. I see them as protection from the odd spike rather then a means to reduce a 14V signal to 5V.

If you cut the incomming voltage down to 5V using a divider you are cutting the spike form 60V to (5//15) 60 or about 20V. That is a good thing.

The cars electrical system is a harsh electrical environment. I would use the divider to get 5V then use a 5V zener on the 5V to keep it them in case of a spike. Resistors and zener are cheap.

To power the processor use a regulator designed for use in automotive electrical systems.
 
Did you mean like that? Did I connected the diode correctly?
Will zener BZX55C4V7 be OK?

capture-jpg.36608
 

Attachments

  • Capture.JPG
    Capture.JPG
    18.8 KB · Views: 390
The endpoints on the dioed are in the right place but you have it connected backwards.

It looks like you calculated the resistor values based on 12V which is too low. Either use 15 or use a voltmeter to check the value on the car while running. An input of 4V would read as 1 which is OK. A voltage higher then the zener voltage will cause the zener to conduct all the time which is not what we want here.
 
you have it connected backwards
I thought that zener has its berak down voltage in reverese biased - that it allways conduct in forward biased but when in reverse that it conducts when voltage is higher than its zener voltage.

The problem will be with lock/unlock pulse, since I only read 8V on my multimeter (sometimes 10V, sometimes only 7), other signals (doors latch switches) are 12.1V no matter of engine turn on/off the motion sensors are units by itself and sends 12V.

Is this wrong if diode will conduct? If I understand it will conduct only so much that the voltage will be 5V. Can I also remove resistors and only have the zener? As I mentioned some signals are not allways the same value.
 
Last edited:
Using a multimeter to measure the voltage of pulses is iffy. They can read lower then the actual value if they are too short. I expect this is the case here. A scope would be a better choice if you have one.

I expect you can use the Zener diode without the voltage divider. It all depends on how much power is in the spike and how much power the Zener can dissipate. The reason I wanted the voltage divider there was to reduce the signal level in case of a spike. I have no idea if there can/will be a spike on the various circuits. Always assume the worst.

The a 5V PIC will see a voltage between 3.5V(check the data sheet) and up as a logical 1. That gives you a bit of wiggle room on the voltage.
 
Wouldn't be much simplier if I use this optocoupler ACPL-847-W00E isntead?
It costs me half € and it has 4 channels.
Current and voltage throug the diode part can vary since collector current will be sufficient from 5mA to 60mA throug diode.
 
Last edited:
I Goofed (my bad)

grekson PMed and pointed out that I was confused about Zeners and he was right. I was thinking the Zener conduction was in the forward direction. That is about as wrong as it gets.

I am sorry for the misinformation.
 
Status
Not open for further replies.

Latest threads

Back
Top