Hello everyone,
This is my first post here. Hopefully somebody can point me in the right direction. I am building a few circuits to control various things in a car (lights, etc.) and am having trouble figuring out how to protect my microcontroller (pic12F683). Basically there are 3 things I need to do:
1. create a good 5V supply
2. inputs are 12V/GND lines
3. outputs need to be 12V to trigger relays
1. I know that "12v" in a car is not really 12V... it can range from 7V (while cranking engine) to 14.x volts (while running), and have large (I'm told 300V) spikes after cranking. So my power supply needs to handle all of that. Should I use a zener diode? A 7805? Something with zeners and transistors? It would be nice to keep it small (SMD) too, and efficient (if possible).
2. To get my inputs converted to 5V I suppose I could use a similar technique as #1, but it needs to have a sharper transition than the power supply. Could I use an optoisolator to route my existing 5V from #1 to an input pin? I've never worked with optoisolators before.
3. I know how to wire an output pin to a transistor to turn on/off a 12V line (through a resistor to limit current) but what happens if the 12V on that line spikes, could it bleed through the base and damage the transistor or microcontroller? Would an optoisolator be useful here as well?
I hope I have given enough details!
Thanks,
Alex
This is my first post here. Hopefully somebody can point me in the right direction. I am building a few circuits to control various things in a car (lights, etc.) and am having trouble figuring out how to protect my microcontroller (pic12F683). Basically there are 3 things I need to do:
1. create a good 5V supply
2. inputs are 12V/GND lines
3. outputs need to be 12V to trigger relays
1. I know that "12v" in a car is not really 12V... it can range from 7V (while cranking engine) to 14.x volts (while running), and have large (I'm told 300V) spikes after cranking. So my power supply needs to handle all of that. Should I use a zener diode? A 7805? Something with zeners and transistors? It would be nice to keep it small (SMD) too, and efficient (if possible).
2. To get my inputs converted to 5V I suppose I could use a similar technique as #1, but it needs to have a sharper transition than the power supply. Could I use an optoisolator to route my existing 5V from #1 to an input pin? I've never worked with optoisolators before.
3. I know how to wire an output pin to a transistor to turn on/off a 12V line (through a resistor to limit current) but what happens if the 12V on that line spikes, could it bleed through the base and damage the transistor or microcontroller? Would an optoisolator be useful here as well?
I hope I have given enough details!
Thanks,
Alex