Education – Dividing voltage with resistors
[update - 31st May 2010 - new, improved article about resistors is here, please read after this post ]
Today I found myself needing to interface an external voltage with an analogue to digital pin of a PICAXE microcontroller. The plan was to use the PICAXE as a voltage meter, just for fun. However it can only accept signals up to the chip supply voltage which was 5V. So the maximum input voltage of 20v needed to be reduced proportionally to a maximum input voltage of 5V. This can be easily done with two resistors, using a voltage-division circuit. It is very easy, using the example below:
Now the fun part – mathematics! First – the formula:
So first, we know Vout is 5, Vin is 20, just need to find values for R1 and R2. Note that the sum of the voltages potentials across R1 and R2 need to equal Vin, and I want to reduce the voltage by around 75% (that is, from 20 to 5). Plus, I wanted to be able to calibrate Vout precisely, so will use a 500 ohm trimpot as R2. So now I need to calculate R1. Which leaves us with 5=20(500/(R1+500)). I am going to assume you can do the algebra, so we have R1 = 1500, or 1.5k ohms.
If you have made it this far, I’m going to give you the solutions for each variable, so you have a ready-reckoner for future use:
So there you have it – voltage division can be easy and fun. But like most things electronic, reading about it and doing it are two different things. So let’s have a look at a real-life example:
[no audio in clip] First R1 and R2 are measured, then Vin, and the voltage drops over the two resistors.
I hope you learned something today, and would like your feedback. Don’t forget to subscribe (top right) for more updates!