Interfacing to a PIC Microcontroller

by Jay » Mon, 28 Sep 2009 00:18:57 GMT

Sponsored Links
 I am looking into to Interfacing an Android Phone with a PIC
Microcontoller and retrieve data via the USB port.  How would I go
about doing this?  What API calls do I need to make to retrieve data
from the PIC?  And will it be easier if I were to do this via
BlueTooth instead of USB by adding a BlueTooth module to my PIC?



Interfacing to a PIC Microcontroller

by Chris Stratton » Tue, 29 Sep 2009 00:00:05 GMT


The current  android phones are  USB devices only, they do not
function as USB  hosts.  So to do this with USB, you would need a PIC
that can be a USB host.

Bluetooth probably is more practical as some progress has been made on
getting rfcom working (see the unofficial bluetooth api community

There also is/was a debug serial port on the extusb connector that
might be an option, though may require a custom kernel?

Anyone you cut it, this is a quite advanced project - not to say that
you shouldn't tackle it, but you will end up learning a lot about the
internals of android before you get it working.



Sponsored Links

Interfacing to a PIC Microcontroller

by -chew- » Fri, 09 Oct 2009 00:00:20 GMT

 Also trying to accomplish the same objective. I've been trying to
investigate other possibilities of capturing incoming USB (maybe hook
the URB's) data in Android. I know that kernel build in Android does
not support the "Enable Loadable Module Support" kernel config and it
has no USB host or OTG capabilities; just client. If possible, I don't
want to do it in kernel mode (to avoid kernel recompilation). Maybe
just a daemon to do the capturing but still no idea how.

The idea of the project is that Android phone will be attached to a
microcontroller (USB host/OTG capable). This controller will be
sending data to Android phone via USB (I still have to write USB host
controller driver for the microcontroller, though). Android phone will
the USB client. Still investigating if this could be done in adb.
Don't want to modify adb itself. Maybe just a filter to capture USB
data traffic in adb. Been scanning the codes in adb. Seems that adb is
also doing the functionality of a typical USB driver, though running
as a daemon/service. Am I right?

@Jay: Do you have any progress so far? Could you please share also
some ideas?



Interfacing to a PIC Microcontroller

by -chew- » Fri, 09 Oct 2009 14:19:34 GMT

 adb implementation seems capable of addressing this requirement. But I
guess the porting the adb host side to the controller requires a lot
of work on the Android phone's side (adb device). I'm planning to
maybe make a separate daemon that would behave like adb (maybe on the
communication protocol used), only a simpler one. I'm not sure though
whether its coexistence with adb will result to other issues.



Other Threads

1. format for progressbar drawable xml?

Does anybody know the proper format for declaring custom horizontal  
progressbar drawables in xml? I've searched and searched, but the only  
documentation/discussions I can find are for custom button graphics,  
which seem to work via a different system.

Allan Hsu <allan at counterpop dot net>


2. GridView: how to select, programmatically?

This is driving me up a wall...

I want to have a GridView, containing four icons, and I want the first 
icon to be pre-selected when the activity is opened. This wouldn't seem 
too tough, but I'm obviously blanking on how to make it work.

Some sample code:

The layout is just a GridView in a LinearLayout. The four icons 
referenced in the Java are just some random icons. They all appear nice 
in a row...just none are selected.

I have grid.setSelection(0), but it does not seem to do anything.

I have tried various ways of augmenting the code, including:

-- calling grid.requestFocus() before grid.setSelection(0)
-- calling grid.invalidate() after grid.setSelection(0)
-- calling grid.requestLayout() after grid.setSelection(0)
-- delaying the grid.setSelection(0) via postDelayed() to ensure it gets 
called after onCreate() finishes
-- putting the grid.setSelection(0) in onResume(), which is NOT what I 
want, but I'm getting desperate

The GridView selection works fine...once somebody presses the D-pad to 
navigate the four icons. The selector (stock one from Android) shows up 
quite nicely. I just want the first icon to be pre-selected, so the UI 
is consistent -- there is *always* one icon highlighted. It is the only 
widget in the layout, so there should be no question of who has the focus.

What am I doing wrong?

Thanks in advance!

Mark Murphy (a Commons Guy)
_The Busy Coder's Guide to Android Development_ Version 1.3 Published!


3. java.lang.VerifyError in Android

4. When ever i run a mail application, ANdroid emulator say sorry (process )stops unexpectedly

5. Nokia & Visa tie up...

6. Web links without showing the URL

7. Video Review of T-Mobile G1