Demo Android app using BBBAndroid

I am perusing degree in Computer Engineering from Institute of Technology, Nirma University. I have previous experience of android app development. I am currently involved with a project for developing “Autonomous Unmanned Aerial Vehicle” for which I have developed some appsp using droneapi.

I want to work on http://elinux.org/BeagleBoard/GSoC/Ideas#Demo_Android_app_using_BBBAndroid for GSOC 2015. Please guide me how can start preparing for that.

Hello Ankur. Because there is much interest is using the BeagleBone Black as a prototyping platform for custom Android-based devices, we’d like to have a GSoC participant develop an app or series of apps that demonstrate how to interface a variety of hardware components to Android apps. Others can then use these apps as the basis for their own, more complex interfacing projects under Android.

While talking to common phone hardware is supported via the Android HAL and API (SensorManager is a good example), developers may wish to quickly prototype hardware interfaces that don’t fit neatly into existing Android APIs. The effort to integrate hardware into the HAL is also a bit involved and may be beyond the capabilities of many developers. Because BBBAndroid uses the 3.8 Linux kernel, it is convenient to create and load dynamic device tree overlays to try new hardware, rather than rebuild a new kernel for each new hardware configuration.

The development effort for this project involves knowledge in the following areas:

  1. The various peripheral interfaces offered by the BBB (SPI, GPIO, I2C, ADC, CAN, etc.) and how each one works.
  2. The kernel device tree, device tree overlays, and the cape manager in the BBB’s 3.8 kernel.
  3. JNI and Android app development.
  4. Basic Linux systems programming for interfacing with kernel device drivers (open(), close(), ioctl(), read(), write(), etc.).
  5. Setup of the hardware within the Android system via init*.rc scripts.

While the end product will be Android apps, much of the effort involves digging into the bits and bytes of Linux-like hardware interfacing. Remember that the goal of this project is to implement the “hard parts” of hardware interfacing under Android and demonstrate to others how these parts can be implemented. A candidate with a good proposal for this topic will have at least some knowledge in these five different areas, a solid plan on which peripheral interfaces to demonstrate and the apps to demonstrate them, and a proposed schedule that is realistic. We don’t expect to have an expert in all five of these areas show up for GSoC, so it will be the job of the mentors to guide the mentee in any areas in which he/she isn’t familiar or needs extra help.

To prepare for this topic, I suggest learning as much as you can about the first four areas listed above. Here are a few resources that might help:

https://www.youtube.com/watch?v=wui_wU1AeQc

https://learn.adafruit.com/category/beaglebone

http://lwn.net/Kernel/LDD3/

Andrew

Am Akah larry from the Faculty of Engineering and technology, Buea Cameroon. The project looks cool and as a seasoned developer I can only be tempted to join. I'll look at the starter links and hope to learn a lot more cool stuff.
Cheers

Hi Andrew,

I have successfully installed the android image in my BBB.

Now I trying to make a simple android app to light an LED in GPIO, can u provide me some guidance regarding that.

This BBB Android project looks like it would require me to have the BBB electronic board. I don’t have the board so i wish to know how else i could be able to work on this project.

I have received a large number of mails regarding this topic, so I felt it would be best to address everyone here instead of sending out 20 mails to different people.

The important portion of this topic is the “hardware interfacing” portion. While the final deliverables will probably be Android apps and their associated native code, the apps themselves can be considered the less difficult part of the project. Thus, a strong proposal on this topic will focus more on interfacing with the hardware that it will on app development.

You should have three goals at the moment:

  1. Learn enough about the BBB to be able to explain the various hardware peripheral interfaces it offers.
  2. Be able to explain the general process for developing hardware interfacing code under Linux.
  3. Develop a proposal that explains how you plan on creating this hardware interfacing code and then adding it to an Android app.

If you are an app developer, then the third item should be very straightforward. Using an AsyncTask instance to call JNI code would be a valid approach, for example.

So, let’s say that you’ve read some documentation on the BBB and you like the idea of interfacing with GPIOs, I2C, SPI, etc. What next? Well, you can do a few Google searches and find some code that talks to these interfaces, or you could look through the BeagleBoard.org project list to find a few libraries that do this sort of interfacing via mmap() and file I/O. Can you build these libraries under Linux on the BBB? Do they work for you? If not, why? Do you think that, if you had the hardware, you would feel comfortable connecting components to the BBB and writing a few simple programs to use those libraries to talk to hardware?

http://i.imgur.com/bz4Fjeq.jpg

Once you get that working, do you think that you could pull the necessary pieces of a library and your own code into an Android app and call it via JNI? How would you encapsulate the hardware interfacing logic into the native code so that it is fairly generic? Is your C/C++ strong enough that you can fully understand these existing interfacing libraries? Do you think you could create something that interfaces with hardware like the Bacon Cape?

http://elinux.org/CircuitCo:Bacon_Cape

IF YOU HAVE A BEAGLEBONE BLACK BOARD:

Have you ever interfaced with GPIOs before under Linux on your BBB? If not, have you googled for any tutorials (like in the tutorial links I posted earlier in this thread)? There are many examples out there for you to learn from. Which have you looked at and tried? If you have tried the very basics before, you’re well ahead of the game. You should try at least one simple hardware interfacing project under Linux prior to submitting your proposal so that you have an idea of what you are getting yourself into.

IF YOU DON’T HAVE A BEAGLEBONE BLACK BOARD:

What research have you done? Have you downloaded any Linux interfacing libraries for the BBB and looked at the code? Have you worked on any other Linux platform and interfaced with hardware before? Have you downloaded and read the BeagleBone Black System Reference Manual? Can you explain how I2C, SPI, PWM, ADC, etc. work?

I am seeing potential candidates interact with the mentors in one of three ways:

  1. “I have read XXX like you suggested. Now what do I do?”

This isn’t very hopeful for us as mentors, as we hope that you’ll take the suggested references as a starting point for your own exploration and research. Yes, it is good that you read them, but what did you learn? What do YOU think you should do next? Did you look at any existing projects or libraries that use what you learned? This project will be YOUR PROJECT. The mentors will help you define the scope and details of your project for your proposal, but it is up to you to become the “expert”.

  1. “I have read XXX like you suggested. I found a few examples that show how I can do ABC and XYZ, but I’m not sure if I will be able to do both ABC and XYZ together at the same time. Is this a common problem?”

This is far more promising. You’re clearly showing that you’ve read the starting references and then performed your own research to see what you should be doing and are asking for clarification on it. You may not be an expert, but you’re demonstrating that you can see a bigger picture on how everything fits together. GSoC will probably be very informative for you, but you will have to work hard this summer to get to where you need to be for success.

  1. “I am already familiar with XXX, and I read on this blog/mailing list/tutorial about a BeagleBone Black hardware interfacing library ABC under Linux. Do you think I could leverage this for the project? It provides interfaces for X, Y, and Z, but I don’t know if the interfaces have changed between the 3.8 and 3.14 kernel. I tried building it and it crashed on 3.14, so I tried it with the 3.8 kernel instead and it worked without a problem. What more can you tell me about this?”

This is the best-case scenario. You’re clearly interested in the topic, you’ve done the background research, and you have a general plan on how to approach the project. You may not know all of the details that you need, but you know enough that the details are only details. GSoC will probably be very rewarding for you and a lot of fun. You probably won’t struggle, but you might get stuck a few times. GSoC is designed to produce code that is useful and non-trivial while giving you the chance to take your skills to the next level.

This topic is about hardware interfacing. Yes, it does involve writing Android apps, but that is far less important than understanding hardware interfacing. If you are an app developer with no experience in hardware interfacing, I suggest that you consider a different topic.

Andrew

Hi Andrew,

Now I am able to glow LED of bacon cape using BBBAndroid.

Now that you have worked out some of the details of hardware interfacing under Android, have you thought about how you are going to put this into a project proposal? Do you feel comfortable exploring more hardware-related aspects and interfaces of the BBB for the project? The next two weeks are your time to ask questions about what should be in your proposal to make it stronger, details about the project, and general guidance along the lines of “is this too much or too little to propose for the project?” Keep experimenting, collect whatever information you can about the proposal topic, and think about how you can incorporate this information into the proposal.

Andrew

Added compilations steps for rowboat android using kernel 3.8

https://github.com/ankurayadav/beagleandroid/blob/master/beagleandroid/README.md

Well, those are the old steps that I put up almost two years ago. You could use those, I suppose, but there is a much newer set of steps for a version using KitKat at bbbandroid.org. The steps that you wrote in your readme file came from http://icculus.org/~hendersa/android, which has this right at the top of the page:

IMPORTANT UPDATE: There is an open source project called BBBAndroid that is an updated process for installing Android on the BeagleBone Black. BBBAndroid is far more automated and much easier for installing AOSP Android 4.4.4 (KitKat). The information on this page is for historical interest and is unsupported.

The reason that BBBAndroid was mentioned in the topic is because it uses a much more modern version of KitKat and the build process is much simpler. That older process was a series of manual hacks to each part of the build process to try and get 3.8 working with Rowboat’s stuff.

thanks for pointing out the correct link.
well i was not able to find out new steps that is why i used old ones.

Now i found out new steps http://bbbandroid.sourceforge.net/build.html so i am trying to compile the new code.

I am maintaining my current status at https://github.com/ankurayadav/beagleandroid/blob/master/beagleandroid/README.md

my tatically-linked ARM Linux “hello world” style executable.

helloworld.bin (576 KB)

Hi Andrew,

I have made my GSOC proposal for demo app for BBBAndroid on google-melange. kindly review it and please provide suggestion.

Regards,
Ankur Yadav

Hi Andrew,
I have been reading your book “Android fot the BeagleBone Black”. I just tried out example to use GPIO using packtHAL.
Difficulty that I faced in doing so.

  1. Setting up NDK in eclipse and using NDK to compile code. (Well it was explained in the book very nicely so i resolved it.)
  2. Problem with file <linux/spi/spidev.h> as it was not included in NDK libraries. (After a long search here and there I found the solution in the book that it should be explicitly copied to the NDK source folder).
  3. Setting up GPIO for output. (I was directly running the code without configuring the GPIO for ouput.)
  4. Giving permission so that any program can access it “chmod 0777”. (After doing everything correct also I was not able to glow LED but again after reading the book I found out that proper permission is required to be given to the value file).
    The book is really very great for the new users.

gpio.mp4 (3.88 MB)