17VDC,ADC and Activity Board
Rsadeika
Posts: 3,837
I am trying to figure out how you can use the ADC, on the Activity board, to check voltages greater than 10VDC batteries? I know and use the 10K resistor voltage divider setup for batteries that are up to 10VDC, but I am not sure what the setup would be for greater VDC input values.
On the NET you can find voltage divider calculators, but when I tried one out, using 14VDC input, r1-15K, r2-15K, the output voltage is 7V. And it seemed like whatever resistor size I used, the output value was 7V. Now I am at a loss as to how you could use the ADC, on the Activity Board , to check for battery values that are greater than 10VDC?
Thanks
Ray
On the NET you can find voltage divider calculators, but when I tried one out, using 14VDC input, r1-15K, r2-15K, the output voltage is 7V. And it seemed like whatever resistor size I used, the output value was 7V. Now I am at a loss as to how you could use the ADC, on the Activity Board , to check for battery values that are greater than 10VDC?
Thanks
Ray
Comments
It's about the ratios Ray, if R1=R2 therefore R1/(R1+R2) will always be half. Now if you left R2 (the one to ground) at 10K and made R1 24K then your ratio would be 10/34 * 17V = 5V full scale. Just remember Ohm's Law R=V/I so I = 17/(R1+R2) and then V across R2 (the one that the ADC sees) = R2 times that current of 17/(R1+R2) = 0.5ma by 10K = 5V. Easy Peasy.
Ray
Not sure what you mean when you say "checking at three different points". Maybe a schematic of some kind would help.
But each independent A/D input will need it's own divider and sometimes you might need a cap on the A/D input due to the resistance in the signal that you introduce and the sampling nature of the A/D. If these resistor where done in surface-mount then each divider of 3x10k + 10k would fit into a tiny 3.2x1.6mm four resistor array however if you use 33K and 10K then that shouldn't be a problem either.
Ray
Be careful here: unless you have a very unusual PV module, Voc could be around 21-22 V nominal, and up to (to err on the side of safety) 30 V or so when you include edge-of-cloud effects and cold weather. Your MPPT controller will very quickly bring it down, and your MPP voltage will probably be about 17V, but that's not what I'd design for if you want your project to keep its magic smoke inside.
You should only need two inputs, because the MPPT controller output should be virtually identical to battery voltage, but the other two must be completely separate; there is no way to combine parts of the voltage dividers.
Since this is still considered a window sill experiment, I will be using a 50W panel, smaller dimensions, which is rated for 17VDC, at the high end. I also want to setup a check point for the load value of the MPPT controller; in the docs, it also states, that there is voltage reduction from the panel to match a good charging level on the battery, of course I am paraphrasing.
Now I have to think of a good solution for the voltage divider setup, I guess it will have to be a larger breadboard to contain a manageable tangle of wires and resistors.
Ray
Ray
Ray
Ray
Ray
'Looks like your latest post got through. Your other one was "automoderated" for some strange reason. I'll be glad when the forum software finally gets sorted out.
-Phil
Ray
Basically what I am seeing is something like: 13V, 10V, 5V, 0V, and on and on. I assume that is what PWM is, sending out different voltages in this case. Since I am using a C program to capture the voltage as is, I need some guidance as to how, using C, I would capture a duration of voltage inputs, average them, and then display the result in a reasonable amount of time? This is a completely new programming strategy for me, or maybe there is a different way of doing this?
Ray
The fix is to bypass your ADC input with a tantalum capacitor (which you should always do, in any case), and you probably won't need to average your voltage readings. However, you have plenty of (microcontroller & circuit) time, so you might as well.
If you want help doing so, please post your code; it will be easier to modify it than us starting from scratch without knowing what you've done so far.
Ray
I assume you have 5V at the ADC V+; do you also have +5V to Vref ?
From a previous post, you said you adjusted by a factor of 2.4 for (3) resistors. This isn't right; it should be 3.0, but then again, if the ADC is 5V, it may have been saturated reading 4.98.
Can you confirm that your resistors are in series, and your ADC is connected to the junction of the first & second, starting from ground ? Again, a voltmeter reading here should be 3.125V.
Thinking about this from a mathematical perspective, is there a simple formula for predicting the actual battery discharge when run through this resistor setup? I guess in other words, how much power are the resistors using in terms of volts?
Ray
<edit> I just checked the battery voltage while the program is running, there is no voltage drop at the battery, now I am lost.<edit>
Measure and record all of them with the propeller running in a while loop and then while paused. If the reference voltage (+5V ?) varies with the current draw of the propeller you will not get accurate readings. If the reference voltage is stable under both conditions you can use the battery and Vin voltage to calculate the calibration factor. Calibration factors calculated from the running while loop and paused should be very close.
So, after making this discovery I changed the adjustment factor to 3.73, and now the reading is the same as what the battery is showing. Since I have a sampling rate of a 1000 in my for loop, I guess I will have to work this number to see if I can get away with a smaller number. Now everything is looking brighter even though it is overcast outside.
Ray