Showing posts with label GSoC-2015. Show all posts
Showing posts with label GSoC-2015. Show all posts

Demo Android app using BBBAndroid



Final Report:

Aim of the project: To develop demo Android applications for BeagleBone Black for all its supported interfaces and develop an Android HAL to support future development.

Code repositories:
1) bbbandroidHAL (link): This is the native C code library which can be used to develop Android Application for BeagleBone Black.
2) demoapps-bbbandroid (link): Demo application for BBBAndroid using bbbandroidHAL. It is just to demonstrate how one can develop android applications using bbbandroidHAL.

Documentation:
1) Videos (link): This playlist contains video demonstrations for all the demo apps (i.e. gpio, adc, pwm, i2c, spi, uart, can, usb).
2) Doxygen documentation for bbbandroidHAL (link).
3) Wiki for bbbnadroidHAL (link): This wiki also example codes along with function explanation.

Code completed in GSoC time Frame:
1) HAL Code for GPIOADCPWMI2CSPIUARTCAN and USB.
2) Demo android apps for GPIOADCPWMI2CSPIUARTCANUSB and for BACON cape.

I have tried to complete almost everything in the proposal, but there is always a chance of improvement. The HAL code and demo apps should help developers accelerate process of Android App development for beaglebone black. I would like to help anyone who wants to try out HAL or wants to develop his/her own Android app for beagle.

It was a great learning experience for me. I would like to thank my mentors Andrew Henderson and Anuj Deshpande for their support and guidance which made it possible for me to complete this project. I would also like to thank this wonderful beagleboard community for their support and Google for giving us this opportunity.

Regards,
Ankur Yadav

Demo Android app using BBBAndroid


Week #12:

Goals Achieved:
  • Completed wiki with some examples. (link).
  • Completed android app for bacon cape. (link)
  • Completed 50min video explaining all the APIs briefly. (link)
Issues:
  • No issues.

Regards,
Ankur Yadav

Demo Android app using BBBAndroid


Week #11:

Goals Achieved:
  • Doxygen documentation completed (link).
  • Wiki content add for bbbandroidHAL (link). 
Issues:
  • No issues.
 Goals for next week:
  • Add some example codes in wiki contents.
  • Make final video explaining all the APIs briefly.

Regards,
Ankur Yadav

Demo Android app using BBBAndroid


Week #10:

Goals Achieved:
  • Android app for USB completed (link).
  • Video tutorials for i2cspiuartcanusb.
  • Started documentation using doxygen (link).
Issues:
  • No issues.
 Goals for next week:
  • Complete doxygen documentation.
  • To do some blog posts for demo apps.

Regards,
Ankur Yadav

Demo Android app using BBBAndroid


Week #9:

Goals Achieved:
  • Android app for CAN completed (link)
  • Got sample program for USB working using libusb. (gives lsusb type output)
  • Video tutorials for i2c, spi.
Issues:
  • Due to heavy rain fall in my area (Bhuj, Kutch) there was a power cut for 2 days and internet is also not working properly. So, I was not able to upload videos. I will upload it soon this week.
  • Also I will try to compensate for the this week's work next week.
 Goals for next week:
  • Video tutorials for uart and can.
  • Wiki content for gpio, pwm, adc, i2c, spi, uart and can.

Regards,
Ankur Yadav

Demo Android app using BBBAndroid



Week #8:

Goals Achieved:
  • Android app for UART completed (link)
  • After lot of try I was able to enable can bus.
  • Android app for CAN (link).
Issues:
  • Even after installing BB-DCAN1 overlay can0 was not created, found that some can bus kernel modules were not loaded in bbbandroid. (issue).
  • Send and Read for can bus is working properly in binary through shell but Read is not working properly in apk.
 Goals for next week:
  • Video tutorials for i2c, spi, and uart
  • Wiki content for gpio, pwm, adc, i2c, spi and uart.

Regards,
Ankur Yadav

Demo Android app using BBBAndroid


Week #7:

Goals Achieved:
  • Android app for SPI for 74HC595 present on bacon cape completed (link).
  • Video tutorial for GPIO app (link).
  • Video tutorial for PWM app (link).
  • Video tutorial for ADC app (link).
Issues:
  • Have problem with one of my beaglebone(its not working) :(
  • My adxl345 breakout board is also not working. (So could not develop Android app for SPI using it).
  • I have ordered new adxl345 breakout board. After that I will try to access it using SPI.
 Goals for next week:
  • Android app for UART.
  • Sample Code to access USB.

Regards,
Ankur Yadav

Demo Android app using BBBAndroid


Week #6:

Goals Achieved:
  • Android app for I2C completed (link).
  • Complete overview of I2C app can be foud here.
  • Studied documentation of termios.h (link).
  • Developed api for UART (link).
Issues:
  • Some functions of I2C had problem so some changes in API were required.
 Goals for next week:
  • Work on SPI android app.
  • Understanding USB and how to access it in BBBAndroid.

Regards,
Ankur Yadav

ADXL345 3-axis accelerometer interfacing using I2C bus


  • Connecting BeagleBone Black with ADXL345
 


  • How to use I2C for accessing ADXL345 sensor.
    • Api for accessing all the peripherals of BeagleBoneBlack with Android OS can be found here
    • Api for I2C is in i2c.c
  • Brief description about I2C funtions.
    • i2cOpenAdaptor(uint8_t adaptorNumber): This function I2C adapter number as input and returns a file descriptor for accessing that I2C adapter.
    • i2cSetSlave(int i2cFD, uint8_t address): This takes I2C adapter file descriptor and address at which device is attached as input and sets slave for file descriptor using ioctl call.
    • i2cSetAddress(int i2cFD, unsigned char add): This is used by some other functions internally for random access of sensor registers. It takes file descriptor and random address to which file descriptor should point.
    • i2cWriteByte(int i2cFD, unsigned char add, unsigned char byte): This function is used to write byte provided in the argument at the address provided.
    • i2cWriteBytes(int i2cFD, unsigned char add, int length, uint8_t *bytes): This function is used to write bytes provided in argument from the address provided to address+length continuously.
    • i2cReadByte(int i2cFD, unsigned char add): It reads a byte from the address provided and returns the byte.
    • i2cReadBytes(int i2cFD, unsigned char add, int length, uint8_t *buff): It is used to get 'length' number of bytes in 'buff' array from 'add' starting address.
    • i2cClose(int i2cFD): For closing file descriptor.
  • Source code of Android app using this api can be found here.
  • Steps for making Android app for accessing any I2C device on BeagleBoneBlack
    • Step 1: Copy i2c.c from here and put it into jni folder in you Android app directory.
    • Step 2: Make a jni_wrapper.c for your i2c funtions.
    • Step 3: Make suitable Android.mk file.
    • Step 4: Compile your program using ndk_build. (call ndk_build from current jni directory).
    • Step 5: Declare suitable native function prototypes in your java file like this.
    • Step 6: Include static library in java program like this.
    • Step 7: Now you can easily call general purpose I2C functions from your java program and easily access I2C devices.
  • Steps for configuring ADXL345 sensor for using it through I2C bus. Details regarding how to configure this sensor can be found on this website (This site assumes predefined macros like ADXL345_POWER_CTL address of these macros can be found put here).
    • Step 1: Enable measurement mode in POWER_CTL register like this.
    • Step 2: Set the data format of measurements like this.
    • Step 3: Now we can read sensor values like this.
  • Screenshot of Android app reading ADXL345 sensor values when button is clicked.


  • Video demonstration of I2C Android app.

Demo Android app using BBBAndroid


Week #5:

Goals Achieved:
  • Study functioning of CAN.
  • Studied this documentation link for CAN.
  • C code API for CAN bus using RAW protocol here.
  • Developing Android app for i2c.
Issues:
  • Difficult to find CAN work references.
  • this documentation was helpful in understanding.
  • this device tree overlay giving error when installing(need to figure out). 
 Goals for next week:
  • Get I2C app working
  • Understanding UART
  • Implementing API for UART

Regards,
Ankur Yadav

Demo Android app using BBBAndroid


Week #4:

Goals Achieved:
  • Android app for ADC completed link.
  • Studied functioning of SPI bus
  • C code api for SPI bus using file system here.
Issues:
  • Issue with ADC app resolved here.
 Goals for next week:
  • Understanding CAN
  • Implementing API for CAN

Demo Android app using BBBAndroid


Week #3:

Goals Achieved:
  • Got HDMI to VGA converter working. (supplied VCC and GND from beagle to 18th(VCC) and Gnd pin of HDMI )
  • Studied functioning of I2C bus
  • Used this library for developing I2C api.
  • C code api for I2C bus using file system here.
  • Developing Android app for adc here.
Issues:
  • HDMI to VGA convector was not working. (took some time to hack the circuit and get it solved)
  • My 5V mouse was not working with beagle had to use 3.3V mouse. 
  • Adc android app is giving error. (still have to solve the issue)
 Goals for next week:
  • Completing ADC app
  • Understanding the AsyncTask.
  • Understanding SPI bus.
  • Implementing API for SPI

Demo Android app using BBBAndroid


Week #2:

Goals Achieved:
  • Modified GPIO code for as discussed with my mentor here.
  • Study functioning of PWM and ADC.
  • C code api for accessing PWM using file system here.
  • C code api for accessing ADC using file system here.
Issues:
  • Took time to compile JNI code properly.
  • Problem in finding proper device tree overlay for testing. I used some from here.
 Goals for next week:
  • Improvement in ADC and PWM code if required
  • understanding I2C
  • Implementing API for I2C

Demo Android app using BBBAndroid


Week #1:

Goals Achieved:
  • Introductory video, blog, github repo, wiki, elinux page.
  • Basic GPIO api usage structure.
  • modified JNI code for GPIO api here.
  • Android app for GPIO access (taken from packtpub example) here.
Issues:
  • Took some time to understand device tree overlay properly.
  • dtc was giving compiling dts properly. got solution here.
  • Problem with installing overlay on Android kernel. Took some time to do that.
 Goals for next week:
  • making API for accessing PWM.
  • understanding Android.mk
  • API for ADC.

Demo Android app using BBBAndroid


Week 0#: 

  • Introductory video for project:

  • Slideshare link:


(for Beagleboard.org)

Demo Android app using BBBAndroid


I am very excited. I got selected in Google Summer of Code - 2015 for Beagleboard.org . Here is link to my Abstract.

Assigned mentors: Anuj Deshpande, Andrew Henderson
Abstract: BBBAndroid is mainly designed to enable users to run Android on our favorite embedded linux board (i.e. Beaglebone Black). "Demo Android app using BBBAndroid" project focuses on the demonstration of apps that can run on Android which makes use of some awesome peripherals support of the BeagleBone Black like ADC, GPIO, I2C, SPI, USB, CAN , PWM, UART etc. Future task could be to make simple APIs for interfacing BBB peripherals using NDK.