Possible voltage senser problem


This is my first project, unfortunately its not quite working and I dont know why.
This isnt my subject – just assume I'm a near idiot who needs things explaining simply.
Hopefully my explanations will be though slightly verbose clearer than mud

First, thanks to the people who have helped me get this far – appreciated.

The project is to power a 6v pump that trickles water into a bog garden.
The Arduino 'project' switchers power between a 6v solar panel and a 9v* mains transformer. The switching is dependent upon the solar panel providing 6v + (sunlight).
*9v is stepped down to 6v using a LM2596 DC to DC Step Down Converter.

Whats working
The time bits works ok
If the solar panel is providing less than 6v the mains/transformer bit works ok

Whats not working
If the solar panel is providing more than 6v for some reason the project keeps switching between mains and solar.
I'm getting strange voltage power readings from the LL3b205 voltage sensors.
Mainly from the solar panel input LL3b205 which changers +- a few volts as the project keeps switching between mains and solar – when it should be solar.
I use an LM2596 with a volt display to simulate the solar panel input, if I (before I plug it in) set this to say 6.5v when plugged in the voltage (simultaneous with the aforementioned switching between mains and solar) drops to a 5?v then risers again with the switching – and repeats.

So it looks like for some reason the LL3b205 voltage sensors are either broken, wired in wrong, sketched wrong or are being interfered with. Though I not being an 'expert' could be focusing on the wrong thing.
If it was interference how could I manage that, Rectifier Diodes maybe

One more thing if I entirely disconnect the second LL3b205 that monitors the LM2596 DC to DC Step Down Converter why do I still get a reading.

I've attached an image of the .sch and a sketch

Suggestions for improving the sketch appreciated

I await questions with interest and a slight amount of trepidation.

pond4.ino (2.54 KB)

You can test your "voltage sensors" by applying a known voltage and then running the [u]Analog Read Serial Sketch[/u]. (You'll have to modify the sketch to read the sensor connected to the A1 input.)

Since the sensor divides the voltage by 5 and the analog-to-digital converter reads 1023 at 5V, then 5V into the sensor should give you a reading of about 205.