:: this week we are required to Communicate wirelessly with a Smart Circuit via a Graphical User Interface (GUI) on the phone using an Arduino UNO that reads a signal from a Bluetooth module component to control an action component using Arduino C (Text Code).
the inspiration this time came from one of the projects I made with kids in a robotics course and I wanted to try it in reality with an Arduino and see what happens, I'll trust the process.
Things don't make themselves, You need some tools and smart software to be able to create your device
Software
From now on, the Tinkercad will become your new friend.
Tinkercad is used for creating digital designs that are ready to be 3D printed or to simulate electric circuits and/or code them. we will use it to simulate an electric circuit before making it in real to test wiring and avoid components burning.
Arduino IDE is used for writing code and connecting with an Arduino board to get actions done, this time we do not write code but turn the coding blocks into written code in IDE.
This week we are going to make a wireless connection by controlling within Arduino Bluetooth Control when you click a button on the app on your phone. Then, there is a signal sent to the Arduino Uno via Bluetooth communication, and the Arduino receives the signal. Then, we can program the Arduino to act based on this signal.
Electronics tools
OUTPUT: consists of seven LEDs. Each of the seven LEDs is called a segment, As each LED has two connecting pins, one called the “Anode” and the other called the “Cathode”, we use a common cathode, which means all the cathode connections of the LED segments are joined together to ground.
INPUT: can be connected to via bluetooth, and can be communicated with via serial communication. So, the RX and TX pins are important. If you do not want to use these pins, you will have to use the Software Serial library.
OUTPUT: to move things by converting signals into rotational angular velocity
jumper wires have 3 types male-male wires, male-female wires, and female-female wires. All of these connect two points to each other and make the circuit closed
to-use programmable open-source microcontroller board that can be integrated into a variety of electronic projects.
is used for building circuits, and demonstrating its action
here is the final wiring. I used a Bluetooth module as INPUT that has four terminals, one for 5V, another for Ground, and Tx connected with Rx in Arduino, Rx connected with Tx in Arduino while the servo motor has three terminals, one for 5V, another for Ground, and a third for pins. I need to light LED from 0 to 9 so I added 8 resistors to 7 segments, the resistors are 220 Ohm. Each resistor is connected to the segment and pin.
wiring shows the connection of pins :
servo motor: Pin 4
7 segment: ( A to 11) (B to 10) (C to 7) (D to 8) (E to 9) (F to 12) (G to 13)
it's an integer variable from 6 to 13 for each segment, these variables don't have the right pins, it's just arranging the number. with adding a character for Bluetooth.
I defined each pin as an output.
from the 7 segment code it functions for each number from 0 to 9, so I can replace each function with its number only
in the Void loop, I made the If function include other If function:
the 7 segment light number 0 by the default
waits for 1 sec
then If bluetooth read 1
the servo will rotate to 270 degree
waits 1 sec
and If bluetooth read 2
the servo will rotate to 180 degree
(repeated step to 9 with different servo degree)
I struggled when I chose number 1 in the app, there was no action done. with the instructor's help, we recognized that I didn't add a serial. begin (9600) in code, after adding it, the actions were done correctly.