How to build your own "Fitbit"

Hi

As a concept, I am trying to build a "fitbit" using a 3 axiz accelerometer.

My problem comes with measuring a "step" and making the sampling as power efficient as possible.

Does anyone have an example sketch of how they would determine a "step" from the readings, and how often you need to poll the sensor output.

what is a fitbit ?

I only know 0 and 1 bits :slight_smile:

You need to understand how the accelerometer works and what values it reports during various activities, before you can begin to analyze for "steps".

What accelerometer do you have and what have you done so far?

I have a Pulolu Freescale MMA7361LC unit {Freescale MMA7361LC}

So far, I have very simply, only started "listening" to the output from each pin every "x" milliseconds, and record a "step" only when the reading is above "y" for each pin.

My sketch is loosely based on the examples from Arduino:

const int xpin = A0;
const int ypin = A1;
const int zpin = A2;

int x,y,z,count = 0;

void setup() {

Serial.begin(9600);

}

void loop() {
x = analogRead(xpin);
y = analogRead(ypin);
z = analogRead(zpin);

if ((x > 360) && (y > 360) && (z > 360)) {
count++;
}
Serial.println(count);
delay(100);
}

I suspect that there are alot if "issues" with this very basic attempt, hence my post here.

I suspect that I will get multiple "true" readings due to the sampling time only being 100ms, ie, I might count more steps that was actually the intention, and with such a short sampling period, I'm not sure if there are any power savings to be had by putting the sensor into sleep mode.

I'm not sure however how to get this right if I increase the sampling time?

You are on the right track.

Reliable detection of just about any event in the real world is not straightforward and requires a lot of experimentation.