Build it step by step
0 of 5 doneBuild the sensor head
Fix the two LDRs on the panel's edge with a small card wall between them, so the wall shades one LDR when the sun is off to one side.
Wire the LDRs
Each LDR from 5V to its pin (A0 east, A1 west), with 10 kΩ from the pin to GND.
Mount the panel
Fix the panel on the servo horn with a light bracket, axis running north-south.
Wire the servo and panel
Servo on D9 from the AA pack with the 470 µF. Panel through the 10 k / 10 k divider to A2.
Test with a torch
Indoors, shine a torch from one side and watch it turn. Then test outside in the morning.
How do you build a single-axis solar tracker?
Two LDRs on either side of a divider compare light, and a servo tilts a small solar panel east or west to face the sun. You need Arduino Nano, LDR Photoresistor × 2, Resistor 10 kΩ × 4, MG996R metal gear servo, Solar panel 6 V 1 W, Battery holder 4 × AA with switch, AA alkaline battery × 4, Electrolytic capacitor 470 µF and Jumper wires male to male (40 pcs, 20 cm). It takes 5 steps and about 90 minutes.
- Level
- Intermediate
- Time
- About 90 min
- Parts
- 9
Parts list
- Development BoardsBuyArduino Nano × 1
- SensorsBuy
- PassivesBuyResistor 10 kΩ × 4Two for the LDRs, two for the panel divider
- Motors & ActuatorsBuyStrong enough for a small panel
- PowerBuy
- PowerBuy
- BatteriesBuy
- PassivesBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| East LDR | Nano 5V to A0, with 10 kΩ from A0 to GND | East light reading |
| West LDR | Nano 5V to A1, with 10 kΩ from A1 to GND | West light reading |
| Panel + | 10 kΩ to A2, 10 kΩ from A2 to GND | Panel voltage halved (max 3.5 V at A2) |
| Panel − | Nano GND | Shared ground |
| Servo signal | Nano D9 | Tilt |
| Servo red / brown | 4 × AA + / −, 470 µF across | Servo power, minus to Nano GND |
Code
Arduino IDE, board "Arduino Nano". Servo library is built in.
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
#include <Servo.h>
Servo tilt;
int angle = 90;
const int DEAD = 25; // ignore small differences
void setup() { tilt.attach(9); tilt.write(angle); Serial.begin(9600); }
void loop() {
int east = analogRead(A0), west = analogRead(A1);
int diff = east - west;
if (diff > DEAD && angle > 15) angle--; // more light in the east: turn east
else if (diff < -DEAD && angle < 165) angle++;
tilt.write(angle);
float panel = analogRead(A2) * 5.0 / 1023 * 2; // undo the divider
Serial.print("E="); Serial.print(east); Serial.print(" W="); Serial.print(west);
Serial.print(" angle="); Serial.print(angle); Serial.print(" panel="); Serial.print(panel, 2); Serial.println(" V");
delay(50);
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
E=512 W=513 angle=90 panel=5.00 V E=512 W=512 angle=90 panel=5.00 V E=512 W=511 angle=90 panel=5.00 V E=511 W=511 angle=90 panel=5.00 V E=512 W=511 angle=90 panel=5.00 V E=512 W=512 angle=90 panel=5.01 V
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Torch from the east side | Panel turns towards the torch until E and W are within 25 |
| Even light | No movement |
| Panel voltage facing the sun vs fixed flat | Higher when tracking, especially in the morning and late afternoon |
If it does not work
Turns away from the light
Swap the A0 and A1 wires, or swap angle-- and angle++.
Hunts back and forth
Raise DEAD to 40, or make the shade wall taller.
Servo too weak in wind
Use a lighter panel and a balanced mount, or a geared motor.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the single-axis solar tracker?
Arduino Nano, LDR Photoresistor × 2, Resistor 10 kΩ × 4, MG996R metal gear servo, Solar panel 6 V 1 W, Battery holder 4 × AA with switch, AA alkaline battery × 4, Electrolytic capacitor 470 µF and Jumper wires male to male (40 pcs, 20 cm). Resistor 10 kΩ × 4: Two for the LDRs, two for the panel divider. MG996R metal gear servo: Strong enough for a small panel.
How long does the single-axis solar tracker take to build?
About 90 minutes for a intermediate maker, in 5 steps.
How do I know the single-axis solar tracker works?
Torch from the east side: Panel turns towards the torch until E and W are within 25. Even light: No movement. Panel voltage facing the sun vs fixed flat: Higher when tracking, especially in the morning and late afternoon.
Turns away from the light: what should I check?
Swap the A0 and A1 wires, or swap angle-- and angle++.
Hunts back and forth: what should I check?
Raise DEAD to 40, or make the shade wall taller.
Servo too weak in wind: what should I check?
Use a lighter panel and a balanced mount, or a geared motor.
