Arduino

Arduino tutorial 3# How to use Photo-resistor with Arduino.

How to use photo-resistor with arduino

If you are visual guy you can watch this tutorial in video mention below this lesson.

In this tutorial we will see how to use photo-resistor in Arduino.

For this you will need

PART:
  1. Arduino,
  2. Jumper wire,
  3. breadboard,
  4. 10K ohms resistor,
  5. Photo-resistor.

A photo-resistor is a light-controlled variable resistor. The resistance of a photo-resistor decreases with increasing incident light intensity. An analog input converts a voltage level into a digital value.

Circuit Diagram :
Photo-Resistor with Arduino circuit Diagram
Photo-Resistor with Arduino circuit Diagram

In this circuit diagram we are using voltage divider. A voltage divider is a passive linear circuit that produces an output voltage that is a fraction of its input voltage. Here input voltage is 5V and two resistor are connected in series. One resistor which is fixed 10k ohms resistor. And other is photo resistor which is a light-controlled variable resistor. When light intensity changes the output voltage changes.

Assembly:
  1. Connect resistor as shown in diagram then connect photo-resistor.
  2. Make sure it is align in same column as shown in diagram.
  3. connect red wire to 5V socket on Arduino,  black wire to ground and green wire to A1.
  4. Upload the sketch below.
Sketch :
void setup() {
 Serial.begin(9600);
}

void loop() {
 int sensorvalue=analogRead(A1);
 Serial.println(sensorvalue);
 delay(100);
}
Explanation :

This is Serial.begin (9600) it will create serial connection with Arduino. By this Arduino can send text output. AnalogRead(A1) which will get reading from socket A1. And Store it to local integer value sensorvalue. So whatever A1 get output we will print it through serial.println(sensorvalue). “Println(sensorvalue)” will create sensor value in new line. If you use “serial.print(sensorvalue)” without “ln” it will print sensor value in the same line. Time delay is in millisecond which is time between each sensor value is printed.

Upload the sketch.

Go to tools and serial monitor. Now you can see values.

If I keep my finger it on sensor it will change value. So your values may be different because of lightning condition.

Components list to buy online:

http://amzn.to/2fvSRJq   (Arduino)

http://amzn.to/2uK49eW  (Photo-resistor)

http://amzn.to/2wxPmWz  (Breadboard)

http://amzn.to/2vJ3lvo   (Jumper wire)

http://amzn.to/2vmSK8l  (Resistor)

 keep learning keep making 🙂

One thought on “Arduino tutorial 3# How to use Photo-resistor with Arduino.

Leave a Reply

Your email address will not be published. Required fields are marked *