Wednesday, 20 February 2013

Arduino for Android


Well what the heck have I been doing for the past three weeks? It seems like I've been going around and around in circles trying to research resources on the www to help me learn how to make apps for Android and so eventually develop accessory applications. Why so hard so far?

Strengths
  • Done some java before
  • 18 months of Arduino
  • Some electronics knowledge
Weaknesses
  • New to smart phones and tablet PCs
  • New to Android dev tools
  • New to Eclipse Juno 
  • New to USB protocol and Java supported classes
  • ......
So on balance it seems the weaknesses greatly outweigh the strengths, huh? Like for a lot of Silver Surfers, the mobile computing side has snook up on me. I have always had a mobile phone - I recall a huge one I had in 1990 (about the size of a briefcase and most of it was the battery).



I mostly use my now tiny featureless phone for texts and calls. I have a Dell mini with 3G that never got used over 3G, because I always used local WiFi  - a lot cheaper.

Moving on to Android


Apart from being new to all of this, the hardest part was finding out which tablets (or phones) supported Android Accessory and the ADK.

  • It isn’t just a case of getting a tablet with the correct operating system, because some hardware doesn’t support it even when the manufacturer claims it so! My cheap and cheerful tablet (<£100)  doesn’t, so beware of these.  You can build and run non-accessory apps on these of course.
  • Hardware claims by the manufacturer may be let down by the USB chip in the machine not having the correct drivers, also some of these tablets have little or no support. In fact that seems to be a symptom of the low-end Android industry
  • But they may not support future.usb and so the example code needs non-trivial modification, at least for a new starter. You need to use hardware.usb in that case.

Ok that’s the whinge over - to positive thought and actions!
I need to order a Google Nexus 7 (from Google Play) and an Arduinomega ADK By doing this I hope to reduce my unknowns. The Nexus also supports Blue Tooth, which will also come in handy when paired with a BlueSmirf module see link: Android-Arduino over BT.
So there should be cross-compatibility with most of the stuff I want to do with my Android tablet and Arduino to learn about making Android USB accessories.
Here are some websites and tutorials I used and found very helpful:
Making Android Apps in Eclipse Juno
I got the above tutorials working nicely on my low-end Tablet (ICS 4.0.3)

Very interesting post on Android and Arduino BT

Android Lectures 
This is a Chinese website but the lectures are in English. Lecture 16 and 17 are usb.hardware.
The ones below obviously didn’t work yet (need the new Tablet):
And the associated book website: http://www.duinodroid.com
I'll keep posting updates as I progress in the development of Arduino for Android.



Thursday, 14 February 2013

Remote Controlled Door-lock

Transistor-relay assembly and a solenoid

The Java ME and Android SDK learning curve is exponential and taking ages. So for fun, I'm taking time out to adapt one of my earlier projects "The remote firework firing device" . It's actually a small step to adapt the code and have the Keypad RC trigger the relay to push-and-pull a solenoid. The solenoid is the deadbolt for a door lock.

It's one of the things I love about Arduino - you can make a prototype then change the software and it becomes something else so easily!

No hardware adaption is needed on the control side, but I want to replace the eight relay board, on the receiver-side, with a single transistor-relay assembly and a solenoid. When the correct PIN number is entered on the keypad a signal is sent over RF and the receiving Arduino activates the circuit, unlocking or locking the door. See the circuit above.