I built a smart home!
As a prerequisite for attaining my Bachelor's degree in Computer Engineering, I enrolled in a course titled Microcomputer Hardware and Software. An integral component of this course was the development of a project utilizing a microcontroller.
Introduction
As a prerequisite for attaining my Bachelor's degree in Computer Engineering, I enrolled in a course titled Microcomputer Hardware and Software. An integral component of this course was the development of a project utilizing a microcontroller.
The project topic given to me was "smart home using Arduino," and then I decided that I was going to build a full prototype of a house, well as best as I could.
Project Overview
The simplified overview of the project is utilizing an Arduino uno microcontroller, setting up a circuit that connects a couple of LEDs, and an HC105 Bluetooth Module for low range real-time communication, which in turn is controlled by an android app called Arduino Bluetooth Control, I didn't build an app from scratch to connect to the Bluetooth module, because an already built app adds a level of abstraction and simplicity to the project.
Components and Cost
Most of the purchasing of components was done at Hub360, a premier electronics store with a presence in Abuja. As shown in the picture below, this project cost less than $50 from start to finish.
Circuit Setup
First things first, I had to create the basic electronic circuit, which consisted of connecting two LEDs to pins 8 and 9 of the Arduino Uno board, and the Bluetooth module to the 5 volt output, rx, tx and ground.
To interface with the Bluetooth module, I installed the Arduino Bluetooth Control app on Playstore.
Programming the Arduino
Once the connections were done, the next step was to test the Bluetooth module, that involved programming the Arduino Microcontroller (yay!)
Arduino primarily utilizes its own programming language, which is based on Wiring, a simplified version of C and C++. This language is specifically designed to be beginner-friendly, allowing users with varying levels of programming experience to easily grasp concepts and create projects.
void setup() {
pinMode(8,OUTPUT);
pinMode(4, OUTPUT);
Serial.begin(9600);
digitalWrite(8,LOW);
digitalWrite(4,LOW);
}
void loop() {
while(Serial.available() == 0) {}
String val = Serial.readString();
val.trim();
Serial.println(val);
if(val== "offBulb1"){
digitalWrite(8,LOW);
}
else if(val=="onBulb1"){
digitalWrite(8,HIGH);
}
else if(val=="offBulb2"){
digitalWrite(4,LOW);
}
else if(val=="onBulb2"){
digitalWrite(4, HIGH);
}
delay(50);
}Building the House Model
Designing a full-scale model of a smart home system was uncharted territory for me. The closest I had ever come to such a project was glimpsing the architectural models proudly displayed by students. But I was determined to make it work. YouTube became my virtual mentor as I scoured through countless videos, seeking inspiration and guidance. After much searching, I stumbled upon a simple yet elegant design that sparked my imagination.
The process of building the house model then commenced, using a combination of cardboard, a lot of technical drawing knowledge, and a sprinkle of glue gun here and there.
After the ground floor was assembled essentially, the connections of the three LED bulbs were all done and arranged in parallel to an output pin, and then the servo motor at the top right, as shown in the image above, was connected to pin 9.
The Garage Door Challenge
I encountered a major struggle with the arm that would open up the garage door. According to design, I could only place the motor in the top right section of the house (as shown above), which meant I had to design a custom arm that would connect to the garage. After about 5 iterations later, I constructed a custom arm that was strong enough to effectively transfer the rotational movement to the garage door, and yet light enough so the servor motor could carry it.
After successfully assembling the ground floor components, the next step was to establish connections for the three LED bulbs on the ground floor, neatly arranged in parallel to an output pin.
Meanwhile, the servo motor positioned at the top right corner of the structure was linked to pin 9, to control the garage door. However, a significant hurdle emerged when it came to implementing the garage door mechanism. According to the design, the motor could only be situated in the top right section of the house, in which case it was necessary to create a custom arm to be attached to the garage door. After undergoing five iterations, I constructed a custom arm that was strong enough to effectively transfer rotational movement to the garage door (as shown below). This solution ensured that the servo motor could effortlessly execute its function without being burdened by excessive weight.
Top Section Assembly
The top section was being designed by a teammate in another location, after it was done, it was time to bring them together and assemble them into a full house model.
The few electrical connections needed at the top section of the house were the three light bulbs, for which I drilled a hole in the floor separating the two floors. The LEDs were all connected in parallel to pin 9 of the Arduino, similar to the setup on the ground floor.
Power Issues and Solution
Just when I thought the finishing touches were in sight, a significant obstacle presented itself. Initially, powering the LEDs and servo motor with two 9V batteries seemed like a practical solution. However, as soon as I put the system to the test and initiated the garage door's motion via the Android app, disaster struck — the batteries drained rapidly, leaving the entire house powerless.
Determined to find a solution, I turned to a combination of ChatGPT's insights and the expertise of the ever reliable Indian YouTube creators. After delving into various tutorials and troubleshooting guides, a breakthrough emerged: a revised power architecture for the project. Implementing this solution involved harnessing the power of four 9V batteries.
The first two were connected in series to provide direct power to the motor, ensuring its smooth operation. Meanwhile, the remaining batteries were linked in parallel to supply ample power to the Arduino Uno Board and LEDs, effectively resolving the issue.
My thoughts/conclusion
The batteries utilized proved suboptimal for the task at hand, as evident during the demonstration session where the 9V mercury batteries were rapidly depleted by the servo motor. This led to excessive battery consumption. In hindsight, opting for a heavy-duty battery could have mitigated this issue and minimized the reliance on multiple batteries.
I learned a lot during the development of this project, Although I envisioned that it would be very easy and straightforward to develop, I encountered a lot of unexpected problems that needed a hands-on fix within a tie frame
Furthermore, this experience highlighted the dynamic nature of project development. Unexpected obstacles often arise, requiring quick thinking and creative problem-solving.
With this newfound knowledge and determination, I am tackling my final year project, which is a whole lot more exciting, and I can wait to share it with you all!
The full code can be accessed here.