swastikchakraborty
Published © GPL3+

ESP8266 Smart Shoe (pedometer)

Smart step counter shoe using ESP8266, Infrared Sensor and a LiPo battery.

IntermediateFull instructions provided40
ESP8266 Smart Shoe (pedometer)

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
Infrared Module (Generic)
×1

Software apps and online services

Blynk
Blynk
Arduino IDE
Arduino IDE

Story

Read more

Schematics

wiring

Code

Code

Arduino
//Include the library files
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define BLYNK_AUTH_TOKEN "" // enter your auth token
int lastState = 0;

char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "";  // Enter your Wifi Username
char pass[] = "";  // wifi password
BlynkTimer timer;
int InPin = 5;  // the pin where out of IR is connected (d1)
int sensorValue = 0;        // value read from the sensor
int steps = 0;
void setup() {
  pinMode(InPin, INPUT);
    Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
    Serial.begin(9600);
  timer.setInterval(100L, ultrasonic);
}
 
void ultrasonic() {
  // read the analog in value:
int  currentState = digitalRead(InPin);
  Serial.println(currentState);
  delay(5);
  if(lastState==1 && currentState==0)
  {
    steps = steps + 1;
    int distance = steps*1.15;  //average distance in metres.
    
  Blynk.virtualWrite(V0, steps);
  
Serial.println(steps);
  Blynk.virtualWrite(V1, distance);
  }
  else
  {
      steps = steps;
      int distance = steps*1.15;
      
Serial.println(steps);
  Blynk.virtualWrite(V0, steps);
  Blynk.virtualWrite(V1, distance);
  }
  lastState = currentState;
}

void loop() {
  Blynk.run();//Run the Blynk library
  timer.run();//Run the Blynk timer
}

Credits

swastikchakraborty

swastikchakraborty

2 projects • 0 followers

Comments

Add projectSign up / Login