Improving one step at a time—a pedometer on mikromedia for S

Here you can find latest news on mikroElektronika products.
Post Reply
Author
Message
User avatar
anikolic
mikroElektronika team
Posts: 1775
Joined: 17 Aug 2009 16:51
Location: Belgrade
Contact:

Improving one step at a time—a pedometer on mikromedia for S

#1 Post by anikolic » 05 Sep 2014 09:02

Improving one step at a time—a pedometer on mikromedia for STM32 M4

Marko spent the past few weeks walking up and down the intern's lab. Criss-crossing the room hundreds
of times, sometimes marching like a soldier, other times tottering like an old lady... all the while keeping a
mikromedia in his pocket.

Image

As every other intern, on his first day Marko received a spreadsheet with a list of projects to choose which
one he will work on. He skipped the WiFi weather station… considered a software implementation of USB…
then finally settled on a pedometer on a mikromedia for STM32 M4:

There was a bunch of interesting stuff on that list, but a pedometer looked to me like the most complete,
all-round challenge. I studied Signal processing in college so I knew the theory. Making it work on a piece
of hardware I was not familiar with looked like an opportunity to learn a lot.


Initially I assumed it would be a straightforward process. I mean how hard could it be? First I would
acquire the signal from the accelerometer. Walking steps would obviously show up as a rhythmically
reoccurring pattern, so I would just have to set up a proper threshold to separate the walking from the
variety of background noises and that's basically a pedometer.

Man was I wrong.

The output from the accelerometer was a mess. No way to reliably tell apart steps from everything else
just by looking at it.

It took a lot of digging through Google scholar to study previous implementations. Coming up with new
assumptions, altering the code… then of course walking and walking… Step by step (pun intended) and the
number of steps slowly started to correlate with the counter on the mikromedia display.

It's a great collaborative environment down here. We help each other all the time… throwing ideas back
and forth… when we get stuck, a senior developer from upstairs shows up to nudge us in the right direction.

End result? You can download the code from Libstock and study the details; in short, Marko developed
an algorithm that dynamically adapts to your particular pattern of walking:

As you walk with the mikromedia in your pocket, the accelerometer generates a jumble of signals; some
of it is from walking, some is the interference from surrounding circuitry, some is from the board shifting
in your pocket. The problem is, your pattern of walking is constantly fluctuating so it's impossible to set
a fixed threshold that would separate your steps and discard all the surplus noise. To address this,
I developed an algorithm that samples the accelerometer data every 0.5 seconds as you walk, and
dynamically adapts this threshold. Additionally, to prevent the pedometer from counting steps as you're
shuffling your feet while waiting for the bus or something, I've set fixed low and high gate values.
These are based on statistical research on what constitutes walking (from Google Scholar). I'd say that
I achieved a precision of about 90 percent. It's not the most sophisticated pedometer in the world,
but it's pretty reliable.

More Intern projects coming up, including the above-mentioned Software USB implementation.
Stay tuned.

Yours sincerely,
MikroElektronika
Web Department Manager

MaGiK
Posts: 897
Joined: 19 Apr 2013 10:00

Re: Improving one step at a time—a pedometer on mikromedia f

#2 Post by MaGiK » 05 Sep 2014 10:04

Thank you Marko for the hard work you put on this project :D
I can only imagine how much steps have been taken to accomplish it, so that candy bar is very well deserved :lol:

Can I ask you something?
It's about the MikroMedia Proto shield. Was that really needed in the design?
From my point of view, I guess it's only there to hold the battery to the MikroMedia board. Am I right?

Also, I'd love to know the name of the soundtrack that's used in this video please. It's really cool!

Other than that, I wish you and the rest of the interns a great learning experience :D
I'm not embarrassed to say that I actually envy you guys. Hanging with MikroElektronika's team and learning from them would be a great honour and pleasure to ... well, anyone!
Have a great day :D

Best Regards
My hobby is collecting MikroElektronika products.
Gotta catch them all!

marko.lainovic
Posts: 2
Joined: 15 Sep 2014 16:21

Re: Improving one step at a time—a pedometer on mikromedia f

#3 Post by marko.lainovic » 15 Sep 2014 16:46

MaGiK wrote:Thank you Marko for the hard work you put on this project :D
I can only imagine how much steps have been taken to accomplish it, so that candy bar is very well deserved :lol:

Can I ask you something?
It's about the MikroMedia Proto shield. Was that really needed in the design?
From my point of view, I guess it's only there to hold the battery to the MikroMedia board. Am I right?

Also, I'd love to know the name of the soundtrack that's used in this video please. It's really cool!

Other than that, I wish you and the rest of the interns a great learning experience :D
I'm not embarrassed to say that I actually envy you guys. Hanging with MikroElektronika's team and learning from them would be a great honour and pleasure to ... well, anyone!
Have a great day :D

Best Regards
Hey, MaGiK, sorry for not replying sooner!

Indeed you're right, it has been great hanging out with MikroE staff, learning from them, as well as having the chance to see how things work and projects get done in such a company... something I'd definitely recommend to anyone who wants to delve into the embedded world.

Regarding you question, you're right again, the shield is there for mechanical purposes only, to support the battery.

Unfortunately, I don't know the name of the song, but I'll ask around and let you know :-)

Have a great day as well!
Marko

MaGiK
Posts: 897
Joined: 19 Apr 2013 10:00

Re: Improving one step at a time—a pedometer on mikromedia f

#4 Post by MaGiK » 19 Sep 2014 18:51

Hello Marko :D
marko.lainovic wrote:Hey, MaGiK, sorry for not replying sooner!
Please don't mention it. I'm quite sure you guys are quite busy there :wink:
I should be very grateful that you found the time to reply to me, and I am grateful :D
marko.lainovic wrote:Indeed you're right, it has been great hanging out with MikroE staff, learning from them, as well as having the chance to see how things work and projects get done in such a company... something I'd definitely recommend to anyone who wants to delve into the embedded world.
I wish I could join you guys there :( It would be a wild dream coming true :cry:
Seize each opportunity presented there to the fullest Marko!
marko.lainovic wrote:Unfortunately, I don't know the name of the song, but I'll ask around and let you know
Please don't trouble yourself over it. It's not that important.
What's important is that you do your best man!

And as always, I wish you guys a great learning experience there :D
Best Regards
My hobby is collecting MikroElektronika products.
Gotta catch them all!

hemantvraut
Posts: 2
Joined: 05 Feb 2016 17:59

Re: Improving one step at a time—a pedometer on mikromedia f

#5 Post by hemantvraut » 05 Feb 2016 18:06

Hi Marko,

Thanks for this project.

I have some queries about the implementation.

1. Does the position of pedomter device on body changes its accuracy of reading steps ?? Means is there any difference if i hold pedometer in my hand or put around my chest or legs and walk ?? Does this will affect the number of steps calculated ??

2. Currently as par project we are sampling the ADXL 342 data every 0.5 seconds, If i want to more accurate steps calculation can i increase the frequency for ADXL 342 reading ??

3. Also can you share the flow diagram for pedometer algorithm ?

Hoping for soon reply.

hemantvraut
Posts: 2
Joined: 05 Feb 2016 17:59

Re: Improving one step at a time—a pedometer on mikromedia f

#6 Post by hemantvraut » 09 Feb 2016 16:47

Hello Marko,
Thanks for sharing pedometer project. It is really helpful.
I am using the LIS3DH accelerometer for reading the acceleration data.
I have following queries
1. Does position of Pedometer on body effects the accuracy of counted steps ?
2. Can you share the links or papers you used for implementation of pedometer ? (I tried to search but unable to get generic documents.)

Regards,
Hemant Raut

marko.lainovic
Posts: 2
Joined: 15 Sep 2014 16:21

Re: Improving one step at a time—a pedometer on mikromedia f

#7 Post by marko.lainovic » 07 Apr 2016 17:28

hemantvraut wrote:Hello Marko,
Thanks for sharing pedometer project. It is really helpful.
I am using the LIS3DH accelerometer for reading the acceleration data.
I have following queries
1. Does position of Pedometer on body effects the accuracy of counted steps ?
2. Can you share the links or papers you used for implementation of pedometer ? (I tried to search but unable to get generic documents.)

Regards,
Hemant Raut
Hey Hemant, sorry for the delayed response.

1. It does; since accelerometer basically reacts to disturbances in force, it will benefit most if it's attached to body parts which are most susceptible to these periodic disturbances, such as hip, arm, etc.

2. If I recall correctly, the paper I've been using is http://www.analog.com/media/en/technica ... ometer.pdf.

Best regards,
Marko

Post Reply

Return to “Product Announcements”