Since we started programming, I have been thinking of the simplest ideas for my assignments.
So I thought of controlling an RGB LED and a Buzzer, and it was straightforward, so I decided to complicate it by making tones with the buzzer from scratch.
I found the tone frequencies, copied the tones I play on the piano, and tested with the delays.
Software
I used Fritzing to design the wiring diagram.
I used Arduino IDE to sketch and upload the text code on the Arduino UNO board.
I used Arduino Bluetooth Control to control the Arduino UNO board through the Bluetooth module on an Android mobile phone.
Electronic components
Arduino UNO board
will be connected to the inputs and the outputs and power them. It is also going to run the code on the components.
Breadboard
To fix the components in and connects them together.
RGB LED
which is going to emit different color light.
Piezo Buzzer
is going to make tones.
Bluetooth Module HC-05
is going to connect the mobile phone to the Arduino.
220-ohm Resistor
Adjusts the current passing through the RGB LED.
male-male Jumper wires
Connecting the components.
male-female Jumper wires
Connecting the Bluetooth Module to Arduino.
The circuit on Fritzing
RGB LED connected to pin 4, pin 3, and pin 5.
Piezo Buzzer connected to pin9.
HC-05 RX is connected to TX->1
HC-05 TX is connected to RX<-0
RGB LED and Piezo Buzzer are OUTPUTS
When we push 1 on the GUI, the LED turns Red and the Buzzer plays the 1st part of the song "Do-Re-Mi".
When we push 2 on the GUI, the LED turns Green and the Buzzer plays the 2nd part of the song "Do-Re-Mi".
When we push 3 on the GUI, the LED turns Blue and the Buzzer plays the 3rd part of the song "Do-Re-Mi".
When we push 4 on the GUI, the LED turns White and the Buzzer plays the 4th part of the song "Do-Re-Mi".
I started searching for codes, and I used these codes in the basic Serial Code from the EOWeek self-practice videos.
In this video, I saw a code where the buzzer can make a music-like sound using the buzzer's frequency and delays.
I found the frequency of each tone so I could use the same code from the video to make the song "Do-Re-Mi" from the movie "The Sound of Music".
I used a piano app on my phone to test the tones I had to write in the code.
I had to upload the code and listen, then go back to change the delay time to make it sound right. This step took a while and a lot of testing and trials.
With this code
When we push 1 on the GUI, the LED turns Red and the Buzzer plays the 1st part of the song "Do-Re-Mi".
When we push 2 on the GUI, the LED turns Green and the Buzzer plays the 2nd part of the song "Do-Re-Mi".
When we push 3 on the GUI, the LED turns Blue and the Buzzer plays the 3rd part of the song "Do-Re-Mi".
When we push 4 on the GUI, the LED turns White and the Buzzer plays the 4th part of the song "Do-Re-Mi".
I wired everything with the actual components, uploaded the code, and connected the Mobile to the Bluetooth module, and here is the final result.
I could not do the wiring on TinkerCAD due to the absence of the HC-05 Bluetooth module.
I saw one of my colleagues asking in Slack's community troubleshooting channel about the same problem.
The instructor replied with a Link to download Fritzing for free.
I tried it, and it was straightforward. I used it to do the wiring diagram.
Controlling the RGB LED with a GUI will help me control the RGB NeoPixel LED rings I am intending to use in my final project.
In the EOWeek Session, we had our second and last Makeathon.
It was a great way to end the studying part and get ready for the Final Project.
We solved all the problems we faced during the self-practice videos and we felt accomplished in a fun and playful way.
Title of Media