Android G1 Serial To Arduino Robot

 by mranalytical
tank.jpg
2010-01-24 22.11.48.jpg
2010-01-24 22.13.01.jpg
2010-01-24 22.15.10.jpg
Learn how your Android cell phone can control a robot using an Arduino board. The phone takes commands via telnet from another phone or a PC, so you can control the robot remotely. This project will not otherwise modify the G1 so you can continue using it as your normal phone after undocking it.

Why?
By using cheap electronic components such as Arduino boards, you can pair them with your $400 phone to make an awesome robot. It would cost hundreds of dollars to add GPS, LCD's, motion sensors, wi-fi, cellular connections, speakers, and more to a hobby bot, but your phone already has these!




Together, the Android G1 and Arduino board allow you to use inexpensive electronics such as simple servos and sensors, to build powerful devices such as robots, remote telepresence, or fun toys for kids. More information at Cellbots.com.

Notice: This project currently requires an Android G1 with root access to use serial output from the phone to the Arduino robot. You can add a $20 BlueTooth module to your Arduino board to have the phone talk to it over serial BlueTooth if you want to use the commercial Android software.

Special thanks: We have the Hacker Dojo in Mountain View, CA to thank for putting us in touch, helping with some tricky issues via their mailing list of awesome members, and for having 74LS04 chips in stock. Most of the assembly was done at the Tech Shop in Menlo Park.
 
Remove these adsRemove these ads by Signing Up

Step 1: Items needed

sdk-large.png
74LS04.jpg
ddms adb shell putty.jpg
devphone-large.png
cyanogenlogo.png
 To complete this tutorial you will need the following:

Hardware:
- Android G1 Dev Phone (or other Android device with root access and serial output)
- Arduino (I'm using a Freeduino SB but any one should do)
- 3.3v to 5v converter if you aren't using a 3.3v Arduino (I'm using a 74LS04 chip for under $1 but other options are available)
- HTC USB break-out board for the G1
- Soldering equipment for two quick connections
- A robot body with micro servos (cardboard, acrylic, treads, wheels, anything will do)

Software:
- Android Scripting Environment (ASE)
- Telnet client for your PC (I'm using PuTTY on Windows)
- Arduino development environment
- (optional) Serial client for your PC (I'm also using PuTTY on Windows for this)
- (optional) Android SDK

If you can follow instructions you can complete this tutorial with little knowledge of Python, Arduino, Android, or electronics. You'll want to know those things if you want to go beyond a blinking LED but this will get you started.
lok.khanal says: Apr 24, 2013. 12:40 AM
I want to try this but don't have much ideas on coding for this kind. anybody can help me out? I am new so just little help would be great.
jeffhorton says: Nov 29, 2012. 8:34 AM
Ok.. Cellbot.py is running on HTC Thunderbolt.. BUT it freezes phone when telnet connection made from computer. Any ideas?
ilhaminspire says: Nov 24, 2012. 3:58 PM
Awesome ! :D
I'll try it with my Samsung Galaxy Mini. Many thanks !
jeffhorton says: Nov 19, 2012. 11:28 AM
Hello,
I am trying to use an HTC Thunderbolt with my Arduino project. I have rooted the phone, I have cellbot.py running on the phone. But when I try to send a command to the Arduino, the phone freezes up. The command is never relayed to the Arduino. Any suggestions on how to cure this. I read in another blog that multithreading the python program will help. Not sure if that is true. I am not that familiar with Python. I am trying to learn multithreading on python now. Am I wasting my time?
Much thanks in advanced.
vince086 says: Oct 22, 2012. 10:44 AM
Can't seem to get "chmod 777 /dev/ttyMSM2" to work.
Keep getting "Operation not permitted".

I am rooted and running Cyanogenmod 6.1.0 on my G1.

Would love to get this working for a personal project.
asmuransyah says: Sep 18, 2012. 8:45 PM
Hi??? this project can use android experia 10 mini pro???
shaijalmusthafa says: Jul 22, 2012. 7:56 AM
it looks nice sir,,we would like to implement this project...from wher we can get the components for this project?
sdfgeoff says: Apr 8, 2012. 11:23 PM
Do you have to have the arduino at all?
Could you not just have the phone do all the processing (after all, they do have pretty good processors) and have the micro-controller just relay the commands to the motors etc,
haroonbms says: Apr 7, 2012. 11:48 AM
my android phone doesn't have serial port. Can i use a usb to srial converter to
connect it to the arduino... please reply
sdfgeoff in reply to haroonbmsApr 8, 2012. 10:55 PM
No android phone has a direct serial port, heck, I don't think you can buy a proper computer with a serial port anymore.
What some android phones do have is the usb port used for connection to a computer, can be used the other way by the phone. This means that you take a special plug (the HTC usb break-out board) that lets your phone talk to a micro-controller.

So google your phone and see it if has a "proper" usb port. Mine doesn't, and I think they are quite rare, but you may be lucky.

(I think, someone correct me if I'm wrong)
haroonbms says: Mar 29, 2012. 8:12 AM
i have a samsung galaxy y s5360. how to connect this phone serially to robot. is it hrough usb data cable.. i desprately want to this project.. please provide with a solution.
Kryptonite says: Mar 2, 2012. 4:03 AM
This is brilliant, I plan to do a similar thing though have it controlled via the left and right channels of the headphone jack. It's not an original idea, though it's certainly an easy way out.
techmind48 says: Sep 26, 2011. 5:32 AM
I have HTC Wildfire Android mobile.

Is it possible to built with this phone?

A. S. Bhasker Raj
Secunderabad
India
Mobile: +919247332574
mahendar says: Sep 23, 2011. 3:41 AM
i don't see /dev/ttyMSM2 on my phone. It is rooted though. what can I do?
Rendydevara says: Aug 16, 2011. 3:44 AM
how did you connect android to arduino ? using serial ttl ?
does android has a serial ttl port ?

sorry, because i only have symbian s60 5th
bsoares says: Apr 23, 2011. 2:07 PM
great work!
ynk06 says: Mar 27, 2011. 9:42 PM
Nice Project! i think i will build this!

But just got a question before i build that

1) i just have a look on the datasheet of 74ls74, isnt that the 74ls04 have a output level of 3.3v but not 5v???So are we converting 3.3v(from phone) to 3.3v(to aridno) agian using the 74ls04?

2) And will G3 and upper version not works with that? since they are using the standard usb again and separate the audio(tx) + Switch(rx) pin to an 3.5mm jack ?

Thank You
peterkaptein says: Mar 24, 2011. 7:11 AM
Beginning of 2011 inopiaaardbei made a solution called: "Microbridge" using the Arduino USB host bridge and wrote the software to use the Android Debug Bridge to communicate from and to the Arduino.

See more here - http://wp.me/pCAFq-h5. Links to his google code solution are in the post.

A direct link to the google code repository is here: http://code.google.com/p/microbridge/
mertaxoy says: Feb 5, 2011. 4:10 AM
is it possible with HTC Wildfire. Wildfire has another USB break-out.. Can you please help me about this.,
rex358 says: Dec 14, 2010. 4:15 AM
hey, can i run my camera app that i have built using the ecclipse , the same time when this appp on python is running....illl be glad if some body helps me on this
Chowmix12 says: Dec 12, 2010. 7:56 PM
For the newer generations of android electronics (phones and tablets) including the Droid. They come with USB host already built in> Could i use the same programing cable for my arduino to connect to an android tablet? If i did, what app would i need to accomplish a serial port to the arduino?

Chow.
Waren-Neutron says: Nov 26, 2010. 12:37 AM
it not goes nothing?
radhoo says: Nov 1, 2010. 4:14 PM
One of my last projects was a 4x4 differential drone, built from scratch, remotely controlled via Bluetooth using an Android smartphone.
Schematics / demo video here: http://www.pocketmagic.net/?p=1398
Besides ultrasonic sensors, the robot is about to be equipped with a homemade geiger counter sensor to detect "exotic" environment parameters
like the dangerous ionizing radiation. There are quite a few possibilities since the robot has an ATmega microcontroller that can easily
support additional sensors.
The data is sent back to the Android device, via bluetooth.
carterson2 says: Jul 25, 2010. 7:23 PM
Can I buy a kit?
wenjiun says: Apr 3, 2010. 5:58 AM
You can also choose the latest Super D 1.10.2 as well while older version 1.9.3 does not support the feature.
roadog says: Apr 2, 2010. 1:53 AM
COOL!I wanna try it! 
christian2gothic says: Mar 27, 2010. 8:49 PM
is it necessary for the phone on the bot to have service turned on??

are there ways to control the bot through satellite instead of using cellphone service. that way you wouldn't be dependent on a service.

Is there any way to bypass the use of cell phone towers all together???
mranalytical (author) in reply to christian2gothicMar 28, 2010. 6:28 PM
 We typically test with phones that have no SIM card and use wi-fi for local communications.
christian2gothic in reply to mranalyticalMar 28, 2010. 7:51 PM
what if you wanted the bot to travel across several states?

and i've been looking into flying bots, it's been hard to find anything here on instructables.

how hard is it to send live video and sound feed from the bot to your PC??

i'm trying to gather info for a different project i'm working on??
mranalytical (author) in reply to christian2gothicMar 30, 2010. 11:21 AM
 We just added XMPP support so as long as the phone has a data connection (any kind will do), you can command it from anywhere.

Feel free to start a thread here with ideas: http://groups.google.com/group/cellbots
captFuture says: Jan 27, 2010. 7:43 AM
Thanks for this nice Tutorial - I can confirm that the latest kernels of Cyanogen have Serial enabled. (I'm personally using a HTC Magic - not a G1)

I did a bit of research as well and found out that Arduino sees 3,3V from the Phone as valid "high" state, so you would not need the 74LS04 in between for sending the data to the arduino.
This is of course different in the other direction - there you have to reduce from 5V to 3,3V :)

Cheers
mranalytical (author) in reply to captFutureJan 28, 2010. 1:36 AM
Great find captFuture. I'll update the instructable to reflect that. Still trying to get two-way working but the issue isn't hardware so much as making an incoming serial socket using Python when pySerial isn't in ASE.
captFuture in reply to mranalyticalJan 29, 2010. 3:39 AM
 Maybe it would be an option to do it in java - some guys are developing a serialport API for the SDK.

code.google.com/p/android-serialport-api/



rice103 in reply to captFutureMar 1, 2010. 5:16 AM
 but you need the serialport dll..... can you send me?? i can't compile it!!! (rice103@gmail.com)
mranalytical (author) in reply to rice103Mar 1, 2010. 9:06 AM
 You'll have to reach out to the Android Serialport API project team for the code they are using. My work has been using Python on Android via the Android Sripting Environment.
tim_programmer says: Jan 27, 2010. 5:49 AM
Good to see someone else looking at this... I'm planning on interfacing to an AVR soon for a couple of projects soon (one is a universal IR remote - sending serial commands to the AVR which flashes an IR LED... the other involves the USB host support on the AT90USB1287.. but that ones a secret ^_^)
TheBestJohn says: Jan 26, 2010. 12:57 AM
 That is pretty awesome.... perhaps programming on the android to the arduino is on the horizon?
mranalytical (author) in reply to TheBestJohnJan 26, 2010. 2:34 PM
 That could certainly be possible. If not programming on the phone it would certainly be nice to send new programs remotely to it instead of plugging it in each time.

Glad you like the tutorial and hope you make something cool with it.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!