Skip to content
Web app (opens in a new tab)Get the kit
Web app (opens in a new tab)Get the kit

Project Ideas & Science Fairs

Automatic Night Light and Street Light Project With an LDR (No Code)

Build a night light that switches itself on when the room gets dark, then turn it into a model street light. You measure your own light levels, pick two thresholds and make the rules without writing code.

A craft-stick model street light glows over a shoebox-lid road on a moonlit night, wired to a blue relay on a purple ESP32 board whose light sensor faces up to the room light
A craft-stick model street light glows over a shoebox-lid road on a moonlit night, wired to a blue relay on a purple ESP32 board whose light sensor faces up to the room light

An automatic night light switches itself on when it gets dark and off when it gets bright again. A light dependent resistor (LDR) senses the light, something compares the reading with a threshold, and a switch turns the lamp on or off. Automatic street lights work the same way, only bigger. This project builds both on the MakerBuddy board: first a soft night light from the board's blue light, then a model street light that switches a small 5 V bulb through the relay.

You survey the light in your room, choose two thresholds with a gap between them and turn them into two no-code rules. Then you test it, fix the usual problems and add upgrades. It fits one 45 to 60 minute lesson for students aged 10 and up.

How an automatic night light works

Every automatic night light has three jobs: sense, decide and switch.

  1. Sense: an LDR changes its resistance with light. In the dark it is high, in bright light it falls a long way. Placed in a voltage divider, that change becomes a voltage.

  2. Decide: something compares the voltage with a set point. In a cheap plug-in night light that is one transistor. On the MakerBuddy board it is a rule running on the ESP32.

  3. Switch: the lamp turns on or off. That can be an LED, or a relay that switches a separate lamp.

A teardown of a shop-bought plug-in night light by Codrey Electronics (opens in a new tab) shows how small this can be: an LDR and a 9.1 kΩ resistor form the divider, and one S8050 transistor turns the LEDs off in daylight. The teardown lists no knob or trimmer for changing when it switches, and it notes a slightly gradual response in dim light. The unit uses about 0.2 W all the time, lit or not. It runs from mains electricity, so never open one.

With a microcontroller, you see the light level as a number and choose the switching point from real readings. The guide to how a light dependent resistor works explains the divider in detail.

The three jobs of an automatic night light. SENSE: an LDR and a resistor form a voltage divider, so the LDR's resistance (high in the dark, low in bright light) becomes a voltage. DECIDE: a plug-in night light uses one transistor, while the MakerBuddy board runs a rule on the ESP32, IF Light Level < 25 THEN LED On. SWITCH: an LED, or a relay feeding a separate 5 V bulb. When the room gets dark and the reading falls below the threshold, the lamp comes on.
The three jobs of an automatic night light. SENSE: an LDR and a resistor form a voltage divider, so the LDR's resistance (high in the dark, low in bright light) becomes a voltage. DECIDE: a plug-in night light uses one transistor, while the MakerBuddy board runs a rule on the ESP32, IF Light Level < 25 THEN LED On. SWITCH: an LED, or a relay feeding a separate 5 V bulb. When the room gets dark and the reading falls below the threshold, the lamp comes on.

How automatic street lights switch on at dusk

Many automatic street lights carry a small cap on top of the lamp head called a photocontrol. Inside is a light sensor and a switch. Wikipedia's street light article (opens in a new tab) says many lamps have light-sensitive photocells or astro clocks that switch them on automatically at dusk, at dawn or under very heavy cloud.

A real photocontrol datasheet shows the details. The Intermatic LC4521C plugs into the ANSI C136.10 socket that, its technical data sheet (opens in a new tab) says, is common on street light fixtures. It uses a cadmium sulphide photocell, which is an LDR, and lists these settings:

Setting on the LC4521CValue on the datasheetWhat it means for your project
Activation On5 footcandles (about 54 lux)The ON threshold
Activation Off15 footcandles (about 161 lux)The OFF threshold, three times brighter than ON
Sensor time delay30 to 90 secondsStops unwanted switching off, such as by a passing car's headlights
Fail modeONIf the control fails, the lamp stays lit
Tested to3,650 ON/OFF cyclesEvery needless switch wears the switch out
Setting on the LC4521C
Activation On
Value on the datasheet
5 footcandles (about 54 lux)
What it means for your project
The ON threshold
Setting on the LC4521C
Activation Off
Value on the datasheet
15 footcandles (about 161 lux)
What it means for your project
The OFF threshold, three times brighter than ON
Setting on the LC4521C
Sensor time delay
Value on the datasheet
30 to 90 seconds
What it means for your project
Stops unwanted switching off, such as by a passing car's headlights
Setting on the LC4521C
Fail mode
Value on the datasheet
ON
What it means for your project
If the control fails, the lamp stays lit
Setting on the LC4521C
Tested to
Value on the datasheet
3,650 ON/OFF cycles
What it means for your project
Every needless switch wears the switch out

Settings from the Intermatic LC4521C technical data sheet (opens in a new tab). Lux values are converted with the NIST factor of 1 footcandle = 10.76 lux, from the NIST Guide to the SI, Appendix B (opens in a new tab).

How dark is 54 lux? The RS light dependent resistor datasheet (opens in a new tab) gives about 50 lux for a 60 W bulb 1 metre away and about 500 lux for fluorescent lighting. Adafruit's photocell tables (opens in a new tab) put a dark room at about 10 lux and a dark overcast day at about 100 lux. So this street light waits until the evening is dimmer than a gloomy day before it switches on.

The big lesson is the gap. The lamp switches on at one level and off at a much brighter one. Between the two, nothing changes. That gap is called hysteresis, and it is the most important idea in this project.

Parts list for the night light and street light

Everything except the bulb comes from the MakerBuddy IoT Kit V1.0. The board comes in purple or green; both colours are the same board.

PartWhere it isJob in this projectNeeded for
Light sensor (LDR)Built in, labelled 35-LDR (GPIO 35)Reads the light level, 0 to 100Both builds
Blue lightBuilt in (GPIO 12)The night light, dimmable from 0 to 255Night light
RelayPlug-in socket marked 23Switches the model street lampStreet light
Small 5 V bulbThe kit photos show one; ask which loads ship with your orderThe street lampStreet light
Colour light (RGB)Built inShows day or night statusUpgrade
PIR motion sensor (HC-SR501)Plug-in socket marked 18Spots traffic for a brighter lampUpgrade
1602 text screenPlug-in socket (I2C)Shows the live light levelUpgrade
Part
Light sensor (LDR)
Where it is
Built in, labelled 35-LDR (GPIO 35)
Job in this project
Reads the light level, 0 to 100
Needed for
Both builds
Part
Blue light
Where it is
Built in (GPIO 12)
Job in this project
The night light, dimmable from 0 to 255
Needed for
Night light
Part
Relay
Where it is
Plug-in socket marked 23
Job in this project
Switches the model street lamp
Needed for
Street light
Part
Small 5 V bulb
Where it is
The kit photos show one; ask which loads ship with your order
Job in this project
The street lamp
Needed for
Street light
Part
Colour light (RGB)
Where it is
Built in
Job in this project
Shows day or night status
Needed for
Upgrade
Part
PIR motion sensor (HC-SR501)
Where it is
Plug-in socket marked 18
Job in this project
Spots traffic for a brighter lamp
Needed for
Upgrade
Part
1602 text screen
Where it is
Plug-in socket (I2C)
Job in this project
Shows the live light level
Needed for
Upgrade

You also need a micro-USB cable, a 5 V USB charger, 2.4 GHz Wi-Fi (a phone hotspot works) and a laptop, iPhone, iPad or Android phone; choosing your dashboard lists the options. A shoebox lid and craft sticks make the street scene.

The board reads the LDR once a second, averages four readings and scales the result from 0 to 100, where low means dark. The Light Level card shows that number and refreshes about every 2 seconds. Lesson 7, Light Sensing, teaches the sensor with a Try it demo in your browser.

Step 1: measure your light and choose two thresholds

A threshold copied from a video only works in the room it was filmed in. Yours comes from your own readings.

Survey the light

Write down the Light Level reading in each condition, waiting at least 3 seconds after each change. These are example numbers; yours will differ.

ConditionExample reading
Next to a sunny window92
Room lights on64
Evening, room lights off, curtains open31
Hand shadow over the LDR18
LDR fully covered4
Condition
Next to a sunny window
Example reading
92
Condition
Room lights on
Example reading
64
Condition
Evening, room lights off, curtains open
Example reading
31
Condition
Hand shadow over the LDR
Example reading
18
Condition
LDR fully covered
Example reading
4

Measure the wobble at dusk

Watch the card for 30 seconds in the evening condition and note the lowest and highest numbers. Readings never sit still: the light outside shifts and the converter is a little noisy. In the example, the reading wobbles between 28 and 33, a wobble of 5.

Measure the lamp's own glow

Darken the room, switch the blue light on by hand at the brightness you want and read the card again. In the example, it rises from 4 to 12. A night light that sees its own light can switch itself off.

Work out the thresholds

Use the numbers in order:

  1. ON level: below the bottom of the dusk wobble, so the light only comes on once it is properly dark. The wobble's lowest reading is 28, so choose ON below 25.

  2. OFF level: above the top of the wobble, and below room-lights-on, so switching the room light on turns the night light off. The wobble's highest reading is 33 and room lights read 64, so choose OFF above 40.

  3. Check the gap: 40 minus 25 is 15. That is three times the wobble of 5, so a wobbling dusk reading cannot cross both lines.

  4. Check the glow: dark plus the lamp's own light reads 12, well below 40. The lamp cannot switch itself off.

A bedroom night light for bedtime needs lower numbers, such as ON below 12 and OFF above 30; Lesson 7's Smart Lighting challenge sets different thresholds for classroom, security and night lights. Do not copy the street lamp's three-to-one ratio onto the 0 to 100 scale: the LDR's resistance does not fall in a straight line, so lux and the dashboard number do not rise in step. The guide to how to pick the right sensor threshold covers threshold choice for every sensor in the kit.

Two graphs of the same example Light Level readings over one evening, falling from 64 to 4 with a dusk wobble between 28 and 33. With one threshold at 30, the wobble crosses the line again and again and the lamp switches on 5 times. With ON below 25 and OFF above 40, the wobble stays inside the shaded gap where nothing changes, and the lamp switches on once.
Two graphs of the same example Light Level readings over one evening, falling from 64 to 4 with a dusk wobble between 28 and 33. With one threshold at 30, the wobble crosses the line again and again and the lamp switches on 5 times. With ON below 25 and OFF above 40, the wobble stays inside the shaded gap where nothing changes, and the lamp switches on once.

Step 2: build the automatic night light with two rules

A MakerBuddy rule has one test and no ELSE. So the night light needs two rules: one that switches the light on in the dark, and one that switches it off in the light. Written as plain logic, the plan is:

text
IF   Light Level < 25   THEN  blue light on, soft      (Rule 1: Dusk)
IF   Light Level > 40   THEN  blue light off           (Rule 2: Dawn)
Between 25 and 40: no rule runs, so the light keeps what it did last

Rule 1: Dusk

  1. Open the Rule Engine tab and type Dusk as the Rule Name.

  2. Choose the Condition loop mode.

  3. Set Sensor to Light Level (LDR), Operator to Less than (<) and Threshold to 25.

  4. Click Add Step. Choose Action LED On, Value 60 and Delay (ms) 1000.

  5. Click Save Rule.

Value sets the brightness from 0 to 255. A night light should glow, not glare, so 60 is a good start. The board dims the light with PWM, explained in PWM, pulse width modulation explained with an LED.

Rule 2: Dawn

  1. Type Dawn as the Rule Name and choose the Condition loop mode.

  2. Set Sensor to Light Level (LDR), Operator to Greater than (>) and Threshold to 40.

  3. Add Step: Action LED Off, Delay (ms) 1000.

  4. Click Save Rule.

Why it works

A Condition rule checks its test against the reading the board takes each second. The test must stay true for 0.3 seconds before the rule starts. While the test is true, the rule repeats its steps. When it turns false, the rule finishes the round it is in and stops, without undoing anything. So LED On stays on after Dusk stops, until Dawn runs LED Off. The rules section of the technical details and the automation rules documentation explain these timings.

Rules are saved on the board and run there, not in your browser. The night light keeps working after you close the dashboard, and it starts again after a power cut. Lesson 26, Sensor-Based Control, builds its first Condition rule as a night light, and the guide to if-then statements explained with real sensors shows the same logic with other sensors.

Test it and predict the timing

TimeWhat you doWhat should happen
0 sCover the LDR with your handThe reading drops below 25
About 0.3 to 1.3 sKeep it coveredDusk starts and the blue light glows
5 sLift your hand halfway, so the card reads about 30Nothing changes: you are in the gap
10 sTake your hand awayThe reading rises above 40
About 1 to 2.3 s laterWaitDawn starts and the light goes off
Time
0 s
What you do
Cover the LDR with your hand
What should happen
The reading drops below 25
Time
About 0.3 to 1.3 s
What you do
Keep it covered
What should happen
Dusk starts and the blue light glows
Time
5 s
What you do
Lift your hand halfway, so the card reads about 30
What should happen
Nothing changes: you are in the gap
Time
10 s
What you do
Take your hand away
What should happen
The reading rises above 40
Time
About 1 to 2.3 s later
What you do
Wait
What should happen
Dawn starts and the light goes off

The 0.3 to 1.3 second response comes from Lesson 15, which times a rule against the once-a-second reading and the 0.3-second check. Switching off can take up to a second longer, because Dusk finishes its 1-second round first.

Step 3: turn it into a model street light

A street light is a night light for a whole road, so the rules stay the same. Only the lamp changes: the relay switches a separate 5 V bulb on a lamppost.

Wire the lamp

  1. Unplug the USB cable. Plug the relay into the three-pin socket marked 23. It fits only one way.

  2. With your teacher, connect a small 5 V lamp through the relay, powered from the board's two-pin 5 V plug: 5V to COM, NO to the lamp, the lamp to GND. Lesson 15, Relay Control, shows each step.

  3. Plug the USB cable back in, open the Relay card and switch it on and off by hand. You should hear a click and see the bulb light.

The relay is for low-voltage things only, like a small 5 V bulb or fan. Never connect mains electricity to it or to any part of the board. The guides to how a relay lets a small signal switch a big load and relay safety for students explain why.

Edit the two rules

Open each rule, add a step and click Update Rule:

RuleTestStep 1Step 2
DuskLight Level (LDR) < 25Relay On, Delay 0LED On, Value 60, Delay 1000
DawnLight Level (LDR) > 40Relay Off, Delay 0LED Off, Delay 1000
Rule
Dusk
Test
Light Level (LDR) < 25
Step 1
Relay On, Delay 0
Step 2
LED On, Value 60, Delay 1000
Rule
Dawn
Test
Light Level (LDR) > 40
Step 1
Relay Off, Delay 0
Step 2
LED Off, Delay 1000

Now the bulb is the street lamp and the blue light is a porch light. The relay switches at once and only clicks when the state changes, so a clean gap means one click at dusk and one at dawn.

Build the scene

Glue two craft sticks into an L for a lamppost, tape the bulb to the top and stand it beside a road drawn on a shoebox lid. Keep the board behind the scene with the LDR facing up to the room light, not under the lamp. A real photocontrol sits on top of the lamp head for the same reason: it must see daylight, not its own lamp. To show night falling, hold a box over the scene.

Upgrades: brighter for traffic and a light meter

Each upgrade adds or changes a rule. The board holds up to 10 rules of up to 10 steps each.

Brighter when something moves

Wikipedia's street light article (opens in a new tab) describes control systems that use ambient light and occupancy sensors to change a lamp's output with pedestrian or vehicle activity. You can model that with the PIR motion sensor in socket 18. Wait a minute after power-on for the PIR to settle, as the motion sensor alarm build explains.

Replace Dusk with two rules. Tick Add a second sensor in each one and choose AND:

RuleTestSteps
StreetBusyLight Level (LDR) < 25 AND Motion Sensor == TrueRelay On, Delay 0; LED On, Value 255, Delay 1000
StreetQuietLight Level (LDR) < 25 AND Motion Sensor == FalseRelay On, Delay 0; LED On, Value 40, Delay 500
DawnLight Level (LDR) > 40Relay Off, Delay 0; LED Off, Delay 1000
Rule
StreetBusy
Test
Light Level (LDR) < 25 AND Motion Sensor == True
Steps
Relay On, Delay 0; LED On, Value 255, Delay 1000
Rule
StreetQuiet
Test
Light Level (LDR) < 25 AND Motion Sensor == False
Steps
Relay On, Delay 0; LED On, Value 40, Delay 500
Rule
Dawn
Test
Light Level (LDR) > 40
Steps
Relay Off, Delay 0; LED Off, Delay 1000

The two night rules are exact opposites on motion, so only one runs at a time. Keep StreetQuiet's delay short. When something moves, StreetQuiet finishes its round and holds the blue light until its delay ends, so a long delay would hold back the bright light. Lesson 27, Range Logic and Multiple Sensors, teaches two-sensor rules.

Flowchart of the motion upgrade. The board reads the light level: above 40, Dawn runs Relay Off and LED Off; from 25 to 40, no rule runs and the lamps keep their state; below 25, the Motion Sensor decides. True runs StreetBusy (Relay On, LED On value 255) and False runs StreetQuiet (Relay On, LED On value 40). The two night rules are exact opposites on motion, so only one runs at a time.
Flowchart of the motion upgrade. The board reads the light level: above 40, Dawn runs Relay Off and LED Off; from 25 to 40, no rule runs and the lamps keep their state; below 25, the Motion Sensor decides. True runs StreetBusy (Relay On, LED On value 255) and False runs StreetQuiet (Relay On, LED On value 40). The two night rules are exact opposites on motion, so only one runs at a time.

A light meter on the screen

Plug in the 1602 text screen and type Light: {light} as custom text on the LCD card. The screen shows the live level and refreshes about every 5 seconds, so you can survey the room without a phone. In a rule, an LCD Display step fills in the number when the step runs, so it is a snapshot rather than a live meter.

Ways to build an automatic night light compared

WayWhat decidesChange the thresholdGap built inCode neededGood for
Plug-in night lightOne transistorNoNo knob to set oneNoUsing, not learning
LDR and transistor kitOne transistor, sometimes with a trimmerWith a screwdriver, if a trimmer is fittedOnly if the circuit adds oneNoLearning the circuit
Arduino or ESP32 sketchYour codeEdit and uploadOnly if you write itYesLearning to program
MakerBuddy rulesTwo rules on the boardType a new numberYes, with two rulesNoLearning logic and thresholds
Street photocontrolA built-in switchNo, set at the factoryYes, 5 fc on and 15 fc offNoReal roads
Way
Plug-in night light
What decides
One transistor
Change the threshold
No
Gap built in
No knob to set one
Code needed
No
Good for
Using, not learning
Way
LDR and transistor kit
What decides
One transistor, sometimes with a trimmer
Change the threshold
With a screwdriver, if a trimmer is fitted
Gap built in
Only if the circuit adds one
Code needed
No
Good for
Learning the circuit
Way
Arduino or ESP32 sketch
What decides
Your code
Change the threshold
Edit and upload
Gap built in
Only if you write it
Code needed
Yes
Good for
Learning to program
Way
MakerBuddy rules
What decides
Two rules on the board
Change the threshold
Type a new number
Gap built in
Yes, with two rules
Code needed
No
Good for
Learning logic and thresholds
Way
Street photocontrol
What decides
A built-in switch
Change the threshold
No, set at the factory
Gap built in
Yes, 5 fc on and 15 fc off
Code needed
No
Good for
Real roads

The plug-in row follows the Codrey Electronics teardown (opens in a new tab); the photocontrol row follows the LC4521C technical data sheet (opens in a new tab); the RS light dependent resistor datasheet (opens in a new tab) shows LDR circuits that set the turn-on point with an adjustable resistor.

The case against the board: a plug-in night light costs little and needs no setup, and a transistor kit teaches how the circuit itself works. Choose the board when the point is the decision: reading the number, choosing the threshold and seeing why a gap matters. If you later write the night light as an Arduino sketch, uploading it replaces the MakerBuddy firmware and your rules until you put the firmware back.

Common mistakes and how to fix them

The light flickers on and off at dusk

  • Symptom: at dusk the light blinks every few seconds.
  • Cause: one threshold, or two thresholds too close together, so the wobbling reading keeps crossing them.
  • Fix: measure the wobble and make the gap at least twice as big. The guide to hysteresis and why a fan keeps switching on and off explains the idea in depth.

The light switches itself off as soon as it comes on

  • Symptom: in the dark, the light turns on, then off, then on again.
  • Cause: the lamp lights up the LDR, so the reading jumps above the OFF level.
  • Fix: measure the lamp's own glow, lower the brightness, roll a paper tube around the LDR, or point the lamp away from it.

The light never turns off

  • Symptom: it comes on in the dark and stays on in daylight.
  • Cause: the Dawn rule is missing, stopped or has the wrong operator. A Condition rule never undoes its own steps.
  • Fix: check that Dawn exists, shows as watching and uses Greater than (>).

Nothing happens when you cover the sensor

  • Symptom: the card reads low, but the light stays off.
  • Cause: the operator is the wrong way round, or the threshold is below your covered reading. Lesson 26 calls mixing up > and < the most common mistake. Its tip: the arrow always points to the smaller number.
  • Fix: Dusk uses Less than (<) with a threshold above your covered reading. Avoid Equal to (==) for light: it needs a match within 0.1, and readings jump past exact numbers.

A torch or a passing car switches the street light off

  • Symptom: a bright flash on the LDR turns the model lamp off for a moment.
  • Cause: a street photocontrol such as the Intermatic LC4521C (opens in a new tab) has a 30 to 90 second delay to stop unwanted switching off. The board reacts to any reading that holds for 0.3 seconds.
  • Fix: keep the LDR facing the sky, away from torches and headlights, and keep the gap wide.

You cannot switch the light by hand

  • Symptom: the LED card says the control is used by the Rule Engine, and its switch is locked.
  • Cause: while a rule watches, the dashboard locks the parts it uses.
  • Fix: press Stop on both rules, then use the switch. Pressing Stop never switches an output off, so turn the light off by hand afterwards.

Use it in class or at a science fair

The build fits one 45 to 60 minute lesson for students aged 10 and up. Lesson 7 teaches the LDR, Lesson 26 the Condition rule, and Lesson 15 the relay.

MinutesActivity
0 to 10Survey the light in five conditions and fill in the table
10 to 20Measure the dusk wobble and the lamp's own glow, then work out ON and OFF
20 to 35Build Dusk and Dawn, then test with the timing table
35 to 50Street light: wire the relay and lamp with the teacher, build the scene
50 to 60Compare thresholds between groups and explain the differences
Minutes
0 to 10
Activity
Survey the light in five conditions and fill in the table
Minutes
10 to 20
Activity
Measure the dusk wobble and the lamp's own glow, then work out ON and OFF
Minutes
20 to 35
Activity
Build Dusk and Dawn, then test with the timing table
Minutes
35 to 50
Activity
Street light: wire the relay and lamp with the teacher, build the scene
Minutes
50 to 60
Activity
Compare thresholds between groups and explain the differences

For a science fair, turn the gap into an experiment. Hypothesis: if the gap between the ON and OFF levels is wider, the lamp switches fewer times at dusk. Change only the gap (0, 5, 10 and 15 points) and count the switches while you slowly lift a box off the scene ten times for each. Electronics science fair projects with 25 sensor ideas shows how to write it up, working models for science exhibitions has similar models, and students in Pakistan can match it to the syllabus with science projects for class 8, 9 and 10 with sensors.

The street light also fits a model town of smart home project ideas for a model house. The MakerBuddy project idea library lists the Smart Night Light and Dusk Lamp, and the pillar list of ESP32 and Arduino project ideas for students sorts 30 builds by sensor and difficulty. Every part here comes in the MakerBuddy IoT Kit, and more guides are on the MakerBuddy blog.

FAQ

How does an automatic night light work?

An LDR senses the light, and its resistance rises as the room gets dark. A circuit or a small computer compares the reading with a set point and switches the lamp on below it. A good design switches off at a brighter level than it switches on, so the light does not flicker at dusk.

How does a street light work?

Many automatic street lights have a photocontrol on top of the lamp head: a light sensor and a switch in one small cap. It switches the lamp on when daylight falls below its ON level and off when daylight rises above a higher OFF level, such as 5 and 15 footcandles on the Intermatic LC4521C (opens in a new tab).

Are street lights on a timer?

Some are, but many switch by light. Wikipedia's street light article (opens in a new tab) says many lamps use photocells or astro clocks that switch them on at dusk, and many councils switch some lights off at quieter times of night. The MakerBuddy board has no clock, so the model uses light only.

What are the main components of an automatic street light?

A light sensor, usually an LDR or photocell; a decision part, such as a transistor circuit, a photocontrol's switch or a microcontroller; a switch, such as a relay; and the lamp and its power supply. In the MakerBuddy model they are the LDR, two rules on the ESP32, the relay and a small 5 V bulb.

Which device is commonly used in automatic street lights?

The light-dependent resistor, also called a photocell or CdS cell. The Intermatic LC4521C street light photocontrol, for example, lists a cadmium sulphide photocell in its technical data sheet (opens in a new tab). LDRs suit the job because they only need to tell dusk from daylight, not measure exact light levels.

What are the disadvantages of automatic street lights?

A light sensor can be fooled by shadows, dirt or bright headlights, which is why the Intermatic LC4521C (opens in a new tab) adds a delay against unwanted switching off. A fixed threshold does not suit every place, as your own light survey shows. Some photocontrols, such as the LC4521C, are designed to fail ON, so a broken one can leave a lamp burning all day. And every switch wears the contacts, which is why a flicker-free gap matters.

What is a street light called?

It has many names. Wikipedia (opens in a new tab) lists street light, light pole, lamp pole, lamppost, streetlamp, light standard and lamp standard. The small sensor cap on top is usually called a photocontrol or photocell.

Can I build an automatic night light without coding?

Yes. On the MakerBuddy board you make two Condition rules in the browser dashboard: Light Level less than 25 turns the light on, and Light Level greater than 40 turns it off. The rules run on the board, so the night light works with the dashboard closed.

What threshold should I use for an LDR night light?

There is no single right number, because LDRs and rooms differ. Adafruit (opens in a new tab) warns that photocells can vary by 50% or more. Measure your own room, set ON below the lowest dusk reading and OFF above the highest, and keep the gap at least twice the wobble you saw.

Sources

From the blog

Keep reading

Learn with MakerBuddy

Start building today.

Every part in these guides has its own lesson. Read them free, or get a kit for your class.