Bluetooth Knife Sharpening Angle Monitor
This project was to a create training device for knife sharpening to give someone instant feedback on their ability to hold and angle during the process. The project uses an Arduino Nano BLE Sense Rev2 that interacts with a python program that receives the angle values.
Details
The Sharpening Assistant project was built using the native Arduino C++ library. When starting the project, I knew I wanted to use a small board that is Bluetooth capable so that the board can be attached to the blade that is being sharpened with minimal impact to the user. The development process was based around figuring out how to create Bluetooth characteristics to transmit data from the peripheral. The other part that proved to be difficult was creating an algorithm that properly filtered out noise from the IMU.
When trying to find a filtering algorithm for angle measurement that was best for the application, many paths were pursued. Initially, a complementary filter was implemented, but the cyclical accelerations inherent to the sharpening motion created inaccurate angle measurements. From there, I looked into and implemented many algorithms. I tried a couple of more advanced filters, including Mahony and Madgwick. I found, for my use, these were difficult to tune and since I knew the motion that I wanted to filter I actually went back to the complementary filter. Instead, this time, I included a few simple filters to address the exact movements from this application that were causing noise. What I landed on is an angle measurement algorithm that is heavily weighted to gyroscope measurements that will only use accelerometer data if the RSS value of acceleration has been close to 1 over a period of measurements.
Scripts / Algorithms
In order to have a working project, there were two programs that were created. These are listed below:
- Central Device Program - Python
- This is the program for the central device (computer) that receives information from the Bluetooth device. This program uses asynchronous routines to get angle measurements. It then compares the angles against the target value of 18.0 and prints the measurements in blue, green, or red for an easy visual indicator while the user is working.
- Part of this program is the searching for Bluetooth devices and connecting to the proper peripheral device.
- Peripheral Device Program - C++
- This program initializes the device and reads IMU data to create angle measurements.
- As part of the initialization, there is the Bluetooth setup as well as a calibration step for the sensors to provide accurate measurements.
- This program also includes the update angle functionality that filters and fuses IMU data to create an accurate angle reading
Lessons Learned
There are many lessons learned while doing this, but here are a few:
- I learned how Bluetooth low energy devices work and provide data to a central device. For a peripheral device that is providing information to a central device, there are tradeoffs to be made if the device is going to implement a notification or indication system. In my system I ended up using indications because I believed it would give me a better path for the future where all data that is transmitted is captured even though this reduces the amount of data that is received.
- IMU's provide a ton of data, but filtering through the noise is the most difficult part. Even though there are more complex algorithms, they may be the best for the application. In my case I settled on a simple filter implementation with some additions that were specific to my application which gave the best results.
- The best way to transmit data via Bluetooth is to convert to an integer by multiplying by a large number like 1000 and then dividing by the same amount on the receiving side. This is because Bluetooth characteristics are sending raw bytes. This adds difficulty when different systems use different representations of floating point numbers.
Accomplishments
- I was able to create a minimum viable product of a Bluetooth angle measurement system that will be used for a training device to hold a consistent angle.
- The angle measurements are consistent and filter out movements as expected to that allows for productive feedback during the sharpening process.
Improvements and Other Variations to Try
- Currently, the end result is to print angle updates live to the console. The next step would be to create a multithreaded central algorithm that can update values to a window while not blocking the readings from the peripheral device.
- I have made it, so the peripheral device sends an angle and acceleration value. I would like to integrate this value to be able to angle as a function of position and break the line plots for this into separate lines, so each stroke movement can be captured individually.
- I would like to continue to tune the sensor fusion / filtering algorithm. I think it is really close, but could be fun to play with to perfect.
- The other next step, which is outside my current skill set, is to create a single PCB that incorporates the DC/DC converter. Along with this, it would be great to make a housing that could easily clamp onto the knife for easy use.