Propeller-Android communications using debug mode

Here’s a new way to connect an Android phone and a Propeller microcontroller. It’s called the PropBridge and uses a very simple circuit with a voltage regulator, a couple of transistors, and a few resistors. The trick to this method lies in creative use of software features that already exist on Android hardware, the Android Debug Bridge (ADB). The ADB was added with development in mind, but since it provides low-level control of certain parts of these devices it was just waiting to be incorporated into a hack.

The Propeller itself uses firmware to make Android think it is one of two different externally connected hardware devices. It can act like a PC running the ADB client or it can mimic a TCP connection. There’s still plenty of room on the uC to add your own firmware, and the majority of the I/O pins are unneeded for the basic connection. Check out the video after the break for a quick overview of the system.

If you need a little help with Android programming before you’re able to use this in your own projects, check out our Android development series.

Comments

  1. multivac says:

    i was waiting for the pic to finish loading… but that was it.

  2. biozz says:

    im not a big fan of Propeller but its nice!

    i did work with communicating via bluetooth with an arduino to control a coffee maker … ill throw it up on the forums when i get time

  3. Beepboopbeep says:

    I saw this on their forums, it looks like a great way to maybe integrate one of those cheap knock off tablets with a touch screen to a microcontroller.

    I just happen to have both of these lying around!

    Thanks

  4. Note that the transistors on the schematic are just for the programming cable, the only hardware needed that doesn’t usually come with a proto board are the USB connector and the four resistors! Also, you need a 6Mhz crystal (usually propeller boards ship with 5).

  5. http://code.google.com/p/microbridge/ This guy did it first, by the way — my own solution comes from wanting to use as few external components as possible.

  6. cantido says:

    >>The ADB was added with development in mind,

    Um.. it’s been there since the start. Debugging stuff is generally part of any decent development environment..

    >>but since it provides low-level control

    Um, I don’t think it does.. unless you have a rooted phone, then you have control of stuff via the normal kernel interfaces. ADB itself is just a bridge.

    >>of certain parts of these devices
    >>it was just waiting to be incorporated
    >>into a hack.

    You could have used bluetooth.. there’s nothing special that ADB has access to that you don’t have access to from Dalvik or native code.

  7. Actually one pretty powerful thing is that even on nonrooted phones, an adb shell has permission to reboot the phone via commandline — that allows the microcontroller to watchdog the phone.

    Also, ADB uses less power than bluetooth and has less latency (and doesn’t have to share spectrum with wifi, so you can actually use all your wifi bandwidth).

  8. Finally, ADB will work on anything that has android on it. Bluetooth wasn’t really in the API until 2.2 and there’s still a lot of 1.x phones out there, plus it needs the hardware. This lets you use bluetooth for something else ;)

  9. Inopia says:

    @cantido: USB is much more reliable than BT and cheaper too in most cases. Spiritplumber used a propeller, but there are many cheap USB host enabled dev boards out there (micropendous, vinculo, fez domino, etc.) that can interface with an Android device using this protocol.

    For robotics, it’s also nice that you can provide VBUS from the main power supply (i.e. an ESC) and power the phone from it.

  10. strider_mt2k says:

    @Beepboopbeep:

    First thing I thought too.

    There are a TON of really crappy Android tablets that would make excellent hack fodder for projects like this.

  11. Inopia says:

    ps: this is a port of MicroBridge (code.google.com/p/microbridge) to the Propeller chip. MicroBridge uses an Arduino in combination with Oleg Masurov’s USB host shield (sparkfun sells these for $25). So if you already have an Arduino and just want to play around with Androidmcu connectivity, you can always go that route.

    Note that MicroBridge is C code though, no Wiring language crap :)

  12. Inopia says:

    @spiritplumber: btw, please don’t claim this as your work. You ported my code without giving proper credits and without stating that a) this is a port of another project, b) providing people with a link to said project.

    Please give people credit for their work. Saying “this guy did it first” is not the same as saying “I took this guy’s source and ported it to another platform”.

    Before MicroBridge there was no easy way to connect Android devices to microcontrollers, I put quite a bit of work into getting the ADB protocol to work correctly and all I ask is a little recognition for that.

  13. I’m not going to get into an argument about this. I understand where you’re coming from re: attribution (I’m usually on the other end of the problem), just tell me what you want the wiki to say and I’ll gladly put that there. That said if you look at the code, I had to take a different direction than microbridge. If you still feel my work derives from yours you’re welcome to feel that way and I will acommodate you, just please tell me what you want the wiki to say.

  14. Anyway if you are unhappy with the page — it’s a wiki, make an account and edit it, I don’t mind either way :)

  15. GoneLoopy says:

    @Inopia: Gees, get over yourself man! The ADB protocol is an open protocol from Google, @spiritplumber has just made that usable on a Propeller. I’m sure you did spend a lot of time making it work on an Arduino – well done – but the Propeller code doesn’t seem to follow your code to any great degree, so – to my mind – there’s been no copying here.

    @spiritplumber: Well done man, and thanks for giving us Propeller folks a wired Android link.

  16. Version 2 will have two ports, one for the phone and one for another usb device.

  17. Version 2 done.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 96,597 other followers