This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use GPIO with Android
#1
Hi guys,
I am trying to use the GPIOs under Android.
First, it's difficult to know which GPIOs you can use for custom applications.
I estimated that I could carry over the RPI's available GPIO pins which physical numbers are:
7,11,12,13,15,16,18 and 22.
May be I'm wrong, thanks for correcting me if anyone knows.

I also noticed that by default, all those pins send 3.3V out as soon as the board is plugged (even after "Power OFF"), which is very strange.

On top of that, I don't know what is the Android corresponding numbers for these physical pins. I did not find any documentation about this. Personally, I think this is the base that Asus should provide.

I tried to use some OrangePI documentation too, but as I expected, it does not work.

Any help is welcome
Reply
#2
Hi again.
I finally found the Asus doc regarding the availagle GPIO and their GPIO nr:
https://tinkerboarding.co.uk/wiki/index.php?title=GPIO

I confirm that many of them send a 3.23V (GPIO.HIGH) output unless they are activated.

Large part of my confusion came from the fact that I used a defectuous relay (though I bought it new on Amazon) outputting 4.4V in the IN pin whe plugged. It gnerated strange behaviour of the GPIOs and confused me a lot until I discovered the problem.

it seems that some of the GPIOs cannot be used for custom apps. If somebody knows about that, I would appreciate some infos.
Reply
#3
hello,

you had some more success to use gpio's with android or you gave up ?

thank you
Reply
#4
(09-23-2017, 05:08 PM)rmivdc Wrote: hello,

you had some more success to use gpio's with android or you gave up ?

thank you

I ran the GPIOs with android from a remote station. Works OK.
I still have to build an app directly on the TB. As it works OK in remote, it should also be OK...but we're never 100% sure Dodgy
Reply
#5
(09-25-2017, 03:34 PM)JGX Wrote:
(09-23-2017, 05:08 PM)rmivdc Wrote: hello,

you had some more success to use gpio's with android or you gave up ?

thank you

I ran the GPIOs with android from a remote station. Works OK.
I still have to build an app directly on the TB. As it works OK in remote, it should also be OK...but we're never 100% sure Dodgy

Is it possible to share some of your work on github or here please ?
i know the gpio interface are on /dev/*something* but i don't really see how to use it in Java program...
or more simply how to echo/read/write "1" or "0" on a single gpio header..

thank you
Reply
#6
(09-26-2017, 07:56 AM)rmivdc Wrote:
(09-25-2017, 03:34 PM)JGX Wrote:
(09-23-2017, 05:08 PM)rmivdc Wrote: hello,

you had some more success to use gpio's with android or you gave up ?

thank you

I ran the GPIOs with android from a remote station. Works OK.
I still have to build an app directly on the TB. As it works OK in remote, it should also be OK...but we're never 100% sure Dodgy

Is it possible to share some of your work on github or here please ?
i know the gpio interface are on /dev/*something* but i don't really see how to use it in Java program...
or more simply how to echo/read/write "1" or "0" on a single gpio header..

thank you

I'll try to share as much as I can. But I have zero skills in Java.
As I told you I did it from a remote windows station, using ADB.
Once I was connected to my TB with ADB, I logged myself as root and folowed the procedure described hereunder.
I guess you can do the same in a Java program.

The directory where you will find the GPIO is /sys/class

What I did (for GPIO port 185):
echo 185 > /sys/class/gpio/export
cd gpio185
echo "out" > /sys/class/gpio/gpio185/direction

Then to output 3.3V on the gpio 185:
echo 0 > /sys/class/gpio/gpio185/value

To output 0V:
echo 1 > /sys/class/gpio/gpio185/value

To get the current value of the gpio (some are 3.3V by default, other 0V):
cat /sys/class/gpio/gpio185/value

I hope it will help you.
Please share you Java basic program doing the same thing.
I am trying to learn Java quickly...but it's a real pain for me and it will be a way for me to learn on a familiar exercise.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)