Maybe a little bit off topic, but I was recently experimenting with training decision trees directly on the MCU. For those unfamiliar, decision tree is a machine learning algorithm and you can teach it to perform some classification task.
Problem definition
We have a huge CNC machine that we use to process wood or aluminum. Sometimes CNC tool breaks during CNC processing, but the machine can't detect it and just keeps going forward without touching the material. (Just moving above it). So when sometimes we leave the machine working and go somewhere, we return and the job is undone. It would be good from a practical standpoint to get alerted, when such error occur(via some messenger app or sms ), so the process can be stopped and restarted.
Other requirement
- We don't have a server or cloud for data gathering or processing, so no cloud processing. Training and inference should be done without network connection directly on the device.
- We don't have budget to pay data scientists. The sensor should be robust enough to be controlled, trained and used by everyone.
- Possibility to adapt to different materials.
Solution
So based on the requirements I made a simple smart accelerometer that can learn the tool breakage state from vibrations. The device is made around bno055, Esp32-C6-Bug and a solar shield. I decided to use Esp32-C6-Bug because it's currently the only board I have that has battery support, Stemma QT connector, SD card for saving the data and a sim card module.
Classified states:
- OK(the device is idle or cutting the material).
- Error state (the device tool is broken and the machine is moving above the material).
Both the code and my learning data are available. For now the device was trained with only one tool and only wood. The classification result is printed to UART, of course it you can send info about state change via SMS, some messenger (like Telegram) up or control a relay to automatically turn of the CNC machine.
The accuracy was 0.89 after learning on 24 minutes of data.
Device states and events that trigger state transfers are on the picture:
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.