Tharrun Kumar NT
Published © GPL3+

Dunkmaster Pro Shoes

An aiding shoe tracker that helps you track you're vertical jump height.

IntermediateWork in progressOver 3 days5
Dunkmaster Pro Shoes

Things used in this project

Hardware components

ESP32
Espressif ESP32
×1
6 DOF Sensor - MPU6050
DFRobot 6 DOF Sensor - MPU6050
×1
FlexiForce A401 Force Sensor
×1
Female Header 8 Position 1 Row (0.1")
Female Header 8 Position 1 Row (0.1")
×3
Rail-to-Rail Input/Output Dual Op-Amp
Microchip Rail-to-Rail Input/Output Dual Op-Amp
MCP6004 Op-Amp
×1
PCBWay Custom PCB
PCBWay Custom PCB
×1

Software apps and online services

Blynk
Blynk
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

angle grinder

Story

Read more

Schematics

Circuit Connections in PCB

Solder Female headers for the connects to be made in the PCB.

Code

Finding Vertical Jump Height and Step Count

C/C++
Using Arduino IDE as a platform I programmed the ESP32 Microcontroller and made
sure the code was free of bugs and issues. The Arduino platform provides a pretty
straightforward USB flash connection with the ESP32 microcontroller and is a sufficient tool
for troubleshooting and debugging ESP32 code. This IDE also helped me a lot in Implementing
the BLYNK IoT Platform into the project.
There are two parts to the main code. One part is calibration of the FSR and the second
part is including the MPU6050 code and sending the data to the smartphone.
float cf = 19.5; // calibration factor

int ffs1 = 36; // FlexiForce sensor is connected analog pin A0 of arduino or mega. 

int ffsdata = 0; 
float vout;
void setup() {
   // put your setup code here, to run once:
   Serial.begin(9600);
     pinMode(ffs1, INPUT); 
  
}
void loop() {
  
 ffsdata = analogRead(ffs1);
vout = (ffsdata * 3.3) / 1023.0; 
vout = vout * cf ; 
Serial.print("Flexi Force sensor: "); 
Serial.print(vout,3); 
Serial.println(""); 
delay(100); 
   // put your main code here, to run repeatedly:
    long int t1 = millis();
 //  task_whose_time_is_to_be_measured();//for as long as fsr value is greater than 100
    while(vout>=100)  //while loop with condition
  {
   
  }
   long int t2 = millis();
   Serial.print("Time taken by the task: "); Serial.print(t2-t1); Serial.println(" milliseconds");
}
//second part below
#include <Wire.h>
unsigned long start, finished, elapsed;
long accelX, accelY, accelZ;
float gForceX, gForceY, gForceZ;

long gyroX, gyroY, gyroZ;
float rotX, rotY, rotZ;

unsigned long previousMillis = 0;
const long interval = 1000;
long count = 0;
unsigned long currentMillis;
int flag = 0;
float cf = 19.5; // caliberation factor
double tim =0;
int ffs1 = 36; // FlexiForce sensor is connected analog pin A0 of arduino or mega. 

int ffsdata = 0; 
float vout; 
#define BLYNK_PRINT Serial

#define BLYNK_USE_DIRECT_CONNECT

#include <BlynkSimpleEsp32_BLE.h>
#include <BLEDevice.h>
#include <BLEServer.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "sWxv_XH0jej8xskj3m85D_Ah65QagIr8";

void setup()
{
  // Debug console
  Serial.begin(9600);
  pinMode(ffs1, INPUT); 
  Wire.begin();
  setupMPU();

  Serial.println("Waiting for connections...");

  Blynk.setDeviceName("ShoeTracker");

  Blynk.begin(auth);
}

void loop()
{
  
 ffsdata = analogRead(ffs1);
vout = (ffsdata * 3.3) / 1023.0; 
vout = vout * cf ; 
  Serial.print("Flexi Force sensor: "); 
  Serial.print(vout,3); 
  Serial.println(""); 
  while(vout < 100){
    double tim = tim + 0.01;
  Serial.println(count);
  delay(10);
  }
  Blynk.virtualWrite(V2,vout);
  Blynk.virtualWrite(V3,tim);
  recordAccelRegisters();
  recordGyroRegisters();
  stepCount();
 // delay(100);
  Blynk.run();

 
   Serial.println();

  

}
void setupMPU(){
  Wire.beginTransmission(0b1101000); //This is the I2C address of the MPU (b1101000/b1101001 for AC0 low/high datasheet sec. 9.2)
  Wire.write(0x6B); //Accessing the register 6B - Power Management (Sec. 4.28)
  Wire.write(0b00000000); //Setting SLEEP register to 0. (Required; see Note on p. 9)
  Wire.endTransmission();  
  Wire.beginTransmission(0b1101000); //I2C address of the MPU
  Wire.write(0x1B); //Accessing the register 1B - Gyroscope Configuration (Sec. 4.4) 
  Wire.write(0x00000000); //Setting the gyro to full scale +/- 250deg./s 
  Wire.endTransmission(); 
  Wire.beginTransmission(0b1101000); //I2C address of the MPU
  Wire.write(0x1C); //Accessing the register 1C - Acccelerometer Configuration (Sec. 4.5) 
  Wire.write(0b00000000); //Setting the accel to +/- 2g
  Wire.endTransmission(); 
}

void recordAccelRegisters() {
  Wire.beginTransmission(0b1101000); //I2C address of the MPU
  Wire.write(0x3B); //Starting register for Accel Readings
  Wire.endTransmission();
  Wire.requestFrom(0b1101000,6); //Request Accel Registers (3B - 40)
  while(Wire.available() < 6);
  accelX = Wire.read()<<8|Wire.read(); //Store first two bytes into accelX
  accelY = Wire.read()<<8|Wire.read(); //Store middle two bytes into accelY
  accelZ = Wire.read()<<8|Wire.read(); //Store last two bytes into accelZ
  processAccelData();
}

void processAccelData(){
  gForceX = accelX / 16384.0;
  gForceY = accelY / 16384.0; 
  gForceZ = accelZ / 16384.0;
}

void recordGyroRegisters() {
  Wire.beginTransmission(0b1101000); //I2C address of the MPU
  Wire.write(0x43); //Starting register for Gyro Readings
  Wire.endTransmission();
  Wire.requestFrom(0b1101000,6); //Request Gyro Registers (43 - 48)
  while(Wire.available() < 6);
  gyroX = Wire.read()<<8|Wire.read(); //Store first two bytes into accelX
  gyroY = Wire.read()<<8|Wire.read(); //Store middle two bytes into accelY
  gyroZ = Wire.read()<<8|Wire.read(); //Store last two bytes into accelZ
  processGyroData();
}

void processGyroData() {
  rotX = gyroX / 131.0;
  rotY = gyroY / 131.0; 
  rotZ = gyroZ / 131.0;
}




void stepCount()
{
  if(gForceY > 0.5 && gForceY < 3.5)
  {
    flag =1;

    previousMillis=millis();
    currentMillis=millis();

  }
  
  if((currentMillis - previousMillis <= interval) && (flag))
  {
    

    if(gForceY < 0.5 );
    {
      count++;
      flag=0;

      }
  }
  currentMillis =millis();

  if(currentMillis - previousMillis > interval)
  {
    flag =0;
   
  }

     Serial.print("steps = ");
     Serial.println(count);
   
     delay(100);
      Blynk.virtualWrite(V1,count);
     
}

Credits

Tharrun Kumar NT

Tharrun Kumar NT

6 projects • 4 followers

Comments

Add projectSign up / Login