Introduction: Activity Monitor
The goals of this project is to design a device using an Arduino Uno to measure a person’s activity level, specifically the number of steps a person takes, the duration of time of physical activity performed, and distance traveled. The monitor incorporates GPS data and a real-time clock to accurately measure these parameters and can be logged on a SD card.
Step 1: Gathering Your Materials
- 1x Arduino Uno
- 1x Sparkfun MMA7361 Accelerometer Breakout
- 1x Adafruit Ultimate GPS Logger Shield (Includes MicroSD card reader and Battery)
- 1x MicroSD card
- 0.1" male headers
Step 2: Operation Principles
To be able to monitor a person's physical activity, an accelerometer is required to be able to determine change in position. The accelerometer is able to determine these position changes with force transducers that shift in capacitance readouts with accelerating movement. This can be used to determine when a person takes a step, as there will be a rapid change in acceleration each time a step is taken. The data received can also be used to determine when a person is performing a physical activity, by setting a threshold, so that if the magnitude of the acceleration exceeds the threshold, the device will record the duration of the activity. A GPS module is also incorporated into the device to determine actual location and the real time for the data. The coordinate data can be used to calculate distance traveled by subtracting the distance between the starting point and the current location of the subject. All of the data is logged onto a MicroSD card, which can store the data as a text file and can be accessed on a computer.
Step 3: Constructing the Device
Constructing the device involves soldering the accelerometer connections onto the GPS shield along with the headers so that it can be attached to the Arduino Uno. The accelerometer connections are shown in the image above. For the Vref connection on the accelerometer, the 3.3 V on the Arduino Uno was connected to both the accelerometer and to Vref on the other side of the Arduino. The X, Y and Z outputs of the accelerometer were connected to the Analog inputs 0, 1 and 2 respectively. The GPS shield digital pins 8 and 7 are connected as the TX and RX GPS outputs that can be used to display soft serial data output, respectively.
Step 4: Arduino Code
Constructing the code involved combining multiple libraries, specifically the G_Force template from the AcceleroMMA7361 library for the accelerometer data and the SD Shield logging template from the Adafruit GPS library for the GPS data. First, the Arduino will check whether there is an accessible MicroSD card to write data to, and if not, the program is interrupted. A new text file is created to write data to. Next, the accelerometer is calibrated, which the code is given in the library by Sparkfun. Once the initialization is complete, the device begins to measure the data from the accelerometer. The accelerometer data is filtered and processed to determine if activity has occurred. If it has, the step counter adds a step to the counter value. A time counter is also kept to record when the activity begins and ends. The distance traveled is determined from the GPS data and an average velocity can be calculated. The data is logged onto the SD after each iteration. While we initially planned to combine all of the codes into one combined file that could log all of the data, we ran into memory issues and ended up splitting the files. We have an accelerometer program that will read the accelerometer inputs and output whether activity is occurring, the time and duration of activity, the step count, the total distance traveled, and average velocity. A separate SD Shield program will output the individual GPS data and log on the SD card the time, date and coordinates from the GPS.
8 years ago on Introduction