I am fond of walking and running in the district I live in. I enjoy the time to be alone because some awesome ideas always come to me at this time. Recently I bought a 6-axis inertial motion sensor from DFRobot. So it occurs to me that why not make a wristband pedometer to calculate my physical strength. I always cannot resist it when the inspiration comes. Ok, let me be straight up and just get started.
The material you may need:
3.7V Mini-Lithium Battery ×1
Toggle Switch ×1
The BMI160 6-axis inertial motion sensor integrates 16-bit-3-axis accelerometer with ultra-low-power 3-axis gyroscope. When accelerometer and gyroscope are in full operation mode, power consumption is typically about 900 uA.
1. Print the shell.
The design inspiration comes from my favorite watch. Its display is designed as simple and elegant. The second hand, minute hand and hour hand occupy most area of the display, which is convenient for us to recognize time. It has weight of 40g and priced at $15
(After printing out the shell, you can spray black paint on the black parts to make the color agreed equably.)
I often collect abrasive material. It’s kind of my hobby. After rummaging through chests and cupboards, finally I found a Yakeli whose color is very similar to that of OLED. So I decide to cut it and to use as a panel.
2. Connect the circuit
OLED and BMI160 both have I2C interface, so you just need to solder them on the corresponding I2C interface of Beetle.
3. Program burning
I directly revised the program of pedometer in the BMI160 library. Add millis() function to convert the system uptime into stopwatch. I add the display code of u8g character library. After trying the font in the u8g.h head file one by one, I found the font freedoomr is great to me.
The code of converting system uptime into stopwatch is shown below:
unsigned int ss=1000; unsigned int mi=ss*60; long minute=t0/mi; long second=(t0-minute*mi)/ss; long milliSecond=sysTime-minute*mi-second*ss; strTime=(minute%60)/10+'0'; strTime=minute%60%10+'0'; strTime=(second%60)/10+'0'; strTime=second%60%10+'0'; strTime=milliSecond/100+'0'; strTime=(milliSecond%100)/10+'0';
4. Solder and install
I think this step is the most difficult one, because after I designed the space distribution and installed the parts carefully, I turn on the switch, and just found that the thing didn’t work. Once again, one or two wires has been cut by me accidentally during installation. But I believe in “where there is patience, there is a way”. After many failures, success finally comes to me.
Use electric grinder to drill an 1mm hole on the both ends of the shell, install all parts together, and then the whole project is finished now.
You may notice that there are two buttons on the left side, the lower one is for stopwatch, so what about the upper one?
For running at night!
The upper button is used to control the four 5mm LEDs (I filled the crack between the hole and the switch with uv glue in a matching colour to make the wristband more exquisite. )
The position of the four LEDs is in accord with the waving angle of arms during people’s running. The ground will always be illuminated no matter how the arm moves.
This wristband pedometer not only helps me to calculate my physical strength, but also makes it more safe to run at night. Such a good stuff, you’re worth to have one.