The idea of this week's project is a led lamp which can change its colors wirelessly through a mobile app to suit different moods of a a person throughout the day.
Title of Media
Components used in the project are:
Breadboard
Arduino uno
seven segment display
Common cathode RGB LED lamp
Bluetooth module HC-05
Resistors
Jumper wires.
Software used in the project are:
Tinkercad for building and simulating the circuit
Arduino IDE for writing and upload the code to the arduino board.
Arduino bluetooth control android app.
As always the first step was building the circuit in tinkercad, piece by piece and testing each step along the way.
However I couldn't find the bluetooth module HC-05 among the components available in tinkercad, so I simulated the receiver and sender pins by 2 resistors to have most of my circuit drawn on tinker cad before building it in real life.
Although I should have added a resistor to each segment of the display instead of having just one at the common cathode, the number of resistors I had in the kit wouldn't have been enough so I used the less efficient but available connection method.
The seven segment display is used to display the initials of the colors that are shown, which are in order from left to right: Red, blue, green, yellow, violet, and Cyan.
After this stage comes the coding stage, I used VS code to write the code then I copied and pasted it to Tinker cad to perform the simulation.
The First step in the code was defining the variables.
In the setup I configured the pin modes to be outputs and started out the serial monitor.
In the loop, I created a code that runs only when the serial receives something, when the serial doesn't receive anything that means that the method Serial.available() returns a 0, and when it receives some input it returns a 1 and the code runs.
You can read the serial once in each loop however so I saved the return of the Serial.read() method into a variable called reading.
Whenever a character of the initials of the colors is read by the serial monitor it performs 3 function based on the character given.
The first function is "*color name*light" and it lights up the LED by the desired color according to the numbers declared.
The second function is called "off" and just turns off all the segments of the display to get read to display the next character.
The last function is "*color name*disp" which displays the initials of the color on the seven segment display.
The video above shows the simulated project in action.
As always I started out by building the electronic circuit to be an exact copy of the one I created on Tinkercad.
With the exception of adding the bluetooth module this time and connecting it to the VCC and the ground.
The next step was to get the arduino code I tested from tinkercad where it was tested and into the arduino IDE to be uploaded via USB.
The next step was the pairing process between the phone and the bluetooth module HC-05.
To control the bluetooth module you need an app the provides the connection on the backend and provides a simple and intuitive GUI at the front end, so I downloaded an app called "" from the google play store.
After the pairing was complete I chose the device I want to connect to, in this case it is the bluetooth module from within the application itself.
Then I changed the button names to reflect the characters I wanted to send to the Arduino
Title of Media
This image shows the six different colors that can be created from the device with the initials of such colors on the seven segment display, I thought it just looked cool and artistic so I wanted to add it.
Title of Media
I wouldn't have been able to do the project if I didn't attend the hackathon in the end of week session, I learned so much form my teammates about the bluetooth module and how it works, and more importantly how to troubleshoot it, as our module would just randomly disconnect during the game.
The code we wrote during the hackathon was also a great reference for me to write my code in this project.
I guess my biggest problem throught the week was that I didn't understand the the Serial.read() method returns a string, I assumed it to return an integer and started doing operations on integers only to find my code behaving in a seemingly random way, which was due to it reading the ASCII code for the number I entered, the instructor guided me however and explained how the function behaved and I was able to complete the week :"D.
The second time I got stuck during the project was when I didn't find the bluetooth module in tinkercad, I could seem to find a way to simulate its behavior so I just ended up mimicing its behavior with the serial monitor and it connection using to resistors to test the voltage dividing circuit before connecting the actual module in real life.
Understanding how to communicate wirelessly with the arduino is a great tool to have in my arsenal, I may add a wireless mode to my project if I had the time.
The most fun thing I did throughout the week was the hackathon.