Categories
TUTORIALS

Using a solar cell and rechargeable battery to power an Arduino servo motor

Overview
This is a step-by-step tutorial on how to power your Arduino Uno and a servo motor with a 6V 2W solar cell. Powering your device with a solar cell can be useful if there is no accessible wired energy source, or it portability is required. Please check your motor’s voltage and current requirements to determine the power requirements of the solar cell and battery. This tutorial uses concepts drawn from the following resources:

Hannah Bonestroo’s tutorial, Powering Arduino Uno with Solar Cell

https://www.youtube.com/watch?v=Q5bi9-oQezE 

https://www.youtube.com/watch?v=YC4kIGQYld4

For more details on how to apply the servo motor to track light and optimize the solar cell, refer to Delfina Vildosola’s tutorial, Using photoresistors and a servo motor to make a single axis solar tracker.

Parts

Solar panel: Select a solar panel with a power output rating that will be sufficient power supply for your motor. In this tutorial, we will use a solar cell with a total output of 6V and 2W. Multiple solar cells could be wired in a series to duplicate power supply. Generally, the current will depend on the amount of sunlight and angel of the panel.

Solar charge controller: Choose a solar charge controller with a built-in voltage regulator. 

Battery: Choose a rechargeable battery with a capacity that can store enough energy to power your Arduino Uno and motor for the desired duration in case there’s no direct solar power.

Boost Converter: If the voltage output of the solar cell is lower than the voltage required by your components, then you will need to use a boost converter to increase the voltage to the required level.

Arduino Uno: You will need an Arduino Uno board to control the motor and other components.

Servo Motor: Choose a motor with specifications that match the power supply and voltage requirements of your system. (Refer to Delfina’s tutorial for details on servo motor.)

Wires and connectors: You will need wires, soldering kit, and connectors to connect the components together.

Schematic wiring configuration of a solar cell and battery connected to a battery charge controller and boost converter controlled by an Arduino Uno powering a servo motor.

Wiring and Testing

  1. Solder the positive (+) and negative (-) terminals of the solar panel to the input terminals of the solar charge controller using M-M jumper wires.
  1. Solder the positive (+) and negative (-) terminals of the solar charge controller to the corresponding terminals of the battery using M-M jumper wires.
  2. Solder the output wires from the battery holder to the TP4056 battery charge controller B+ and B- terminals.
  3. Solder output wires from the battery charge controller to the input terminal of the XL6009 – Voltage Adjustable DC-DC (5v-35v) Boost Converter. Use a voltmeter connected to the output terminals to determine the output voltage.
  4. Connect the output terminals of the solar charge controller to the Vin (+) and GND (-) pins of the Arduino Uno board. Powering the Arduino Uno through the Vin port requires an input between 7 and 12 Volts, so the desired output from the Boost Converter is 9V. The voltage output can be adjusted by turning the knob located on the blue rectangle.
  1. Connect your motor to your Arduino Uno board using an appropriate motor driver such as the L293D. Be sure to connect the motor driver to the appropriate digital pins on the Arduino Uno.
  1. Write a program on your Arduino Uno board to control the motor based on your desired specifications. See <Code> section below for details on this tutorial’s program. 
  1. Test the system by exposing the solar panel to sunlight and verifying that the Arduino Uno and motor are receiving power and operating correctly.
GIF showing that when the solar panel is exposed to light the controller turns on, indicating that the wires are properly soldered.

Code

This code is basic foundation to help manage the speed of the motor. Generally, required code to manage the solar panel is limited with the boost converter and power manager wired in.

Example Application

Photo of prototype set-up of solar cell charging battery pack and powering an Arduino and servo motor that tracks light with photoresistors

Schematic of how to wire a solar cell to a battery charger with a boost converter and charger controller to an Arduino that optimizes the position of the solar panel according to the light reading from photoresistors attached to the panel.

Leave a Reply

Your email address will not be published. Required fields are marked *