Software Details
The software is organized into a three main threads:
- Motor control thread to read ADC values from the photoresistors and compare the difference between the two to generate a PWM signal to drive the motor. This thread also updates the LCD to display important system variables.
- Battery status and power control thread to display battery charge status on LEDs and control system sleep during low battery conditions and during “night-mode” when the panel is not rotating.
- Sleep thread to repeatedly put the system to sleep after a specific amount of time during day-time operation. The system regularly wakes using an interrupt generated by the real time clock to update the system state and then this thread puts the system back to sleep.
Battery status display
The sleep mode code and real time clock control code were tricky to implement due to the multiple different conditions under which to put the system to sleep. Prioritizing different conditions and ensuring the system was not awake when it was not supposed to took some time to implement correctly.
Hardware Details
The main hardware components used were as follows:
- Solar panel used to capture solar energy to power the motor, PIC32 microcontroller and charge the battery.
- Servo motor used to rotate the solar panel over a single-axis.
- Two photo resistors used to capture light intensity and provide feedback to the motor controller.
- 3.7 V battery to store power an ensure continued operation when no solar energy is being captured.
- Powerboost 1000 charger connected directly to the solar panel and used as a load-sharing device to power the PIC32 microcontroller and charge the battery at the same time.
- Linear regulator to step down 5 V supply from the Powerboost 1000 to 3.3 V to power the PIC32 microcontroller.
- Four LEDs controlled by the PIC32 and used to display the status of charge in the battery.
- Adafruit LCD display used to display system time and important ADC readings/ PWM values.
This system could easily be built by someone based on the details provided above.