Decrease Voltage to a Microcontroller

Thread Starter

Jibebuoy

Joined Nov 5, 2025
59
Hi

I am using a Seeeduino Nano that has a max pin current rating of 40 mA and voltage of 5 volts. I want to use separate pins as input pins for a 12 volt and 1.9 volt load. I want those loads to be decreased to 5 volts and 1 volt, respectively. How do I do that and not exceed the maximum pin current rating at the same time?

Thanks.
 

sagor

Joined Mar 10, 2019
1,046
Input pins will take very little current, they are a higher impedance. Especially when doing A/D conversions. Use a resistor divider to get the voltage to a range you can work with.

There are online voltage divider network calculators. Enter your source voltage and one resistor, and it will calculate the other. For example:
https://ohmslawcalculator.com/voltage-divider-calculator

I plugged in 12V source, 5V result. Entered 10k top resistor and it calculated 7.142k as bottom (7.2k would likely work, but may be a bit high for 5V)
Tried 4.7k top and get just over 3.3k for bottom, so a 3.3k will give very close to 5V, just a bit below that.

For 1.9v to 1v, I tried the same 4.7k on top and got just over 5.2k for the bottom (so voltage will be a tad less than 1V)

Remember to test resistors or use high tolerance resistors (1% tolerance), as many can be +/- 5%
 

MisterBill2

Joined Jan 23, 2018
27,181
IF the inputs and outputs of that tiny computer are rated for 12 volts then it might work. IF they are only rated for 5 volts or possibly only 3.3 volts, 12 volts will cause a problem. READ All OF THE BOOK ABOUT THE RATING OF ALL OF THE PROCESSOR CIRCUITS!! Avoid burning it out!!
 

Thread Starter

Jibebuoy

Joined Nov 5, 2025
59
IF the inputs and outputs of that tiny computer are rated for 12 volts then it might work. IF they are only rated for 5 volts or possibly only 3.3 volts, 12 volts will cause a problem. READ All OF THE BOOK ABOUT THE RATING OF ALL OF THE PROCESSOR CIRCUITS!! Avoid burning it out!!
If I size the voltage divider correctly so only 5 volts max goes to the micro controller, then why would it burn out?

Thank you.
 

panic mode

Joined Oct 10, 2011
4,864
you are working with product that is very bare bone, it has no protection as found in say automotive ECU. if you are confident that 12V will never be exceeded, it is all fine. but... we do not live in isolation, every step you take across the floor builds charge. you wiggle tush in that comfy chair and you build way more charge. then you touch the input and ZAP... static kills your project. also what if the 12V is not exactly 12V? what if there is a transient that makes it 19V for split second? what if the 12V is simply connected backwards and your input sees -12V? with divider, MCU pin would see -5V. or maybe YOU would never make that mistake but you are making product that 100s of people will be messing with so you cannot predict their actions and want to minimize recalls? things like those are common concerns when thinking of hardening.

one option to protect inputs is to put pair of reverse biased diodes like here D1/D2
1772032007816.png

notice that if the "12V" becomes too high current through D1 will go to 5V and limit AI to 5.6V which is survivable.
if the "12V" is low (negative) or wired backwards D2 would protect the input.

but... this only works as long as current through R1 and R2 is small enough. otherwise such current may change the 5V/0V rails and IC will die.
to prevent that, above diode scheme should always be paired with sufficiently large C1 and D3 to absorb hits.
another strategy is to use zener as D2, then D1 is not needed and TVS/Zener D3 is also probably not needed.
1772032389213.png
 
Last edited:

panic mode

Joined Oct 10, 2011
4,864
voltage dividers and regulators have different roles. regulators maintain stable voltage. this is used to supply power to MCU.
voltage dividers scale (proportionally) larger voltage to something smaller - used when measuring device range is exceeded. using simpe divider does work but it offers little or no protection if things go sideways...
using voltage divider instead of regulator can work but it is far from ideal. using regulator in place of voltage divider does not work at all.
 

Thread Starter

Jibebuoy

Joined Nov 5, 2025
59
Thanks for all the input. Appreciate it. Let me provide more context of what I am trying to achieve. I have two inputs that change voltages -they are either ~1.5v or 12 v. I want to scale down those voltages so that I can use a 5v microcontroller to have a pin go high or low. How can I 'transform' the 12v to a HIGH voltage between 3.5 and 5 v, and the 1.5 voltage to LOW voltage between 0 and 1.5 volts? The voltage divider concept was attractive since it did this nicely although I understand the concerns with using it.
 

panic mode

Joined Oct 10, 2011
4,864
so how many states is that? 1.5V or 12V is of course two states but i am not clear if you only need to differentiate between them or you want to know more, such as 0V, 1.5V, 12V (three states).
 

panic mode

Joined Oct 10, 2011
4,864
if using analog input, i would pick voltage divider for 0-14V for example so that all of them are covered.
if your MCU is able to read 0-5V then values like 27k and 15k will form suitable voltage divider that scales 0-14V down to 0-5V. and in software you can scale the input voltage accordingly.

since you need to monitor 2 signals, using two ADCs will do the job. if you want to add some protection, you can add pair of diodes (1N914 or whatever) or 5.1V zener diode at each input as shown inf post #6

advantage of configuring the pins as analog is that you can see not just thoe two values but also any other value in range.
 
Last edited:

Thread Starter

Jibebuoy

Joined Nov 5, 2025
59
so how many states is that? 1.5V or 12V is of course two states but i am not clear if you only need to differentiate between them or you want to know more, such as 0V, 1.5V, 12V (three states).
I only need to know two states: if the voltage is 0 or 1.5 V would be state 1 and if the voltage is 12v then that would be state 2.
 

Thread Starter

Jibebuoy

Joined Nov 5, 2025
59
if using analog input, i would pick voltage divider for 0-14V for example so that all of them are covered.
if your MCU is able to read 0-5V then values like 27k and 15k will form suitable voltage divider that scales 0-14V down to 0-5V. and in software you can scale the input voltage accordingly.

since you need to monitor 2 signals, using two ADCs will do the job. if you want to add some protection, you can add pair of diodes (1N914 or whatever) or 5.1V zener diode at each input as shown inf post #6

advantage of configuring the pins as analog is that you can see not just thoe two values but also any other value in range.
With a voltage divider I can also get my desired voltages using smaller resistors like 320 and 220. Is there an advantage to using larger resistors as you have suggested?
 

Thread Starter

Jibebuoy

Joined Nov 5, 2025
59
With a voltage divider I can also get my desired voltages using smaller resistors like 320 and 220. Is there an advantage to using larger resistors as you have suggested?
I like the idea of protection. You suggested adding two diodes (d1 and d2 as shown in post 6). Would I need C1 and D3?
 

panic mode

Joined Oct 10, 2011
4,864
low resistance means high current. 330 + 220 Ohm = 550 Ohm and 12V/550 Ohm = 22mA which is ok if this is not battery powered circuit.
Arduino likely has onboard capacitor close to MCU but this does not hurt. you can skip D3...
 

Thread Starter

Jibebuoy

Joined Nov 5, 2025
59
Do i need C1 shown in post 6 or are you saying the arduino onboard cap takes its place? Also, you figured the current going to the arduino was "low resistance means high current. 330 + 220 Ohm = 550 Ohm and 12V/550 Ohm = 22mA" assuming I used those resisitors. Wouldn't I use R1 only to determine the current instead of R1+R2? And yes, I see the advantage of using high R values to minimize the current. Makes sense. Thank you for your help.
 
Top