Introduction

Download Report

Transcript Introduction

Title:
Remote control of a Robot from Laptop
using Bluetooth
Group members:
Stephen Mulryan
Anthony Conneely
Introduction
•
Control two wheeled servo motor robot
from a laptop using Bluetooth
•
Project presented two distinct tasks.
i.
i.
•
Develop java user Interface
Develop program that would run on the
microcontroller used to drive the motors
We chose a ToothPic which combines
a Bluematik radio and a PIC18LF6720
Java Interface
•
•
•
Allow user to select a port open it and then control the
robot by pressing arrow keys.
Used comm. API to do this
A JFrame is created with buttons that give the user the
options
i.
ii.
iii.
•
•
•
Select a Port
Open A Port
Control The Robot
Select A Port button opens another Port Chooser
window
User selects the Port and clicks Confirm Selection
The PortChooser window then closes
Java Interface
•
•
•
Open Port Button runs the openPort method in the
interface
It tries to open the COM port selected by the user
If the opening is successful it then sets the parameters
of the port including
i.
ii.
iii.
iv.
•
•
Baud Rate
Data Bits
Error bits
Parity bits
If all this is successful the user is shown a message
Indicating that the robot can now be controlled
Java Interface
Issues incurred
• When key is pressed a number is transmitted on the
serial Port indicating to the microcontroller which way to
move
• The output is buffered which produces a delay between
the time the key is pressed and when the microcontroller
receives the message
• So the response from the robot is not instantaneous
Microcontroller
• As was mentioned in the Introduction we chose the
Toothpic as our Microcontroller.
• We did so for the following reasons:
- It combines a PIC microcontroller with a
Bluetooth module.
- It had relatively low power consumption compared to other
devices, this is good as it runs on a battery.
- Large database of documentation on the vendors website.
- “Hello World” solutions provided by vendors which gave us a
starting point!
Microcontroller
•
•
Application was developed in C using the MPLAB
development Environment
Program checks the Bluetooth input buffer
- checks if SWI_LMTData flag is set. If set data has been received.
- *LMTRxCh is pointer to the first memory location in the input buffer.
- LMTRxAdvanceCh Removes character from the input buffer so you can check again.
•
•
•
Calls the appropriate direction function depending on
the integer value received
Motors run on 333Hz and need a duty cycle of 33%
and 66% to go forward and back
To drive the motors need to send them a square wave
signal
Microcontroller
•
•
•
Originally hoped to use PWM on the PIC, but the minimum
frequency was only 1220Hz
If you want to lower the frequency you must use the ToothPIC in
power conserving mode meaning the Bluetooth is disabled
Instead we used the analogue/digital outputs which involved
i.
ii.
iii.
•
•
Setting the pins as outputs
Setting the pins high for % of the period
Setting the pins low for remaining % of the period
Two output pins are used (one for each wheel)
Each directional function then sets the duty cycle of each signal
e.g.. When going forward both motors are set with a duty cycle of
33%
Microcontroller
Problems incurred
• We found it hard originally to download software to the
microcontroller.
• Because we could not use the PWM it made the harder
to set up the correct signals. We had to use a infinite
while loop in each motion function which was interrupted
every time new data was received on the input buffer.
This was less stable then the PWM that can be simply
switched on and off
Hardware
• We used the Scooterbot II
robot chassis as it was very
light in weight.
• We also used and opto-isolator
circuit to isolate the current
going from the battery to the
motor from the current going
from the battery to the
Toothpic.
• We used a voltage regulator to
make sure the voltage applied
to the input of the Toothpic did
not exceed 5 volts.
Opto-Isolator
This image was taken
from:
http://upload.wikimedia.
org/wikipedia/commons/
f/ff/Optocoupler_Circuit.
svg
Java 2 Micro Edition
(J2ME)
• We explored the possibility of using a mobile phone to
control the robot over a Bluetooth link.
• We researched the use of J2ME but it was late on in the
project.
• We found that the documentation was poor regarding the
use of serial ports on phones.
Possible Uses ?
• Toy cars! Why use a joystick?
• Further development could lead to a minesweeper.
- Attaching a metal detector could allow it to do this.
- Class 1 Bluetooth devices have a range of 100m. A
safe distance away from mines.
• Surveillance! Mounting a camera on this robot would
allow security guards access blind spots.
System Flow Diagram
Conclusion
•
Project was very useful in increasing our
understanding of
i.
ii.
iii.
iv.
v.
Java comm API
Building a GUI in Java
Application development in MPLAB
Potential problems that can arise like the need to send data
immediately without buffering and manually setting up PWM
The creation of phone application’s using Netbeans Integrated
Development Environment (IDE).