Smart Fan & Lamp (Clap Switch)
The Inspiration Image
I did a search on the Internet, and through the picture above, I was inspired by the idea of making a Smart fan & Lamp, and after that I began to imagine the components and tools needed to make the project and prepare for that
Website Link (Source of Inspiration)
DC motor
Adapters (9 v)
Card Board
DC Jack to terminal block converter
Crocodile Wires
Software :
Fritzing
IDE Arduino
Material & Tools
Arduino Uno
Voice / Sound detection Sensor
Temp & Humidity Sensor (DHT 11)
H-Bridge (Motor Driver)
LCD (1C2) - 16*2
1 DC Motor
led
1 DC Jack to terminal block converter
Jumper Wires (Male - Male, Male - Female)
3 Crocodile Wires
Adapters (9 v)
Small Breadboard
Breadboard
Resistor 220 om
Bottle Cap
Avometer
AC Bulb
Resistor 220 Ohms
Led
Jumper Wires (Male - Male, Male - Female)
Arduino Uno
Bread Board
H- Bridge
Avometer
IDE Arduino
AC Bulb
Pin A4 - SDA for LCD
Pin A5 - SCL for LCD
Pseudo code
The idea of the Smart Fan & Lamp depends on the following inputs and outputs
First: The Input
****************
1- DHT 11 Sensor for measuring temperature and humidity
2- Sound dedection Sensor to track sounds, so the device can be controlled by clapping
Secondly : The Outputs
**************************
1- DC motor to drive the fan and the fan is driven by a Motor Driver (H-Bridge)
2- The AC Lamp operates on an AC household electrical current through the Relay Module
3- Green LED when the motor is running
4- LCD screen 16 * 2 (I2c) to show data for temperature and humidity data
Thirdly: How The Circuit operate and work
************************************************
- By clapping twice, the fan motor ,the AC lamp and the Green led are turned on in a smart way.
- As soon as you clap twice after that, the fan motor ,the AC lamp and the Green led are turned off smartly.
-The DHT 11 sensor, which is used to measure temperature and humidity, as well as the LCD screen, works simultaneously and continuously, as they are separate from the on or off statuses of the light and the fan.
Writing the code for controlling and operating the fan and smart lighting device, and measuring temperatures and humidity levels, I relied on downloading the library for the LCD, which is LiquidCrystal_I2Ch and the DHT sensor library was also downloaded.
And the work of the code depended on the function if as well as else, and the millis function was also used, through which the code can read and process the data coming from the sound sensor, and the toggleState function was also used, which is used to set two states "on - off" and through these functions the control is carried out In the working conditions of the device, it was used as follows
When you clap twice, the fan and the AC bulb work in addition to the green led, and after that, when you clap twice, the work of the aforementioned components is closed.
It was also taken into account that the code to operate the DHT 11 sensor, as well as the LCD, should work continuously and separate from the above components (fan and lighting), so that the temperature and humidity sensor continues to continue making measurements as inputs, and these inputs appear on the screen of the LCD synchronously.
NO (Normally Open)
NC (Normally Close )
I think that I have become able to deal with the Arduino-Uno control board in a much better way, and I have become able to use Pseudo code and C++ programing language for coding to do programming, and I have also become able to integrate several inputs and several outputs and make them work harmoniously together, and I have also become able to use most The sensors that were shared in the explanation videos and linked to the various projects, in addition to that I feel a great development in the ability to logical thinking based on solving problems and creating alternatives and thinking about the development of problems that may face the end user with the development of the largest number of solutions Which will greatly reflect on facilitating work on my final graduation project.
The most enjoyable thing for me is that I was able to Design, write programing code and have the full remotely control on my Smart Home Circuit, taking into account User Experience including simplicity, and aesthetic form, which is one of the most important customer requirements in products.