Zeile 1: |
Zeile 1: |
| German version [[Sonnenstandsberechner (für sun tracker devices)]] | | German version [[Sonnenstandsberechner (für sun tracker devices)]] |
| | | |
| + | =General considerations= |
| + | To calculate the solar position with a microcontroller (on a fixed geographic place) |
| + | you have to solve two problems: |
| + | The controller needs a time device (typically a battery buffered chip like in a PC) |
| + | and it needs a reasonably simple algorithm to calculate solar azimuth and |
| + | elevation from date, time and geographic position (longitude and latitude). |
| + | An algorithm which works on a PC might have problems on a microcontroller. |
| + | For instance, on Arduino you must take into account that |
| + | ''double'' data type has the same precision as float (IEEE 23 bit mantissa) |
| + | |
| + | ==Get the Time== |
| To get Greenwich Time (aka UT) I use a DS1307 chip. | | To get Greenwich Time (aka UT) I use a DS1307 chip. |
| Following the description of http://www.glacialwanderer.com/hobbyrobotics/?p=12 | | Following the description of http://www.glacialwanderer.com/hobbyrobotics/?p=12 |
− | it worked immediately. Did not find any 2.2K resistors, it worked with | + | it worked immediately. Did not find any 2.2K resistors, |
− | 4.7K as well. | + | 4.7K ones are just as fine. |
| I have taken the code from this site and tucked the complexity | | I have taken the code from this site and tucked the complexity |
| into an Arduino libary (DS1307.h) | | into an Arduino libary (DS1307.h) |
Zeile 20: |
Zeile 31: |
| The formulas for calculating the [http://en.wikipedia.org/wiki/Julian_day Juliand Day] | | The formulas for calculating the [http://en.wikipedia.org/wiki/Julian_day Juliand Day] |
| are not working properly on Arduino due to reduced double precision. | | are not working properly on Arduino due to reduced double precision. |
− | (doubles have the same precision as floats on Arduino) | + | (Therefore, I have adapted them (expecting only Julians dates from 1.Jan. 2000). |
− | Therefore, I have adapted them (expecting Julians dates from 1.Jan. 2000). | |
| These calculations I have put into another library (Helios.h) | | These calculations I have put into another library (Helios.h) |