Skip to content

Latest commit

 

History

History
71 lines (42 loc) · 2.09 KB

I2C_LIB_EVAL.md

File metadata and controls

71 lines (42 loc) · 2.09 KB

Human motion recognition by IMU and Android (PIC1825 with MPU9250 and Android)

Goals

(Work in progress)

  • IMU evaluation board that is small enough as a wearble device
  • IMU data visualization by an Android GUI app
  • Human motion recognition by TensorFlow with the IMU board
 [InvenSense MPU-9255 (HiLetgo MPU9250 module)]--I2C--[PIC16F1825]--USB serial--[Android app]

Data sampling

  • 80Hz for accelerometer and gyroscope (40Hz LPF is applied to the data on the chip)
  • 5Hz for magnetometer

InvenSense (TDK) MPU-9250/9255

The module I purchased from Amazon is MPU-9255. The module includes an accelerometer, a gyroscope and a mangetometer from Asahi Kasei.

Schematic

Schematic

The universal board has 14 holes x 17 holes.

Code

I use I2C bus to access all the sensors in the module.

=> Code for PIC16F1825

=> Code for Android

Case (3D model in STL format)

=> Case

Android app screen shots

gui

Note on I2C driver generated by MCC

Although i2c_master_example.h and i2c_master_example.c generated by MCC is just an example implementation, the APIs in the implementation are very easy to understand and work very well for basic I2C operations.

#include <stdint.h>
#include <stdio.h>
#include "../i2c_master.h"

uint8_t  I2C_Read1ByteRegister(i2c_address_t address, uint8_t reg);
uint16_t I2C_Read2ByteRegister(i2c_address_t address, uint8_t reg);
void I2C_Write1ByteRegister(i2c_address_t address, uint8_t reg, uint8_t data);
void I2C_Write2ByteRegister(i2c_address_t address, uint8_t reg, uint16_t data);
void I2C_WriteNBytes(i2c_address_t address, uint8_t *data, size_t len);
void I2C_ReadNBytes(i2c_address_t address, uint8_t *data, size_t len);
void I2C_ReadDataBlock(i2c_address_t address, uint8_t reg, uint8_t *data, size_t len);

References