Arduino — Solar Tracker with Two LDRs
A servo that follows the light, like a real solar panel
Arduino
LDR
Servo
Solar
Renewable energy
What you will learn
- How to read two analog sensors and compare their values
- How to use map() to convert a sensor reading (0-1023) to a servo angle (0-180)
- Why a small "dead zone" prevents the servo from jittering back and forth at equality
What you will need
| Component |
|---|
| 1× Arduino Uno R3 |
| 2× LDR (photoresistor) |
| 2× 10kΩ resistor |
| 1× servo motor (SG90) |
| 1× breadboard |
| 6× jumper wires |
Step by step
Take it further
- Add a second servo and two more LDRs (up/down) to make a full 2-axis tracker.
- Log the brightness values over a day to see when the sun is strongest.
- Add a "night mode" — when both LDRs read very low (< 100), return the panel to the morning position (east) to wait for sunrise.
Practise it before you build it
Wire this circuit in the ThinkEdge Learn simulator first. The simulator runs a real Arduino sketch against a modified-nodal-analysis solver, so the LED on screen actually lights when the current is right — no hardware, no burnt components, and a class can try it in a browser.
Related projects
LDR — Light-Following Robot (Solar Tracker)It always faces the brightest spot
Arduino Mega — 4-Servo Robot ArmDrive 4 servos at once for a pan-tilt-gripper-tilt arm
Arduino — Ultrasonic Radar ScannerA servo sweeps the ultrasonic sensor to scan the room
Servo — Knob to AngleTwist to point
LDR — Sunrise Alarm ClockWhen the sun rises, the room wakes up with a soft glow
Arduino — RGB LED Color MixerThree pots, one RGB LED — mix any color of the rainbow
Guides that use this project
7 guides on the site build this project as part of a longer explanation. The guide says why the circuit works; this page says how to wire it.
Solar and Renewable Energy ProjectsSolar and renewable energy projects for students: a light tracker, a solar water heater, a wind generator and a home energy monitor, with the physics behind each.
Solar-Powered DevicesHow to build a solar-powered device: charge controllers, energy budgets, why a panel alone is not enough, and how to size everything for a sensor that runs all year.
Physical AI: Intelligence That Has to ActPhysical AI is intelligence that drives a motor, not a cursor. Here is how models, controllers and feedback split up, and how to build the loop safely.
Self-Improving AI: Three Different ClaimsSelf-improving AI means three different things. Separate them, then build the version you can measure: a controller that tunes itself and shows you the numbers.
Air Taxis and eVTOL AircraftAir taxis and eVTOL aircraft explained: the lift configurations, why certification is the real constraint, and what the physics demands of them.
Drone Inspection and SurveillanceWhere drones genuinely pay for themselves: inspection of towers, roofs, pipelines and power lines. The sensor choices, the regulation and the real economics.
The Shahed Drone ExplainedHow a Shahed one-way attack drone works: the airframe, the piston engine, the satellite navigation and the economics that made it effective.
Where this project sits
It is also part of these lists, which is how a class usually finds it.
Arduino servo motor projects for students12 projects in this list
Arduino LDR light sensor projects7 projects in this list
Try the full simulator with your class
103 guided circuit projects, 21 lessons and an in-browser Arduino simulator. The first 15 projects are free, no account needed. One licence covers a whole school.