Use photoresistor to stop actuator.

Okay, here is what I am trying to do. I want to have an actuator move from 0 to 180. But I want the actuator to stop moving when the light threshold reaches (number). The idea is to have a solar cell follow the sun across the sky stopping in optimal position.

Can someone help me in this. I am new to this and having some trouble getting it right. I have been able to get it to be basically 0 or 180 depending on the presence of light but cannot get it to move and stop at light and move again when light is removed.

Thanks in advance.

do not very clean about the detail you want . do you mean you want to control the actuator from 0 to 180 depending on the ligtht intensity? if yes, just serial connect the photoresistor with a resistor , and then analog read the voltage between ,you will get the relative light intensity. but if you need the light intersity presicely, i suggest you use a digital light sensor, whose output has a much more bettter linearity with the light intensity.

We need to know about this actuator and what sensor you are using.

If you have two Light Dependent Resistors attached to your solar panel with some optical shielding (a small piece of board separating them?) so that the sun only falls evenly on both of them when the panel is facing directly at the sun then your code needs to read the values of the two LDRs and move the panel a little bit in the direction of the LDR with more light. Then read the LDRs again etc. Should need very little code. LDRs are very cheap.

You might need to add end-stop detectors (microswitches perhaps) to prevent the panel rotating too far.

I was recently talking to a man who has a working system like this. He said his biggest problem was protecting the electronics from the rain.


I have been able to get it to be basically 0 or 180

You don't say what sort of actuator you have, but if you know how to move it to a given position then all you need to add is a pair of LDRs as Robin2 describes. The algorithm to control the actuator is then extremely simple.

Example of a 2 axes solar tracker: