The idea of the assignment for this week is to communicate wirelessly with a Smart Circuit via a Graphical User Interface (GUI) on your phone or PC.
The smart circuit is programmed using Arduino C to perform serial communication and communicates wirelessly via a Bluetooth module to a PC or phone
The idea is to make a circuit with two action components. I chose to make a simple design which is indication of the RGB led colors.
Simulating program
Coding program
5V adapter
Jumper wires
3 Resistors 330 ohm
RGB LED
Breadboard
Arduino uno and its cable
Buzzer
The circuit components are Buzzer, RGB led, Arduino and Bluetooth module.
The control of the circuit should be from three buttons in the Bluetooth application.
First I draw the circuit on TinkerCAD to show the connections of the circuit.
I tested the Bluetooth with the RGB first as I follow the "Divide and conquer" method.
The buzzer is added to the final step.
The circuit consists of many connections. First the connection of bluetooth module, the VCC and ground are connected to 5V and ground on the breadboard respectively. The RX pin is connected to TX pin on arduino and the TX pin is connected to RX pin on arduino.
The RGB LED is connected to 3 resistors 330 ohm. The 330 ohm resistors is used as the LEDs take voltage less than 5V. In order to protect the LED from burning, the voltage divider method is applied by using resistor to take the exceeded current and voltage.
The RGB red LED is connected to pin 2, blue LED is connected to pin 4 and the green LED is connected to pin 7 and the buzzer is connected to pin 8. All the components ground are collected at common ground on the breadboard, then the common ground is connected via jumper wire to the arduino ground pin.
The circuit with bluetooth module.
The code is set that by adding the bluetooth module the circuit will work. I created a new variable called 'incomingData' to store the value of the bluetooth button that the user will press.
When button 1 is pressed, the red LED will work. When button 2 is pressed, blue LED will work. When button 3 is pressed, green LED will work.
Testing RGB
Testing RGB
At the final code I added a last condition. When any other button is pressed, the LEDs will not work and alarming sound from the buzzer will be produced.
Final code.
Final code
I recorded with the RGB first to see if there any problems. The bluetooth is fully functioned. By applying the concept of the project, the RGB was working very well.
The RGB LED is connected to 3 resistors 330 ohm. The 330 ohm resistors is used as the LEDs take voltage less than 5V. In order to protect the LED from burning, the voltage divider method is applied by using resistor to take the exceeded current and voltage.
The RGB red LED is connected to pin 2, blue LED is connected to pin 4, the green LED is connected to pin 7 and the ground is connected to the common ground on the breadboard.
Testing the RGB
Photo for the circuit.
The final step for this circuit is when another button is pressed the buzzer produces alarming sound and then the RGB is shut down.
The buzzer is connected to pin 8. All the components ground are collected at common ground on the breadboard, then the common ground is connected via jumper wire to the arduino ground pin.
Final output
Final output video
The challenge I faced was the sound of the buzzer as it was beeping continuously. It does not stop.
The error was in the coding as it only needs delay 100 msec then a command to stop.
The wrong code
The right code.
Second challenge I faced was when I tested the RGB it did not work.
After checking the connections I found that the led wass not connected to ground.
Without ground
With ground