This week’s assignment was to create a smart electrical device with at least two inputs and two outputs. I decided to design a small box that measures and displays the temperature, humidity, and brightness of a room. The device also gives signals to show whether the conditions are suitable for activities like studying or working.
I care about this idea because the environment strongly affects productivity and focus. My inspiration came from a YouTube documentary about successful people, where I learned that they optimize their time and energy by working under the best conditions.
Picture 1
Picture 2
For Practical Implementation :
Breadboard
Adpter 5v
Jumper wires
Arduino
DHT sensor
LDR sensor
LCD screen
Breadboard
RGB led
Avometre
Electrinic circuit in Tinkercad :
To design and prepare my project I used Tinkercad, which allows creating and simulating electronic circuits before building them in real life. Here are the main stages I followed:
Steps to build the circuit on Tinkercad.com :
I logged into Tinkercad.com and selected the electronic circuits section
From the component search bar, I selected the following parts:
Arduino Uno,
breadboard,
RGB LED,
LCD Screen,
an DHT sensor,
and 3 resistors (220-ohm).
LDR sensor,
Jumpers,
Picture 1
Picture 2
Input / Output components :
For the input components, I used an DHT sensor and an LDR sensor, the DHT sensor provides both temperature and humidity measurements with a single, and the LDR sensor measure the brightness of the room and determine whether the lighting conditions are suitable for working or studying.
For the output components, I used RGB Led and LCD Screen : The RGB LED allows displaying three different colors (red, green, and blue) depending on the commands received, The LCD screen displays text or numbers based on the commands it receives.
Coding With Arduino IDE :
Including Libraries and Defining Pins: I started by calling the necessary libraries, such as the one for the LCD display and the DHT sensor for temperature and humidity. Then, I defined variables to represent the Arduino pins for each input and output component.
Creating the setColor Function: In this step, I wrote a function called setColor() to control the RGB LED. This function assigns values to the three pins of the LED, allowing me to display the three different colors.
Initializing Components: Next, I initialized the outputs and sensors. I used dht.begin() to activate the temperature and humidity sensor, Serial.begin() to enable serial communication, and initialized the LCD display with lcd.init().
Using Conditions with If Statements: I then programmed the conditions that control the RGB LED. For example, if the temperature is between 20°C and 22°C, the LED turns blue; if it is between 23°C and 27°C, it turns red; and if it is above 27°C, it turns green.
Displaying Values on the LCD: Finally, I configured the LCD screen to show the three parameters: humidity, temperature, and light intensity. I adjusted their positions on the display so the data could be read clearly.
THE CONSTRUCTION STEPS :
1-Power and Breadboard Setup: I first connected the Arduino Uno to the breadboard using jumper wires. I linked the Arduino’s 5V pin and GND pin to the positive and negative rails of the breadboard, then connected both rails together to distribute power across the circuit.
Picture 1
Picture 2
Picture 3
2-RGB LED Connection: Next, I connected the RGB LED to the Arduino. Each of the three color pins was connected through a 220-ohm resistor to pins 9, 10, and 11 of the Arduino, while the common cathode pin was connected to ground.
Picture 1
Picture 2
Picture 3
3-Light Sensor Connection: I then wired the light sensor (LDR). Its positive and negative pins were connected to the breadboard rails, the analog output pin was connected to A0 on the Arduino, and the digital output pin was connected to pin 5.
Picture 1
Picture 2
4-Temperature and Humidity Sensor (DHT): I connected the DHT sensor, which has three pins. The VCC and GND pins were connected to the breadboard rails, and the data pin was connected to digital pin 8 on the Arduino.
Picture 1
Picture 2
5-Temperature and Humidity Sensor (DHT): I connected the DHT sensor, which has three pins. The VCC and GND pins were connected to the breadboard rails, and the data pin was connected to digital pin 8 on the Arduino.
Picture 1
Picture 2
The final Result :
The biggest challenge I faced while working on this project was with the LCD screen. After completing the wiring by following tutorial videos, I wanted to display the different information in well-defined positions on the screen. To solve this issue, I turned to the internet for research and discovered that I could change the position of the information on the screen by modifying the parameter lcd.setCursor().