• Something I had in mind for a while, but never got to it: A light tracker (sun tracker).

    Two LDRs - light dependent resistors - separated by an 'vertical, flat wall' mounted on a platform catch the light. When the light is in the plane of the wall - right above - both LDRs get about the same amount of light and pose about the same resistance. Each LDRs is series with a resistor between the power rails 0 - and 3.3V - and builds a voltage divider. The voltage at the divider points is sampled several times and then compared. If different by more as a given delta, a state information switches the values of -1, 0, +1. This state is used to trigger a tracker that rotates the platform - longitudinal to the wall - with a stepper until both LDRs catch about the same light again. To get the best results, I paired the LDRs (and series resistors) from a bunch to get two of each with most 'equal' specs.

    The code started out with just working the LDRs and showing green or red LED of PICO with flashing of both on polled light sensing. I added - recycled - some old code of mine - Stepper Motor Spinning Slow from almost 7 years ago - to rotate the platform. I linked both the light sensing and stepper motor code together with a tracker function. Initially, I called the tracker on an interval as well, but that kept the platform oscillating. In a second version tracking, I called the tracking on change of light sensing state. But it was still overshooting and oscillating, except I made the rotation really, really slow, so that about a step or two per light sampling. Lastly - what is shown - is a combination of both, trigger rotation or stopping of it on intervalled light sampling AND check with stopping of rotation on every step by taking 'quickly' a simple light sample.

    The attached clip shows the sensor platform 'following' the light desk lamp which I move back and forth. Notice a small correctional adjustment after a major adjustment - in seconds 11 and 16. - seen by a short 'after' flashing of the stepper LEDs. This is because the LDR is slow reacting (and also because only one sample read is taken for triggering the stop of rotation on every stepper step (Every 4[ms] a step is made. The rotation is so slow because of the high reduction gear as part of the motor.)

    The code - see next post - is far from prime time... but it shows that with a few lines something can be done quickly. For real worl used, limits have to be introduced - with 'hard range end detection / switches' - and detection of false adjustment triggers. In the end, this tracker will serve a single or with a double a two axis solar tracker. Given real time, values in tables for each week of an earth-sun year for the geo-location and a few formulas, the trackers position is primed and uses presented contraption for fine adjustment.

    2 Attachments


Avatar for allObjects @allObjects started