The objective of this week was to learn how to write an Arduino C code. Accordingly, we were asked in our assignment to design a smart device that has 2 inputs , 2 outputs in order to get used to writing the code on our own. So, I decided to make a push-up counter, its main idea is that once the chest is down it starts to count as long as it is within the range determined and each time the body enters this range it adds one to the existing number and displayed on the 7 segment.
I used Arduino IDE for coding and TinkerCad for the wiring diagram
Components used:
1-Arduino UNO board
2-Buzzer (first output)
3-Bluetooth Module (first input)
4- 7 Resistances 1kohm
5-Jumper wires
6- Seven Segment (second output)
7-Ultrasonic sensor (second input)
The wiring diagram
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)
Ultrasonic Sensor:
Trigger--> on Arduino pin 4
Echo--> on Arduino pin 3
VCC terminal--> +5v
Ground terminal-->GND
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
After wiring the components on the breadboard and burning the code on the Arduino, I connected the Bluetooth module to the mobile phone. The Bluetooth module here played the role of a wireless on/off switch, were by sending '0' the device isn't activated and indication for this appears from the buzzer sound that buzzes once '0' is sent. When '1' is sent this indicates that the device is starting to function its required role. When the body is outside the range specified for it, even if 1 is pressed no counting is done and the 7 segment doesn't display anything. Once the body enters the range, it starts to count until the body goes out from the range again.
This week I had a problem with my Arduino board, each time I tried to upload the code on it a message appeared on the ide compiling console notifying me that the code couldn't be uploaded. I doubted a lot of things and started to check one by one in order to know from where the error was. After a lot of checking and troubleshooting I had only 2 scenarios left, either the problem comes from the microcontroller itself and it has burned or that there is a problem with the port or anything like that . Although I doubted the whole issue was due to the microcontroller but I needed a way that proves beyond a shadow of a doubt. I discussed the issue with the team and the instructor and they all tried to help with different suggestions about what can I do to figure out the reason of the problem. At the end of the discussion the instructor really helped me a lot by giving me a way called 'looping-back' in which a group of instructions is done to ensure that there is no problems in the serial communication between the laptop and the board. I followed the steps and unfortunately the microcontroller was burned.
Before using the 7 segment in this week task, I wanted to know either its common anode or common cathode, but I forget how to do it. So, I had to pause and go back to a tutorial that illustrates how to do it. I watched this video and so I knew it was common cathode 7 segment.
Title of Media
Title of Media
Title of Media