Flow Chart
One of the aims of this project is that the system has to be able to run in either sensor or equation mode. The sensor mode relies on sensory input from the structure to track the sun, while the equation mode relies on input data from the microcontroller to control the motors direction. The following flowchart outlines the steps that the program will follow during operation.
Control Sequence
First of all, the microcontroller is waiting for synchronization to get the real time from computer, this done as the follows:
- The microcontroller checks if serial port is available
- Then the user run this shell command (the operating system used is Ubuntu Linux)
“TZ_adjust=3;
echo T$(($(date +%s)+60*60*$TZ_adjust)) > /dev/ttyACM0 ”
This code sends the real time and date to the microcontroller, then microcontroller start resetting procedure discussed in the next subsection, if we activate the system for the first time in the day it will work in equation mode to go to the calculated azimuth and elevation position in that time but if we activate the system in the night the system after resetting goes to sun rise position and wait for sun rise.
In the day after resetting and going to calculated azimuth and elevation position in that time, the system checks for cloudy condition ( the sun sensor reads values less than 2.5V ) the system will work in equation mode else the system will work in sensor mode.
- Equation mode :
Every 4 minute the microcontroller code calculate the Sun position at that time and order the motors to go to that position.
- Sensor mode :
For elevation angle the microcontroller will read the up and down sensors values and compares them digitally if the up sensor is higher than the down sensor the actuator will go up but if the down sensor is higher the actuator will go down , until the up and down sensor readings are almost equal.
For azimuth, the same procedure: the microcontroller will read the east and west sensors values and comparing them and moving the dc motor CCW (to east) if the east sensor value is higher than west or CW (west) if the west sensor value is higher than east sensor.
Notes:
- The system is supposed to go only CW from east to west as the Sun moves through the day.
- Any moving of the system up-down or CW , the new values of Azimuth and Elevation angles will be stored in the registers azimth_postion and elevation_postion in the microcontroller.
At the sun set the system will reset and then go to sun rise position, and waiting for sun rise.
System Rest
The reset logic is used to place the device into a known state (reference position). At the day end the system should be moved to sunrise position .so, we need to reset the system to the reference from where the calculated sunrise position starts .by adjust initial values of azimuth and elevation registers shall be:
azimth_postion = 60;
elevation_postion =79;
We use two types of switches for reset the system, one for azimuth position and the other for elevation position. For the azimuth position we used a hall effect sensor which detects magnetic field produced by a physical magnet presented on the gear which is responsible for azimuth movement. For the elevation position we used micro-switch which is pressed at the reference position .
- The microcontroller checks if serial port is available
- Then the user run this shell command (the operating system used is Ubuntu Linux)
“TZ_adjust=3;
echo T$(($(date +%s)+60*60*$TZ_adjust)) > /dev/ttyACM0 ”
This code sends the real time and date to the microcontroller, then microcontroller start resetting procedure discussed in the next subsection, if we activate the system for the first time in the day it will work in equation mode to go to the calculated azimuth and elevation position in that time but if we activate the system in the night the system after resetting goes to sun rise position and wait for sun rise.
In the day after resetting and going to calculated azimuth and elevation position in that time, the system checks for cloudy condition ( the sun sensor reads values less than 2.5V ) the system will work in equation mode else the system will work in sensor mode.
- Equation mode :
Every 4 minute the microcontroller code calculate the Sun position at that time and order the motors to go to that position.
- Sensor mode :
For elevation angle the microcontroller will read the up and down sensors values and compares them digitally if the up sensor is higher than the down sensor the actuator will go up but if the down sensor is higher the actuator will go down , until the up and down sensor readings are almost equal.
For azimuth, the same procedure: the microcontroller will read the east and west sensors values and comparing them and moving the dc motor CCW (to east) if the east sensor value is higher than west or CW (west) if the west sensor value is higher than east sensor.
Notes:
- The system is supposed to go only CW from east to west as the Sun moves through the day.
- Any moving of the system up-down or CW , the new values of Azimuth and Elevation angles will be stored in the registers azimth_postion and elevation_postion in the microcontroller.
At the sun set the system will reset and then go to sun rise position, and waiting for sun rise.
System Rest
The reset logic is used to place the device into a known state (reference position). At the day end the system should be moved to sunrise position .so, we need to reset the system to the reference from where the calculated sunrise position starts .by adjust initial values of azimuth and elevation registers shall be:
azimth_postion = 60;
elevation_postion =79;
We use two types of switches for reset the system, one for azimuth position and the other for elevation position. For the azimuth position we used a hall effect sensor which detects magnetic field produced by a physical magnet presented on the gear which is responsible for azimuth movement. For the elevation position we used micro-switch which is pressed at the reference position .