The purpose of technology is to make life much easier. So, developing the electronics to make it smarter is the main target of this century. Subsequently, Arduino is a great example of this development!
This week mainly focusing on how to make the electric devices more smarter. Therefore, we learned how to deal with the Arduino and different sensors to build a smart project.
We are surrounded by many smart devices such as the automatic open door that sensing you got close to it and open thus, finding a good idea was too easy. I searched for the word "smart devices" and a lot of ideas comes out in front of my eyes such as smart home products. Specifically, lighting the lamb depending on reads comes from sensor. Consequently, i brought this idea that inspired me to use my Arduino UNO, LDR sensor, and LED to make a prototype of one smart home applications.
Arduino UNO
TinkerCad
Jumpers
Arduino Cable
LDR Sensor
Resistance
Breadboard
LED
Arduino IDE
Circuit Design
I used TinkerCad software to make my circuit connections, As shown the circuit is consisting of one main INPUT which is the LDR sensor, and one main OUTPUT representing the LED.
The LDR sensor is powered by the Arduino 5 V and the other leg is connected through an analog pin from the Arduino because it gives out an analog voltage .
The LED connection is through an Arduino digital pin and its ground.
The main goal of this circuit is to sense the intensity of the light and switch it OFF when there is another source of light and switch it ON when the intensity of the light decrease.
this function is done through our circuit by adding this code block.
this if statement indicates the conditional intensity of light which will control the switching mode of the LED.
Circuit Simulation
The difference between the simulation and the real wiring is that I will use an LDR module that is very similar to the LDR sensor without the module and when I used the module I was not in need to add resistance with the LDR.
To build my circuit I connected first the LDR Module to the Arduino then I Connected the LED (it's better to add resistance on both ) then I powered the Arduino from the USB port to my laptop and finally, I uploaded the code.
The testing of this circuit is done by putting my hand in front of the sensor to simulate the night light; when I remove my hand the LED will turn OFF as the sensor senses the light's appearance.
Circuit Recorded Video
I faced two main challenges :
First is the LDR module connections as I used on the simulation the LDR sensor without the module so the module's connections were missing for me and I searched for them.
this link helped me https://www.instructables.com/LDR-Sensor-Module-Users-Manual-V10/
Note: the LDR sensor should be connected to an analog pin.
Second is that I did not know the process to write my code using the code blocks on TinkerCad, but I asked Eng Maram and she helped me to write it . Despite it was easy, I found it is preferred for me to use text code in my future circuits.
Sensing is a very important technique and in my final project I will be in need of it but I don't know now which kind of sensor I will use.
this week I learned how to deal well with Arduino and that will help me a lot to handle my final project.