# Lesson 11--Microduino "The lamp of Da Vinci（light-sensitive experiments）"

 Language: English  • 中文

## Objective

In previous lesson, we have learned more knowledge. In later lesson, we will introduce the all kinds of sensor. Firstly we learn the photoresistance which can detect the illumination intensity. Use it to Simulate an automatic street light, strong light during the day, street lights off, relatively weak illumination at night, street lights turned on.

## Equipment

• Microduino-Core
• Microduino-FT232R
• Other hardware equipment
• Photoresistance one
• LED Light-emitting diodes one
• 220Ω, 10k resistor one
• USB Data cable one

### Photoresistance

Photoresistance is a semiconductor components of convert optical signals into electrical signals. In the dark environment, its resistance is very high, when exposed to light, resistance decline. The light is strong, the low resistance. Photosensitive resistance without polarity, is purely a resistance device, can be added when using dc voltage, ac voltage are also added.

Photoresistance's dark resistance more than 1mΩ, even as high as 100mΩ, while light resistance under a few kΩ, the ratio of the dark resistance and light resistance between 102 ~ 106, so it has a high sensitivity,and have a good spectral characteristics, the spectral response from ultraviolet to infrared region. And small volume, light weight, stable performance, price cheap, so widely used in many field.

## Experimental schematic

Photoresistance connect the GND directly at one end, the other end by a resistance connect to the power supply. At night no more light, its value in a few mΩ or so, so constant value resistance tolerance can be ignored. The photoresistance voltage on both ends should be the the power supply voltage ideally, when the day is glare, its resistance value dropped to a few hundred ohm ro to a few KΩ, the total resistance is reduced, so the whole circuit current increases, the voltage of constant value resistance increases (Ur = I * R), and photoresistance voltage decreases (total U= Ur + U photosensitive), even close to 0 v. By this circuit,convert optical signals into electrical signals, we can read the voltage to simulate a street lamp.

Because each moment light intensity is different, so in order to better control the influence of the light, can instead the fixed value resistor with an adjustable precision resistor of 100k. You can try it by yourself.

## Program

```int a =600;        //This is the basic environmental brightness variables, please check your own brightness values, fill out here is slightly greater than the measured value of the data but the data is less than the light
void setup ()
{
Serial.begin(115200);
pinMode(13,OUTPUT);
}
void loop()
{
Serial.println(n);
if (n>= a )                   //To determine the light intensity, if smaller than setted, close the LED, or light
{
digitalWrite(13,HIGH);
}
else
{
digitalWrite(13,LOW);
}
delay(100);
}```

## Result

When the light intensity is stronger, the voltage on both ends of the photoresistance is low, read the simulation value is lower than the set of reference value to close the LED, simulate the light during the day. When the light is weak, the voltage on both ends of the photoresistance is high, read the simulation values higher than the set of reference light LED, simulates the night Open Day light.