The idea is a voice-activated smart home light, am a big fan of the IoT (Internet of Things) and love to tinker with that type of project. So I decided to control a 220V lamp wirelessly using the Bluetooth mobile application.
I got inspired by a very known product in the market of Smart Homes from a company called "Sonoff".
More info about it here: https://www.sonoffegypt.com/products/sonoff-tx-t3-us-3c-black-series-wifi-wall-switch
I used the following software and tools:
Arduino IDE.
Arduino BlueControl.
TinkerCad for the diagram.
I did prepare all the needed components and thought of the wiring and sequence.
I decided to use a 5V 2A adapter as a power supply as I will power the Arduino, the relay module and the Bluetooth HC-05. The Arduino will be connected to the 5V adapter through the Arduino built-in jack and the rest of the components will be powered using 5V pin and a Ground pin to a breadboard.
I used the relay module cause I need to control a 220V using a 5V signal, If I didn't use the relay the 220 Volts will be very high when the circuit closes and will damage all the components, so this can be handled by using the relay module.
Input:
Android Bluetooth App.
Serial Monitor.
Output:
220V lamp via relay module.
LED. (instead of the Fan as it didn't work).
Wiring diagram of the entire circuit. (a LED instead of the Fan) we'll see why in the challenges section.
Started the code following the tutorials in the MD videos for communication with the Bluetooth module.
Store the incoming serial data in a variable.
Define the Light and the Fan pins.
Start the serial communication and set the baud rate.
Set the pins to output.
The loop started by reading serial incoming data.
Added the if condition with 2 buttons for each device.
Added an "invalid input" in the serial monitor if anything else received.
Added print the incoming data after "your input" text.
Now with the wiring. (replaced the fan with LED).
And now with demo of the functionality.
I did help my colleagues on the troubleshooting slack channel in fixing an Arduino code uploading problem it was needed to remove the RX and TX pins while uploading.
And another problem with another colleague for finding a syntax error.
I got stuck with rinning the Fan on my current project as it needed 5V and for some reason, the Arduino got 2.X V out of the pin that was not enough for the fan to function.
I did change the fan with a LED and it worked as the 2.X Volts was enough to power the LED and currently still searching for the problem.
I know that LED was not acceptable during this assignment but I did replace it with the geared DC motor and it was the same problem the volt was not enough to make the motor move.
We had this problem before during the smart home activity on the End of Week session and fixed that by adding another relay module. (currenly I have only one relay that I used for powering the 220V lamb.).
The assignment project was a part of my final project as I will control the vending and the movement of the servos using the Bluetooth mobile app.
Managed to voice activate the projects.
I managed to order a 3D printer from Amazon USA to be directly shipped to Egypt. I did that before and it was difficult to deal with the customs here in Egypt, but finally, I got the items so want to give it a try on the 3D printer as it was a very decent deal.
I ordered this and waiting for it to arrive: https://www.amazon.com/Printers-Removable-Carborundum-Platform-220x220x250mm/dp/B08KZDQVVM/