Suntracker 2 revision 3 consists of two inter-connected PCB: the controller mainboard (1), and the displayboard (2). The GitHub repository has the two zipped gerber files that I used to order from the PCB manufacturer.
Notice there are two gerber files for the mainboard: v1.7 and v1.8. I build with mainboard v1.7 gerber files, but noticed a bug with OLED display 1 (left) I2C connection. I fixed by hand-wiring the two I2C pins, and updated the mainboard PCB layout to v1.8. However I haven't manufactured v1.8 yet, please use with care.
The mainboard gerber is a 2-layber PCB, while the displayboard gerber is a 4-layer PCB. Note that 4-layer production is more costly, takes more manufacturing time, and may need an extra step to select 4-layers at the order screen. I used standard 1.6mm PCB for both boards.
2Electronics component assembly
Next, gather the electronics components and solder in place. The list of components (BOM) is available in the GitHub repository for each PCB:
There is also a BOM at Digikey shared:
Disclaimer: The Digikey BOM is researched to my best abilities. I build with components from a local store. I selected the smallest through-hole metal film resistors for the display board.
Next, solder the components in place. Carefully verify the position and polarity, especially on the 32-LED ring. The PCB silkscreen has extensive annotations to add clarity, also use the schematics:
I am using sockets for the Arduino MKR Zero and most of the modules. This helps me to swap and re-use modules once I move to a higher board revision.
3Component tests and Magnetometer calibration
After electronics assembly, its helpful to test components individually. I am typically using the sample programs from the component libraries to check if the module is seen by the processor.
- SD library Demo sketches for the MicroSD card
- lsm303-arduino Demo sketches for the magnetometer sensor
- u8g2 Demo sketches for OLED SSD1606 displays
- uRTCLib Demo sketches for DS3231
The suntracker Arduino sketch itself has self-test functions that help pinpoint anything that doesn't work. In my assembly I had no trouble at all, and everything worked right at first turn-on (except OLED1, see the node on the mainboard v1.7 gerber). If something doesn't work, a typical cause is cold solder points. The displayboard has 260 solder points.
The magnetometer sensor needs us to identify its calibration values. I am using the lsm303-arduino calibration sketch "Calibrate.ino", with the sensor placed on a small universal board for doing the necessary axis rotations. Then am noting down the calibration min/max values, and enter them in the "mainboard-rev3.ino" sketch, see lines 325.
4Arduino suntracker sketch
The suntracker Arduino sketch uses approx. 64 Kilobytes (25%). The sketch requires a manual update of the OLED library u8g2. This library is currently unable to drive two SSD1306 OLEDs independently (in parallel) on a single I2C bus. To make both OLED displays work, I manually updated the library. The necessary steps are outlined in this bug post at the libraries GitHub repository. Updating means adding small code sections to four library files manually. Remember if the Ardunio IDE library update function for u8g2 is used, it overwrites the manual update. Programming the MKR Zero uses the standard Arduino IDE code upload.
5Solar position data generation
The suntracker code expects to find the solar position data files stored on the MicroSD card, inserted in the Arduino MKRZero. The files are generated using the suncalc program under Linux. After calculation, the generated file set is located under the /tracker-data folder. The files need to be copied into the root of a FAT-formatted SD Card. A 2-year data set needs about 46MB space. A sample zip file of solar position data has been uploaded into the "files" section of this project. The suncalc file format specification is available under the suncalc GitHub repository.
The suncalc code currently uses the SPA library files pubished by the National Renewable Energy Laboratory (NREL). The SPA license, source code and reference information can be found at https://midcdmz.nrel.gov/spa/. Note the library is only for internal, noncommercial purposes, and the "spa.c" file cannot be re-distributed. To obtain the required file, please register on the link above.