Category Archives: Arduino

Using standard Arduino board as Google’s ADK kit

When Google announced about the Open Accessory Development kit (ADK) in the last Google IO conference, I was really excited since it was based on Arduino boards.

But after the initial bliss went off, I was disappointed for two reasons. First you need an Android phone running Android version 2.3.4 or above. The second reason is that the original ADK kit is not compatible with the plain Arduino board. The downside of this is that all your existing Arduino Shields will not work with that board and not to mention you have to buy a rather expensive ADK kit. Now there is also an Arduino compatible ADK kit, but it is again expensive and it didn’t made sense for me to buy another Arduino board when I already had a bunch of them lying around.

Since it is based on Oleg’s USB Host Shield, I was trying to see if I can build a board with just plain Arduino board and Oleg’s USB Host Shield. It turns out it is possible and with the release of Oleg’s second version of the USB Host Library, it is much simpler.

Things you need

Any Arduino board.

You can use either UNO or Duemilanove. You can also use Arduino Mega, if you have one lying around. The advantage of using Mega is that you will have additional I/O pins.

USB Host Shield

You need a USB Host shield for Arduino. You can use the original shield by Oleg for $40, or you can buy a cheaper clone from sparkfun for $25. I recommend the original one by Oleg, since it doesn’t need an external power supply. If you are going to use Sparkfun’s version you need an external power supply. Also make sure you don’t buy the older version of Sparkfun shield. It has pins marked wrongly and you need to make changes to the library to make it work.

ADK compatible Android phone

You need an Android Phone which is ADK compatible, which means you need a phone which is running 2.3.4 or above. I tested this setup in Nexus S and it is working properly.

Sensors, LED’s, buttons

You would need additional sensors, LEDs or buttons to test the flow. To start with, you can just use some LED’s


Stack the USB Host shield on top of the Arduino board. Connect an LED on pin number 3. Connect your phone’s cable to the USB port of the shield.

Arduino Firmware

Download v2 of the USB Host Shield Library and place it in the library folder of your Arduino setup. Open the demokit_20 example sketch from the /examples folder and upload it to your Arduino board.

Android App

The Android demo app for ADK, can be found under the /app folder of the ADK package. Upload the app to your Android phone.

Testing it

Power on Arduino and connect your Android phone to the other side of the cable. You should see a dialog box, which asks you whether you want to launch the app. Click yes. Once the app is launched you can control the LED connected on pin 3, by moving the slider in the Android app.

Now enjoy your new cheaper ADK kit 😉

Posted in Android/Java, Arduino | Tagged , , , | 17 Comments

Hardware hacking in Yahoo Open hackday

The annual Yahoo Open Hack day is back and this year it is going to happen on 30th and 31st of July.

This hackday is special for me, for a couple of reasons.

First and foremost, I am going to see my idol Douglas Crockford in person 🙂 He is one of the reasons why I started loving JavaScript and I am really excited about meeting him in person and to listen to his talk.

Update: Here are the photos

Me and Doug

Me and Doug

And the second reason is that, we are going to have hardware hacks during the event. Yes you read it right 🙂 This time we are planning to have tech talks about hardware and let people do hardware hacks as well.

Regular readers of my blog would know that I hack around hardware (especially Arduino) as a hobby and you could understand my excitement.

I am also going to give a talk on Arduino and Android ADK and will be demoing some of the hacks which I have created using them.

If this hasn’t convinced you, then there is more. Yahoo is also going to sponsor 50% price for the hardware that you need for hacking. Yes, you read it right again. 😉 We have arranged this offer with 9 Circuits.  Head over to the Open hackday wiki to get more details about it.

See you guys at Open Hack day next weekend.


My Slides

Open hack 2011-hardware-hacks from Sudar Muthu

More information

Posted in Arduino, Events/Conferences, Google/Yahoo | Tagged , , , | 14 Comments

JoystickShield Library for Arduino

I recently bought the JoystickShield for Arduino from Sparkfun and after playing around with it for a while, I realized that we don’t have a good Arduino library to interface with the JoystickShield. As it always happens with me, I ended up creating one 🙂


The library supports the following events

  • All 8 directions of Joystick. (Up, RightUp, Right, RightDown, Down, LeftDown, Left and LeftUp)
  • Joystick button press
  • All 4 button press (Up, Right, Down, Left)

JavaScript influence

While designing the interface for the library, my JavaScript skills influenced me and I have added callback function support for all the events, in addition to the normal mode.

If you are wondering how I added support for callbacks in C/C++, then the answer is that I implemented them using function pointers. I would probably write an article explaining about it when I find some time. Meanwhile you can check the source code or check out the callback example sketch to find out how to use them.

More details and Download

You can find more details about the library at its homepage and can download it from github account. There are also examples in the /examples directory from which you can find out how to use the library in both the modes.

Try it out and let me know if you have any feedback/comments.

PS: BTW this is my first Arduino based library 🙂

Posted in Arduino | Tagged , , , | Leave a comment

iAndroidRemote – Control your Android phone using Apple Remote

Long time readers of my blog, would know that I hack around Arduino. Couple of days ago, I was playing around with Arduino while listening to music from my Android phone. I wanted to increase the volume of the song that was playing.

At that moment an idea struck me and I thought it would be cool if I can control the volume using some kind of remote. I opened my bag and found an old Apple remote.

Couple of hours later, I was continuing hacking around Arduino, listening to music from my Android phone, but now if I had to change the volume or change the track, I don’t have to reach for my phone, I can do it using my Apple remote itself 😉


If you want to know more about how I did it, or want to try it out yourself, then head over to the project page, where I describe the entire process including the schematics and the source code for both Arduino and Android that I am using.

Try it out and let me know how it works for you. Happy hacking 😉

Posted in Android/Java, Arduino | Tagged , , | 5 Comments

Making Arduino talk with Android using Amarino

Last week, I gave a talk + demo about using Amarino to make both Arduino and Android talk to each other in Bangalore Open source Hardware meetup

I have uploaded the slides which I used for the talk to my slideshare account and you can download it from there or view them here.

Making arduino-talk-with-android-using-amarino from Sudar Muthu

The slide also includes the schematic diagram for the circuit which I used for the demo. The source code that I used for the demo can be downloaded from the below links

Posted in Android/Java, Arduino, Events/Conferences | Tagged , , , | 3 Comments