I have been inspired by controlling Arduino's components via smart phone Bluetooth module in addition to sending data.
Software Tools:
Tinker CAD: to build the virtual circuit
Arduino IDE: to upload the code to the Arduino board
Arduino Bluetooth Control mobile app: to communicate wirelessly to the Bluetooth module
TinkerCad
Arduino
Arduino BlueControl mobile App
BreadBoard
Servo Motor
HC06
Wires
Arduino Uno
Electric Components:
Breadboard, wires to connect the component
1 servo motor
Buzzer
Bluetooth module: for the wireless communication
Arduino Uno: to read the input wireless signals from the Bluetooth module, and control the action components
1- Circuit main power supply:
I used Arduino 5v output and connected it to
breadboard (+,-) terminals to feed all other components
2- Bluetooth module:
Will communicate with the mobile application (INPUT)
Receive commands from the paired mobile
Transmit these data to Arduino
3- Bluetooth module wiring:
Its VCC is connected to breadboard + terminal
Its GND is connected to breadboard - terminal
Its Tx pin is connected to Arduino Rx pin
Its Rx pin is connected to Arduino Tx pin
4- Servo Motor (OUTPUT)
Its VCC is connected to breadboard + terminal
Its GND is connected to breadboard - terminal
Its signal pin is attached to Arduino
5- Buzzer (OUTPUT)
Its + terminal is connected to Arduino pin OUTPUT
Its GND is connected to breadboard - terminal
1- Circuit main power supply:
I used Arduino 5v output and connected it to breadboard (+,-) terminals to feed all other components
2- Bluetooth module:
Will communicate with the mobile application (INPUT)
Receive commands from the paired mobile
Transmit these data to Arduino
3- Bluetooth module wiring:
Its VCC is connected to breadboard + terminal
Its GND is connected to breadboard - terminal
Its Tx pin is connected to Arduino Rx pin
Its Rx pin is connected to Arduino Tx pin
4- Servo Motor (OUTPUT)
Its VCC is connected to breadboard + terminal
Its GND is connected to breadboard - terminal
Its signal pin is attached to Arduino (pin 10)
5- Buzzer (OUTPUT)
Its + terminal is connected to Arduino (pin 13)
Its GND is connected to breadboard - terminal
A- Includes and declaration
1- Include library of servo motor , that has customize functions related to servo
2- Define variable to store data received from Bluetooth
3- Assign pin 13 to the buzzer
4-Create instance from servo
5- Declare variable for servo position
6- Start serial communication and set baud rate
7- Attach servo to pin 10
8- Set servo initial position to 0
9- Set pin 13 as OUTPUT for Buzzer
B- Main Code
1- as long as Bluetooth module is available
Read serial data and store it in a variable named "incomingData"
2- If Mobile application send 1 ( in other words, if Arduino received 1)
Buzzer will be activated
Servo will move to position 5
3- If Mobile application send 0 ( in other words, if Arduino received 0)
Buzzer will be deactivated
Servo will move to position 10
First time to work with Bluetooth and serial communication and I was confused about Tx and Rx and how to connect them.
While testing the project , the data was not received by Arduino and the code was not working.
after many trails, I found that the Tx of Bluetooth is connected to Arduino TX , and Rx of Bluetooth is connected to Arduino RX.
Once I swapped the two wires, the code was working.
Now it is clear for me that the transmit of Bluetooth is the receive of the Arduino and vice verse.