close
KnowledgeBase

(3/4) BPM (Pulse Sensor) and Pedometer (ADXL345 Accelerometer) Wearable Device with OLED Display

91450-GY-291-ADXL345-3-Axis-Accelerometer-700×700

Overview

The final key to the puzzle lies within the ADXL345 accelerometer. The easiest way to obtain a pedometer is buying one. But where’s the challenge in that?

For a more detailed ADXL345 Accelerometer visit my good friend, Eddyson’s, post here :

https://community.createlabz.com/knowledgebase/3d-animation-control-using-adxl345-triple-axis-accelerometer-on-arduino-uno-and-processing-3-ide

Application Description

There are different types of pedometer available in the market. Some are dedicated wearables, and some are phone applications that uses the phone’s sensors. Pedometer apps for Android for example are abundant as listed here: https://joyofandroid.com/best-pedometer-apps-for-android

Nonetheless, either wearables or phone apps, they serve the same purpose : To measure a person’s step.

The magic to make the accelerometer work as a pedometer lies within the code. It uses an adaptive peak detection so that each back-and-forth movement can be recognized as a step.

Before you upload the code here, be sure to calibrate your Accelerometer ! Otherwise it will be highly inaccurate in recognizing your steps !

For more information, go here : https://www.explainthatstuff.com/how-pedometers-work.html

Calibration

  1. The Pedometer Calibration is very simple. Upload the code to your Arduino, and Note the threshold value.
  2. Walk around a few steps, or move the accelerometer a few times. Increase or decrease the threshold value, where a movement should be recognized as a step.
  3. You are done !

Set-up the Hardware

Similiar to Eddyson’s set-up the hardware !

Code

The code is very similar to the linked post, except that function ArduinoPedometer() is added.

 

Code Breakdown

We are interested in this variable, since this determines when to register a movement as a step.

Since we are receiving a chunk of data, we will separate/parse the data into different variables.

This formula is the length of a line segment. We will be using this to detect a movement/step.

Here’s a discussion on different pedometer algorithms : https://stackoverflow.com/questions/20324356/how-to-calculate-exact-foot-step-count-using-accelerometer-in-android.

We’ll use the (1) as our algorithm.

Conclusion

The ADXL345 accelerometer is a versatile device that can be used in many applications. If a time element is used, it can be used to determine the distance traveled.

References

https://github.com/abhaysbharadwaj/ArduinoPedometer

https://community.createlabz.com/knowledgebase/3d-animation-control-using-adxl345-triple-axis-accelerometer-on-arduino-uno-and-processing-3-ide

https://joyofandroid.com/best-pedometer-apps-for-android

 

Tags : accelerometeradxl345arduinoPedometerwearable

Leave a Response