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.
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
Improving one step at a time—a pedometer on mikromedia for S
Improving one step at a time—a pedometer on mikromedia for S
Web Department Manager
Re: Improving one step at a time—a pedometer on mikromedia f
Thank you Marko for the hard work you put on this project
I can only imagine how much steps have been taken to accomplish it, so that candy bar is very well deserved
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
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
Best Regards
I can only imagine how much steps have been taken to accomplish it, so that candy bar is very well deserved
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
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
Best Regards
My hobby is collecting MikroElektronika products.
Gotta catch them all!
Gotta catch them all!
-
- Posts: 2
- Joined: 15 Sep 2014 16:21
Re: Improving one step at a time—a pedometer on mikromedia f
Hey, MaGiK, sorry for not replying sooner!MaGiK wrote:Thank you Marko for the hard work you put on this project
I can only imagine how much steps have been taken to accomplish it, so that candy bar is very well deserved
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
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
Best Regards
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
Re: Improving one step at a time—a pedometer on mikromedia f
Hello Marko
I should be very grateful that you found the time to reply to me, and I am grateful
Seize each opportunity presented there to the fullest Marko!
What's important is that you do your best man!
And as always, I wish you guys a great learning experience there
Best Regards
Please don't mention it. I'm quite sure you guys are quite busy theremarko.lainovic wrote:Hey, MaGiK, sorry for not replying sooner!
I should be very grateful that you found the time to reply to me, and I am grateful
I wish I could join you guys there It would be a wild dream coming truemarko.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.
Seize each opportunity presented there to the fullest Marko!
Please don't trouble yourself over it. It's not that important.marko.lainovic wrote:Unfortunately, I don't know the name of the song, but I'll ask around and let you know
What's important is that you do your best man!
And as always, I wish you guys a great learning experience there
Best Regards
My hobby is collecting MikroElektronika products.
Gotta catch them all!
Gotta catch them all!
-
- Posts: 2
- Joined: 05 Feb 2016 17:59
Re: Improving one step at a time—a pedometer on mikromedia f
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.
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.
-
- Posts: 2
- Joined: 05 Feb 2016 17:59
Re: Improving one step at a time—a pedometer on mikromedia f
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
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
-
- Posts: 2
- Joined: 15 Sep 2014 16:21
Re: Improving one step at a time—a pedometer on mikromedia f
Hey Hemant, sorry for the delayed response.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
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