25
Acceleration Based Pedometer CSE 237B Project by Vladimir Ermakov

Acceleration Based Pedometer CSE 237B Project by Vladimir Ermakov

Embed Size (px)

Citation preview

Acceleration Based Pedometer

CSE 237B Projectby Vladimir Ermakov

Agenda

● High Level Problem description● Hardware Used/Resources Available● Design● Implementation● Conclusion

Problem Description

● Accelerometers today do not measure distance accurately.

● They measure the number of steps traveled, and multiply it by some constant step length.

● This approach is not good for complex exercise sets, and hiking trips where step length varies.

Goal of The Project

Come up with a pedometer that does a better distance approximation.

Two Approaches

● Use instantaneous acceleration of the foot to get instantaneous velocity and calculate exact distance traveled.

● Use the acceleration of the foot to figure out the mode/style of walking and provide different step lengths for different modes.

Why Approach 1 Failed

● The accelerometer I had available is too coarse.

● Error gets multiplied by t(10ms) added up 100 times a second and multiplied by t again.

● This makes the error multiplied 10000 times for each second

● With a regular pedometer the error is only a couple of centimeters a step.

Can We Do Better?

● Yes, use modes approximation approach.● Have different modes (My implementation

has 2 modes) to measure different step lengths.

● Mode1 can be Walking● Mode2 can be Running● Use foot acceleration to decide which mode

to use.

What is the Hardware Available

● MMA3201D Accelerometer (+-40g)● Two Micro-controllers:

– Atiny26L performs A2D on the accelerometer– AT89C5131(32 KB programmable flash) user

interface and algorithms.– Connected through a serial interface(UART)

● ES13BA0FR LCD display

Design

● Two parts: – Sensor

● Gets mounted on shoe● Atiny26L performs A2D conversion on Accelerometer

output● Sends it to the processing unit upon request

– Processing Unit● User interface: LCD, Keypad● Step counting/distance calculation algorithms● Sends requests to the Sensor via UART

More Details

● Pressing GO turns on the processing unit.● After displaying the Splash Screen the

system enters MAIN state.● From here one can enter the menu by

pressing SELECT or start counting steps by pressing GO.

● The menu exposes multiple parameters that control the sensitivity of the pedometer.

Parameters

● Step Length – distance traveled in a step● Threshold – minimum acceleration to register

as a step● Step Time – minimum number of

measurements to be above threshold before a step is registered

● Recoil – duration of a step. A new step will not be registered during this time.

Illustration of Parameters

States of the System

● Stopped● Counting● Paused● Auto-configure

What is Auto-configure

● Asks the user to walk 10 steps and uses that as a sample of the mode of walking.

● Finds average maximum acceleration of the ten steps, and uses that as a guide when deciding what mode of walking one is in.

Implementation

● No OS, just compiler supported interrupt handling

● main() with a while(1) loop.● Scheduling is of tasks is performed using

timers.● No preemption except for interrupt handling.

Timing

● An interrupt handler timer0_irq() gets called every 10 milli-seconds.

● Its job is to decrement counters and to read in the current state of the keyboard register.

● Several important counters:– power_off_timer– sensor_timer

Serial Communication

● The protocol is simple, byte based.● First byte is a start of packet indicator.● Its followed by 6 bytes of data – X, Y, Z● Actually each data parameter is only 10 bits,

so 6 bits are wasted per parameter.● Not a bottle neck.

pkt_processSensor()

● Responsible for data processing.● Sensor data has to be centered and

normalized● Filter out the noise using the threshold

specified by the user (High noise to data ratio)

● Check step counter● After step gets registered set the recoil timer.

The Menu

● Menu is implemented as a key driven state machine

● Special cases are the Auto-configure, and Counting states where a special key(KEY_NONE) had to be generated in order to fit the model.

Real Time Issues

● LCD updating is done synchronously and is very slow.

● First I tried updating the screen every half a second – problems over/under counting steps. (Diagram on next slide)

● Solution – to only update the display when a step occurs.

Timing Problems

Testing

● Testing was performed by running/walking around the house and block

● Did very well counting steps.● Problems with determining modes, actually it

barely works.

Reasons for Error

● Acceleration does not differ that much between walking and running, so a more accurate accelerometer is needed to perform the job.

● Possibly the approach with taking the maximum acceleration can be replaced with taking the average acceleration instead.

Conclusion

● Instantaneous acceleration approach is not a feasible option.

● Modes of walking approach has good potential, and could be made more reliable if more time and hardware resources were available

The End

Questions?