Sei sulla pagina 1di 17

Princess Sumaya University

Embedded Systems Course Project


Arm Robot controlled by Bluetooth
Students involved: Rahma Atallah 20140310
Farah Bata 20140264
Zain Bitar 20140233
Tasneem Quniebi 20130353

Doctor: Mutaz Al-Tarawneh

1
Table of contents

I. Abstract Page 3
II. Introduction Page 3

III. Design Page 3

a. Hardware Details Page 3


b. Interface description Page 4
c. Connection scheme Page 5
d. Detailed component description Page 5
e. Code Flow chart Page 8
f. Calculations Page 9
g. Problems encountered Page 9
h. Future work Page 9

IV. Conclusion Page 10

I. Abstract
2
In this technical report we will be providing a detailed overview of
our Embedded Systems course project 2017/2018. Our Project’s name
is: Arm robot controlled by Bluetooth. Details of Hardware and
Software involved in this project will be shown in order to provide the
functionality and overview of our project.

II. Introduction
Our aim in this project is to apply what we studied in books on reality.
In our project we involved a Robot arm on a robot car whose motion
is controlled by Bluetooth using Android mobile application. This
project aims to apply Artificial Intelligence concepts that help to make
people’s life easier. Our project can be modified and evolved to
become a robot that can help disabled people in daily life tasks. In
order to have our project implemented, Software and hardware were
interfaced using the concepts we learnt in our Embedded Systems
course.

III. Design

Hardware Details:

a- Components
 Pic 16F877a
 Servo Motor MG 995
 DC motor
 Robot Arm
 H-bridge
 Battery
 Robot car
 Bluetooh HC06 Module
3
 Breadboard

b- Block Diagram:
In this Block Diagram, we provide a general overview of our project’s
interface. It starts with the mobile command that is transmitted by
Bluetooth to the pic, off to the DC motors which drive the Robot Car
or the servo motors which drive the Robot arm.

Figure 1.1: Block Diagram

4
c- Detailed component description:
- PIC 16F877a
CMOS Flash based 8-bit microcontroller from Microchip's powerful PIC®
architecture.

Pin configuration:
We have set the direction of Port B and Port D as output since our project
didn’t involve any inputs.

Pin 1 MCLR: We have connected this pin to the 5v supply from the H-
bridge to avoid any resets.
Pin 11 VDD: We have connected this pin to the 5v supply from the H-
bridge.
Pin 12 VSS: We have connected this pin to the common ground of the
circuit.
Pin 13/14 osc1/osc2: We have connected these pins to a Crystal oscillator
which has a frequency of 8 Khz. This oscillator stabilizes the PIC operation
and internal frequency.
Pin 24 Tx: We have connected this pin to the Bluetooth HC06 Module
Receiver.
Pin 25 Rx: We have connected this pin to to the Bluetooth HC06 Module
Transmitter.
Pin 29 RD6: We have connected this pin to the signal wire of the clamp
stepper motor.
Pin 30 RD7: We have connected this pin to the signal wire of the y-axis
stepper motor.
Pin 33 RB0: We have connected this pin to IN2 from H-bridge #1 for car
backside right wheel.
Pin 34 RB1: We have connected this pin to IN1 from H-bridge #1 for car
backside right wheel.
Pin 35 RB2: We have connected this pin to IN3 from H-bridge #1 for car
backside left wheel.
Pin 36 RB3: We have connected this pin to IN4 from H-bridge #1 for car
backside left wheel.
5
Pin 37 RB4: We have connected this pin to IN1 from H-bridge #2 for car
Front side right wheel.
Pin 38 RB5: We have connected this pin to IN2 from H-bridge #2 for car
Front side right wheel.
Pin 39 RB6: We have connected this pin to IN3 from the H-Bridge # 2 for
car Front side left wheel.
Pin 40 RB7: We have connected this pin to IN4 from the H-Bridge # 2 for
car Front side left wheel.

- Servo Motor MG 995

High-speed standard servo that can rotate approximately 120 degrees (60 in
each direction). In our project we have used two stepper motors. One that
was used for y-axis motion and one for the clamp open, close motion. The
servo motor input consists of three wires. One for signal from PIC, one that
is grounded to the common ground of the circuit and one that is supplied by
5v. The Frequency of the servo motor is 50 Hz with a period of 20 ms
which we provided the delays upon it.

Guided by the stepper motor Data sheet:

Weight of a single stepper motor : 55 g


Operating voltage : 4.8 V to 7.2 V
Stall torque : 8.5 kg for every cm

Servo Motor #1 (Open/Close clamp):

a- Signal Input: We have connected this Motor input wire to Port D (RD6)
and provided the signal from the PIC.
b- Ground Wire: We have connected this Motor input wire to the common
ground of our circuit.
c- Supply Wire: We have connected this Motor input wire to the Voltage
supply (5v) of our circuit.

Servo Motor #2 (y-axis motion):

6
a- Signal Input: We have connected this Motor input wire to Port D
(RD7) and provided the signal from the PIC.
b- Ground Wire: We have connected this Motor input wire to the
common ground of our circuit.
c- Supply Wire: We have connected this Motor input wire to the
Voltage supply (5v) of our circuit.

- H-bridge

An H bridge is an electronic circuit that enables a voltage to be applied


across a load in opposite direction. It allows DC motors to run forwards or
backwards.

H-bridge #1 (Backside of car):

a- IN 1: We have connected IN1 from H-bridge #1 for car backside right


wheel to RB1 in PIC.
b- IN 2: We have connected IN2 from H-bridge #1 for car backside right
wheel to RB0 in PIC.
c- OUT 1: We have connected OUT 1 to DC motor for backside of car
right wheel.
d- OUT 2: We have connected OUT 2 to DC motor for backside of car
right wheel.
e- IN 3: We have connected IN3 from H-bridge #1 for car backside left
wheel to RB2 in PIC.
f- IN 4: We have connected IN4 from H-bridge #1 for car backside left
wheel to RB3 in PIC.
g- OUT 3: We have connected OUT 3 to DC motor for backside of car left
wheel.
h- OUT 4: We have connected OUT 4 to DC motor for backside of car left
wheel.
i- VSS: We have connected the supply to H-bridge to 8v voltage supply.
j- Vs: We have connected this 5V volts supply to VDD of PIC and to VDD
of Bluetooth module HC06.
k- Ground: We have connected the ground of H-bridge to common ground
of circuit.

7
H-bridge #2 (Front side of car):

a- IN 1: We have connected IN1 from H-bridge #2 for car Front side right
wheel to RB4 in PIC.
b- IN 2: We have connected IN2 from H-bridge #2 for car Front side right
wheel to RB5 in PIC.
c- OUT 1: We have connected OUT 1 to DC motor for Front side of car
right wheel.
d- OUT 2: We have connected OUT 2 to DC motor for Front side of car
right wheel.
e- IN 3: We have connected IN3 from H-bridge #2 for car Front side left
wheel to RB6 in PIC.
f- IN 4: We have connected IN2 from H-bridge #2 for car Front side left
wheel to RB7 in PIC.
g- OUT 3: We have connected OUT 3 to DC motor for Front side of car
left wheel.
h- OUT 4: We have connected OUT 4 to DC motor for Front side of car
left wheel.
i- VSS: We have connected the supply to H-bridge to 8v voltage supply.
j- Vs: We have connected this 5V volts supply to VDD of PIC and to VDD
of Bluetooth module HC06.
k- Ground: We have connected the ground of H-bridge to common ground
of circuit.

- DC geared motor
8
A DC motor is any of a class of rotary electrical machines that converts direct
current electrical energy into mechanical energy.

Guided by the DC motor Data sheet:

Weight of a single DC motor : 67g


Operating voltage : 3V to 12 V
Motor Current : 70 mA to 250 mA
Speed : up to 170 RPM
Torque : Up to 0.8 Kg
Wheel Diameter :66mm

Right wheel Front side DC motor:


-Connected to Out1/Out2 from H-bridge #2
Left wheel Front side DC motor:
-Connected to Out 3/Out 4 from H-bridge #2
Right wheel Backside DC motor:
-Connected to Out1/Out2 from H-bridge #1
Left wheel Backside DC motor:
-Connected to Out 3/Out 4 from H-bridge #1

- Bluetooth Module HC-06


It is a Wireless transceiver with a Sensitivity (Bit error rate) that can reach
80dBm. It is considered to be run on low power consumption which made it
efficient for use in our project.

Connections:
-Pin Tx : This pin is connected to Rx of PIC.
-Pin Rx: This pin is connected to Tx of PIC.
-Pin ground: This pin is connected to common ground of circuit.
-Pin VCC: This pin is connected to the 5v supply of H-bridge.

- Arm Robot

9
We used an Arm Robot that is driven by Stepper motors. The arm we used
can achieve y-axis motion and open/close clamp motion.

- Car Robot

We used a Car Robot that is driven by four DC motors. The motion


achieved by this car was (Forwards, Backwards, Left, Right and Stop
motion.)

- Battery
We used a battery that can supply up to 12 Volts. As well as , having the
ability to supply current as much as needed by the peripherals.

d-Circuit Schematic
10
Figure 1.2: Hardware circuit schematic

11
Software Details:

We have written a code using C language on Mikro C program. The


code’s general over view is that it provides a mean of control of two
separate peripherals, that are the Robot car and Robot arm. The code
starts with initializing our variables, moving on to receiving signals
from Bluetooth interface and finally checking using if statements which
case of motion we have received. After case condition is met, it is
translated on hardware where we can see the motion involved.

- Code Flow chart:

For our code, we have put together a flow chart that interprets how the
code flows. Firstly, the user chooses whether he wants to control arm
motion or car motion. Moving on to car motion cases which are (Left,
Right, Forward, Backward and Stop) or the arm motion cases which are
(Up, Down, Open clamp, Close Clamp).

Figure 1.3: Flow chart

12
- Detailed Code Description:
13
The main Code concepts involved in the DC motor code and Servo motor
code.

For the servo motor code:


The motion in servo motors is achieved by providing delays in to the signal
input to the servo motor. We used a similar concept to PWM by providing a
logic one signal to the ports and providing a delay. By trial and error, the
delays that were optimum for our code were:

y-axis: - 0 degree was achieved by a 2.4 ms logic 1 signal from a period of


20 ms (12% duty cycle.)
- 90 degrees was achieved by a 2 ms logic 1 signal from a period of
20 ms (10% duty cycle.)

Clamp: - Open was achieved by a 0.7 ms delay from a period of 20ms (3.5%
duty cycle.)
- Close was achieved by a 2.5 ms logic one signal from a period of
20 ms (12.5% duty cycle.)

For the DC motor code:


The motion DC motors is achieved by providing a logic high signal to one of
its inputs and a logic zero to the other input of the motor.
By trial and error, the motion cases translated into Binary in Port B were as
follows:
Forward Motion : Port B=B’01100110’
Backward Motion : Port B=B’10011001’
Right Motion : Port B=B’01010101’
Left Motion : Port B=B;10101010’

14
IV. Calculations

15
V. Challenges

VI. Conclusion
This project provided us a chance to experience the hardware field of our
Embedded systems course. Engineering wise, this project helped implement
ideas that were rather difficult to be understood theoretically since some
details can only be experienced in real life hardware. As well as, we have
developed deeper understandings of data sheets and design specifications of
electronic components. This will definitely make future projects a lot easier
since this skill is highly required. From the other side, we have developed
analytical skills of tracing circuits and discovering roots of problems. Also,
Team work skills were acquired since this project was a combination of
efforts from various field.

16
17

Potrebbero piacerti anche