Electronics - "Forknife" the Android G1 controlled robot.

Intro:
I have always been interested in working (read: playing) with embedded electronics such as iPods, the D-Link DNS-323, and most recently the really cool and inexpensive Arduino prototyping platform. With that track record it was only natural for me to switch carriers to T-Mobile when I found out about the Android OS and the G1. 3G Internet, email, video, A-GPS, accelerometers, gyroscope, wifi/bluetooth, a compass, camera, and memory expansion big enough to hold my music collection in one device? Sign me up! And it works as a phone too? Awesome.

It took around 2 months until I was finally able to use my G1. First T-Mobile sent me a DOA phone, then signed me up for the wrong plan. After making many phone calls, T-Mobile tried to fix the situation but ended up signing me up for the wrong plan again. I almost gave up at this point to perhaps get a Neo Freerunner (The open hardware really appeals to me!), but the G1 that had been taunting me all this time on my kitchen table made me press on until T-Mobile corrected everything.

When I was finally able to use the phone, the first thing I did was to root it (Why do companies like to lock you out of your own devices?) and see if it could act as a USB host. My intention here was to see if I could use the G1 as a serial console or talk with my arduino device. Unfortunately after poking around I found that while the chipset supports USB on-the-go, there was no code for this. I have also overheard that some pins required for this functionality may not be connected in the device. As a result, even if code was present, a dongle would have to be made to do anything.

I was disappointed to learn this, but decided to brainstorm other ways to communicate with the arduino since it seemed useful to be able to remotely control devices from thousands of miles away. Some ideas I came up with were:

-Invert control and use a USB host chip on the arduino to communicate with the phone. (Would require lots of coding and could be expensive.)
-Bridge the arduino with an embedded wifi/bluetooth solution and have the phone connect to this (Expensive and inefficient power-wise)
-Use audio (or light) to control the arduino (Inexpensive! Fairly simple, but only one direction)

There are many ways to send data over an audio signal. These include using FSK (Frequency-Shift Keying), PSK (Phase-Shift Keying), using tone decoder circuits, etc. The one that seemed easiest to implement to me involved using DTMF (Dual-tone multi-frequency) tones. Android already has a DTMF tone generator library, and you can buy (or salvage) DTMF decoder chips so you don't have to code much on the arduino side... although if you are feeling masochistic you could always write a fourier transform based software solution!

To see how well this idea worked I decided to build a small robot and a few applications to control it last weekend. The result of this is the Forknife Android G1 based robot, the RoboComm android application, and the RoboServ java server which I am happy to say work well. An overview of how the entire system works may be seen below.

In case others are interested in this, stuff, I have made my code for the robot, server, and android application available under the GPLv2 license. Please don't get too upset with me if the code isn't very polished.. I threw this together pretty quickly. At least I commented it! Be thankful :)

Oh, if you want to see what the robot looks like or watch a video of me controlling it take a look at the media page. Enjoy!

Not but a few minutes after I posted this someone pointed out that I could have modified Android's kernel to allow for serial over audio (gnd=gnd, rx=right, tx=left, no flow control). This would have been a better solution, but would require the kernel to be modified. I will likely play around with this next after poking further into what is required to get usb on-the-go working.

Update (3/24/09): The G1 has a serial debugger which if you disable will allow you to interact with things over 2.8v level serial communications. See the Misc section for how to build this connector.

 

Overview:


 

If you found this project interesting or helpful and have the means feel free to donate! Computers and bandwidth are expensive.

Comments to date: 2. Page 1 of 1.

Brian   guest

1:34am on Monday, January 26th, 2009

The 11-pin extended USB connector does have a TTL level serial port (Linux sees it as /dev/ttyMSM2 -- you'll need to build a kernel with the H2W driver and FIQ serial debugger disabled for it to be usable). Alternatively there's bluetooth. All of this does require some hacking below the application layer, but hey, that's why we released the source code. Have fun!

Admin:  This is exciting to hear, thanks for mentioning it! I just happen to have an rs232 chip here too. With that I should be able to hook up to just about anything with a serial port for diagnostics/configuration.

Xander   guest

12:30am on Monday, January 26th, 2009

Very clever implementation! I've been wanting to get my G1 talking to an arduino too, but was a bit stumped when it had no serial connection.

Now that I'm thinking about it, I'm not sure this would have to be a one-way communication. That special usb port on the G1 can accept incoming audio from an inline mic as well. So potentially you could have the arduino beeping back at the G1. Maybe that's what you were getting at with that last paragraph about modifying the Arduino kernel?

Keep up the good work!

Admin:  This is what I was suggesting with the last paragraph. If you are able to root your phone however, Brian's solution would be much better since it allows for flow-control.

Name:

Comments:

security image