Experiment 2 (Detect Spinning Fan Obstructions)
This is a continuation of Experiment 1
Please read my other blog posts too if you haven't
Experimenting with Vibration Sensors - zst123's Blog Posts
Objective
This experiment is of intermediate difficulty.
Previously I faced speed limitations when using the Arduino Graph Plotter and today I will create my own using Python PyQt.
After which, it is possible to do detailed analysis.
I will demonstrate an example use-case application to detect obstructions in spinning fans.
Setup (A faster PyQt Graph Plotter)
Using a faster graph will make it possible to do some detailed analysis.
I have written instructions on my GitHub page on how to set it up. You will need to install some dependencies like Python 3, PyQt, PySerial.
I have documented it all on my GitHub page. You can download my graph plotter program here
I have also updated the Mbed code for the microcontroller, the main changes are in red. The changes are necessary because I have removed the 100ms delay, and also increased the serial port baud rate so that the data can transfer to the PC faster.
#include "mbed.h"
static UnbufferedSerial serial_port(USBTX, USBRX, 57600);
AnalogIn sensor(A0);
DigitalOut green_led(LED1);
DigitalOut red_led(LED3);
int main() {
char buffer[50];
const uint16_t lower_threshold = 32768 - 7000;
const uint16_t upper_threshold = 32768 + 7000;
while(1) {
uint16_t reading = sensor.read_u16();
if (lower_threshold < reading && reading < upper_threshold) {
green_led = true;
red_led = false;
} else {
green_led = false;
red_led = true;
}
int length = snprintf(buffer, 50, "%d\n", reading);
serial_port.write((uint8_t *) buffer, length);
}
}
Compile and drag & drop to program your board again.
Connect the board and run the Python 3 program in a Terminal.
The graph will appear instantly on the PC.
Test Results
Here’s a video of me testing the vibration sensor on a PyQT graph plot. It is extremely smooth!
Tapping on the sensor, it is now very easy to distinguish the profile of the tap waveform, between harder taps and softer taps.
From here we can realise how powerful the vibration sensor is if you can sample with a fast enough microcontroller.
Application – Detect Fan Obstructions
The idea for this application comes from the fact that an ideal fan will produce little vibrations when running smoothly. When there is an obstruction to the fan blades, more vibrations and sound will be produced.
I will use this handheld fan I found at home. I simply attached the sensor to the middle of the fan.
Here is a video of it in normal operation. There are 3 fan speeds and the amplitude of vibrations also increases slightly.
When there is an obstruction, we observe a large amplitude on the graph. The red LED turns on due to the threshold.
Continuous moments can be seen when a fan is spinning. And obstructions can cause a big spike in vibrations.
Conclusion
Today, I learnt that indeed this vibration sensor by Kemet is very sensitive even to small vibrations. There is a consistent pattern of vibration in normal operation that can be observed.
When there is an obstruction, the fan blades rub against the paper which amplifies the effects of the vibration. Hence, by detecting the amplitude, an obstruction detector application is possible.
The hardware setup is pretty much done and I will focus on collecting different data sets next time.
In the next post, I will experiment towards my goal of characterizing RPMs of spinning devices.
If you have any issues following through, please let me know and I will elaborate more next time. Leave your suggestions in the comments for what I should try out next!
Top Comments