#MakeWithMaxim MAX32630FTHR Skateboard trick analyzer

Introduction
My project was to make a device that tracks and analyzes skateboard tricks.
This would be important for training and activity logging. The device would be able to recognize tricks, and also analyze how much force and speed is being applied to monitor your progress.

I chose this idea, because it uses the MAX32630FTHR board most efficiently:

ARM Cortex-M4F, 96MHz
Analyzing data on the fly requires a high performance processor
MAX14690 Wearable PMIC and battery connector
Because this device has to be battery powered, it can utilize these features
Micro SD Card Connector
Data can be stored to SD card when not connected to a Bluetooth phone
RGB Indicator LED
Can signal different battery states
6-Axis Accelerometer/Gyro
Analyzing tricks requires highly accurate and real-time IMU sensor data
Dual-Mode Bluetooth Module
Device can be easlity connected using Bluetooth and interfaced with mobile apps
User Pushbutton
This can be used to switch the device off, or provide other user activated functions.
Miniature form factor
Device that attaches to skateboard must be extremely lightweight and small to not cause any inconvenience

Too bad that the Bluetooth module didn't work in the beginning, I just wasted so much time and frustration on that, so I just re-started this now 2 days ago.
Maybe these 2 days can show how ultra fast it's to start developing these boards.

I cannot finish this project in time while working 8h/day, but I will post my project just for fun and inspiration. I'm grateful to receive the opportunity to participate in this competition. It's still a cool project and this MAX32630FTHR board fits it so well!

So far this is just a blank project, and the project stage is at ready-set-go-finish.
I will try to program some data analyzation algorithms tomorrow, and maybe try to make some IMU processing libraries in future(after the competition, as the time ran out) based on machine learning. Neat!

It's 2am now here in Finland, I'll be back.

BOM
MAX32630FTHR board
Li-ion battery

Instructions
The project only requires the MAX32630FTHR board and the programming tool. In this stage, it feeds the sensor data through serial port to Processing for analyzation. This is done because it's 10x faster to develop code real time, than to reprogram the MCU all the time. When I discover good algorithm, I can just transfer it to mbed C++ code for standalone MAX32630FTHR operation.

Please feel free to use the Processing code below to analyze the IMU data! It's very cool to see the sensor in real time!
I just need to program some algorithms that analyze that raw data.

Top graph is Gyro, and bottom one Acceleration.
(As can be seen in the idle state, the red acceleration graph indicates that gravity is in that direction)

Here's my test setup:
1574644598674.png


Here are the raw data I have gathered so far today:
1574644606407.png


1574644615082.png


Source Code
MBED:
Same as MAX32630FTHR_IMU_Hello_World, but while loop replaced with this:
Code:
        while(1)
        {
            wait(.02);
            imu.getGyroAccXYZandSensorTime(accData, gyroData, sensorTime, accConfig.range, gyroConfig.range);
            imu.getTemperature(&imuTemperature);
     
            pc.printf("%d,%d,%d,", (int)(gyroData.xAxis.scaled*10), (int)(gyroData.yAxis.scaled*10), (int)(gyroData.zAxis.scaled*10));
            pc.printf("%d,%d,%d", (int)(accData.xAxis.scaled*1000), (int)(accData.yAxis.scaled*1000), (int)(accData.zAxis.scaled*1000));
            pc.printf("\n");  //home

            gLED = !gLED;
        }
PROCESSING:
Code:
import processing.serial.*;

Serial myPort;        // The serial port
int xPos = 1;         // horizontal position of the graph

int oldRead = 0;
int newRead = 0;

int gyroX = 0;
int gyroY = 0;
int gyroZ = 0;

int accX = 0;
int accY = 0;
int accZ = 0;

int meas_scale = 9;

void setup () {
  // set the window size:
  size(1000, 800, P3D);

  println((Object[])Serial.list());

  myPort = new Serial(this, Serial.list()[1], 115200);

  myPort.bufferUntil('\n');

  background(0);
}
void draw () {
  //background(0);
  strokeWeight(2);
  //draw line
  //line(xPos, height/2 - oldRead, xPos+1, height/2 - newRead);
  stroke(0,128,128,200);
  line(xPos, height*1/4 , xPos, height*1/4 - gyroX);
  stroke(128,128,0,200);
  line(xPos, height*1/4 , xPos, height*1/4 - gyroY);
  stroke(128,0,128,200);
  line(xPos, height*1/4 , xPos, height*1/4 - gyroZ);
  stroke(0,0,255,200);
  line(xPos, height*3/4 , xPos, height*3/4 - accX);
  stroke(0,255,0,200);
  line(xPos, height*3/4 , xPos, height*3/4 - accY);
  stroke(255,0,0,200);
  line(xPos, height*3/4 , xPos, height*3/4 - accZ);

  translate(100,100,-100);
  stroke(255);
  //line(0,0,0,accX,accY,accZ);

  // at the edge of the screen, go back to the beginning:
  if (xPos >= width) {
    xPos = 0;
    background(0);
  } else {
    // increment the horizontal position:
    xPos+=1;
  }
}


void serialEvent (Serial myPort) {
  try{
  //oldRead=newRead;
  String inString = myPort.readStringUntil('\n');
  String list[] = split(inString,",");
  print((Object[])list);
  gyroX=int(list[0])/meas_scale;
  gyroY=int(list[1])/meas_scale;
  gyroZ=int(list[2])/meas_scale;
  accX=int(list[3])/meas_scale;
  accY=int(list[4])/meas_scale;
  accZ=int(trim(list[5]))/meas_scale;
  }catch(Exception e){
    print("Seral error!\n");
    e.printStackTrace();
  }
}

Blog entry information

Author
Tuppe
Views
714
Comments
1
Last update

More entries in General

Share this entry

Top