A small amount of acrylic pigment (green, yellow, blue and brown; if gray and white pigment is provided, the oil paint does not need to be prepared)
Light gray and white oil paint
A good-looking 2-foot button (I bought it on Taobao)
Lead wire (2 mm) (If no, replace it with soft iron wire)
40 cm PVC hollow rod (I use the one with outer diameter 9 mm and inner diameter 5 mm)
A screw and nut with the length of 20mm
Codes and SLDPRT Files
Download the routine program of BMI160 on uno, then open the serial port to observe the data, and carry out data sampling through a series of knocking. Then, write the corresponding program through data analysis.
1. After I put it on the table, it barely shakes:
The first tree columns are gyroscope and the last three columns are acceleration. The data indicates that the gyroscope values fluctuate in the range of 0.30 and accelerometer values fluctuate in the range of 0.02 without shake and vibration.
2. After knocking:
After an evident knocking, the gyroscope values varied in the range of 17 approximately and the accelerometer values varied in the range of 0.20.
Through repeated knocking and sampling with varied strength, the analysis concludes that, one knock can be determined when the value difference of gyroscope is greater than 0.30 and the value difference of accelerometer is greater than 0.03 in the meantime. Some friends may say, “it’s easy to cause incorrect knocking”. Yes. So, I finally adopt two knocks. There are two cases: 1. Two knocks are determined when the normal state is recovered in 1 s following one knock and then another knock is detected. 2. Two knocks are determined when the normal state of sensor cannot be recovered in 1 s following one knock and a difference value of accelerometer is 0.20 larger than the mean value of previous 5 difference values.
The microusb port of charging panel is located outside the lamp holder shell for charging.
1. Weld lamp beams: Weld into triangular prism shape with three beams on each side and the remaining one beam at the bottom.
2. Color the earth model printed through 3D with propylene (I referred to the color of astroreality small earth model):
3. Spray the button switch periphery and screw into gray (blocking the remaining part with textured paper):
4. Take out the lead wire, start winding 10 rolls and provide the balance weight:
5. Drill a small hole at the top of earth model for threading; paint the PVC tube into gray, and make notches at both ends for placing wires:
6. Print the base model. There are model files below. After printing, spray white paint.
2. Mount it into the base and insert the periphery into the balance weight. Provide a charging panel slot on the back of model to expose the microusb port and paste bmi160 on the base plate:
Burn the program after assembly. I firstly tested its effect on uno; bmi160’s effect is great. When you lightly knock on it, it can also feel. It seems that the whole table top has become a switch. You can turn on the light simply by knocking on any position for two times:
With so high sensitivity, bmi1 should have many playing methods to be developed by geniuses
Some friends may ask, “What else function can bmi160 realize?” It can also detect your hand shaking!
The data analysis indicates that the shake will cause continuous value change of gyroscope and accelerometer, so I used multiple test difference values in program, and set the threshold value. In case the difference value change exceeds 0.2, all values will be equal to 0.20. You can judge whether bmi160 is shaking at this moment through the mean of 35 difference values.
Some friends may ask, “What’s the meaning for detecting hand shake?”
Haha, it means someone wants to use it and then it will be turned on and become a lantern to accompany you to walk at night. If you give it to a girl, she would feel delighted.