LED LIGHT USING SOUND SENSOR & LIGHT SENSOR CHIRAZ BOUDHRIOUA
Plan INTRODUCTION REQUIREMENTS AND COST ESTIMATE CONNECTING THE SOUND SENSOR CONNECTING THE LEDS PROGRAMMING THE ARDUINO PROJECT IMPLEMENTATION
Introduction Sound sensors can be used for a variety of things, one of them could be turning lights off and on by clapping. Today however we are going to use hook up the sound sensor and the light sensor to an array of LED lights which will beat with music, clapping or knocking. 1
Almost any Arduino I used the popular Arduino Uno($23.90) REQUIREMENTS AND COST ESTIMATE Almost any Arduino I used the popular Arduino Uno($23.90) Some breadboard cables($4,70 65 pcs) A sound sensor ($6.90) A light sensor ($3.50) At least 1 LED light – I used 11! The more the better! ($3.40 50 pcs) As many LEDs you are using you should have resistors. 333 ohm resistors should do the trick for most LEDs but I used 220 ohm ones. ($0.13 ) => The project cost $42,53 2
CONNECTING THE SOUND SENSOR The sound sensor should look something like this. 3
CONNECTING THE LIGHT SENSOR The light sensor should look something like this. 4
CONNECTING THE LEDS 5
PROGRAMMING THE ARDUINO void setup(){ pinMode(3,OUTPUT); pinMode(4,OUTPUT); pinMode(5,OUTPUT); pinMode(6,OUTPUT); pinMode(7,OUTPUT); pinMode(8,OUTPUT);} void outs(String a){ if(a=="FAIBLE"){ digitalWrite(3,HIGH); digitalWrite(4,LOW); digitalWrite(5,LOW); digitalWrite(6,LOW); } if(a=="MOYENNE"){ digitalWrite(4,HIGH); if(a=="FORTE"){ digitalWrite(5,HIGH); if(a=="TRES_FORTE"){ digitalWrite(6,HIGH); } } String lightlevel(int a){ String s; if(a<70) { s= "Faible"; } if(a>70 && a<200) { s= "Moyenne"; if(a>200) { s= "Forte"; return s; void outl(String a){ if(a=="Faible"){ digitalWrite(7,LOW); digitalWrite(8,LOW); } if(a=="Moyenne"){ digitalWrite(7,HIGH); if(a=="Forte"){ digitalWrite(8,HIGH); void loop(){ String r; int a = analogRead(A1); int b = analogRead(A2); a=(a*1.2);//amplification du son outs(soundlevel(a)); outl(lightlevel(b)); } String soundlevel(int a){ String s; if(a<200) { s= "FAIBLE"; } if(a<350 && a>200) { s= "MOYENNE"; if(a>350 && a<500) { s= "FORTE"; if(a>500) { s= "TRES_FORTE"; return s; } 6
PROJECT IMPLIMENTATION 7
thank you for your attention 8