Close

Shake it off

A project log for Monitoring washing machines

One mans quest to spend less time in the basement

Lars KnudsenLars Knudsen 02/07/2016 at 15:360 Comments

When the machines are doing their thing they shake- a lot of water, clothes and parts of the machine itself is moving around which can be felt as the machine shaking. Unlike my worries over using sound, the motion does not travel from neighboring machines. However, if both my machines are running (remember - they are stacked), it might be hard to distinguish if either machine has completed the cycle as they are able to shake each other. This will be interesting to study once the data goes to the cloud, perhaps the difference in amplitude, or using multiple sensors will be sufficient to distinguish.

I will be measuring motion using an accelerometer, and my plan is to make a very naive implementation, where I try to sum the amount of movement over time, much like the approach I described for measuring noise. For this project i've gotten a MPU-6050 breakout board from my local dealer. Fortunately it communicates using I2C so I don't have to add additional hardware to make it talk to the Pi.

Microphone and accelerometer next to each other on a breadboard.

I found a good ressource on getting the MPU-6050 up and running on a pi, Andrew has very easy to follow guide here http://blog.bitify.co.uk/2013/11/reading-data-from-mpu-6050-on-raspberry.html (and a previous entry on the wiring). After having set it up I made it do 10 consecutive reading one second a part and for each reading it would calculate sum the difference in acceleration from the previous measurement - the excerpt below from my code should be self explanatory

diffAcc += abs(prevX-accel_xout)+abs(prevY-accel_yout)+abs(prevZ-accel_zout)
Printing the output gave the following result
428
1060
1532
1820
2416
2860
2964
3160
3472
3904

So far so good. Then I paired the code with the stuff I had found for google sheets and the results were shared in the cloud, where I could produce this graph

I gave the board a bit of a shake which showed up nicely on the graph. I am almost ready to mount my hardware on my machine for a first test! I practically only need to get wifi working, so I'm going on a treasure hunt in my parts pile to find those usb dongles I know I have laying around.

Discussions