The Smart Sun Tracker: a solar panel that tilts itself to chase the brightest light
A small solar panel sits on a robotic arm that compares the light hitting two sensors, and quietly tilts toward whichever side is brighter. Move a lamp around it, and it follows — the same idea real solar farms use to squeeze more power out of every sunny hour.
What you're building
A light-seeking robotic mount that teaches sensors, servo control, and renewable energy together.
The Smart Sun Tracker holds a small solar panel on a tilting arm. Two light sensors sit on either side of the panel, constantly comparing how much light is hitting each one. When one side reads brighter than the other, a servo motor gently tilts the whole panel toward that side, narrowing the gap until both sensors see roughly equal light — which means the panel is now facing the brightest source in the room, whether that's a lamp, a window, or the real sun outside.
Light Sensing
Two LDR sensors constantly compare brightness on the left and right of the panel.
Servo Tilting
A servo motor smoothly rotates the panel toward whichever sensor sees more light.
Live Readout
A small screen shows both sensor readings and which way the panel is currently facing.
Materials list
Most electronics can be reused from a beginner Arduino sensor kit.
Electronics
- 1x Arduino Uno
- 2x LDR (light-dependent resistor) sensors
- 2x 10k-ohm resistors (voltage divider for the LDRs)
- 1x micro servo motor (the tilting mount)
- 1x small solar panel (5-6V, for demonstration)
- 1x 16x2 LCD display with I2C backpack
- Jumper wires + breadboard
- USB cable or 5V power supply
Build supplies
- Small wooden or cardboard base
- A thin divider (cardboard strip) between the two LDRs
- Hot glue gun
- Craft knife (adult use only)
- A small desk lamp (for indoor testing)
- Double-sided tape
Circuit diagram
Two LDRs feed analog readings to the Arduino, which drives one servo and a status display.
Tip: Fix a thin cardboard divider between the two LDRs so each one is shaded from the sensor's blind side — without it, both sensors see almost the same light and the tracker won't know which way to turn. Keep all grounds connected together.
Wiring reference table
| Component | Component Pin | Arduino Pin |
|---|---|---|
| Left LDR (voltage divider) | Signal | A0 |
| Right LDR (voltage divider) | Signal | A1 |
| Tilt Servo | Signal | D9 |
| 16x2 LCD (I2C) | SDA / SCL | A4 / A5 |
| All components | GND | Common GND rail |
| All components | VCC | 5V rail |
Step-by-step build instructions
Work through these in order — test the sensors and servo on the bench before building the mount.
-
Wire the two LDR sensors
Build a simple voltage divider for each LDR using a 10k-ohm resistor, and connect their signal outputs to A0 (left) and A1 (right).
-
Test the raw readings
Upload a basic test sketch that prints both LDR values to the Serial Monitor, and confirm each reading changes clearly when you shine a light on just one sensor.
-
Attach the servo to the base
Mount the servo upright on a small wooden or cardboard base, with its horn facing up to become the tilting pivot for the panel.
-
Build the sensor-and-panel platform
Glue the small solar panel to a flat platform, with one LDR fixed on its left edge and one on its right, separated by a thin cardboard divider standing up between them.
-
Mount the platform on the servo
Attach the platform to the servo horn so that as the servo rotates, the whole sensor-and-panel platform tilts together.
-
Add the LCD display
Wire the 16x2 LCD's SDA/SCL to A4/A5 so you can watch both sensor readings and the current servo angle live.
-
Upload the code and calibrate
Upload the sketch below, then adjust TOLERANCE in the code until the panel holds steady under even light instead of jittering back and forth.
-
Test with a moving light source
Slowly move a desk lamp from one side of the tracker to the other, and watch the panel smoothly follow it across the full range of motion.
Arduino code
Copy this into a new sketch in the Arduino IDE. Install the Servo and LiquidCrystal_I2C libraries first from the Library Manager.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>
// ---- Pin setup ----
#define LEFT_LDR_PIN A0
#define RIGHT_LDR_PIN A1
#define SERVO_PIN 9
LiquidCrystal_I2C lcd(0x27, 16, 2);
Servo tiltServo;
int currentAngle = 90; // start centered
int TOLERANCE = 40; // how different readings must be before moving (calibrate this)
const int STEP_SIZE = 2; // how many degrees to move per adjustment
const int MIN_ANGLE = 20; // don't tilt past these limits
const int MAX_ANGLE = 160;
void setup() {
tiltServo.attach(SERVO_PIN);
tiltServo.write(currentAngle);
lcd.init();
lcd.backlight();
}
void loop() {
int leftValue = analogRead(LEFT_LDR_PIN);
int rightValue = analogRead(RIGHT_LDR_PIN);
int difference = leftValue - rightValue;
if (abs(difference) > TOLERANCE) {
if (difference > 0) {
// Left side is brighter, tilt that way
currentAngle -= STEP_SIZE;
} else {
// Right side is brighter, tilt that way
currentAngle += STEP_SIZE;
}
currentAngle = constrain(currentAngle, MIN_ANGLE, MAX_ANGLE);
tiltServo.write(currentAngle);
}
updateDisplay(leftValue, rightValue);
delay(200); // small pause between adjustments keeps motion smooth
}
void updateDisplay(int leftValue, int rightValue) {
lcd.setCursor(0, 0);
lcd.print("L:");
lcd.print(leftValue);
lcd.print(" R:");
lcd.print(rightValue);
lcd.print(" ");
lcd.setCursor(0, 1);
lcd.print("Angle: ");
lcd.print(currentAngle);
lcd.print(" deg ");
}
Beginner tip
If the panel twitches back and forth even under steady light, raise TOLERANCE a little at a time until it settles — this gap is what stops the servo from chasing tiny, meaningless differences between the two sensors.
Safety notes for young makers
Ask an adult to help with wiring and with mounting the servo securely so it doesn't tip over while tilting. If testing with a desk lamp, keep the bulb a safe distance from the cardboard base and wiring, since both warm bulbs and bare wires need careful handling.
Why this project works so well for learning
The Smart Sun Tracker is a hands-on introduction to feedback control — one of the most important ideas in robotics. Instead of moving to a fixed position, the servo constantly compares two readings and nudges itself toward balance, which is exactly how real solar trackers, thermostats, and even self-balancing robots work. Adding a tolerance gap teaches why real sensors need a little "slack" built into the logic, and building in min/max angle limits introduces protecting a mechanism from over-rotating — a habit worth carrying into every future robotics project.
Frequently asked questions
What age group is this robotics project best suited for?
Ages 9 and up can build this with an adult helping on wiring and the physical mount. Ages 12+ with some Arduino experience can usually manage most of it, including calibration, independently.
Do I need to know how to code to build this?
No. The code above uploads and runs as-is. The one hands-on coding step is adjusting TOLERANCE during calibration, which is a great first edit for a beginner.
Does this actually generate more solar power?
In a real outdoor setup, yes — keeping a panel pointed more directly at the sun throughout the day increases the energy it collects compared to a fixed panel. This small indoor version demonstrates the same principle using a lamp instead of the sun.
Can I make it track in two directions (up/down and left/right) instead of just one?
Yes, with a second servo and two more LDRs (top and bottom), using the same logic as this project but applied on a second axis — this is often called a "dual-axis" tracker.
Why does the panel need a divider between the two sensors?
Without something blocking light between them, both LDRs tend to read similar brightness even when the light source has moved off to one side, since light scatters. The divider creates a clear shadow difference the Arduino can actually detect.

Comments
Post a Comment