This week's task is to build a simple smart circuit that contains at least one action component that we can control wirelessly using Android GUI to control the action component.
I got the inspiration from this show teaching toddlers about colors, so I decided to use Android Phone GUI to control the action component (RBG LED )
I used Tinkercad web app to design my circuit.
Electric circuit components:
Jumper wires.
Arduino UNO.
Bluetooth module
9V adaptor.
breadboard.
RGB LED.
Resistors.
Avometer for troubleshooting.
I used Arduino IDE software to run and upload my code on the Arduino board
I used Arduino Bluetooth control app to control the action components wirelessly.
Open Tinkercad and click on create tab and select circuit
Use the bar on the right to search for the components
Search for the first component "breadboard" then drag it
Then drag the rest of the components of the circuit
Arduino UNO
breadboard.
Bluetooth module
RGB LED.
Resistors.
The action component is RGB LED
Wiring the components together is done this way
Prepare all the electric circuit components to build the circuit.
Connect the 5V and GND of Arduino to the breadboard.
Connect the circuit components
RBG LED is connected to resistors then to Arduino pins 11,12,13,GND
Bluetooth module is VCC & GND are connected to 5v and GND , Tx&Rx to Arduino Rx &Tx
Here's my circuit.
Open Arduino bluetooth app and make sure the bluetooth module is connected to the app as shown
I wrote the basic code for serial testing and tried it using my Arduino control Bluetooth app
Press the app keys and the readings will show on the serial monitor:
Let's now integrate the code we want for controlling the RBG LED with the main code:
This is our final code, compile and upload to the Arduino Board.
Upload was successful.
Connect the 9V adaptor.
The circuit is working perfectly.
A challenge I faced was when I tried to test the wireless serial communication and the serial monitor showed "???" instead of the keys I entered
So this is how I solved the problem:
I gave my code a second look:
The 0 in the while condition is put in single quotation marks. which in turn will be read as a character not as a value.
I removed them and adjusted the code like this:
After compiling and uploading the code, the serial readings were accurate.