“Pumps are an integral part of the wastewater treatment process. They move massive amounts of water. Keeping pumps operational is necessary to ensure water treatment processes remain online. Serious problems can occur when a critical pump breaks.”Intro
This project demonstrates how machine learning on the RASynBoard can be used to catch faulty pumps before they cause problems.
There are many reasons that machine learning is quickly becoming a standard in water asset management:
While creating this project, I was struck by the RASynBoard's effectiveness when it comes to monitoring small differences in audio data (acoustic event detection).
For instance, the difference between the sound of running the pump without water, and running the pump with the valve closed (simulating a clog) were inaudible to me, but were easily detected by the model with 99% accuracy.
The RASynBoard's onboard PDM digital microphone (MMICT5838) is remarkably good at picking up subtle sounds, and Edge Impulse's software, along with the DSP firmware on the RASynBoard's NDP120 neural accelerator, are able to transform these sounds into excellent features for machine learning.
This project will walk you through getting set up on RASynBoard to monitor pump activity.
Install the required softwareThe following software tools are necessary for programming the RASynBoard and connecting it to Edge Impulse for data collection:
- The Renesas Flash Programmer (RFP) is used to load pre-built binary images onto the Renesas RA6M4 MCU
- TeraTerm is a free terminal application used to view debug from the demo application
- The Edge Impulse CLI is a utility installed on your PC and used to capture Audio or IMU sensor data in real-time from our embedded device and send it directly to our Edge Impulse project.
Follow Brian Willess's Machine Learning Lab 0 guide to install these tools: http://avnet.me/ML-WorkshopV2-Lab0
Create a project on Edge ImpulseIn the guide in the previous step, you created a free Edge Impulse account.
- Log in to your Edge Impulse account and select "Create new project."
- Give your project a name, and click "Create new project"
One application of industrial pumps is the Lift Pump. A typical wastewater infrastructure leverages gravity to move wastewater to a water treatment facility. Lift pumps are utilized in city wastewater applications where geographic features require moving the wastewater from a lower point to a higher elevation to keep the wastewater moving towards its destination using gravity.
A lift pump demo is represented in the diagram below:
- This is a closed loop system where the lift pump continually moves water from a low point (wet well) to a higher elevation.
- The RASynBoard is attached to the pump where either audio or accelerometer data can be used to identify when the pump is not performing as designed
- A restriction valve (ball valve) is placed before the pump to influence the system with the goal of creating an anomaly that can be detected by the NDP120
Set up:
- Using a strong scissors, cut three lengths of the tubing - two short lengths for the inlet (4 to 10cm ) and a longer length for the outlet (20+ cm)
- Connect the ball-valve. The ball-valve will be used to simulate a clog.
- Use a hose clamp on each hose connection. Tighten them with a screwdriver.
This pump must be completely submerged in order to work. In order to submerge it, we'll make use of the screw holes in the pump's mounting clip to screw the pump to the bottom of a tub full of water.
I screwed the mounting clip to a small piece of wood. I used gorilla glue to attach this piece of wood to the bottom of a plastic tub.
Leave the black and red leads out of the tub while filling it with water.
Connect the pump to power:
IMPORTANT: Place the power supply out of reach of any water that might spill or splash, as shown. Always use caution when working with water and electricity.
Connect the 12V power supply to an AC power cable, but don't plug it in yet:
- On the power supply, loosen the screws on "L" and "N." Plug the black wire (power) into "L" and the white wire (neutral) into "N." and tighten the screws. If there is a green wire (ground) on your AC power cable, plug it into ground.
- Plug a red wire into one of the "+V" screw terminals, and a black wire into one of the "-V" screw terminals (it doesn't matter which one). Use alligator clips to connect these wires to the red and black wires on the pump.
- Plug the AC power connector in. The pump should start.
- (optional) Use a multimeter while adjusting the DC output voltage screw to make sure the voltage is 12 volts, as the pump may not run if it is below 12 volts.
Try running the pump:
- with a full tank (label: "pump on")
- with an empty tank (label: "out of water")
- with the ball valve close (label: "pump clogged")
- turn it off (label: "pump off")
Follow Brian Willess's Hardware Setup guide to set up your RASynBoard: http://avnet.me/ML-WorkshopV2-HardwareSetup
This guide will walk you through:
- Jumper configurations for flashing firmware vs debugging
- Flashing the board with the firmware-avnet-rasyn.srec (found in the Lab 1 folder) using RFP software
- Copying the required files from the Student Files folder to the microSD card
- Connecting the board via USB to TTL cable to view debug output
NOTE: I've included STL files to print a case for the RASynBoard, since this project involves water and this will add some protection against splash damage. It's also helpful for keeping the RASynBoard in the same position, which is key for gathering a good dataset and for inference accuracy.
Connect RASynBoard to Edge ImpulseAfter completing the hardware setup guide, you should have the edge impulse data ingestion firmware (firmware-avnet-rasyn.srec) installed on the RASynBoard.
You should also have the microSD card files, including the config.ini file, the MCU firmware, and the dsp firmware on the microSD card.
Double check your config.ini file on your SD card:
- Make sure that Mode=4 in the config.ini file (at the top of the file).
- If you wish to debug via USB to TTL, set Port=1 (line 48)
- To debug via the USB C cable plugged into the core board, select Port=2 (this is recommended because it is faster)
Configure the RASynBoard for auto-boot:
- Install the jumper on J3 pins 1-2 on the IO board
Connect the USB C Cable OR USB to TTL Debug Cable:
Make sure you have the correct port selected in config.ini (see above step)
- To connect USB C Cable: Plug the USB-C cable into the Core board as shown.
- To connect USB to TTL Debug Cable: Connect the supplied 3-pin male/male header to your RASynBoard PMOD connector as shown (You don’t need to connect the red wire; the red wire supplies 5V and is not needed for our configuration)
Note: If you still have a serial terminal open, close the terminal to free up the COM port
Run the Edge Impulse Serial Daemon:
The serial daemon uses the debug serial port on to RASynBoard to collect data and send it to Edge Impulse.
- In the Windows search bar type cmd. Select the Command Prompt application.
- In the terminal window enter the command edge-impulse-daemon
You’ll be prompted for your Edge Impulse Login credentials
The utility will access your Edge Impulse account and list all the projects.
Select the project you just created using the arrow keys on your keyboard
The daemon is now connected to your RASynboard using the serial port, and your Edge Impulse Project over Web Sockets!
Collect Data- Click on the Data acquisition tab of your Edge Impulse project.
- Enter the label for the data that you wish to collect (.e.g "pump on, " "out of water", etc).
- Select "Microphone" from the Sensor dropdown
- Click "Start sampling." It takes a couple seconds before sampling begins.
Note: due to limited memory, the RASynBoard only lets you collect 10 seconds (10, 000 ms) at a time.
Collecting 5 minutes for each label should be enough for a robust proof-of-concept. That means I'll collect 30 ten second samples for each label.
Your data is the most important part of your model. You should collect data with various background noise your microphone might pick up, as this will mirror the actual conditions where your model will have to perform.
Split datasetOnce you have collected 5 minutes for each sample, it's important to rebalance your dataset. This will create a separate dataset for testing that is not used during training.
- On the Dashboard, scroll to the bottom of the page and select "Perform train / test split"
- Select "Yes" and type "perform split"
- Under the Impulse Design tab, select Create Impulse.
- Enter 300 for the Window increase.
- Add a Syntiant block as the processing block.
- For the learning block, select Classify. Make sure the Syntiant box is checked under "Input Features."
- Finally, select "Save Impulse."
- On the next tab, make sure that under Parameters - Chip, select the log-bin(NDP120/200) Features extractor.
- select Generate Features.
The generated features show up in the Feature Explorer.
On the Classifier tab, select "Start training."
Once complete, you will be able to see the model's accuracy, as well as a confusion matrix.
This will give you a good idea as to how well your model will perform.
Note: If the accuracy is 100%, you will need to collect more data because this indicates that your model is overfitting.
Testing your model on both your test set data and live data is an important step to make sure that the model will work well in a real world application.
- One way to test your model's accuracy is to use the Test data that we set aside when we split our dataset. On the Model Testing tab, select "Classify all."
- You can easily test your model on actual data, collected live from your RASynBoard. Make sure your RASynBoard is still connected to the Edge Impulse Daemon. On the Live classification tab, select your device from the dropdown and click "Start sampling."
By clicking on the items in the list of detailed results, you can listen to each timestamp in the raw data and view it in the feature explorer to understand why it was classified in a certain way.
Once you are satisfied with your model's accuracy, it's time to deploy it!
Deploy your model- On the Deployment tab, select "RASynBoard" in the search bar.
- Select "Find posterior parameters" and select the labels that you wish to identify. In my case, I chose all 4 labels.
- Select the
- Select "Build"
- Once your model has built, select it under "Latest build" to download it to your PC.
- Extract the files and copy them over to your RASynBoard's micro-SD card.
- Make sure the jumper is removed from pins 1-2 on the RASynBoard.
- The USB to TTL debug cable should still be attached to the board.
- Connect the USB-C cable to the RASynBoard IO Board.
- Open TeraTerm and connect to your RASynBoard. You should see the inferences:
Follow along to PART TWO to build a dashboard to keep track of the pump status over time!
Comments
Please log in or sign up to comment.