Solar Tracker

Solar Tracker

Are you interested in maximizing the energy generated by your solar panels? Using the Ambient Light TinyShield and some servos, we are able to rotate your solar panels to face the brightest light source.  In this tutorial, we will show you how to charge a lithium-ion battery from solar power more efficiently by building your very own solar tracker.





  • Soldering Iron
  • 3D printer
  • Multimeter (optional)
  • Glue gun (optional)

Step 1: 3d Printing the solar tracker

Our print took about 4.5 hours for all three parts using the Form 2.

    Step 2: Designing a solar panel

         As seen in this datasheet for the MCP73831 lithium battery charger used on the TinyZero, we need to output between 3.75v-6v to charge the LiPo properly. The solar cell output voltage will vary based on the strength of the incoming light. By tracking the sun closely, we maximize the voltage output, thus making it highly likely to meet the 3.75v minimum.

         In choosing how many cells to use, keep in mind that a solar cell rated for a 30ma output will only produce 30ma under perfect conditions. With our 3x 30ma panels, we measured an average output current of 20ma on a completely overcast day and 60ma on a very sunny day.

         Our results indicate that using 3 of the 30ma solar cells is best if you are interested in a proof of concept that maintains the battery charge level. If you are interested in charging the battery, we recommend using at least 6 cells. You can calculate how long it would take to charge the battery by dividing the battery capacity by the charging current. With 6 cells, that would be 1100/100 or about 11 hours to fully charge the 1100mAh battery.

         Here are the results we got in 5 hours using the battery voltage sketch, showing that it is possible to charge the batteries slowly on sunny days with only 3 panels:

    Step 3: Creating the solar panel

    • We chose to wire our 5v cells in parallel to maintain a 5v output while increasing the output current.
    • Wiring in parallel results in the positive terminal of a cell being connected to the positive terminal of the next cell. Negative terminals are also connected. Make sure to put plenty of solder on the contacts of your solar cell. The below diagram illustrates the wiring:

    • Under artificial lighting, you should measure at least 2v on the output leads with your multimeter to confirm that your panels are wired correctly.
    • Once confirmed, cut the micro USB cord about 6’’ from the micro USB connector and strip the outer coating and insulation.
    • After removing the green and white data lines, solder the black (ground) lead to the black lead from the solar panel.
    • Then, solder the 1N5817 Diode between the two the red leads. It is very important that the cathode (indicated by the printed horizontal line) is connected to the micro USB lead, while the anode is connected to the solar panel. In this way, current will be blocked from flowing from the battery into the solar panels.

    The micro USB connector will plug into the TinyZero, which will charge the LiPo battery on sunny days.

    Step 4: Connecting the servos

         Each of your servos should come with a large JST connector that contains 3 inputs: power, ground, and signal. We need to remove the large connector and replace it with the small one found on the JST pigtail.

    •  First though, connect a JST pigtail to the Servo TinyShield. Then, plug in the 1100 mAh battery and measure the voltage across the VCC (red) and Ground (black) leads of the JST pigtail.
         If you get a negative voltage, dismiss your inner electrical intuition as you connect the red lead of the pigtail to the brown lead of the servo and the black lead of the pigtail to the red lead of the servo. Otherwise, connect the red lead of the pigtail to the red lead of the servo and the black lead of the pigtail to the brown lead of the servo. This can be seen in the below wiring diagram:

      • Now that the servos are wired, we can insert them into the 3D print created in Step 1. Use the mounting screws and servo horns (the white plastic pieces that attach to the end of your servo) provided with the SG90 and consider using hot glue for an even stronger grip.
      • Finally, we need to connect each servo to the Servo TinyShield. The servo which adjusts the angle of the solar panel should be connected to the first servo port and the servo that adjusts the heading of the solar panel to the second servo port. The first servo port is found on the top left corner when the TinyShield is oriented with the 32 pin connector at the bottom.

      Step 5: uploading The Code to the TinyZero

      • Please download the code and required dependencies from the zip archive provided in the Software section above.
      • If this is your first time using the TinyZero, refer to this tutorial to configure the Arduino IDE for the TinyZero.
      • Before compiling, navigate to the Arduino library manager.

      • Ensure that you have the Arduino Low Power library installed:

      • The global constant integer value MEASUREMENT_INTERVAL allows you to choose the number of minutes that elapse between movements of the solar tracker. We have found that moving once every 60 minutes is most efficient for the small solar panels used in this tutorial.
      • Once you are satisfied with the parameter settings, upload the code to the TinyZero using the upload button on the top left corner of the Arduino IDE interface. (pictured below)

       Step 6: putting it all together

           Firstly, we need to mount the solar panels and light sensor onto a piece of foam plastic. If you choose a piece around 1 inch thick it will allow you to cut holes for the TinyZero and battery so that they do not extend the depth profile beyond that of the solar panels.

           Once you have chosen your piece of foam plastic, prepare to hot glue (or glue) your solar panels to it. Placing the solar panels higher will allow for a larger range of movement. Make sure that you do not put undue stress on the solder joints or you will have to peel the solar panel right back off to fix it. That totally didn't happen...!

      • Consider cutting channels for the servo wires to run through to reduce tangling. 
      • Double stick tape is sufficient on the reverse side of the battery and TinyZero, as you will likely need to remove them occasionally.
      • Next, mount the tracker using the 4 remaining wood screws. We chose to mount ours diagonally so that the solar panels would align with the hypotenuse of the triangle at the midpoint of their range.

      • Then, hot glue (or glue) the foam plastic to the 3D printed tracker. We recommend drawing an outline so that you know exactly where to place the hot glue and attach the tracker before the glue cools. 
           At this point, assembly is complete. In order to test the functionality, connect the battery and solar panel micro USB directly to the TinyZero and turn on the power switch. You can use a bright flashlight to confirm that the panels end up facing the brightest light source. If you are outdoors and your battery is not fully charged, the orange charging light should illuminate on the TinyZero, indicating that the solar panels are charging the battery.

        That’s all there is to it! We hope you enjoyed learning how to harvest the power of the sun with this tiny tracker tutorial!


        CONTACT US

        As always, if you have any questions or feedback, feel free to email us at

        Show us what you make by tagging @TinyCircuits on Instagram, Twitter, or Facebook so we can feature it!

        Thanks for making with us!!