In this lesson, we will show how to use the OSOYOO light detect module to work with the OSOYOO UNO board, we will monitor the output of this sensor, allow the Arduino to know how light or dark it is. When the light falls below a certain level, the Arduino turns on an LED.
The OSOYOO Light Detect module incorporates a photocell, is a commonly used sensor in a wide variety of applications from DIY projects to industrial automation. Typically, the resistance of the LDR or Photoresistor will decrease when the ambient light intensity increases. This means that the output signal from this module will be HIGH in bright light, and LOW in the dark.
Photocells are sensors that allow you to detect light. They are small, inexpensive, low-power, easy to use and don’t wear out. For that reason they often appear in toys, gadgets and appliances. They are often referred to as CdS cells (they are made of Cadmium-Sulfide), light-dependent resistors (LDR), and photoresistors.
Photocells are basically a resistor that changes its resistive value (in ohms Ω) depending on how much light is shining onto the squiggly face.When it is dark, the resistance of a photoresistor may be as high as a few MΩ. When it is light, however, the resistance of a photoresistor may be as low as a few hundred ohms. They are very low cost, easy to get in many sizes and specifications, but are very innacurate. Each photocell sensor will act a little differently than the other, even if they are from the same batch. The variations can be really large, 50% or higher! For this reason, they shouldn’t be used to try to determine precise light levels in lux or millicandela. Instead, you can expect to only be able to determine basic light changes.
This graph indicates approximately the resistance of the sensor at different light levels:
Light sensor is commonly seen in our daily life and is mainly used in intelligent switch, also in common electronic design.
To make it more easier and effective, we supply corresponding modules. Light sensor is a semiconductor. It has features of high sensitivity, quick response, spectral characteristic, and R-value consistence, maintaining high stability and reliability in environment extremes such as high temperature, high humidity.
It’s widely used in automatic control switch fields like cameras, garden solar lights, lawn lamps, money detectors, quartz clocks, music cups, gift boxes, mini night lights, sound and light control switches, etc.
Plug OSOYOO Magic I/O Shield v1.1 into OSOYOO UNO Board as the picture show:
Then you can connect the components as shown below:
LED Module – D9
Light Detect Module – A0
After above operations are completed, connect the Arduino board to your computer using the USB cable. The green power LED (labelled PWR) should go on.
Open the Graphical Programming software Mixly and follow the next operations:
Then follow the below operations:
In this experiment, we will connect a photoresistor to an Arduino analog input and read the value with the analogRead() function. Depending on the value the Arduino reads, the program will then set pin 9 HIGH or LOW to turn on or turn off the LED night lights. The threshold value is 500. When the analog value read is less than 500, the Arduino will turn the LEDs on. When the analog value it reads is more than 500, the Arduino will turn the LEDs off.
The whole program blocks are as following:
After above operations are completed, do as follows:
If the room is lighted, the LEDs should not light. Try getting them to turn on it by covering the photoresistor. Remove the cover and observe that they turn off again.
When you are using the Serial Monitor, please make sure the baudrate setting is same as your sketch definition.
DownLoad Url osoyoo.com