Custom Search
Featured Services
Tutorials on Embedded
System Design .
Tutorials on
Antenna Design.
Tutorials on
Image Processing Using
read more


Mail us at :

:Uploaded on Saturday 22nd OCT 2016

Beagle bone black based Smart Street or Room Lightning system

The concept of Smart street or Room lightning system has been developed using beagle bone black using a very inexpensive sensor LDR( Light dependent Resistor). The Code has been written using Python Scripting language. The Adafruit library developed by Adafruit for Raspberry PI & Beagle bone black has been used in the code, as these library will define the PINS to be configured as ADC or PWM or as GPIO pins.

LDR detects the light and using suitable mechanism, the amount of light illuminating on it is calculated. Then in the Program a threshold has been set. If the Intensity of light falling on LDR exceeds the threshold then it is observed as Presence of Light hence automatic switch off of light bulb is done and if the Intensity of light falling on LDR is observed to be below the threshold set, then darkness is observed hence LED light bulb is turned on automatically.

Block Diagram for the proposed Beagle bone black based Smart Street or Room Lightning system
HelpShareideas- Project with Codes image

Click on the image to goto Article Source. -It will open in Newtab

Components required for the Project

    Below Components are used while designing the project
  • Beagle Bone Black - 1 no.
  • LDR Sensor - 1 no.
  • Resistors - 10K Ohm - 1 no.
  • Resistors - 470 Ohm - 1 no.
  • LED Bulb - 1 no.
  • Breadboard and Connecting Wires

Beagle Bone Black

BeagleBone Black is a low-cost, community-supported development platform for developers and hobbyists.It Boots Linux in under 10 seconds and get started on development in less than 5 minutes with just a single USB cable.

HelpShareideas- Project with Codes image

Click on the image to goto -It will open in Newtab

You can visit Beagle Bone black Website for more Information or visit our TUTORIALS section for more details on Beagle Bone Black.

What is a Light Dependent Resistor or a Photo Resistor?

A Light Dependent Resistor (LDR) or a photo resistor is a device whose resistivity is a function of the incident electromagnetic radiation. Hence, they are light sensitive devices. They are also called as photo conductors, photo conductive cells or simply photocells. They are made up of semiconductor materials having high resistance. There are many different symbols used to indicate a LDR, one of the most commonly used symbol is shown in the figure below. The arrow indicates light falling on it.

HelpShareideas- Project with Codes image

Working Principle of LDR

A light dependent resistor works on the principle of photo conductivity. Photo conductivity is an optical phenomenon in which the materials conductivity (Hence resistivity) reduces when light is absorbed by the material.

When light falls i.e. when the photons fall on the device, the electrons in the valence band of the semiconductor material are excited to the conduction band. These photons in the incident light should have energy greater than the band gap of the semiconductormaterial to make the electrons jump from the valence band to the conduction band. Hence when light having enough energy is incident on the device more & more electrons are excited to the conduction band which results in large number of charge carriers. The result of this process is more and more current starts flowing and hence it is said that theresistance of the device has decreased.This is the most common working principle of LDR

Characteristics of LDR

LDR’s are light dependent devices whose resistance decreases when light falls on them and increases in the dark. When a light dependent resistor is kept in dark, its resistance is very high. This resistance is called as dark resistance. It can be as high as 1012 ohm. And if the device is allowed to absorb light its resistance will decrease drastically. If a constantvoltage is applied to it and intensity of light is increased the current starts increasing. Figure below shows resistance vs. illumination curve for a particular LDR.

HelpShareideas- Project with Codes image

Photocells or LDR’s are non linear devices. There sensitivity varies with the wavelength of light incident on them. Some photocells might not at all response to a certain range of wavelengths. Based on the material used different cells have different spectral response curves.

When light is incident on a photocell it usually takes about 8 to 12ms for the change inresistance to take place, while it takes seconds for the resistance to rise back again to its initial value after removal of light. This phenomenon is called as resistance recovery rate. This property is used in audio compressors. Also, LDR’s are less sensitive than photo diodes and photo transistor. (A photo diode and a photocell (LDR) are not the same, a photo-diode is a p-n junction semiconductor device that converts light to electricity, whereas a photocell is a passive device, there is no p-n junction in this nor it “converts” light to electricity).

Types of Light Dependent Resistors:

Based on the materials used they are classified as:
i) Intrinsic photo resistors (Un doped semiconductor): These are pure semiconductormaterials such as silicon or germanium. Electrons get excited from valance band to conduction band when photons of enough energy falls on it and number charge carriers increases.
ii) Extrinsic photo resistors: These are semiconductor materials doped with impurities which are called as dopants. Theses dopants create new energy bands above the valence band which are filled with electrons. Hence this reduces the band gap and less energy is required in exciting them. Extrinsic photo resistors are generally used for long wavelengths.

Construction of a Photocell

The structure of a light dependent resistor consists of a light sensitive material which is deposited on an insulating substrate such as ceramic. The material is deposited in zigzag pattern in order to obtain the desired resistance & power rating. This zigzag area separates the metal deposited areas into two regions. Then the ohmic contacts are made on the either sides of the area. The resistances of these contacts should be as less as possible to make sure that the resistance mainly changes due to the effect of light only. Materials normally used are cadmium sulphide, cadmium selenide, indium antimonide and cadmium sulphonide. The use of lead and cadmium is avoided as they are harmful to the environment.

HelpShareideas- Project with Codes image

Applications of LDR

LDR’s have low cost and simple structure. They are often used as light sensors. They are used when there is a need to detect absences or presences of light like in a camera light meter. Used in street lamps, alarm clock, burglar alarm circuits, light intensity meters, for counting the packages moving on a conveyor belt, etc.

How LED works?

LED (Light Emitting Diode) is a special diode that emits light when an electric voltage is applied to it. It is common electronic component that is being used in devices like TV, computer, etc. generally for indicating purpose. They are available in various colors like red, yellow, green etc.
There are two leads of an LED that are used to supply input voltage. The longer lead is positive and known as ‘Post’, and the smaller is negative known as ‘Anvil’ as shown in the image below.

HelpShareideas- Project with Codes image

PYTHON CODE for the project

Python is a popularly used high-level, general-purpose, interpreted, dynamic programming language. Its a Identation based Language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than would be possible in languages such as C++ or Java.

The Python code for the project starts below

    import Adafruit_BBIO.GPIO as GPIO
    import Adafruit_BBIO.ADC as ADC
    import time

    GPIO.setup("P8_13", GPIO.OUT) #Set P8.13 as LED output pin
    print "Welcome to Automatic swtiching ON-OFF of Room lights Demo"
    try :
      print "ADC of Beagle bone black is Ready to capture temp values "
      print('Temperature Reading \t\t\t in Volts')
      while True:
       volts= reading*1.800
       print(' %f \t %f '% (reading, volts))
       if reading >=0.5 :
        print('Bright light is illuminating on LDR!')
        print('No need for Switching on of Lights So switch it off if on')
        GPIO.output("P8_13", GPIO.LOW) #P8.13, aka GPIO 67 aka GPIO2_3
       else :
        print('Darkness has been detected')
        print (' Automtically Swtiching on the light bulbs - in our demo LED')
        GPIO.output("P8_13", GPIO.HIGH)
    except KeyboardInterrupt :
      print " Quitting Now- Automatic Switch on off control operation is aborted"

Note : Kindly give attention to Identation. Copy the code as it is given below with inclusion of spaces else error will appear and program might give unwanted results.


For giving feedback on this article please mail us at :

<: Click the link PROJECTS with Code to access the Latest Projects with codes Page:>