I am designing a board for which I want to have single input terminal for voltage. Board is microcontroller based(Atmega328) so the voltage coming to uC(Vcc on picture) should not exceed 5V.
How I imagined it: V_PICK is jumper for choosing the input voltage. User will connect only 5V or 12V to this board: a) When 5V is connected, voltage goes directly to Vcc and to the rest of circuit. Jumper is in 1st position. The voltage gone to the linear regulator doesn't matter because is too small for regulator to do anything with it. b) When 12V is connected, jumper is in 2nd position and voltage goes over regulator who regulates it down to 5V. Then the voltage goes to Vcc.
The problem is, when jumper is left in 1st position and 12V input is connected to input terminal - then 12V directly goes to Vcc and burns uC and other chips onboard. I have thought of adding Zener diode at place marked on picture, but not 100% sure how to connect it. I googled out that zener in series with resistor(who will deal with remaining voltage, for example if input is 12V and zener is 4V7, resistor will dissipate 7.3V). If I need 500mA of current at 5V, resistor value should be 14.6 ohm? Is that correct? Formula I used is: (Vin - Vout) / current needed
VIN on picture is line used by MOSFETS in other part of circuit so it should be left there directly connected to input.
Is it correct that if I added zener diode, jumper and regulator will be no longer needed? Voltage would automatically "find its way": a) 5V is in, voltage goes across zener to uC. MOSFETS directly draw current from VIN line while not load on zener. b) Same thing when 12V is in, just voltage will be reduced for uC.
Finally, I should find zener diode that's 2.5W(500mA * 5V). As I have seen, they are not very often and might be expensive. Should I got some alternative way for all this?
I am just a guy still learning about electronic laws and really appreciate your help. Thank you!