This project is a pedometer. This combines an accelerometer which sends movement information to a microcontroller which interprets the data and sends the information to a screen which displays steps taken and distance traveled. With a few modifications to the board to make it portable and allow it to be equipped the project is complete.
This device has a switch to turn the device on and a button to toggle whether the display screen receives power or not. The board itself is fastened to a plate that acts to hold the power source (two AAA batteries) in place. This addition has another advantage of adding some weight to the device allowing it to take better measurements. The MMA8451Q accelerometer connects to the RL78/G12 microcontroller and tells the microcontroller whenever an appropriate acceleration threshold has been surpassed. The microcontroller, in turn, adds a counter to the number of steps and outputs the signal to the LCD to display the proper readings.
Schematic | Top view | |
The software for our project is rather simple in concept but no so easily implemented. When the switch is thrown to turn the device on the microcontroller starts by activating the pins, firing up the internal clock and setting it to 8MHz, creating the counters to track steps taken and miles traveled, setting the SPI and I2C variables to configure the LCD and accelerometer respectively, and finally entering the main loop. In the main loop the microcontroller waits patiently for the accelerometer to alert it of a change in gravity. The microcontroller then checks the reading and the direction of it to see if it's noteworthy. If the disturbance is noteworthy the step counter is incremented by one. Then the LCD is updated to show the correct amount of steps and miles. The creation of numbers to display on the LCD was especially hard as we had to code for two rows of text, which meant shifting one row down a pixel.
The test board is designed to take the gravity measurements that we get from walking so we can later implement those values in our actual project. This device has several differences from the project itself. This design makes use of a breadboard, since it is meant to be dismantled at the completion of the project. The power used to run the testware is supplied through the USB hookup that the R5F10RBC microcontroller uses to communicate gravity readings to the computer. This test equipment also lacks an LCD as it makes use of the computer to display the kind of information it receives from the accelerometer. An additional piece of hardware required to complete this circuit is the CP2104 converter that allows us to link our device to the computer for the sampling.
Schematic | Prototype | |
For this alteration of our pedometer we used a similar code to the one found in our actual project. One of the changes made is that the microcontroller is not awoken by the accelerometer itself, but rather awakens to take a reading every 10 ms. The microcontroller then sends the information it gathered to a routine that allows it to be transferred to the computer itself. From there we can then take the values we want from the samplings and craft a graph from those points. This gives us a chart that we can use to find when steps are taken and how many gravities of force are produced with each step. Such information tells us what we need to have as a gravity threshold for our pedometer and how often we should take a reading to identify whether a step was taken or not.
Last modified:Mon, Jan 23, 2023.