# Solar Tracking

MoCo Makers is building a solar tracking turn table! This Wiki page will help us track the progress of this project!

This Wiki page is publicly editable. Please see here for how to contribute to this wiki.

### Background:

We are assisting the nonprofit Solar Household Energy to build a solar tracking device. We are building hardware and software to support this solar tracker, that will be used for solar cooker testing, and other rotating other instruments.

For technical goals of this project, see this presentation by Paul Arveson:

Consider that you can track the sun well using astronomical data:

https://rredc.nrel.gov/solar/codesandalgorithms/spa/

In particular, we will use Python to do these computations by relaying on AstroPy and SunPy.

### Where we are:

Our hardware designs need to be documented, but track closely with MIT’s Spin project. The first prototype is in the Studio i Makerspace, if anyone wants to stop by and play with it, they are encouraged to.

The code is hosted on our GitHub:

www.github.com/MoCoMakers/SolarTracking

Right now we have a turn table based on Arduino, that gets commands over serial. The following are the current commands available:

#### Turntable Commands

Commands are ALL UPPERCASE.

Bn move By n degrees from current position
Cn move Continuously at n degrees/second
E Emergency stop, idles stepper
H move Home by shortest path
Pa,b,c,d,e move Periodically,
a = period in seconds
b = start position in degrees
c = stop position in degrees
d = movement in degrees
e = repeat count, 0 = indefinitely
S Stop
Tn move To position n degrees from zero
Z Zero position, sets home

If accepted, acknowledged with same command character.
If rejected, acknowledged with X.
When completed, acknowledged with -.

### Next Steps:

We need to focus on a controller software (presumably running on a Raspberry Pi), that can update the Arduino with the specific commands relevant to pointing the turn table at the sun over the course of the day. Let’s assume a researcher has a cellphone with Longitude, Latitude, Compass, and accurate time.

Software goals:

• Zeroing the device to true North, based on Magnetic North, Longitude and Latitude.
• Creating a list of Azimuth points for a time series between a start time, and end time, by a given interval (seconds?)
• Correct the Azimuth to a device specific angle (the Arduino tracks what angle it’s currently at, after zeroing it)
• Pipe updated angle and movement commands to the Arduino over the relevant period of time
• A Raspberry Pi script that activates on boot, acts as a Bluetooth server, and receives the commands needed for Turntable.py

We now have a Python serial communication interface (see Turntable.py in the App folder) – and some amazing design ideas by Junxiao. See here:|
https://github.com/MocoMakers/SolarTracking/issues

We also have a basic Bluetooth based app for controlling the turn table – though we still need to build a bluetooth receiver for a Raspberry Pi that receives and initiates the commands in Turntable.py. I’ve added this a software goal. A starter Bluetooth app is available for download here:

It works with the MIT App Inventor project: http://ai2.appinventor.mit.edu

How to get started:

www.github.com/MoCoMakers/SolarTracking

2. install PIP and then the pre-requisits:

pip install solar
pip install geomag

3. Open your command line, go to the App folder

4. if you run ‘flask’ from command line it will tell you how to set it up. On windows you run:

then you run it by running:

5. Open a browser and go to localhost:5000 – this is the interface for running a time series. To run a one-off azimuth calculation, in your browser go to:

http://localhost:5000/command/go_to_sun

The Latitude/Longitude is hardcoded in the doTrack.py file where it says:

@app.route(“/command/<command>”)
def run_command(command=None):

If you modify the code, quit the execution, and re-run ‘flask run’

If you want to help with this project, please comment on this wiki (what task you may want). Clone our GitHub, and submit a pull request.