Project showcase
Fitness Tracker Using POV Display

Fitness Tracker Using POV Display

Heart beat count and steps count are calculated and calories burnt is retrieved from it and displayed using POV through IOT.

  • 2,149 views
  • 0 comments
  • 4 respects

Components and supplies

Apps and online services

About this project

Objective

The aim of our project is to monitor the amount of calories burnt during jogging by using pulse and piezo electric sensor via artik cloud and displaying the result using POV display.

It tracks your level of activeness by counting the number of steps walked and monitors your health by continuously plotting heartbeat from pulse sensor. It helps you to know whether you have acheived your fitness target(calories burnt) everyday and motivates you to reach your target the next day by displaying the target to be achieved and your past performance ,as soon as you wake up in the morning because pov display is incorporated onto the fan in your living room

Artik Cloud Setup

1. Sign up with Artik Cloud

2. In the dashboard select New device type

3. Enter device display name and unique name

Thus device is created

4. Create Manifest, switch to manifest and select New Manifest

5. Enter field name and description

6. Activate Manifest

7. Create application in dashboard

8. Enter app name and description

9. Assign permission to read

Thus application is made

10. Switch to my devices and connect the device

11. Click the device

12. Once the connections are made,data will be displayed

Heart Beat Calculation:

The Pulse Sensor Amped is a a plug-and-play heart-rate sensor for Arduino and Arduino compatibles. It can be used by people who want to easily incorporate live heart-rate data into their projects.

You gently place the sensor on any area of skin (such as a finger or earlobe) and it will transmit pulse data to your Arduino for processing. The Pulse Sensor measures changes in light from expansion of the capillary blood vessels to sense your heartbeat.

Pulse Sensor Amped adds amplification and noise cancellation circuitry to the hardware. It’s noticeably faster and easier to get reliable pulse readings. Pulse Sensor Amped works with either a 3V or 5V Arduino.

The sensor is connected as follows, the pulse sensor pin is what is marked on the sensor, I have noticed that some of these use different colour wires

  • Pulse sensor pin Arduino pin
  • – -----------> Gnd pin
  • + -----------> 5v pin
  • s ----------->Arduino A0

3 Important Things You Can Learn From Heart Rate

1. How fit you're getting:

If you've started a fitness program, a decrease in your resting heart rate over time can mean your fitness level is improving.

2. How hard you should exercise:

Exercising within target heart rate zones for fat burning, cardio training and endurance training ensures you're working at the right intensity.

3. How stressed you are:

One interesting use for heart rate monitoring devices is to gauge the effectiveness of stress management exercises

Step Count:

Here we use a Piezo element to detect sound, what will allow us to use it as a knock sensor. We are taking advantage of the processors capability to read analog signals through its ADC - analog to digital converter. These converters read a voltage value and transform it into a value encoded digitally. In the case of the Arduino boards, we transform the voltage into a value in the range 0..1024. 0 represents 0volts, while 1024 represents 5volts at the input of one of the six analog pins.

A Piezo is nothing but an electronic device that can both be used to play tones and to detect tones. Here we are plugging the Piezo on the analog input pin number 0, that supports the functionality of reading a value between 0 and 5volts, and not just a plain HIGH or LOW.

Practically piezoelecteic sensor can be placed under shoe to detect step count .

CALORIES CALCULATION:

Calories spent during jogging is calculated from this formula and displayed using pov display

cal=((-55.0969+(.6309*heartbeat)+(0.1988*weight)+(0.2017*age))/4.184*60*time 

WORKING

Once the data is collected it is displayed through POV

POV:

Persistence Of Vision is the phenomenon of the eye by which an image seen by our eye persists for about 0.04s during which any other images that we see are merged together with this image. This ability can be used to create an illusion of images/characters floating in the air, by rapidly flashing a column of LEDs while moving the display in air. For example:

Thus to make the display we have to do the following

1. Design a circuitry to control the flashing of LEDs in a LED column.

2. Program the circuit to flash in an appropriate pattern.

3. Synchronize the flashing with the motion of the display.

First we constructed POV on a rectangular mica sheet. Due to the connection uneasiness.. then we switched on to a circular mica sheet. The crank and the circular sheet are bolted together.

When data from cloud is not being received i.e other than the time of jogging POV display is converted into a clock:

RESULT

Thus by using this one can keep track of the number of calories burnt(with heart beat count calculated through pulse sensor), distance covered(with help of piezo electric sensor) during jogging. The data displayed through POV could act as a motivator to increase your calories burnt count on a daily basis This would be placed in a great utility in the future. Thank you!

Code

calorie calculatorArduino
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ArduinoJson.h> 
#include <ArduinoHttpClient.h> 

int h1;
int d;
int f;
int ledPin = 13;
int knockSensor = 0;               
byte val = 0;
int statePin = LOW;
int THRESHOLD = 100;
int steps1;

char ssid[] = "wifi name";     
char pass[] = "wifi password";



char server[] = "api.artik.cloud";   //cloud intializaton
int port = 443;             // 443 for HTTPS 
char buf[200]; // buffer to store the JSON to be sent to the ARTIK cloud 
String deviceID = " device id"; 
String deviceToken = "device token";




WiFiSSLClient wifi; 
HttpClient client = HttpClient(wifi, server, port);



void setup()
{
  
  pinMode(A0,INPUT);
  pinMode(ledPin, OUTPUT);
  millis_start = millis();
  Serial.begin(9600);
  connectWifi();                      //conncet to wifi
}

void loop()
{
  h=int heart();
  steps=int piezo();
   Serial.println("making POST request");
  String contentType = "application/json"; 
  String AuthorizationData = "Bearer " + deviceToken; //Device Token 
  int len = loadBuffer(h,steps);   
  
  // push the data to the ARTIK Cloud
  Serial.println("Sending piezo: "+String(piezo) +" and heart: "+String(heart) );  
  Serial.println("Send POST to ARTIK Cloud API"); 
  client.beginRequest(); 
  client.post("/v1.1/messages"); //, contentType, buf 
  client.sendHeader("Authorization", AuthorizationData); 
  client.sendHeader("Content-Type", "application/json"); 
  client.sendHeader("Content-Length", len); 
  client.endRequest(); 
  client.print(buf); 

  // read the status code and body of the response

  int statusCode = client.responseStatusCode(); 
  String response = client.responseBody(); 

  Serial.print("Status code: "); 
  Serial.println(statusCode); 
  Serial.print("Response: "); 
  Serial.println(response);   
  delay(1000); // delay of update 
  
}

void conncetWifi(){
  Serial.println("Connecting node mcu to network...");
  //  WiFi.begin();
  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED ) {
    Serial.print("Attempting to connect network");
    Serial.println(WIFI_AP);
    status=WiFi.begin(ssid, pass);
    // wait 5 seconds for connection:
    delay(5000);
   
  }
}



/*Buffer to send on REST*/
int loadBuffer(int h,int steps) {   
  StaticJsonBuffer<200> jsonBuffer; // reserve spot in memory 
  JsonObject& root = jsonBuffer.createObject(); // create root objects 
  root["sdid"] =  deviceID;   
  root["type"] = "message"; 
  JsonObject& dataPair = root.createNestedObject("data"); // create nested objects 
  dataPair["pulse"] = h;   
  dataPair["step"] = steps; 
  root.printTo(buf, sizeof(buf)); // JSON-print to buffer 
  return (root.measureLength()); // also return length 
} 

int heart() 
{
 d=analogRead(A0);

 Serial.println(d);
 h=60000/d;// gives heart count
 Serial.print("heart beat:");
 Serial.print(h1);
 Serial.println();
 return(h1);
 
}
// to determine step count
int piezo() {

  val = analogRead(A1);     

  if (val >= THRESHOLD) {

    statePin = !statePin;

    digitalWrite(ledPin, statePin);

    Serial.println("Knock!");

      steps1++;//gives step value
return(steps1);
  }

  delay(100);  // we have to make a delay to avoid overloading the serial port

}
pov dispalyArduino
int pin=7;
int _[] = {0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,0};
int A[] = {1,1,1,1,1,1,1, 1,0,0,1,0,0,0, 1,0,0,1,0,0,0, 1,0,0,1,0,0,0, 1,1,1,1,1,1,1};
int B[] = {0,1,0,0,0,1,0, 1,0,1,0,1,0,1,  1,0,0,1,0,0,1, 1,0,0,1,0,0,1, 1,1,1,1,1,1,1};
int C[] = {1,0,0,0,0,0,1, 1,0,0,0,0,0,1, 1,0,0,0,0,0,1, 1,0,0,0,0,0,1,  1,1,1,1,1,1,1};
int D[] = {0,0,1,1,1,0,0, 1,0,0,0,0,0,1, 1,0,0,0,0,0,1, 1,0,0,0,0,0,1, 1,1,1,1,1,1,1,};
int E[] = {1,0,0,1,0,0,1, 1,0,0,1,0,0,1,  1,0,0,1,0,0,1, 1,0,0,1,0,0,1 ,1,1,1,1,1,1,1};
int F[] = { 1,0,0,1,0,0,0, 1,0,0,1,0,0,0, 1,0,0,1,0,0,0 ,1,1,1,1,1,1,1, 1,1,1,1,1,1,1};
int G[] = {1,0,0,1,1,1,1 ,1,0,0,1,0,0,1, 1,0,0,1,0,0,1, 1,0,0,0,0,0,1, 1,1,1,1,1,1,1,};
int H[] = {1,1,1,1,1,1,1, 0,0,0,1,0,0,0, 0,0,0,1,0,0,0,  0,0,0,1,0,0,0, 1,1,1,1,1,1,1};
int I[] = {1,0,0,0,0,0,1, 1,0,0,0,0,0,1, 1,1,1,1,1,1,1, 1,0,0,0,0,0,1, 1,0,0,0,0,0,1};
int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0,1, 0,0,0,0,1,0,0, 1,1,1,0,0,0,0};
int W[] = {1,1,1,1,1,1,1, 0,0,0,0,0,1,0, 0,0,0,1,0,0,0, 0,0,0,0,0,1,0, 1,1,1,1,1,1,1};
int X[] = {1,0,0,0,0,0,1, 0,0,1,0,0,1,0, 0,0,0,1,0,0,0, 0,0,1,0,0,1,0, 1,0,0,0,0,0,1};
int Y[] = {1,0,0,0,0,0,0, 1,0,1,0,0,0,0, 0,0,0,1,1,1,1, 1,0,1,0,0,0,0, 1,0,0,0,0,0,0};
int Z[] = {1,0,0,0,0,0,1, 1,0,0,0,1,0,1, 1,0,0,1,0,0,1, 1,0,1,0,0,0,1, 1,0,0,0,0,0,1};
int letterSpace;
int dotTime;
float cal=((-55.0969+(.6309*heartbeat)+(0.1988*weight)+(0.2017*age))/4.184*60*time
char abc[]="cal heartbeat step";// enter data here
int temp[23];
int count=0;
int c=0;
int var=0;
int q=0;
int b;
int z=0;
int d[20];
int tep=0;
int w=0;
int arr[]={16,5,4,0,2,14,12};
void setup()
{
  // setting the ports of the leds to OUTPUT
  Serial.begin(115200);
  pinMode(D0, OUTPUT);
  pinMode(D1, OUTPUT);
  pinMode(D2, OUTPUT);
  pinMode(D3, OUTPUT);  
  pinMode(D4, OUTPUT);
  pinMode(D5, OUTPUT);
  pinMode(D6, OUTPUT);
  pinMode(A0,INPUT);
 
  // defining the space between the letters (ms)
  letterSpace = 3;
  // defining the time dots appear (ms)
  dotTime =1;
 
}
void printlet(int letter[])
{
  int y;
 
  // printing the first y row of the letter
  for (y=0; y<7; y++)
  {
    digitalWrite(arr[y], letter[y]);
    //Serial.print(letter[y]);
  }
  delay(dotTime);
 
  // printing the second y row of the letter
  for (y=0; y<7; y++)
  {
    digitalWrite(arr[y], letter[y+7]);
  }
  delay(dotTime);
 
  // printing the third y row of the letter
  for (y=0; y<7; y++)
  {
    digitalWrite(arr[y], letter[y+14]);
  }
  delay(dotTime);
  // printing the fourth y row of the letter
  for (y=0; y<7; y++)
  {
    
    digitalWrite(y+2, letter[y+21]);
  }
  delay(dotTime);
  // printing the fifth y row of the letter
  for (y=0; y<7; y++)
  {
    digitalWrite(arr[y], letter[y+28]);
  }
  delay(dotTime);
  
  for(y=0;y<7;y++)
  {
    digitalWrite(arr[y],0);
  }
  delay(letterSpace);

  
 
  
}

void loop()
{ 
   for(int i=0;i<=(sizeof(abc)-2);i++)      //splitting the array into pieces for display purpose
  {
     
    if(abc[i]==' ')
    {
      
      temp[q]=i-(tep+1);
      
      if(temp[q]>14)                 //each frame in pov display can display 14 characeters
      {
        var=temp[q-1]+tep+1;
         
         printword(var);
         i=var;
         tep=var;    
         
      }
      q++;
      
      
    }
   if(i==(sizeof(abc)-2))
    {
     


      printword(i);
      i=-1;
      tep=-1;
      q=0;
      z=0;
    }
  }
}
int done=0;
void printword(int a)
{
 int d;
 d=analogRead(A0);
 Serial.println(d);
 if(d>=550)
 {
 
  
 for(b=z;b<=a;b++)
 {
 // Serial.println(abc[b]);
   switch(abc[b])
      {
        case 'a': printlet(A);
        break;
        case 'A':printlet(A);
        break;
        case 'b': printlet(B);
        break;
        case 'B':printlet(B);
        break;
        case 'c': printlet(C);
        break;
        case 'C':printlet(C);
        break;
        case 'd': printlet(D);
        break;
        case 'D':printlet(D);
        break;
        case 'e': printlet(E);
        break;
        case 'E':printlet(E);
        break;
        case 'f': printlet(F);
        break;
        case 'F':printlet(F);
        break;
        case 'g': printlet(G);
        break;
        case 'G':printlet(G);
        break;
        case 'h': printlet(H);
        break;
        case 'H':printlet(H);
        break;
        case 'i': printlet(I);
        break;
        case 'I':printlet(I);
        break;
        case 'j': printlet(J);
        break;
        case 'J':printlet(J);
        break;
        case 'k': printlet(K);
        break;
        case 'K':printlet(K);
        break;
        case 'l': printlet(L);
        break;
        case 'L':printlet(L);
        break;
        case 'm': printlet(M);
        break;
        case 'M':printlet(M);
        break;
        case 'n': printlet(N);
        break;
        case 'N':printlet(N);
        break;
        case 'o': printlet(O);
        break;
        case 'O':printlet(O);
        break;
        case 'p': printlet(P);
        break;
        case 'P':printlet(P);
        break;
        case 'q': printlet(Q);
        break;
        case 'Q':printlet(Q);
        break;
        case 'r': printlet(R);
        break;
        case 'R':printlet(R);
        break;
        case 's': printlet(S);
        break;
        case 'S':printlet(S);
        break;
        case 't': printlet(T);
        break;
        case 'T':printlet(T);
        break;
        case 'u': printlet(U);
        break;
        case 'U':printlet(U);
        break;
        case 'v': printlet(V);
        break;
        case 'V':printlet(V);
        break;
        case 'w': printlet(W);
        break;
        case 'W':printlet(W);
        break;
  case 'x': printlet(X);
        break;
        case 'X':printlet(X);
      break;
        case 'y': printlet(Y);
        break;
        case 'Y':printlet(Y);
        break;
        case 'z': printlet(Z);
        break;
        case 'Z':printlet(Z);
       break;
        case ' ':printlet(_);
        break;
      }

 // delay(1000);
  
 } 
 
 



 }
}
pov clockArduino
when you are not jogging or exercising pov display is used as clock
int s=0,m=20,h=30;// initial time
int a,b,c;
int x;
unsigned long tym;
unsigned long previoustym=0;
int tempo;
int seconds=0;
int minutes=0;
int hours=0;

int sec[]= {1,1,1,1,1,1,1,1,1};
int minu[]={0,0,0,0,1,1,1,1,1};
int hr[]=  {0,0,0,0,0,0,1,1,1};
int arr[]={16,5,4,0,2,14,12,13,15};
int q=0;
int z=0;
int done=0;
void setup()
{
  Serial.begin(115200);
 pinMode(D0, OUTPUT);
  pinMode(D1, OUTPUT);
  pinMode(D2, OUTPUT);
  pinMode(D3, OUTPUT);  
  pinMode(D4, OUTPUT);
  pinMode(D5, OUTPUT);
  pinMode(D6, OUTPUT);
  pinMode(D7, OUTPUT);
  pinMode(D8, OUTPUT);
  pinMode(A0,INPUT);
  
}
void printlet(int letter[])
{
  int y;
  for (y=0; y<9; y++)
  {
  digitalWrite(arr[y], letter[y]);
  }
  
  delay(1);
   for (y=0; y<9; y++)
  {
   
    digitalWrite(arr[y],0);
  }
  }
  
 
  
  void loop() 
  { 
     tym=millis();
     x=tym-previoustym;
     if(x>=1000)
     {
       previoustym=tym;
      s=s+2;       // incrementing 2 in pov display will increase 1 in real time
      seconds++;
   
     }
       if(seconds==60)
      {
        m=m+2;     // incrementing 2 in pov display will increase 1 in real time
        seconds=0;
        s=0;
        minutes++;
      }
      
      switch(minutes)
      {
        
        case 10:
              h=h+2;
              break;
       case 20:
              h=h+2;
              break;
        case 30:
              h=h+2;    
              break;
        case 40:
              h=h+2;
              break;
        case 50:
              break;
        case 60:
              h=h+2; 
              minutes=0; 
               m=0;
             break;
             default:
             break;  
         }
      a=s;
      b=m;
      c=h;
    Serial.println(seconds); 
    
  //sorting to find which one to display first
  if (a>b) 
  {
    tempo=b;
    b=a;
    a=tempo;
  }
 if(a>c)
  {
    tempo=c;
    c=a;
    a=tempo;
  }
  if(b>c)
  {
    tempo=c;
    c=b;
    b=tempo;
  }
            
 
     while(1)              //breaks the loop when ir sensor is high
  {
    int done=analogRead(A0);
    if(done>550)
      break;
  }
   
delay(a);
if(a==s)
          {  
           // Serial.print(a);
            // Serial.print("sec");
           printlet(sec);
           }
           
else if(a==m)
           {
         //  Serial.print(a);
            // Serial.print("min"); 
           printlet(minu);
           }
else if(a==h)
            {
      
            // Serial.print(a);
             //Serial.print("hr");  
             printlet(hr);
           }
         //  Serial.print(":");
       //    Serial.println("................... ");

           
  q=b-a;
  delay(q);
   while(1)
  {
     if(b==s)
          {// Serial.print(b);
             //Serial.print("sec"); 
            printlet(sec);
             break;
          }
      else if(b==m)
      {
            
            
            //  Serial.print(b);
             //
            // Serial.print("min"); 
               printlet(minu);
               break;
       }
 else if(b==h)
 {
            // Serial.print(b);
            /// Serial.print("hr"); 
            printlet(hr);
            break; 
   }        
  }
//Serial.print(":");



 
 z=c-b; 
  delay(z);
 while(1)
  {
 if(c==s)
    {     
    // Serial.print(c);
    //  Serial.print("sec");   
      printlet(sec);
      break;
      }
else if(c==m)
{
         //  Serial.print(c);
         //  Serial.print("min");   
           printlet(minu);
           break;
}
 else if(c==h)
 {
        // Serial.print(c);
        //   Serial.print("hr");    
           printlet(hr);
          break;    

}

}
//Serial.println("");

 }
 

Schematics

pov display
PLSE refers to heart beat
CAL refers to calories burnt
STEPS refer to jogging distance
Povdisplay%20(2).mov
pulse sensor
it shows pulse sensor connection and working
XiaoYing_Video_1476084325172%5B1%5D.mp4
pov clock
video_2016-10-10_15-20-14%20(2).mov
piezo counter
Arduino pt1 02(1)

Comments

Similar projects you might like

POV Fan Display Making

Project tutorial by ashish_8284

  • 2,530 views
  • 0 comments
  • 16 respects

GPS Location Display With GPS And TFT Display Shields

Project tutorial by Boian Mitov

  • 8,825 views
  • 5 comments
  • 23 respects

Hamster Fitness Tracker

Project in progress by Peter Gullberg

  • 1,359 views
  • 0 comments
  • 4 respects

Dual Axis Solar Tracker Panel with Auto and Manual Mode

Project tutorial by Giannis Arvanitakis

  • 7,154 views
  • 6 comments
  • 35 respects

Room temperature sensor with display on Mobile

Project showcase by Kaustubh Agarwal

  • 23,958 views
  • 8 comments
  • 54 respects
Add projectSign up / Login