Sep 122006
 

Ever since Bluetooth adapters for Roombas appeared, I’ve wanted to control my Roomba with a cell phone. All my recent phones have had Bluetooth. But getting a devkit for a phone was expensive and phone-specific. Trying to develop J2ME (aka “JavaME”) applications for cell phones has been a mess, especially for non-Windows users. Thankfully, Mobile Processing wraps up the ugly details, like Processing does for normal Java. It makes writing little programs for your phone pretty easy, and makes whipping up a program to control a Roomba possible.

So here’s “RoombaCtrl”, a small Java program for your Bluetooth- and J2ME-compatible phone that works with the build-your-own Bluetooth adapter shown in the book “Hacking Roomba” or the pre-built RooTooth.

RoombaCtrl Demo

Now you can drive your Roomba with your cellphone like so:

Download

You can download RoombaCtrl compiled, ready to install:
roombactrl-1.0.jar
roombactrl-1.0.jad
The “jad” file is if you’re doing “over-the-air” (OTA) installation. Don’t worry about that though. Just grab the jar file and copy it over with Bluetooth file transfer.

You can also download the Mobile Processing source:
roombactrl-1.0-src.zip
Unzip that into your MobileProcessing sketch folder, open Mobile Processing, and choose RoombaCtrl from the available Sketches. Or if you want to see the entire source code right now:
roombactrl.pde

You’ll also need a slightly patched Mobile Processing Bluetooth library:
mobileprocessing-bluetooth-patched.zip
In the “libraries” directory of the Mobile Processing application, move the existing “bluetooth” library directory out of the way and unzip the above zipfile in its place.

Mobile Processing Bluetooth Library Patch

The patch for Mobile’s Bluetooth library is only a few lines long:
Mobile-0005-Bluetooth.patch
All the patch does is allow one to specify short UUIDs when searching for services. The standard Bluetooth Serial Port Profile (SPP) has a short UUID of 0x1101. All the Roomba Bluetooth adapters appear as normal serial ports using SPP.

This patch allows you to search for Bluetooth serial ports (instead of other Mobile Processing apps) by doing:

Bluetooth bt = new Bluetooth(this, Bluetooth.UUID_SERIALPORT);

Conceivably, you could add additional static defines for the other pre-defined Bluetooth UUIDs.

RoombaCtrl Buildling and Installation

Installing a program on a cell phone can be mysterious; some cell providers even prohibit you from downloading programs. If you have Bluetooth on your phone, installation becomes a simple file transfer.

Building MIDlets (Java applets for cell phones) can also be a little puzzling. Mobile Processing makes it easier, but it still assumes a little too much knowledge. Mobile Processing is still pretty new so perhaps as it ages it’ll get easier. Of course, it doesn’t help that Sun doesn’t make a cross-platform toolkit for developing MIDlets.

Below is a small movie showing how, if everything is configured correctly, building and installing a new Mobile Processing program on your phone can be pretty quick. It uses Mac OS X, but the techniques are the same for any OS.

Useful Links

I had a real time trying to figure out why Mobile Processing wouldn’t let me talk to Bluetooth Serial Devices. I ended up learning how to write Java MIDlets by hand. Here’s some of the links I got knowledge from:

 Posted by at 11:21 pm

  41 Responses to “RoombaCtrl: Drive your Roomba with your cell phone”

  1. On my v3i the program runs and finds my bluesmirf but never finds the serial port. Has anyone overcome this problem?

  2. Hey i was just wondering if you could help me out. I have a siemens sx66 pocketpc and im having trouble running it. It comes with a midLet manager and installer, but its not reconizing the jar file to install.

  3. Hi Dan,
    Sorry, I have no experience with WinCE devices. In my limited experience with diferent cell phones, I just sent the jar file to the phone and then ran it.

  4. Hello Tod,

    I’ve download your .jar and .jad files to my PocketPC Jasjam (HT) Running Windows Mobile 5, and when I execute your application I got an error “Invalid Java Arvhive (jar)”.

    Do you have any idea what is it?

    Thanks.

  5. No clue. I’ve not done much J2ME programming lately. You should try going to the Mobile Processing site and downloading some of the examples onto your device and see if those work.

  6. Will that work with a samsung upstage?

  7. In my experience, JAD and JAR files can be tricky sometime – what runs on one architecture may not run on another. Often this is caused by having one line in the Manifest file be incorrect for whatever architecture you are running on. This is something that only the developer of the JAD/JAR can fix. My guess is that the JAD and JAR were created using an SDK that wasn’t really geared toward developing for PocketPC or WindowsCE devices. I spent several years as a J2ME game developer, and unfortunately each architecture requires its own tweaks.

    I would love to see someone develop a BREW version of a Roomba controller as well. BREW is the C/C++ environment that runs on carriers like Verizon and AllTel, carriers where there are no Java enabled phones. In my area (San Diego), Verizon has the best quality network for voice calls, but Verizon keeps a very tight lid on the distribution of BREW applications. I think it will still be a couple years or so before BREW apps become as freely distributable as J2ME apps.

    Are there any other devices you plan to control with your Bluetooth cell phone? It might be even more fun to control your neighbors’ Roomba instead! ;-)

  8. Hey Tod. Need sum help here. I have the iRobot Create and I have an RS232 Blue-tooth adapter. Is it possible at all to configure the adapter with my create? plz… =] thanx

  9. […] can build a serial interface, bluetooth interface, gamepad interface, Wiimote interface, cellphone interface … and you can buy the vast majority of those via third-parties if you value time over money, […]

  10. […] out this hack for controlling the bluetooth Roomba with a bluetooth […]

  11. Hi man. i’ve been trying to use your mobile processing bluetooth with my nokia 6682 but. i keep having this sentence

    Unable to create MIDlet processing.core.PMIDlet
    java.lang.InstantiationException
    at com.sun.midp.midlet.MIDletState.createMIDlet(MIDletState.java:157)
    at com.sun.midp.midlet.Selector.run(Selector.java:150)

    i’ve read it’s because the midlet is abstract. but i have no idea how to fix it… please i really could use some help fixing this.

  12. Hi Zheyk,
    I’ve not done Mobile Processing or J2ME stuff in a long time so I don’t know how to fix your problem. I recommend poking around the mobile.processing.org site, especially the forum and wiki.
    Sorry I couldn’t be more help.

  13. Hi.
    About the UUID’s, i’ve tried the patch, but i can’t get it working!
    My Bluetooth module is this one – http://www.dataspherewireless.de/manufacturers/firmtech/fb755ac.htm

    The problem is, that it isn’t discovered when i’m using the SPP searching UUID, and in my Bluetooth Application on my computer, it says Undefined (00:1F:00)?? Do you know what it means?

    How can i get it working? And what is this modules UUID, as it isn’t the SPP, but it supports SPP, as i’m using the module connected to my computer as a virtual SERIAL PORT, and it works (in HyperTerminal)

    Best Regards
    Thomas Jespersen

  14. Hi Thomas,
    MobileProcessing should have the patch I mention above in it now so you shouldn’t have to apply it. But I’ve not played with MobileProcessing in a year so I don’t really have any tips for you.

  15. Ohh… :(
    I can program applications which connects to another mobile phone or a computer, but not my Bluetooth Module!!! :( :( :(

  16. […] like the creator posted the source code. Now if only I knew what to do with it. todbot blog ? Blog Archive ? RoombaCtrl: Drive your Roomba with your cell phone __________________ -When the rich wage war, it’s the poor who […]

  17. please help me with the codes for generating a Bluetooth signal when you press a key on your phone’s keypad receive these signals on your on another bluetooth phone and they should appear with tone for corresponding keypad on the other phone instantly

  18. […] sketch as explained in the first part of code is based on the Roomba hacking and ideas from a NXT Symbian project.  It uses the patched bluetooth library of Roomba project. […]

  19. Thanks you Todd for the inspiration and the code.

    Based on your work and ideas by Pedro Miguel for NXT, I have just completed code to control a 8051 robot “Robo-51”.

    The tutorial with the code can be read at:

    http://redacacia.wordpress.com/2010/09/15/controlling-a-robot-with-bluetooth-enabled-cell-phone/

    I have more projects on the blog that may interest everyone. They can be checked directly at:

    http://redacacia.wordpress.com

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)