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