Instructables
Picture of Program your Arduino with an Android device!

Hi,

in this Instructable I want to show you, how you can program your Arduino with your Android device. It is very simple and cheap. Also it allows us to program our Arduino where ever we want, this is usefull for permanently installed Arduino boards, like in light controllers...

So lets get started! :)

 
Remove these adsRemove these ads by Signing Up

Step 1: Materials and Tools

Materials:

A USB-A to USB-B cable ( http://www.amazon.de/AmazonBasics-USB-2-0-Kabel-A-... )

A USB-Host cable (OTG cable) ( http://www.amazon.de/USB-OTG-Adapterkabel-Adapter-... )

An Arduino( http://de.farnell.com/ )

1 LED (for testing)

A Android device with Android 4.0.0+ (or with host aviability)

Software:

ArduinoDroid or

ArduinoCommander from the Google Play store

Step 2: The USB-Host cable

Such a USB-Host cable is basicaly just a USB cable, but just with a few changed resistors in the mikro USB plug. The internal resistors let the Android device activate the USB-Host mode, in this mode you can also use USB-Sticks or other usb applications on the device. That is very useful, now you could plug a usb-printer in.

The problem is now, that every USB device which you plug in, will now run on the energy of your device, what realy can bring the akku down.

Step 4: Arduino power up

Picture of Arduino power up

Now it should look like the connections on the picture. Also your Arduino should now power up and load the last code you uploaded. On my Arduino was the Blink sketch. If it doesn´t power up, check connections.

1-40 of 55Next »
dwfunk44755 months ago

To not drain power from phone, get one of these:

http://routerboard.com/5VUSB

plus 5V 2A supply.

Jan_Henrik (author)  dwfunk44755 months ago

Awesome, Thank you!! :)

ASCAS made it!5 months ago

Works great, awesome! This helps a lot in changing values during competitions.

1471238_615321765181154_24135764_n.jpg
Jan_Henrik (author)  ASCAS5 months ago

Nice! :)

pucksurfer2 months ago
Does it work with any otg cable? I everything up with the otg cable and the USB a to b. I hooked it up to a moto e running on kitkat 4.4.4. I didn't download the app yet. But the arduino didn't turn on(the built in LEDs didn't turn on). Is it a problem w my otg cable? Or do I need the app first?
Jan_Henrik (author)  pucksurfer2 months ago

Which device do you have, sometimes, they dont have an OTG mode or they dont turn it on... There is only 1 type of OTG kable, so that should work...

I have the moto e. it isn't a tablet but it should work with a phone right?
Jan_Henrik (author)  pucksurfer2 months ago

Yea, most new phones have OTG, but sadly the Moto E doesnt support otg :/

that's to bad, thanks for helping me
Jan_Henrik (author)  pucksurfer2 months ago

I´m realy sorry, that it doesnt work for you :(

Professzore6 months ago

It's a common mistake/misunderstanding about the LED connection to pin13. As a rule, never EVER connect an LED directly to ANY pin of Arduino, otherwise the microcontroller of your board may be killed.
There is NO resistor on Pin13 (meanwhile the on-board Pin13 LED has its own). If you put a single red LED, forward current may goes up to the maximum current of USB hosting device (your android phone or your computer). First scenario is not serious (as a phone/tablet has a very limited current capability), but with a pc, it may be almost 1 A (1000 mA). An Atmel microcontroller is limited to 400 mA overall current, a maximum of 40 mA on each pin, meanwhile 20 mA recommended to prevent overheat. If you put a simple LED on any pin without a resistor in line (serial connection), it may be driven by over 400 mA. Not a good idea.

Jan_Henrik (author)  Professzore5 months ago

pin 13 has a current limit of 20mA, this pin was made to connect a led directly :)

Take a look at the schematics:
http://arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf

Take a look at the datasheet:
http://www.atmel.com/Images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet_Complete.pdf
29.1. Absolute maximum ratings

It's your decision to brick your controller and/or LEDs.

Note: pins on the microcontroller are not constant current outputs, yet none of them are protected to overcurrent.

each pin has an internal resistor which can be enabled; see digitalwrite() second parameter.

Also see "input and output" under http://arduino.cc/en/Main/arduinoBoardUno

the official Uno has this covered. In any case, your cautioning users to use a resistor explicitly is good practice and ok especially as they may further explore electronics without the Arduino, build their own board, etc.

Yep. They're called pull-up resistors and should be used when the digital pin is set as input (normal pin state). But they have no any effect when pin is set as output. See description:

http://arduino.cc/en/Reference/DigitalWrite

and

http://arduino.cc/en/Reference/Constants

And the above mentioned datasheet of Atmel controllers (see digital I/O diagram).

I write it agan, it's your decision to brick your controller and/or LEDs.

I connect leds to I/O pins on 5v powered atmegas without limiting resistors and have never damaged a chip. Often even more than one at a time. So it's not going to "brick" your atmega328p because of the current limiting characteristic of the port which provides a max of 40ma. I wouldn't implement a final product without the limiting resistors but just for quick and easy testing it is not going to hurt anything. I have done it a lot over several years too, not just once or twice.

KidWithAHat2 months ago
I wish I could do this on a iPhone :( but cool inscrutable.
Jan_Henrik (author)  KidWithAHat2 months ago

Thank you, I will try to find an app for that :)

lazaro.pt3 months ago

Hi, i have tried both applications, with Arduino UNO R3 and Arduino Mega 2560, and nothing works, arduino boards are not detected on the apps, my phone is compatible with USB OTG cable, because i can use some USB devices, such as USB flas drives, Joystick and a mouse, and my USB OTG cable have an auxiliary USB connector for power. I have sent an email for the creator of these apps, and he said to check troubleshooting page, and i did, but it didn't help. Can anyone help me? Thank you!

Jan_Henrik (author)  lazaro.pt3 months ago

Hi, which phone and and which cables do you use, can you take some photos? :)

kschmidt25 months ago

Here's a question, I know in linux you can use the terminal to compile and send scripts to the arduino, do you think that with a terminal app (I'm talking iOS which is basically linux, which Android is a version of) you could do the same thing, possibly with the Camera connector? I'm gonna try it anyway, but I'll still ask.

FYI, IOS and Android (or Linux) are nothing alike under the hood, in terms of architecture and in development methods and in ease of accessing hardware from simple scripts. I love IOS as a user, but I'd not suggest it as a way to interact with Arduino. The exception is if you jailbreak IOS, which is more difficult with IOS 7 and few people do it.

That said, Cortado Bean (by Punch Through) holds promise of being a Bluetooth enabled Arduino which you can (eventually) program right from IOS. Don't expect the Arduino IDE to follow suit though this would be a Punch a Through paid product. (Google it, it's cool).

Well, I'm jail broken under iOS 6.x.x, that's the only way I could find a decent terminal app. so that'd help somewhat, but I don't really think an iPod would be that good for arduino programming when you can't connect keyboard to them AND the arduino at the same time, the arduino would use too much power and the fact of what you said above, not to mention I have an ODROID which I'm going to be making into a tablet soon anyway, and I have a little acer laptop, so there's two reasons more to not use an ipod.

Awesome instructable though man, the ODROID can run Android so I might try it with that some time. :D

Jan_Henrik (author)  kschmidt25 months ago

I think so, but what is the camera connector? :D

it's just an adaptor that goes from the 30-pin plug that ipods/ipads have to a USB, you can use keyboards with the ipads with them. So the arduino /Might/ work, emphasis on might.
Jan_Henrik (author)  kschmidt25 months ago

okay, I dont know much about apple products, so i cant tell, i hope that it works :)

nodcah6 months ago

Nice instructable! I have ArduinoDroid, but I didn't know Arduino Commander existed!

Also, I think the title should be "an Android", not "a Android".

its an easy rule not many know of but if the word starts with a vowel then its an AN else an A

also if it is an open sounding vowel, as you see often in abbreviations: "An NDA" (An en-dee-aa)
and of course the reverse in closed consonants: "a one time deal" (a wan-time...)

Jan_Henrik (author)  mrichardson245 months ago

Yea, i knew about it, but i failed to use it, Englisch is not my main language D:

Jan_Henrik (author)  nodcah6 months ago

Thank you and sorry, my mistake, I will change it as soon as possible :) Thank you for your support :3

nodcah Jan_Henrik6 months ago
No problem! =D
Jan_Henrik (author)  nodcah6 months ago

Changed it, Thanks :)

diy_bloke5 months ago

:-)
"Sofortly", you must be German :-)

nevertheless, nifty instructable

Jan_Henrik (author)  diy_bloke5 months ago

hehe, yes i´m German :)

Thanks! :)

Sembazuru5 months ago

I use ArduinoDroid on my ASUS Transformer tablet. It works well with my UNOr3 using the USB connector of the keyboard dock. Oh, and this combo gives me a hardware keyboard so I don't waste screen real estate with a soft keyboard.

Jan_Henrik (author)  Sembazuru5 months ago

Okay, very nice! :)

ymr-turpi5 months ago
exciting!
Jan_Henrik (author)  ymr-turpi5 months ago

Thanks :3

hemalchevli5 months ago

I think you need to upload Standard firmata sketch on arduino for the this to work.

1-40 of 55Next »