This week we were supposed to make a smart circuit that contains more than one action component on the Arduino UNO board and communicate with it through the Bluetooth module.
So, I decided to make a simple circuit similar to that in Macdonald in which I send a number through my mobile application and this number appears on the seven segment.
I used TinkerCad for circuit simulation and wiring.
I also used ARDUINO IDE for coding.
Components:
1-Arduino UNO board
2-Buzzer
3-Bluetooth Module
4- 7 Resistances 1kohm
5-Jumper wires
6- Seven Segment
Title of Media
The components were wired as follows:
Buzzer: +ve terminal --> on Arduino pin 5
-ve terminal --> GND
Bluetooth Module: ground terminal -->GND
VCC terminal --> +5V
TX --> on RX of the Arduino (pin 0)
RX --> on TX of the Arduino (pin 1)
7 Segment (Common cathode):
cathode terminal --> GND
a terminal --> on Arduino pin 6
b terminal --> on Arduino pin 7
c terminal --> on Arduino pin 8
d terminal --> on Arduino pin 9 e terminal --> on Arduino pin 10
f terminal --> on Arduino pin 11
g terminal -->on Arduino pin 12
First, I started to declare the variables am going to use as global variables before the void setup function and also the pins they are connected to on the Arduino board.
Then, inside the void setup, I determined the mode of each pin, either it will be output or input pin. Here all the pins were output pins only as I didn't have any component that will give me an input. Also, I used the function 'Serial.begin(9600)' to initialize the serial data transmission and I set the baud rate with value 9600.
After that, inside the void loop (so the code will be repeated more than one time) I made a while loop with a condition 'Serial.available() > 0 ' which means that, while receiving data do the following instructions that are inside the loop curly brackets. Inside the loop the first function written 'Serial.read()' is used for reading the data coming through the serial transmission and saving these data inside the variable 'incomingdata'.
Then, I started to use the if condition to light certain LEDs in the 7 segment when a certain input is send from the mobile application to the Arduino through the Bluetooth module.
When 1 is pressed in the mobile application, the LEDs that forms the shape of number 1 takes HIGH voltage through the function 'digitalWrite(,)' and the buzz sound is heard from the buzzer.
When 2 is pressed in the mobile application, the LEDs that forms the shape of number 1 takes HIGH voltage through the function 'digitalWrite(,)' .
When 3 is pressed in the mobile application, the LEDs that forms the shape of number 2 takes HIGH voltage through the function 'digitalWrite(,)' and the buzz sound is heard from the buzzer.
When 4 is pressed in the mobile application, the LEDs that forms the shape of number 1 takes HIGH voltage through the function 'digitalWrite(,)'.
And finally, when 5 is pressed in the mobile application, the LEDs that forms the shape of number 1 takes HIGH voltage through the function 'digitalWrite(,)' and the buzz sound is heard from the buzzer.
After wiring the components on the breadboard and burning the code on the Arduino, I connected the Bluetooth module to the mobile phone so that I can send data to the Arduino through it.
During the sessions I tried to help my peers specially those who were in the same team I was in as there was a plenty of time to know what they are stuck in
While I was doing the EOWeek exercise in the lab , I faced a problem that the code isn't uploading to the Arduino. I asked the instructors and they explained to me that I need to remove the TX and RX wires coming from the Bluetooth module to pin 0 (RX) and pin 1 (TX) in the Arduino board. From this I understood that the usb cable supports the half duplex only.
TX and RX pins in the Arduino UNO board
Title of Media
Title of Media
Title of Media