Mission
Build this
Build two light-sensitive eyes, invent the shadow between them, and let a turning head show where brightness is winning.
Borrowed parts are labelled below and have a fallback. The registered device ID is fixed; sensing and behaviour decisions remain yours.
Bill of materials
Parts
| Source | Part | Fallback |
|---|---|---|
| ● kit | Photoresistors ×2 | — |
| ● kit | 10 kΩ resistors ×2 | — |
| ● kit | SG90 servo | — |
Disconnect USB before rewiring. Motors, the relay, and the servo need appropriate power and a shared ground. Never drive an actuator from the ESP32 3V3 pin.
Your invitation
Light leaves clues, but never an arrow
A patch of sunlight cannot tell you where it came from. It only says, “I am here.” To discover direction, your creature needs two eyes and a carefully placed shadow between them.
You will build that shadow. When the left eye sees more light, the head turns left. When the right eye wins, it turns right. When they agree closely enough, the creature rests.
Observation“The brightest place was not facing the sun. A white wall was throwing the light back.”
Your project begins with three questions.
Which side is brighter?
Is the difference large enough to believe?
What should a thoughtful turn look like?
The central idea
Direction lives in the difference
A photoresistor changes electrically when light reaches it. Your board turns that change into a number. The number is not lux and it is not a universal measure of brightness. It is simply what this particular eye reports in this particular circuit.
Example numbers only. Your two eyes will have their own habits.
Two photoresistors from the same bag may disagree in perfectly even light. That disagreement is not direction. Measure it first, then correct for it. Only the difference left over belongs to the scene.
What turns changing resistance into a number?
The ESP32 reads voltage, not resistance. Each photoresistor shares 3.3 V with a fixed 10 kΩ resistor. Together they split the voltage. As light changes the photoresistor, the middle of that split moves, and the board reports a number from 0 to 4095.
The response is curved and the two parts will not match. That is why this project compares left with right instead of pretending to be a calibrated light meter.
Build the shadow
The piece with no wires may matter most
Without a shade, both eyes see almost the same world and direction disappears. Place a fin, tube, hood, or pair of blinkers between them and a light from one side creates a useful difference.
Kind, but confused
Both eyes see everything. The head rarely knows which way to turn.
A useful disagreement
Side light shades one eye while leaving enough light for both to respond.
Sharp, but hungry
Direction becomes precise, but dim greenhouse light may never reach either eye.
Cardboard is part of the instrument. Change one dimension, repeat the same five light directions, and keep the design that separates directions without blinding the sensors.
Wiring
Give each eye the same chance
Build one eye and see its raw number first. Copy the circuit for the second eye. Add movement only after both respond.
The power rule: Both light circuits use 3V3. The servo uses a separate 5 V supply. Join the grounds, and unplug USB before changing wires.
Bench referenceOpen the exact wiring map
| ESP32 pin | Part | Part marking | Carries |
|---|---|---|---|
3V3 | Photoresistor A (left) | free leg | 3V3 power |
GPIO 32 | Divider A junction | LDR + resistor | Analog voltage — ADC1, safe with Wi-Fi on |
GND | 10 kΩ resistor A | free leg | Ground |
3V3 | Photoresistor B (right) | free leg | 3V3 power |
GPIO 33 | Divider B junction | LDR + resistor | Analog voltage — ADC1, safe with Wi-Fi on |
GND | 10 kΩ resistor B | free leg | Ground |
GPIO 13 | SG90 servo | signal (orange) | PWM to actuator |
external 5 V | SG90 servo | V+ (red) | 5V power — its own supply, not a board pin |
GND | SG90 servo | GND (brown) | Ground — servo supply ground joins the ESP32 ground |
Never power the servo from 3V3. Keep both sensor inputs on ADC1 pins, GPIO 32 to 39; ADC2 stops working when Wi-Fi starts.
- 3V3 power
- Analog voltage
- Ground
- PWM to actuator
- 5V power
Make the two divider circuits physically alike. A different resistor or loose joint on one side looks exactly like a different amount of light.
Teach it some restraint
A creature that moves at every whisper looks lost
Even steady light produces slightly wandering numbers. If your head reacts to every tiny difference, it chatters left and right and wears out its gears.
The quiet middle is your deadband: a difference small enough to ignore. Find it by holding the light still and watching how far the difference wanders. Make the resting region a little wider than that wander.
Your team decides:
- Does the head jump to three positions or turn in small steps?
- Does it decide quickly or pause like a living thing considering?
- What does it do when both eyes are almost dark?
Your light expedition
Ask the same question five ways
- Choose five directions.
Mark them on the table so every trial uses the same angles.
- Hold the light still.
Record both eyes, their corrected difference, and the direction your code chooses.
- Repeat the whole circle three times.
A good instrument gives the same answer when the same scene returns.
- Try one awkward scene.
Use a reflection, a glazing-bar shadow, or two lamps. Let the world challenge your simple rule.
Leave room for surprise.
| Light direction | Left eye | Right eye | Decision |
|---|---|---|---|
| far left | ___ | ___ | ___ |
| centre | ___ | ___ | ___ |
| reflection | ___ | ___ | ___ |
When it gets dramatic
Let the symptom point to the cause
The head never settles
Your resting region is narrower than the noise. Hold the light still, measure the wandering difference, then widen the deadband.
One eye always wins
The parts do not match, or the shade is crooked. Expose both eyes to the same even light, measure the offset, and correct it before judging direction.
The readings fail when Wi-Fi connects
An eye is connected to ADC2. Move both analog inputs to ADC1 pins such as GPIO 32 and 33.
The board restarts during a turn
The servo is stealing the board’s power. Give it a separate 5 V supply and keep the grounds joined.
The creature follows your hand instead of the lamp
Your body is casting a larger shadow than the shade. Step back, repeat the trial, and record where the observer stood.
Choose your direction
What kind of light finder will you build?
The shade sculptors
Make geometry the experiment. Test fins, tubes, and hoods until direction becomes clear without losing dim light.
The patient trackers
Make movement the experiment. Compare quick obedience with slow, calm turns that feel intentional.
The shadow cartographers
Record direction through the day and explain the path using glass, walls, leaves, and reflections.
A calm way through the build
Collect four small wins
sc-01says hello.Prove the garden connection before adding a sensor.
- Two eyes notice a hand shadow.
Read both raw numbers in Serial Monitor.
- The difference makes one good decision.
Correct the offset and choose a deadband before moving anything.
- The head turns without losing contact.
Add the separately powered servo, then take the creature into real greenhouse light.
The garden handshake
Share what you found
These names are the rigid part of the project. They let another team find your work without knowing what you called the variables in your code.
Light level
garden/greenhouse-1/light-node/sc-01/light-levelUnit: percent
Light direction
garden/greenhouse-1/light-node/sc-01/light-directionUnit: enum
Listen beyond your own device.
garden/greenhouse-1/climate-node/gm-01/temperatureDecide whether a hot greenhouse should make your tracker slower, more cautious, or visibly uncomfortable. The connection should support your story rather than decorate it.
Finish line
Ready to introduce to the garden
sc-01 stays online and publishes both registered readings.
The reject feed stays clear after the final code starts.
The device reads the microclimate temperature topic.
The head responds to real light without chatter or interrupted messages.
The build log shows repeated orientations, your deadband, and one scene the device misunderstood.
The shade and wiring stay fixed, the moving head is safe, and the device label can be scanned.
It does not need to find a perfect sun. It needs to show how your team turned comparison into direction.