# 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.

## The Build

#### Pi Hat

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()

### 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:

## 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