GPIO access in Android Environment

I am working on DB410c.And want to access GPIO thought android application.Is it possible to do it by using Android NDK??
or I should use another method for accessing GPIO of Dragonboard410c in Android Environment.

Thanks in Advance.

Hi kamble,

Please refer to previous threads related to this topic:
GPIO access in Android via NDK,
How to access GPIO? android, linux or windows?,,


Thank you vchong,
but I am unable to access net.calit2.mooc.iot_db410c:db410c_gpiolib library in my application.Do you know any tutorials on it?

thanks in advance.

Tbh I’ve not tried this myself. Are you able to view the Coursera course? I think they’re free to audit. The source code and/or libraries for the course seem to here: Particularly looks related.

you can try this link

It is at coursera Internet of Things: Sensing and Actuation From Devices
University of California, San Diego

Go to week 2 and follow the lessons. You will see that you can set/reset the GPIO by Java without going in native mode. You will see how to implement the GPIO library in Gradle using Android Studio.
I did it and it works.

Thanks @jmjobin for the tip! :slight_smile:

thank you jmjobin, for the reply

I followed the lesson.but I am unable to modify boot strips of DB410c.I followed the procedure but could not export all the GPIO pins of Board.Can you give me any solution on it?

Thanks in Advance.

thank you @jmjobin, for your previous help.

@kamble what boot strips? You mean the boot script?
Did you import it?
Then modify it in you PC?
Then pushed it back?
Where do you have a problem.
Let me know and I will try to help… :slight_smile:

oh sorry @jmjobin , yes I mean Boot script.

As they mentioned in course, If I pushed file after adding a code of GPIO export into /etc/ then It would not show any exported gpio folder in /sys/class/gpio.

so, I am unable to access GPIO of BD410c in Android Studio.

Kamble I will try to find out what went wrong and maybe you have already done what I will list below:

  1. After pushing the file in the etc directory check the date and time of the file you just changed by making >adb shell.
    then #cd etc and #ls -l
  2. Do not forget to root before making any of these actions (>adb root)

I made some tries now and it worked for me.
Go back in the forum if you still do not succeed and we will try to find where something is wrong.
Talk to you soon.

hi @jmjobin,
what android version you are using? Is it depends on android a version.

Hello kamble.
I was using the version #99 from 96boards. But as far as I know it is not version dependent.
Now I am using version #128.

hi @jmjobin,
I used same android sd image but still have same problem. have u changed any step in the procedure of Modify Boot Scripts?

OK will help with pleasure but still do not know where is your problem to succeed.

  1. adb root
  2. adb remount
  3. adb pull /etc/ (is this OK?)
  4. modify the file as coursera lesson 5a last session (is this OK?)
  5. adb push /etc/ (is this OK?)
  6. adb reboot
  7. check if this work by doing adb devices, adb shell, sudo, cd sys/class/gpio (is this OK?)

You should find your gpios.


hi @jmjobin
I have figured out the problem but I don’t know how to fix it. Actually does not run after boot up.
Even if I append script with chmod 777 /sys/class/gpio/export it does not work. After bootup permissions remain same as before. Tell me any other script that runs after bootup.

Kamble, how do you know the script is not running?

Are you sure you arrive to step 5) of my questions?

If you do, do something to be sure it is pushed properly:

Delete the on your PC and redo the step 3)
Once done open again the script file to see if your file was changed.
If yes check again your modifications.

I made this modification two weeks ago on the version #128 as I did for the #99 and for me all is alright.

Have patience :slight_smile: