Professional Documents
Culture Documents
Step 7: Load the Cellbots program on the Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Step 8: Run the whole process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
http://www.instructables.com/id/Android-G1-Serial-To-Arduino/
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.
http://www.instructables.com/id/Android-G1-Serial-To-Arduino/
Image Notes 1. Freeduino SB 2. Breadboard 3. HTC USB and phone off screen in this direction
Image Notes 1. This goes to pin 8 on the HTC USB board 2. Goes to pin 8 ground on HTC USB board 3. 5v power to the Arduino is at the other end of the breadboard and not in this picture 4. 5v Power 5. Jump pins 2 and 3 together 6. Connects to the RX pin 0 on the Arduino 7. Ground 8. Connects to ground on the Arduino at the other end of the breadboard out of this picture
Image Notes 1. These two are not used during this tutorial but I used them when testing serial to USB from the other linked instructable 2. Pins 7 and 8 are used to connect to your breadboard
http://www.instructables.com/id/Android-G1-Serial-To-Arduino/
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.
Image Notes 1. The TX0 pin of the HTC USB board connects here 2. Connect these two togther 3. This does to the RX pin 0 on the Arduino 4. Connect to ground 5. Connect to the 5v power from the Arduino
Image Notes 1. You can scan this with a barcode reader to download the apk file. Or go to the official project site.
http://www.instructables.com/id/Android-G1-Serial-To-Arduino/
Image Notes 1. Use ddms from the Android SDK to take screen shots from your phone (among other tricks) 2. Use adb shell from the Android SDK to execute commands from the PC instead of typing them into the phone. 3. I used PuTTY on Windows to telnet into the phone.
Image Notes 1. We use the Android Dev Phone 1, also known as the G1 in this tutorial but ADP2 should also work in theory.
http://www.instructables.com/id/Android-G1-Serial-To-Arduino/
Then you can run the Python script from the Android Scripting edit in the next step and it will have access to send serial output.
Image Notes 1. We use the Android Dev Phone 1, also known as the G1 in this tutorial but ADP2 should also work in theory.
Image Notes 1. If you don't see this the phone does not have serial out enabled.
http://www.instructables.com/id/Android-G1-Serial-To-Arduino/
Image Notes 1. You can scan this with a barcode reader to download the apk file. Or go to the official project site.
Step 4: Copy and run the cellbot.py script to launch the Python program
This tutorial uses a Python script to be the "brains" of the robot. Get the latest code from our open source Google Code project . You only need the cellbot.py file but others may help with various things you want to explore. I simply plugged the phone into my PC's USB connection and mounted the drive before copying the file to /sdcard/ase/scripts. The program creates an open socket connection to accept an incoming telnet session. It also prints the received commands to the screen while sending them out the serial port. Put this file on the phone's SD card in the /ase/scripts/ directory. Detailed steps to load and run the scripts: 1. Copy the cellbot.py script to the SD card's /ase/scripts/ directory 2. Be sure to dismount the SD card from your PC if you copied them that way since the phone can't access the files at the same time your PC is. 3. Open the Android Scripting Environment app 4. Click on cellbot.py to launch it You should see a confirmation that the device is ready at this point to accept incoming telnet sessions on port 9002. Tip: Be sure to run the "chmod 777 /dev/ttyMSM2" command from step #3 first. See step #5 for finding the phone's IP address.
Image Notes 1. This is where the received commands get sent out the serial port
http://www.instructables.com/id/Android-G1-Serial-To-Arduino/
http://www.instructables.com/id/Android-G1-Serial-To-Arduino/
5. Use a wire to connect pin 2 and 3 of the chip 6. Connect pin 4 of the chip to the Arduino RX point (pin 0 on the Freeduino SB and Arduino Duemilanove) 7. Connect pin 7 (GND) on the chip to the ground for your breadboard (which also connects to the Arduino ground) 8. Connect pin 14 (VCC) to the 5v power on your breadboard (which gets the power from the Arduino 5v output) You should now be ready to plug in the HTC USB break-out board into the bottom of the phone and power on the Arduino. Check for sparks and smells and touch things to make sure they are cool. Note: The current cellbot code turns on LED #13 when the servo motors of the robot should be running. If you don't have a robot yet you can check to see that the LED turns on and off to confirm it is working.
Image Notes 1. This goes to pin 8 on the HTC USB board 2. Goes to pin 8 ground on HTC USB board 3. 5v power to the Arduino is at the other end of the breadboard and not in this picture 4. 5v Power 5. Jump pins 2 and 3 together 6. Connects to the RX pin 0 on the Arduino 7. Ground 8. Connects to ground on the Arduino at the other end of the breadboard out of this picture
Image Notes 1. These two are not used during this tutorial but I used them when testing serial to USB from the other linked instructable 2. Pins 7 and 8 are used to connect to your breadboard
http://www.instructables.com/id/Android-G1-Serial-To-Arduino/
Image Notes 1. Freeduino SB 2. Breadboard 3. HTC USB and phone off screen in this direction
Image Notes 1. 5v power 2. Ground 3. Connects to pin 4 on 74LS04 chip 4. Optional - connects to external LED but the onboard LED would suffice for this tutorial. 5. I'm using external 9V power but you could use another voltage in the Arduino's 7-12v range, or use power over USB (but that doesn't demonstrate the coolness of being disconnected from the PC) 6. USB plugged in during this picture but unplugged when fully running.
Image Notes 1. The TX0 pin of the HTC USB board connects here 2. Connect these two togther 3. This does to the RX pin 0 on the Arduino 4. Connect to ground 5. Connect to the 5v power from the Arduino
http://www.instructables.com/id/Android-G1-Serial-To-Arduino/
Image Notes 1. You should be able to control the LED from the Arduino serial monitor without having the phone plugged in. Image Notes 1. Type commands in here to test sending ASCII characters over serial to the Arduino
http://www.instructables.com/id/Android-G1-Serial-To-Arduino/
Image Notes 1. Use ddms from the Android SDK to take screen shots from your phone (among other tricks) 2. Use adb shell from the Android SDK to execute commands from the PC instead of typing them into the phone. 3. I used PuTTY on Windows to telnet into the phone.
Related Instructables
Android G1 Dance Pad with Serial to USB Color LED using Cable by Arduino by macpoddotnet woshialex
http://www.instructables.com/id/Android-G1-Serial-To-Arduino/
Comments
20 comments Add Comment
mertaxoy says:
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 REPLY 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 Dec 12, 2010. 7:56 PM REPLY 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.
Chowmix12 says:
wareneutron says:
it not goes nothing?
radhoo says:
Nov 1, 2010. 4:14 PM REPLY 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:
Can I buy a kit?
wenjiun says:
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:
COOL!I wanna try it!
christian2gothic says:
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 says:
We typically test with phones that have no SIM card and use wi-fi for local communications.
christian2gothic says:
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 says:
Mar 30, 2010. 11:21 AM REPLY 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.
http://www.instructables.com/id/Android-G1-Serial-To-Arduino/
captFuture says:
Jan 27, 2010. 7:43 AM REPLY 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 says:
Jan 28, 2010. 1:36 AM REPLY 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 says:
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 says:
but you need the serialport dll..... can you send me?? i can't compile it!!! (rice103@gmail.com)
mranalytical says:
Mar 1, 2010. 9:06 AM REPLY 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 REPLY 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 ^_^)
Jorad says:
That is pretty awesome.... perhaps programming on the android to the arduino is on the horizon?
mranalytical says:
Jan 26, 2010. 2:34 PM REPLY 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.
http://www.instructables.com/id/Android-G1-Serial-To-Arduino/