This week's assignment is to build and program a simple smart circuit that contains at least Two action components that can be controlled wirelessly via a Bluetooth module and a Graphical User Interface (GUI) on a phone or PC.
Software:
Arduino IDE:
TINKERCAD (website)
Arduino BlueControl App
Electronics components
Resistor (220)
Resistor (1k&560)
Piezo Buzzer
7segment
Breadboard
Arduino UNO Board
jumber wires (per need)
Explaining the idea:
my assignment idea is a counter which counts up/down form 0 to 9 according to buttins "U" and "D" and the buzzer alerts me when I over press over numbers 9 or 0.
Simulating the circut on Tinkercad
Note: Bluetooth module doesn't exitst on tinkercad, so I photoshopped the circuit to put a Bluetooth module
Coding design:
Explaining the code:
First: Testing 7-segment
in the Void Setup sekchen, I defined the pins that the segment is connected to on the Arduino.
in the Void Loop sekchen, I made the 7 segment count from 0 to 9
Second: Adding the buzzer and the Bluetooth module codes.
Before the Void Setup sekchen, I defined the integers I had.
in the Void Setup sekchen, I defined the buzzer pin and the x value
in the Void Loop sekchen, I added the buzzer code, and the "Error" message printed to the serial monitor.
The concept of the code is:
I made x=0 makes the start number is 0.
when I press the "U" button the action is (x=x+1) to make it counts up, then the 7-segment displays the numbers from 0 to 9 every time I press the button again.
When x=9 and I press "U" again the buzzer alerts me and Arduino prints "Error" on the serial monitor.
when I press the "D" button the action is (x=x-1) to make it counts down, then the 7-segment displays the numbers from 9 to 0 every time I press the button again.
When x=0 and I press "D" again the buzzer alerts me and Arduino prints "Error" on the serial monitor.
Finally, connecting the Arduino to the laptop and Uploading the code to the Arduino board and test it.
Wiring the circuit on the physical breadboard and connected it to the Arduino UNO board.
wiring the resistors to the 7-segment on the breadboard
connecting them to the Arduino's pins (5,6,7,9,10,11,12)
wiring the buzzer on the breadbaord
connecting it to the Arduino's pin
wiring the resistors the Bluetooth module on the breadboard
the whole circuit wiring
Finally, connected them all to a common GND and VCC from the Arduino.
Pair Bluetooth module
open the app.
changing the Buttons input.
final impelmentaion
on the EOWeek session, I had a problem with the Bluetooth module, Whenever I connect it, it didn't respond, I faced the same problem in the Assignment, when I connect the 7-segment and uploading its code to the Arduino is worked well. But when I uploaded the Bluetooth code and connected it to the Arduino, the 7-segment turned off and didn't work.
I forgot to wire resistors to the Bluetooth module
In the EOWeek session, SALMA and MOHAM helped me with the Bluetooth problem, Mohab helped me to understand connecting the resistors to the Bluetooth's RXD, and used salma's laptop to run the code and it worked.
This assignment aims to learn how to control multiple components wirelessly via a Bluetooth module, this will me with the -setting personal mode- part in my final project.