the idea of my project is:
controlling on two actions (Buzzer and servo motor ) with Bluetooth module via a Graphical User Interface (GUI) (Arduino Bluetooth control)
the idea is when you press the first button the buzzer will work and make sound till you press the second button to stop it.
when you press the third button servo motor will rotate, Each press will increase the angle 10 degree until the angle =180 degree
when you press the fourth button servo motor will rotate in the opposite direction until the angle =zero.
For this assignment i used:
1-Arduino uno
2-Breadbboard
3-Jumpers
4- Buzzer
5- 2 Resistors (560 ohm, 1k ohm)
6-Servo motor
7- Bluetooth module (Hc-05)
8-Arduino software
9-Fritzing for wiring
10- Arduino Bluetooth control application
Arduino Bluetooth control
Arduino software
Servo motor
Bluetooth module Hc-05
the idea is when you press the first button the buzzer will work and make sound till you press the second button to stop it.
when you press the third button servo motor will rotate, Each press will increase the angle 10 degree until the angle =180 degree
when you press the fourth button servo motor will rotate in the opposite direction until the angle =zero.
wiring on Fritzing
Firstly, connected the Buzzer to the Breadboard ( the negative pin to the gnd and the positive pin to pin 8.
connecting the Bluetooth module, the negative pin to the gnd, vcc to the 5v, TX to the RX in Arduino, then we need to make voltage divider before connecting the RX pin to the Arduino so i put 2 resistors as shown in Figure.
connecting the servo motor with Arduino (vcc with 5v, gnd with gnd pin and the last pin to pin9)
Firstly, connected the Buzzer to the Breadboard ( the negative pin to the gnd and the positive pin to pin 8.
connecting the Bluetooth module, the negative pin to the gnd, vcc to the 5v, TX to the RX in Arduino, then we need to make voltage divider before connecting the RX pin to the Arduino so i put 2 resistors as shown in Figure.
Then, I try to write the code for this circuit and make sure it works well.
connecting the servo motor with Arduino (vcc with 5v, gnd with gnd pin and the last pin to pin9)
writing the code for this circuit and make sure it works succesfully.
char data= '0' ;
int angle = 0;
int inc = 10;
#include <Servo.h>
Servo motor ;
void setup() {
Serial.begin(9600);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
motor.attach(9);
}
void loop() {
while (Serial.available()==0);
data= Serial.read();
if (data == '1')
{
digitalWrite(8, HIGH);
}
if (data == '2')
{
digitalWrite(8, LOW);
}
if (data== '3')
{
angle += inc;
}
else if (data== '4')
{
angle -= inc;
}
if (angle <= 0 ) angle = 0;
if (angle >= 180) angle = 180;
motor.write(angle);
}
In the offline session we're divided into groups, I worked with Salma and Ahmad to make a Mini robotic arm!
3 servos motor the first in the base to rotate it, then the second in the middle, the last on in the arm.
#include<Servo.h>
Servo motor, motor2, motor3;
int angle = 0;
int angle2 = 0;
int angle3 = 0;
int inc = 10;
char serial = '0';
void setup() {
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
motor.attach(9);
motor2.attach(10);
motor3.attach(11);
Serial.begin(9600);
}
void loop() {
while (Serial.available() == 0);
serial = Serial.read();
/*************** MOTOR 1 ***************/
if (serial == '0')
{
angle += inc;
}
else if (serial == '1')
{
angle -= inc;
}
if (angle <= 0 ) angle = 0;
if (angle >= 180) angle = 180;
/*************** MOTOR 2 ***************/
if (serial == '2')
{
angle2 += inc;
}
else if (serial == '3')
{
angle2 -= inc;
}
if (angle2 <= 0 ) angle2 = 0;
else if (angle2 >= 180) angle2 = 180;
/*************** MOTOR 3 ***************/
if (serial == '4')
{
angle3 += inc;
}
else if (serial == '5')
{
angle3 -= inc;
}
if (angle3 <= 0 ) angle3 = 0;
else if (angle3 >= 180) angle3 = 180;
/*************** ًWrite angles ***************/
motor.write(angle);
motor2.write(angle2);
motor3.write(angle3);
}
Ahmad showed me how to write the code for 3 servo and how to control on them by using the app.
I couldn't deal with fritzing so i asked salma to help me in downloading.
she send me a free link to download the application.
I can't connect the Bluetooth module to the Arduino Bluetooth control APP, i didn't know what's the problem! Finally i knew that, I should connect the Bluetooth module to the mobile phone :"D
This week i know how to communicate wireless via a Bluetooth module to a PC or phone
Title of Media