Solar Tracker with live Data Feed – Windows IOT

Archived - This project is no longer maintained

This project is a Solar Tracker with live data feed powered by the Windows IoT Core running on the Raspberry Pi 2. It is built up of 2 main parts; The Raspberry Pi running as the main controller and an Arduino which takes care of moving the servos and taking the light measurements. The Raspberry Pi has a prototyping board attached to the top to make the connections neater. On that board is a MCP3008 ADC Chip and a Logic Level Converter. The MCP3008 connects to 2 Voltage dividers (One for solar (Max 30 Volts) and one for Battery (Max 15V)) and the ACS715 Current Board. The Logic Level converter connects to the I2C lines and then to the Arduino. The Arduino has 4 Light Dependant Resistors and 2 Servos.

Download Source Code

Released under the GNU GENERAL PUBLIC LICENSE V3, you have access to all the source code and schematics to build your own

The Build

Schematic

Pi Hat

Raspberry Pi Hat constructed

The Raspberry Pi side components can be mounted on a prototyping board such as the PiBreak Plus from Freetronics. On this board the Logic Level converter and MCP3008 ADC chip are mounted. There are terminals and headers for connecting to the other components of the project.

To construct the board refer to the schematic above. The components on the left side of the schematic are the parts for the Raspberry Pi (Minus the servos). Start by soldering the 16 Pin IC socket and Logic Level converter (Refer to images) then the headers and terminals. After that solder the wired connections. The PiBreak Plus makes wiring the connections easier by providing a breakout of all the pins. To make the connections refer to the schematics and images above.

Arduino Movement System

The Arduino is responsible for controlling the drive gear (2 Servos in this case). It receives commands from the raspberry pi via I2C then translates that information into drive commands for the servos. In this example there are two servos (horizontal and vertical) that move the panel and Light Sensor Board. In a permanent setup, servos may not be practical. A more practical option may to use a bigger motor or a worm drive system. However dependent of the drive system the Arduino side code can be easily changed to suit your setup.

Upon looking at the code you will find several functions towards the bottom. The functions begin will killAll()

killAll() Disengages the servos so that they are free moving
systemResume()Re-engages the servos so that they are ready to receive commands
homeServos()Positions the servos in there neutral position. This occurs before killing the servos
runTracker()Position the servos dependent on the light position
forceServo()Forces the servos into a certainty position (Note: Max input is 180. This can be changed in the Raspberry Pi side code

Commands received by the Arduino:

0x00Kill System
0x01Resume System
0x02Home Servos
0x0AForce Servo (Any)
0x0BH Servo
0x0CV Servo
DECPosition to Send
0x0FRun Tracking System

Arduino Code


    

Voltage Dividers and LDRs

The above images show the voltage dividers used for each channel. The below image shows the assembled board with the voltage dividers and the ACS715 current sensor.

The Light Sensor Board has 4 Light LDRs with a separator (to block the light) in between them. This is so that a shadow is cast over the LDRs when a light source is not exactly above them. The board once assembled is then attached to the same mount as the solar panel then connect each of the 4 channels (LDRs) to there corresponding pins as follows:

Top LeftA0
Top RightA1
Bottom LeftA2
Bottom RightA3

Putting it all together

Now its time to wire it up. Start by wiring the solar panel to a regulator and wire the rest as shown in the above image. Remember the battery input has a limit of 15 volts, so if you need higher change the voltage divider (and some code). Have the voltage monitors in parallel to the incoming voltage and have the ACS715 in series to the load. Also remember the ACS715 has a limit of 30 Amps and 30 Volts.

Once power connections have been made connect each input to the channel on the raspberry pi (see schematic) and connect the servos and LDRs to the Arduino then wire the I2C lines in.

You may also want to power the Arduino and Pi by the solar panel so add the correct voltage regulator. Now plug in a monitor to HDMI and connect a mouse and move on to programming.

Programming

Install the required IDEs. You will need a version of Visual Studio 2015 take a look at this guide for that. Then install the Arduino IDE. Now download the project files from GitHub.

Now you will need to flash your memory card with Windows 10 IoT core. Take a look at this guide. It might be a good idea to try the blinky example first to make sure you setup is correct.

Find and open the Arduino software then upload to your Arduino (or compatible) board.

Then find and open the Raspberry Pi software. Open the WindowsIOT_SolarTracker.sln file. Change the platform to ARM and select your remote device (refer to here for help) then press F5 or Deploy to upload the code.

If all is well you may want to set the app to automatically launch on start up. Refer to here for more information on that.

Pi Application

code/windows_iot_app/WindowsIOT_SolarTracker


    

Done

Now your all finished. Enjoy! Please comment and make improvements. Show us your improvements.

Leave a Reply

Your email address will not be published. Required fields are marked *