After experimenting with the Fischertechnik's encoder motor and finding out that the motor's electrical current changes when external torque is exerted on the motor in rotation, I have decided to use Qeexo's AutoML program to make a machine learning model that classifies the motor's state and detects for any issues on the running motor on the robot arm.
Fischertechnik
Fischertecnik is a German construction toy brand. Using their Stem Engineering kit (519341), a simple robot arm was built.
AutoML
Qeexo's AutoML software allows for a simple and easy machine learning model development. With the supported hardware, AutoML allows easy data collection and machine learning model development without having the user write a single line of code; for this particular project, I have used STMicroelectronics STWINKT1B multi-sensor tile.
Step One: Building the Fischertechnik robotUsing Fischertecnik's 519341 Stem Engineering set, a four-motor robot arm was built. While this project uses this particular robot arm model, virtually any other robot model that uses a motor and has ML needs can be used to create a similar project.
In the normal, unmodified setup of the robot, two cables connect the motor directly to the controller. However, this setup needs to be modified to connect the motor to the current sensor and MCU.
In the initial version of the project, SparkFun's INA169 current sensor module was used to measure and collect the current data from the running motor.
INA169 instructions:
GND --- to green cable on MCU picture (top row, 5th pin from right)
VIN+ --- connect directly from the motor
VIN- --- connect to the controller
VOUT --- to blue cable on MCU picture (bottom row, 3rd pin from right)
VCC --- to red pin on MCU picture
*Note: INA169 sensor can only measure the current in a single direction. In other words, if the sensor is set to measure the current data of the motor rotating in a clockwise direction, it won't measure the counter-clockwise rotation data unless the setup is rearranged.
**Note: In the Bonus section, I have included a more developed, complex second version of this project. There, I have used the CZH-LABS D-1020 sensor module which records the current data as it flows in both directions.
Step Three: Recording training data setsNow that the hardware setup is done, the data collection process needs to be started. In my prior ML model, I used the multi-classclassification and collected the data for three different classes: normal (when the motor rotates at a constant maximum speed), off (when the motor is turned off), and issue (when a stick is used to cause interference on the gears connected to the motor). However, I have realized that collecting the "issue" dataset and using it in the model training process is unideal. Why? in real-world applications, who would want to break the motor just to collect some issue dataset?
So, I have decided to use the multi-class anomaly classification type to train a machine learning model. Here, I only collected the training data set for the normal and off status.
- When collecting 10 seconds of Normal data set, I turned the motor on at full speed for the duration.
- When collecting the Off data set, I collected the current data with the motor off.
After successfully collecting the training data, I trained machine learning models on all five supported algorithms.
All five algorithms had the same 0.93 accuracy on cross validation, and similar latency. However, GBM (Gradient Boosting Machine) turned out to be the best working algorithm on live testing, while also having a small memory size.
Step Five: TestingFinally, the developed machine learning model was tested on live demonstration.
Check out the video below
BonusIn addition to the prior model above, I have created a more complex version of this project. Using CZH-LABS D-1020 current sensor, I made a classifier that differentiates between:
- Up-8 (arm going upward at full speed)
- Down-8 (arm going downward at full speed)
- Off
- Up-issue (gear interference during upward movement)
- Down-issue (gear interference during downward movement)
- Unknown (arm moving up/down at a slower speed)
A mere teenager toy was used in this project, so this developed ML model will not be able to be applied directly in any industrial setting. Nevertheless, there is a notable takeaway: the motor's electrical current changes when there is an issue in the motor itself or one of the connected gear components. The change in the current data was sufficient enough that the model was able to be trained and tested to a reliable accuracy. Hence, this idea of using a current sensor to detect motor anomalies through ML model may be used in many practical instances such as in automated factories, apartment water pumps, elevators, etc...
Comments