http://
1.Hi my name is Joan, and I am going to explain how we can open and close a LED automaticaly depending on the intensity of light with an Arduino.
2.Arduino is a single-board microcontroller it makes using electronics in projects more accessible. The hardware consists of an open-source hardware board like this one.
3.Arduino has several parts, for example the analog/digital inputs/outputs, the red buton is to reset the information( in Arduino Leonardo it works differeent, it is used to restart the code another time), we have also in Arduino 3 Gnd and 2 electricity socket of 3,5 and 5 volts, and he enter of the USB to computer conetion.
4.To download the software of Arduino we go to the web page arduino.cc ; then we click on download ; we then scroll down the page and here we can select our operative system.
5.When we have finished the download, this symbol should appear, we then click “extract file”, we wait for a couple of minutes, we then click on this and we install the arduino software in the computer following this order:I agree, next, in browse we select the place where the program will be installed.
6.We wait for the program to install and when it finishes we close the tab, in the place where we have indicated ( Browse) this new folder will appear, we open the folder and then this symbol will appear, we open it and then we have finished the installation of arduino.
7.We connect the arduino, here we select the port and the type of arduino, in this case it is Arduino leonardo in Com4, this is very important if we don’t do this at the time for sending the code it will give us errors.
8.The first code that we will use is the Blink code to know if: the Led works, The recognizon of Arduino by the computer in some cases is one of the most difficult parts.
9.to know if the LDR works correctly we will use the analog read, we have to connect this with a resistor because we can burn the arduino.
10.The language that the Arduino uses is processing, there is a lot of code which is the same but there are some differences, here we can see the code of Blink.
11.void set up, means it is going to be executed only once. In theory serial.begin is the number of signals per second, and we are presenting the LED to the arduino.
12.Void loop means do the same every time, here we are presenting the LED to the arduino and we are saying the intput where the LED is connected, we also say to the sensor that it has to read in analog and where the sensor is connected.
13.Here we are saying in the code that if the analog lector reads more then 1000 the LED will be opened and if it reads less than 1000 the led will close.
14.An LDR is a resistor that changes its resistance depending on the light, when the LDR recives a lot of light its resistence decreases but when it recives less light the resistance increases.
15.We are going to connect the LDR and the resistor like this in order to have the best result, if we don’t put the resistor in we can’t make a curtcircuit an we will burn the arduino.
16.5v is the voltatge,A0 is the Analog read and GND is the ground, in this scematic picture we can see the passing ofelectricity, on the left we can see the example with a little light, the LDR increases its resistence and the current goes to A0. So the value pass 1000 and the LED opens.
17.In the picture on the right is an example of, when the receptor recives a lot of light so the resistence decreases and the electricity goes to GND, so the lectorA0 receives less intensity and the arduino orders the led in 13 to close.
18.To know if the code makes sense we click the tick, to send the code to the arduino we click the arrow and in order to see the analog read we click on the magnifying glass.
19. This is what we will see, in the analog read, the value goes from 0 to 1023 it elevates to ten different numbers, the first time that we see these numbers we can adapt the code changing the values to make the LED open and close depending on the intensity of light that we want.
20.Thanks to all of you to listen me or to read this in my blog.