• Decrease font size
  • Reset font size to default
  • Increase font size

Login Form

Syndication

DMV Robotics

Twitter

Follow us on Twitter @dmvrobotics
Home Projects Member Projects 3Pi Bluetooth iPhone Robot
3Pi Bluetooth iPhone Robot PDF Print E-mail
Written by Shivang Patel   
Friday, 01 January 2010 23:10
Introduction

This projected started as a desire tolearn to develop on the iPhone.Having previously integrated Palm PDAswith robots, this seemed like a natural use for the iPhone and thenew 3.0 SDK. There are a number of applications for using the iPhonewith robotics once the iPhone is able to communicate with the robot,some applications are using the accelerometers or multitouch screento control the robot, using OpenGL support for sensorvisualization, or using the iPhone as the main processor in anautonomous robot.

Unfortunately due to lack of research prior to starting the project required creating a software hack at the end.

 

Background

I had the Pololu 3Pi robot platform,figure 1, from a previous workshop and thought it would be theperfect platform for this project.The Pololu 3Pi features a AtmelATmega168 microcontroller that is compatible with the Arduinosoftware libraries, making it very simple to program.

I'm using a iPhone 2G with the 3.0firmware. The original idea for the project was to connect to the 3Pirobot using bluetooth. Since the iPhone already has bluetooth, thiswould only require adding bluetooth to the 3Pi robot. Using theBluesmirf module from Sparkfun it would be simple to add bluetooth tothe 3Pi, the Bluesmirf module abstracts the hardware layer so itlooks acts as a standard serial connection on both ends.

3Pi

Figure 1: 3Pi robot platform

 

Hardware

Figure 2 shows the parts used in thisproject, including the 3Pi with expansion board, Bluesmirf withantenna, and the Podbreakout board used to create a serial cable tothe iPhone.All the parts, except the Pololu 3Pi expansion board, waspurchased from Sparkfun.com.

 

Parts

Figure 2: Parts

 

The first task was to attachthe Bluesmirf module to the 3Pi. This required four connections -ground, Vcc, Rx and Tx. Ground and Vcc were connected to therespectable pins on the 3Pi expansion board. Tx on the Bluesmirf wasconnected to the Rx(PD0) port on the 3Pi and the Bluesmirf's Rx wasconnected to Tx(PD1) on the 3Pi. Figure 3 shows a close up of theheader and connection.

 

Bluesmirf 3Pi

Figure 3: Close up of Bluesmirf to 3Piconnection

 

I also created a serialcable (figure 4) to connect the iPhone directly to the 3Pi withoutthe need for bluetooth. Unfortunately I forgot to pick up a logiclevel converter (figure 5) so the cable did not work. The logic levelconverter is needed to convert the 5V from the 3Pi to the 3.3V usedby the iPhone. Next time I make an order to Sparkfun I'll make sureto pick up the converter and update this article.

iPhone Serial Cable

Figure 4: iPhone Serial cable

Logic Level Convertor

Figure 5: Logic Level Converter



Software

The software is brokendown into three parts, the serial code on the 3Pi, the application onthe iPhone, and a middle man application running on a laptop. Thedesired software design would be to have the iPhone create abluetooth serial connection directly to the 3Pi robot - once thisconnection has been made the iPhone and 3Pi are free to exchange dataand commands. Unfortunately the only supported bluetooth devices bythe iPhone are headsets.

Because of this I had tocreate a hack to get things working. I now have "middleman" application running on a laptop that basically creates atunnel between a network TCP socket and the bluetooth serial port.I keep the control commands on a seperate TCP port from thesensors, I did this so it would be easier to debug.

Another alternative wouldbe to add wifi directly to the 3Pi. Sparkfun sells a niceWiFi-to-Serial module for $70.http://www.sparkfun.com/commerce/product_info.php?products_id=9290

 

Videos

Here are some videos ofthe application working:

 

 

 

 

 

Figure 5: Logic Level Converter
Attachments:
Download this file (060_iPhoneRobot.zip)iPhoneRobot.zip[iPhone XCode Project]916 Kb
Download this file (060_MyMiddleMan.cpp)MyMiddleMan.cpp[Middleman Software]6 Kb
Download this file (060_serial_controller.pde)serial_controller.pde[3Pi Arduino Software]3 Kb
Last Updated on Saturday, 02 January 2010 01:42