Program using Light Sensitive Sensors on Tinkercad

  

Objectives:

      To understand the working of Light Sensitive Sensors

      To understand the use of Arduino with Tinkercad

      To study basic concepts of light intensity


Light Sensitive Sensors- It is also called as LDR or Photoresister


Requirements:

 

Component

Quantity

 Arduino Uno R3

1

 Photoresistor(Light Sensitive Sensor)

1

1 kΩ Resistors

2

Red LED

1

 

Connections:

 

LED

Arduino Uno

Anode (+ve end of LED)

 PIN  4

Cathode (-ve end of LED)

 GND

 

Photoresister (Light Sensitive Sensor)

Arduino Uno

Terminal 1

GND,A0

Terminal 2

5v

 

Circuit Diagram: Connect components as given in the below circuit diagram

Procedure:Arrange blocks in the below order in a block editor. 



Output: Observe the light intensity values received from photoresister on serial monitor



Explanation:

  1. Photoresister is connected on the analog pin of Arduino Uno
  2. LED will blink If the intensity of light is below 100
  3. LED will fade out If the intensity of light is  100 or above
  4. Functions used in program are as below:

a.     Void setup() :- The Arduino program calls the setup function as the first thing when the Arduino unit powers up. So any code that you place in the setup function in your sketch runs first, and it only runs once. The setup function is a great place to initialize input and output pins so they are ready to be used.

b.  pinMode() :- pinMode() function Set the mode of an individual pin. It accepts two arguments: Pin Number , Type of pin(output/input)

c.    loop() :- Like all other functions, loop() is a function. Its call only results in the execution of the code it contains; it has no effect on the looping behavior of the code from which it is called.

d.    digitalWrite() :- digitalWrite will set the output to one of two states , LOW or HIGH. It can be used to turn on a LED, switch a relay etc.

e.    analogRead() :- Reads the value from the specified analog pin

f.  delay() :- The delay() function allows you to pause the execution of your Arduino program for a specified period.


Comments

Popular posts from this blog

Create an android app that demonstrates Activity Lifecycle and Instance State.