Sensor in shoe sole for BPM measurement

Hi guys,

I'm working on a small project for school and I have some basic sensor background, but I'm struggling with a project. A part of this project is to measure the BPM at which a person walks/runs.

The detection of the beat should happen in the shoe, so I need a sensor to put in the sole of the shoe. I was thinking of putting an infrared sensor in the sole, so that whenever a person steps on the floor, everything is black and the sensor can detect that. The problem I have with this is that people also walk when its dark outside and then the difference would not be detectable.

My question is: is there a sensor available that can constantly measure the BPM of a person's walk, and if so, which one would you recommend? (It's just for a prototype so I don't need something extremely expensive)


Accelerometers are the standard tool for the job. Landing a foot gives a big spike, while the foot is
on the ground is a period of stillness.

I was thinking of an FSR. Accellerometer may be the more accurate one indeed.

Accelerometers are the standard tool for the job. Landing a foot gives a big spike, while the foot is
on the ground is a period of stillness.

Thank you, this made a lot of sense to me so I immediately ordered the ADXL345 accelerometer. I managed to hook it up to my Arduino and used the following sample code to print the x,y and z values to the serial monitor:

< #include <Wire.h>
#define DEVICE (0x53) // Device address as specified in data sheet
byte _buff[6];
char POWER_CTL = 0x2D;    //Power Control Register
char DATA_FORMAT = 0x31;
char DATAX0 = 0x32;    //X-Axis Data 0
char DATAX1 = 0x33;    //X-Axis Data 1
char DATAY0 = 0x34;    //Y-Axis Data 0
char DATAY1 = 0x35;    //Y-Axis Data 1
char DATAZ0 = 0x36;    //Z-Axis Data 0
char DATAZ1 = 0x37;    //Z-Axis Data 1

void setup() {
 Wire.begin(); // join i2c bus (address optional for master)
 Serial.begin(9600); // start serial for output. Make sure you set your Serial Monitor to the same!
 //Put the ADXL345 into +/- 4G range by writing the value 0x01 to the DATA_FORMAT register.
 writeTo(DATA_FORMAT, 0x01);
 //Put the ADXL345 into Measurement Mode by writing 0x08 to the POWER_CTL register.
 writeTo(POWER_CTL, 0x08);

void loop() {
 readAccel(); // read the x/y/z tilt
 delay(50); // only read every 0,5 seconds

void readAccel() {
 uint8_t howManyBytesToRead = 6;
 readFrom( DATAX0, howManyBytesToRead, _buff); //read the acceleration data from the ADXL345
 // each axis reading comes in 10 bit resolution, ie 2 bytes. Least Significat Byte first!!
 // thus we are converting both bytes in to one int
 int x = (((int)_buff[1]) << 8) | _buff[0];
 int y = (((int)_buff[3]) << 8) | _buff[2];
 int z = (((int)_buff[5]) << 8) | _buff[4];
 Serial.print("x: ");
 Serial.print( x );
 Serial.print(" y: ");
 Serial.print( y );
 Serial.print(" z: ");
 Serial.println( z );

void writeTo(byte address, byte val) {
 Wire.beginTransmission(DEVICE); // start transmission to device
 Wire.write(address); // send register address
 Wire.write(val); // send value to write
 Wire.endTransmission(); // end transmission
// Reads num bytes starting from address register on device in to _buff array
void readFrom(byte address, int num, byte _buff[]) {
 Wire.beginTransmission(DEVICE); // start transmission to device
 Wire.write(address); // sends address to read from
 Wire.endTransmission(); // end transmission
 Wire.beginTransmission(DEVICE); // start transmission to device
 Wire.requestFrom(DEVICE, num); // request 6 bytes from device
 int i = 0;
 while(Wire.available()) {// device may send less than requested (abnormal)
   _buff[i] =; // receive a byte
 Wire.endTransmission(); // end transmission

As expected, the values in the serial monitor change whenever I move the sensor.

What I want to do now is basically take the ‘‘spikes’’ you were talking about, add them and get an avarage value which constantly updates itself when new data is collected from the sensor. I want to do this for x, y and z seperately. This should give me the tempo in all three directions right?

Now the issue I have is that I have no clue on how to do this. I would really appreciate if someone could provide me with some information on how I could solve this

Google "arduino peak detection algorithm" for examples of how to find the spikes.

You will also need to record the times at which they occur, or measure at regular intervals, so you can calculate spikes per second (or minute). Use the millis() function for timing.

I think the first thing to do is write a sketch to capture data for a couple of steps (whatever fits in the
small amount of memory), and print this out via serial so you can plot it and see what the signal looks
like and what characteristics are easiest to recognize - perhaps the forward acceleration surge as the
trailing foot is picked up, perhaps the z-spike on landing the foot.

I was thinking of an FSR. Accellerometer may be the more accurate one indeed.

Accelerometer's advantage is robustness really - all the moving parts are safely
hermetically sealed in the package and to my knowledge pretty much wear-free.