loading
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

Picture of 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

Picture of 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 3: Connections

Picture of Connections
IMG_6221-6.jpg
IMG_6222-7.jpg

This step is very simple and doesn´t require much text. Just plug the USB-A to USB-B cable into the female USB of the Host cable. Then plug the USB-B plug into the Arduino and the Mikro USB into the Android device.

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.

Step 5: The apps

Picture of The apps

Now your Arduino is ready to get coded, but your Android device isnt...

Lets change that!

Currently there are 2 apps which allow us to work with our Arduino via the Host mode.

To get them we have to go to the Play Store, then type into the search bar "Arduino". Now tap on "Apps", now there should be only apps. We want the apps "ArduinoDroid" and "ArduinoCommander". Install them and launch "ArduinoDroid", it has to update the IDE, that will need some time. "ArduinoCommander" should be ready promptly.

Note: We dont need both apps, i just want to show you both! :)

Step 6: ArduinoCommander by Anton Smirnov

Picture of ArduinoCommander by Anton Smirnov

Okay, the first app I want to show you is "ArduinoCommander". It is by Anton Smirnov and is for Andorid 2.2 or higher.

https://play.google.com/store/apps/details?id=name...

This app is for working with the Arduino on an Android device, you can change pins easy (directly set pins hight or low), upload sketches or read analog pins with a oscilloscope mode.

The app is easy to understand, even if the controlls are unusual. It finds the Arduino automatical and doesnt crash.

But sadly some of the functions didnt work when i tried to use them, hopefully that get fixed. Uploading a sketch worked very good!

So I would give this app 4.0 out of 5 stars :)

I want to show you short how you can connect to the Arduino:

Step 7: Step 1

Picture of Step 1

First we have to start the app, now a blue window wih 4 options should appear. As we want to connect via USB we tap on "USB-Device" (on the picture in german :) ).

Other options are:

Ethernet

Bluetooth

USB-extras

Step 8: Step 2

Picture of Step 2
IMG_6235-14.jpg

Now tap on "Autodetect", the Android device will now scann for Arduino(s) nad show them on the screen. We will pic our Arduino ( just tap on it ).

Step 9: Step 3

Picture of Step 3

After we did that the app will now show us our Arduino as a drawn animation. Normally it is colored and you can tap the pins, to change their mode. This didnt work for me, sadly i couldnt fix it for me, maybe it works for you. when you tap in the down right corner you get to the menu, where you can upload sketches from your SD-card, what works very well.

Step 10: ArduinoDroid

Picture of ArduinoDroid
IMG_6249-18.jpg

Now the seccond app, which allows us to upload sketches to our Arduino. This app is called "ArduinoDroid" and is for Android 4.2.2 or higher. It is also by Anton Smirnov!

https://play.google.com/store/apps/details?id=name...

This app is an IDE, a compiler and an uploader for Arduino, it also uses the host mode to upload sketches, which you can write directly in the app.

After you wrote a code, you can compile it with the "Lightning-Button", that needs some time, but works good.

when its compiled you can press the upload button (the to the right).

The upload should take only secconds.

After that my Arduino started the new code --> It worked very good!

For testing I used the "Blink" sketch.

Why am i talking?! here is a short video of the app compiling and uploading a sketch:

Step 11: Finishing!

Picture of Finishing!

As you just saw, it is very easy to write, compile and upload a sketch to an Arduino with an Android device.

And here a big THANK YOU to Anton Smirnov who created the apps for Android!

https://play.google.com/store/apps/developer?id=An...

Thank you for reading!

Feel free to comment and to visit my other websites!

Your Jan Henrik

www.janhenrik.org

www.facebook.com/janhenrikhemsingfotografie

1-40 of 73Next »
dwfunk44751 year ago

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

http://routerboard.com/5VUSB

plus 5V 2A supply.

Jan_Henrik (author)  dwfunk44751 year ago

Awesome, Thank you!! :)

ASCAS made it!1 year ago

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

1471238_615321765181154_24135764_n.jpg
Jan_Henrik (author)  ASCAS1 year ago

Nice! :)

MrSlehofer.4 months ago

Ok I have a bit of a problem with my arduino because its a clone with CH340G chip.

I need a suitable driver for android, do you know about any? Thanks for replies

Hi, have you solved your problem? I'm in the same situation with my dcduino, i cannot upload to board...
Hi, I still haven't solved my problem :(

Damn!!!

I'm trying android driver for ch340 that i've found here but at the moment I haven't solved too...

Jan_Henrik (author)  MrSlehofer.4 months ago

No, sorry, I dont know any drivers for android, doesnt it work with Arduino Droid?

ochâtelain1 month ago
Schöne Lösung, danke für das Tutorial.
barbarossa7894 months ago

can i use it with Arduino Due? if so, can i make the phone get the readings of a sensors and manipulate it as i want??

Jan_Henrik (author)  barbarossa7894 months ago

Not by now, but it is planned

Hi, is it possible to upload sketch in ArduinoDroid through Bluetooth?

Jan_Henrik (author)  digvijay.m.patil4 months ago

No, just via USB-OTG

diy_bloke1 year ago

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

nevertheless, nifty instructable

Jan_Henrik (author)  diy_bloke4 months ago

*late comment incoming* Thankies, I replaced it with the right term ;)

Jan_Henrik (author)  diy_bloke1 year ago

hehe, yes i´m German :)

Thanks! :)

IrfanT5 months ago

if I use the arduino mega adk r3, how to connect android to arduino using usb?

please help me. Thanks

Jan_Henrik (author)  IrfanT5 months ago

scroll up and read my Instructable ;)

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)  Professzore1 year ago

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

on all arduino board? i use mega2560.

Jan_Henrik (author)  ZakiMuslim_5 months ago

I guess so

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.

PaulD7 Professzore10 months ago

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.

ZakiMuslim_5 months ago

this apps have serial monitor? i want to see sensor value

techno man7 months ago
If your android device doesn't supports USB Host mode or OTG, you can make it into USB Host mode by following this steps:

STEP 1 : First you should root your android device.
For this find specific instructions for your model from such websites as The Unlockr.com and XDA developer forums to root your device.

STEP 2 : Once rooted,install Stick Mount app a free app from Google play store.

STEP 3 : Now connect the OTG cable ,Arduino. Check 'use by default' and tap ok when Android pops up a prompt that says 'open StickMount when this USB device is connected'.

After your device successfully mounts ,you will see a notification from StickMount that displays a message like 'Activate mounts: /sda/usbStorage/sda1' to let you know that your USB device is ready for reading or writing.

Note :( I'm not responsible for any problems /damages while rooting or using this method.Do it at your own risk)
Jan_Henrik (author)  techno man7 months ago

Awesome, Thank you! Didnt know about this possibility!

pucksurfer9 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)  pucksurfer9 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)  pucksurfer9 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)  pucksurfer9 months ago

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

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

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

lazaro.pt11 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.pt11 months ago

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

1-40 of 73Next »