Odd Voltage Sensor Error

Hello all,

First reach-out for help.

I am writing a program to control and move solar panels in an array, similar idea to the dual-axis solar trackers with with the LDRs for light monitoring.

My approach is slightly different however, I have four solar panel arrays, eight panels in total (6v panels), wired in series pairs and each, now 12v series pair wired in parallel.

Pretty much so far, everything is working how I like regards to solar panel positions, the code is not yet complete and some parts are not there yet. This is pretty much my first Arduino program, I am sure there are parts that could be better.

As voltage changes between panel pairs, servos move and do their thing. All great and all fine.

The issue I have is a strange one that I can’t get my head around.

For the whole time I have been using serial monitor to view the voltages and most functions in the program have some info to report back. For example, if the solar panel servo moves past a limit I set, the LED blinks (there was a buzzer but I needed the pin and it was a annoying). I have a low voltage warning that prints to serial and other, the whole code is attached in a zip.

On to my issue, finally. The volt meters have decided to stop reporting the actual voltage, instead, the value is below 1v mostly, when I meter the panels they are outputting 3 - 4v (I am inside).

So, I thought, must be a wiring issue. Originally, I had an issue with individual panel voltage metering, I am using the VCC<25V “sensors”. I have one on each 12v panel array and one on the main output, where they are all connected together. To solve the issue with all sensors reading the same, as they were all connected essentially to the same connections, I added a diode on the + output of each panel. This solved the problem and all was working fine. I had moved to another room, where there was more sunlight, everything seemed ok. I could’t see any voltages but it all worked. It was only when I added a low voltage alert that I noticed the issue. All sensors are reporting a fraction of the voltage that they are receiving.

I have checked and checked and can’t see anything wrong, now, the very interesting part is, if I write a new program, that only checks the voltages and reports them back, they all come back ok. The code is the same, the connections are the same, but the readings are not.

Maybe I have done something silly and can’t see.

I would very much appreciate someones help on this please.

many thanks


Solar_Charge_NEW_002_-_BUZZER_REMOVED.zip (7.52 KB)


I have no idea really why this error is occurring, however, I seem to have found a solution.

I have added a fudge factor. Although the readings were far from right, they did go up and down as they should, more voltage, higher value.

After some quick math, I found them to be around 5 x smaller than they should be, so I have added a fudge factor of 5.2, if I multiply all the sensor values by 5.2, the voltages match my meter readings.

Maybe one of you will recognise the 5 x factor and know why this is.

Anyway, back on a forward path with this project which is good.

Cheers all


The factor of 5 happens to be the ratio of the voltage divider. Your code is wrong:

    value = analogRead(pan01Input);
    vout01 = (value * 5.0) / 1024.0;
    vin01 = vout01 / (R2/(R1+R2)); 
    Serial.print("PAN01 V= ");
    if (vout01 > arrayHIGHthresh) {

You are comparing vout1 with arrayHIGHthresh but you should be using vin01. Similar errors in vout02, vout03 vout04.


Hello el_supremo,

Thank you, looks like I have some fudge code to remove.