Maker Pro
Maker Pro

Questions regarding voltage divider for micro controller sensing

Hello Guys,

I am beginner trying to develop two voltage sensors for attiny85 microcontroller. I have two separate voltage levels that I want to sense using the attiny. One of the voltage supply is 0V-5.5V and is fluctuating very often within that range, and I want to detect the voltage every second or so through attiny85 analogread function and record it inside a log. I want to use the VS1 sense line from the schematic and connect it directly to any analog pin of the attiny85. And the SIN is directly connected to the supply voltage. On the other supply, I have linear 0V-2.7V which is connected directly to the CVP pin. And the VS2 is connected directly to another analog pin of the attiny85.

The attiny85 is being powered by a separate 3.3V supply. And the reference voltage I want to use is 1.35V inside the software. So, 0V-1.35V inside the attiny analogread to detect this 0V-5.5V fluctuating range and 0V-2.7V linear range.

Now, the questions:
1. Is my voltage divider circuits feasible and a good approach for these two types of voltage measurements?
2. Is it possible to improve the voltage sense circuitry, to get better accurate readings?
3. What high quality good brand SMD components I could use for these voltage sense circuits and their eagle library parts suggestions?


Any suggestions and tips would be highly appreciated. Thank You.
 

Attachments

  • vsense.PNG
    vsense.PNG
    25.7 KB · Views: 6
The sum you need to derive the correct division ratio is (V1 / V2) - 1. You also need to take into account the loading effect of the attiny85's input impedance as this will shunt R2 resulting in an error. If you can determine its impedance, you could adjust the value of R2 to compensate. Using low value resistors will mitigate the effect too a degree. Alternatively you could buffer the voltage divider with an opamp but you would need to find one who's output goes all the way to ground, though there are ways of getting round that problem.
A simpler solution would be to put a potentiometer (Pot) in series with either of the resistors and adjust the Pot until you get the reading you require.
 
I already calculated the division ratio which is 3.07 and I have chose the resistors according to that value. And the reference I have on the attiny85 is a software based reference which is 1.35 volt. And the resistors in the circuit diagram provided are selected to be as close to the ratio as possible with standard resistor values.
 
As I said in post 2, you need to determine the input impedance of your device as it will be in parallel with R2 and will affect the result.
 
The data sheet will tell you the max output impedance of the divider to get full accuracy. For PICs it is 2.5K for the older ones and 10K for the newer ones.

You can also put a capacitor across the lower resistor to lower the effective output impedance to virtually zero. A 100nF would be fine.

Bob
 
Top