Pick X and Y coordinates from date and time


I am new to programming and I am trying to build a solar tracker.

It will change the X and Y axis of the solar array using two linear actuators. I have a graphic with the X and Y coordinates for the month and time of the day. I want to move the array in increments of 15 degrees.

I have the an arduino with a working clock and lcd.

I know very little about programming but I believe I need to define an array and put the values in it then pick theses values depending on the time and date?

For example, in April at 1 PM, the solar azimuth should be 195 deg. and the elevation should be 65 deg.

Could anyone give me an example of how I could make this work, just to get me on the right track?



An array (look up table) would be a good way to do it, the problem is that Arduino does not ave enough memory for a table large enough to hold all the dates and serveral pieces of data for each of them.

I bought an AT24C1024B EEPROM, it has 1 MBIT of memory.


Can you give me an example for the array?

Thank you,


Thats cool, but it wont directly solve your problem.

You cant create an Array in the EEPROM that Arduino can read.

You will have to create some kind of datastructure and then read portions of that into Arduinos RAM.

Unfortunately i don't know enough about EEPROMs to be of much help with that.

My reply in another thread might help with putting a 2d array in an EEPROM and using it.



Assuming azimuth data is does not change, you can store a lot of data without external hardware using progmem.

If the array uses two bytes to hold the x and y coordinates for each point in time that you store, you can hold a years worth of data on Arduino 2009 board leaving 13k bytes available for sketch code. This assumes one coordinate pair stored per hour.

see: http://www.arduino.cc/en/Reference/PROGMEM

Why a table. Arduino can compute the 2 values.

Read this it can help you: http://answers.google.com/answers/threadview/id/782886.html

or this : http://squ1.org/wiki/Solar_Position_Calculator

Wow thanks for these answers.

When I started, I wanted to calculate the x and y on the fly but I was told doing the calculation would be too complicated and the table was the way to go.

I guess I will look at both now.

@fdufnews that's some good examples you gave me, thanks!


but I was told doing the calculation would be too complicated and the table was the way to go.

To populate the table, you're going to have to do the calculation anyway. The processor probably won't be doing much else, I assume, so yes, why not do it on-the-fly?

I already have the table and it's not that big since for the solar tracker you get about 95% of the performance if you move in 15 degrees increments.

There is about 14 positions on the azimuth and 7 on the elevation in a day.

I took the coordinates from the University of Oregon using my longitude and latitude.

BTW, if anyone wants to code this for me, I would be willing to pay for it.