Components Required

Image Component Quantity Available in Kit
evive 1
USB A-B Cable 1
Photo-resistor 1
10 kOhm Resistor 1
5V Relay module 1


A street light is a raised source of light on the edge of a road or path. Modern lamps may also light-sensitive that activate automatically when the light is or is not needed. Many street light systems are being connected underground instead of wiring from one utility post to another.

In this tutorial, we are going to make one light-sensitive bulb using LDR

LDR is a light dependent resistor which shows a drop in resistance proportional to applied light intensity.


Warning: Working with LDR is not always reliable as it’s thershold depends on ambient lighting. You can use it outdoor but same system may not work with same threshold indoor  
Threshold can be found on Serial monitor by uncommenting Serial.print(); instruction.


  • Connect Resistor and LDR in Series on evive’s mini breadboard
  • Provide supply to LDR and Resistor network
  • Take Analog input at A0
  • Connect Relay Module with Bulb
  • Connect Relay with evive
  • Check all connections.
  • Start Coding.

Coding Algorithm:

  • Start Serial to work at 9600 baud rate
  • Select Mode for input and Output operations.
  • Check state of LDR ( value between 0 to 1023)
  • If the value is more then threshold Turn OFF Light. ( as Light is More)
  • If the value is less then threshold Turn ON Light. ( as Light is less)
  • For Checking Threshold 
    • Uncomment serial.println(state);
    • Upload Sketch
    • Open Serial Monitor
    • Place hand LDR and check value.
    • Remove hand and check value
    • Threshold = (dark value+ Light value) / 2 
    • Set threshold in the First line of code