Using the Arduino Sun Tracking / Heliostat Program

Subscribe to my Feed!

This page will explain how to use the Sun Tracking / Heliostat Program after you have input your settings into the program, set up the electronics system, and set up one or more machines.

Note that much of this documentation assumes that you are using the Arduino Sun Harvester Shield, or at least have wired together a similar circuit. If you aren’t using either of these things, this documentation is still relevant. You just might have to skip over some sections.

Normal Operation

The following will occur during normal operation of the Sun Tracking / Heliostat Program.


1. When the Arduino is first powered on, the azimuth stepper motor will seek out the limit / homing switch. After it is triggered, the machine will move away from the switch so that it is no longer active.

2. After the azimuth stepper motor has finished its reset, the altitude stepper motor will repeat the same process.

3.  If multiple machines are set up, each one will follow the process described in 1 and 2 above.

Moving into Position After Reset

If the sun is below the horizon, the machine will not move after resetting. When the sun is above the horizon, the machine will do one of the following.

If the machine is a sun tracker, it will move to point at the sun.

If the machine is a heliostat, it will move to reflect the light from the sun at the target.

Note that the machine will not move into position if the required movement is outside of the machine’s software limits. If this is the case, you will see “Move exceeds bounds” displayed in the Serial Monitor. If the next calculated movement is found to be within the software limits, the machine will then move into position.

Moving Throughout the Day

Once the machine is in position it will update every 30 seconds (assuming you are using the default update time) until either the sun drops below the horizon or the next move is outside of the machine’s software bounds.

Nighttime Reset

At this point, the machine will have ceased its movement since the sun is now below the horizon. When the hour the machine is programmed to reset occurs, it will reset on the limit switches as it did in the beginning and wait until morning before resuming operation.

Switches, Buttons, Potentiometer, and Joystick

Changing Heliostat Target Groups with Target Changing Potentiometer

If you have wired a 10K ohm linear potentiometer to the Sun Harvester Shield, you can quickly change between target groups just by rotating it. By default, you can program five target groups which are stored in the Arduino’s EEPROM.

The name “target group” is in reference to the fact that you may have multiple heliostats set up. So if you have three heliostats, each with its own unique target saved at a particular potentiometer position, that is considered a “group” of targets. The terminology is somewhat confusing however if you only have one heliostat set up. If that’s the case, then you would technically only have one target saved at that potentiometer setting, but that single target is still referred to as a target “group”.

When you first get your Arduino (or more accurately after you run the EEPROM FLOAT FORMAT program) each saved target defaults to an altitude of zero and an azimuth of zero. This means that when you initially rotate the potentiometer nothing will happen.

To program your first target “group” into the Arduino, first start by turning the potentiometer counterclockwise as far as it will go. Next, use either manual control through the Serial Monitor or via the joystick (described in the next section) to make the heliostat(s) reflect the light where you want it. Note that when manual control is deactivated, the target(s) are automatically saved to the current potentiometer position.

After you have programmed and saved the first target group, you’ll notice that when you move the potentiometer clockwise the heliostat(s) will suddenly move back to the default (target alt and az equals zero) position. If you move the potentiometer counterclockwise back to where it was initially,  the heliostat(s) should move back to the target(s) you just saved.

If this happens, then you have successfully saved your first set of targets at the far counterclockwise position on the potentiometer. You can continue on in the manner (i.e. manually moving to the target(s), saving them, and then turning the potentiometer clockwise to access the next target group) for up to five target groups.

Note: It’s a good idea to make marks on the potentiometer to indicate where you need to rotate it to select each target group.

 Copying saved targets to other potentiometer positions.

If you want to copy a target group from one potentiometer position to another, first start by selecting the target group that you want to copy with the potentiometer.

When the heliostat(s) have finished moving, activate either Manual Control through the Serial Monitor or via the joystick.

Next, turn the potentiometer to the position where you wish to copy the settings.

Finally, deactivate manual control. Once you have done this, the targets should be saved to the new potentiometer position.

Manual Control through Serial Monitor

If the “Serial Monitor Control” switch is turned on (up position), the Arduino is plugged into the computer, and the Serial Monitor is open in the Arduino IDE, you will be able to precisely control where the machine moves by following the displayed instructions.

If the machine is a sun tracker, it will move to point in the direction of the inputted altitude and azimuth angles.

If the machine is a heliostat, it will move to reflect the light at the inputted target altitude and azimuth angles. Note: The heliostat may make an unexpectedly large move when choosing targets that are even very close to each other. If you experience this, try and let the move complete before starting to debug. There is a good chance that the reflected light will stop where you expected it to stop.

Note that the operation will be canceled if the required movement is outside of the machine’s software bounds for either a sun tracker or a heliostat.

Manual control through the Serial Monitor is deactivated simply by turning the “Serial Monitor Control” switch off (down position). If you are controlling a heliostat, the selected target will automatically be saved to the current target group (as described previously).

Manual Control through the Joystick

To activate manual control through the joystick, make sure the machine is not moving and then press and hold both the “Prev” and “Next” buttons on the Sun Harvester Shield for about one second.

WARNING: Make sure the joystick is in the center position when activated Manual Control through the Joystick. If it’s not, the machine will move even when the joystick is not being pushed!

Once activated, and if controlling multiple machines, you can use the “Prev” and “Next” buttons to select which machine to control.

If the machine is a sun tracker, pushing the joystick up and down will control the altitude movement and pushing it left and right will control the azimuth movement. BE CAREFUL the machine’s software limits are ignored when in sun tracker mode and manually controlling it with the joystick.

If the machine is a heliostat, pushing the joystick up and down will control the target’s altitude and pushing it left and right will control the target’s azimuth. Note that the machine’s altitude and azimuth angles USUALLY move to more or less follow the target’s altitude and azimuth angles, but NOT ALWAYS. The two sets of angles are affected by one another, but they are not the same. So when you are moving the machine to point at a certain target, it may make a large unexpected move. Don’t panic! If you let the move finish, you will most likely find that the reflected light will eventually end up where you expected it to be.

Note that (unlike when in sun tracker mode) the software limits are not ignored when in heliostat mode, so you may find that your heliostat will suddenly stop moving in a particular direction if the next calculated move is outside of the software limits.

When using heliostats and in joystick control mode, you can reset the target alt and az to its default (0, 0) just by turning the Serial Monitor Control switch on and then off again.
It is possible for a heliostat to become “trapped” as the sun moves across the sky because the machine’s new calculated angles are outside of the software bounds. Put simply, the machine will not move when you try to use the joystick. Being able to reset the target alt and az to (0, 0) helps remedy this potentially confusing situation.

Note that the position of the sun is not updated while you are using the joystick. If you have constantly moved the machine for an especially long time (more than 30 seconds for example), you may want to release the joystick for a few seconds to give the Arduino a chance to recalculated the position of the sun. You’ll notice that the heliostat(s) will move some when this happens.

To deactivate Manual Control through the Joystick, simply push and hold both the “Prev” and “Next” buttons for about one second again. When controlling one or more heliostats, the current target for each heliostat will automatically be saved to the selected target group.

Heliostat to Sun Tracker Mode

If the “Heliostat to Sun Tracker” switch (labeled “H. to S.” on the Sun Harvester Shield) is turned on (up position), the heliostat(s) will move to point at the sun instead of reflecting its light at the target. This can be useful when first aligning the heliostat(s).

Note that when manual control through either the joystick or the Serial Monitor is activated, the heliostat will still be treated as a sun tracker.

To deactivate Heliostat to Sun Tracker Mode, simply turn the H. to S. switch off (down position).

Wind Protection Mode

If you have a “Wind Protection Mode” switch wired to the Sun Harvester Shield, simply turn it on to make the machine(s) move into the wind protected position. This should happen immediately after the switch is activated as long as the machine(s) are not in the middle of a reset.

Note that the machine(s) will not move out of wind protected mode even if the Arduino is reset, either on purpose or if the Arduino briefly loses power.

Warning: If you’re wondering why your machines aren’t doing anything, it may be because you accidentally turned on Wind Protection Mode.

When Wind Protection Mode is deactivated, the machine(s) will immediately reset (this might not happen if wind protection mode was only briefly activated) and then continue normal operation.

Misc. Relevant Links

This documentation is part of the Open Sun Harvesting Project. Click the link for more information.

Arduino Sun Tracking / Heliostat Program Setup

Setting the Time on the Real Time Clock

Forum Link

Sun Harvester Shield Wiring

Using the Arduino Sun Tracking / Heliostat Program

Subscribe to my Feed!