Arduino project idea 2020 | how to make a Digital light intensity meter | innovationsfy


How to make it?

To build this you'll need:

1. Arduino Uno
2. 4 Different color LEDs
3. 1k resistance
4. 10k resistance
5  LDR
6. Breadboard
7. PC with Arduino IDE

Steps to build:


  1. Connect LEDs with the Arduino Digital pins (3, 4, 5, 6) and 1k resistance with LEDs
  2. Connect the LDR with 10k Resistance to A0 pin as shown in the below Circuit diagram
  3. Now upload the below program and done, Now it will work same as shown in the above video.

Circuit diagram:


Program for the project:

_________________________________________________________________________________

/* Copy the below program */
_________________________________________________________________________________

/*
Date 17, April, 2020
Program by Prince Kumar member at innovationsfy.com
This program is free to use as an open-source community
Feel free to ask any query Send an email on [email protected]
*/

int led1 = 3; //output led 
int led2 = 4; //output led 
int led3 = 5; //output led 
int led4 = 6; //output led 

int sensor = A0; // input ldr sensor 
int Value; // to store ldr analog valuew

void setup() 
{
  pinMode(led1,OUTPUT); // output defined
  pinMode(led2,OUTPUT); // output defined
  pinMode(led3,OUTPUT); // output defined
  pinMode(led4,OUTPUT); // output defined

  pinMode(sensor,INPUT); // intput defined

}

void loop() 
{
  Value = analogRead(sensor); // reading sensor value and storing in 'value'  
  
if(Value<=255) //1st level of intenstiy
{
  digitalWrite(led1,HIGH);
  digitalWrite(led2,LOW);
  digitalWrite(led3,LOW);
  digitalWrite(led4,LOW);
}

if(Value>=255 && Value<=510) //2nd level of intenstiy
{
  digitalWrite(led1,LOW);
  digitalWrite(led2,HIGH);
  digitalWrite(led3,LOW);
  digitalWrite(led4,LOW);
}

if(Value>=510 && Value<=765) //3rd level of intenstiy
{
  digitalWrite(led1,LOW);
  digitalWrite(led2,LOW);
  digitalWrite(led3,HIGH);
  digitalWrite(led4,LOW);
}

if(Value>=765 && Value<=1023)//4th level of intenstiy
{
  digitalWrite(led1,LOW);
  digitalWrite(led2,LOW);
  digitalWrite(led3,LOW);
  digitalWrite(led4,HIGH);
}

}

_________________________________________________________________________________

 /*End of program*/
_________________________________________________________________________________


Comment down your query or mail us on [email protected]





Post a Comment

0 Comments