-
Loot!
02/20/2016 at 14:48 • 0 commentsI ordered home some new wifi adapters (bought two different models, just in case either didn't work), two powered usb hubs (just in case the Pi couldn't power it on its own) and two MCP3008 ADC's for analog inputs. Bought two of each because they are components which can be used generally and I did not want to risk any of the components failing, being incompatible or something along those lines.
Two of each pictured except one of the wifi adapter, a LogiLink WL0145, currently mounted on the pi. Notice the 13 port hub, just because you can never have too much!
I took the smallest of the two wifi adapter and put it directly on the pi without a powered usb hub and it worked out of the box. This was quite a relief, but it also made the effort wasted on the other receiver feel even more crushing and ridiculous. The adapter found my network immediatly, and shazam(!), the magic of wireless networking was blessed upon the project. Next question was then if the wireless network would work all the way down in the basement.
The current project setup, placed in the basement on top of the dryer
Before I had gotten up from the basement to my laptop the pi had connected to the network. The sense of succes, progress and confidence was once more present in the project and excited by this I ditched the original plan of mounting all the sensors, and went ahead with just getting data from the accelerometer. I tried running the washer (mounted under the dryer) and the dryer afterwards.
The first half of the graph shows the washing cycle (estimated to last for 40 minutes). After lunch we got home and started the dryer seen in the latter half of the graph (estimated to last for three hours)
The results from the accelerometer are very promising, in that they show that I should be easily able to distinguish if neither machine is running as well as the dryer from the washer using an accelerometer. But it shows that I probably do have to mount an accelerometer on each machine - I'm quite keen to see what kind of data an accelerometer on the washer would provide. With the other sensor options and more in depth post processing to be done still to be explored, I am very hopeful for the sensoring part of the project being succesful.
Being able to see the data online is a nice first step, but I would like to figure out automated processing and getting a notification to my devices. However, the coming week will be filled with a different adventure, so I don't expect to put out another update until in two weeks time.
-
First major bump
02/14/2016 at 21:09 • 0 commentsExcited to progress with the project I took the only available wifi dongle in the house, a TP-Link WDN3200, threw it on the pi and assumed I would be able to do a test run this weekend. How horribly wrong I was.
Remove the cable they said, usb dongles are fine on the raspberry pi they said... Now I'm stuck
After some research I found that I needed to build the drivers for the dongle and at this time my lack of experience with Linux reared it's ugly head. Having been an almost exclusive windows guy so far, I'm used to plugging in usb devices, wait a minute or two and just having them work. After spending about three hours trying to get the driver built, updating my kernel and gcc and generally doing a lot of other things which I barely understood I had made no progress at all and aborted my attempts in frustration. I had never antiticated this would be this hard.
Next step is to simply pick a device which exist both at one of my local dealerships and coincides with the compatibility list I found.
-
Shake it off
02/07/2016 at 15:36 • 0 commentsWhen 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 result428 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.
-
Providing perception
02/07/2016 at 08:24 • 0 commentsWhen the machines are running they have a few things in common: They move/shake, they make noise, their interfaces change during the cycle, the washing machine takes in water, both machines out water and they draw power. I don't know enough about the water in- and outtake of the machine to estimate if that would be a viable indication of when the machine cycle is complete so for now I will rule that out. Also, as mentioned in a previous post, I'd like the solution to not rely on something my machines do specifically, so others can use the solution and I can migrate it onto other machines if e.g. one of them breaks down at some point. This leaves noise, movement and power draw.
Measuring noise - This is probably the solution I have the least faith in due to the context of my machines. They are placed in a room with 5 other washing machines which can also produce noise, but perhaps clever microphone placement can isolate the noise from my machines.
My machines are the two stacked ones, dryer on top, washer in the bottom
I have previously had good experience with small preamplified microphone boards, so I've picked one of those up for the project. My local electronics dealer had the Adafruit Electret Microphone Amplifier available, so I will be using that for prototyping. If I end up making a custom board then I'm sure I could cut costs a lot by making the amplification circuit myself.
The microphone I will be using in the first prototype
I'll be measuring the amount of noise coming out of the microphone to determine if the machine is running or not. Sound is measured in waves and the input I am getting from the microphone would be waves around half the provided voltage (1.65V) from the provided voltage (3.3V) to 0V. Simplified by a sine function it would look like this
Then I'll use an ADC to convert it to a number my processor understand, and for this project I'll probably use the MCP3008 (Note to self - Pi has no ADC itself, you have left the world of Arduinos). The MCP3008 has a 10 bit ADC providing 1024 levels of sampling. I will deduct half of the sampling resolution, 512, from the signal which will make it look like this
Now half of the signal is in negative values, so I'll take the absolute value of the signal
And voila! Now I have a signal which I can summarize over time to express the amount of noise measured in that timeframe. The simplified example above makes this approach look vulnerable to sample at nyquist frequency, but since the noise the machines makes have more in common with white noise than pure sinusoids, I don't think this will be a practical problem.
-
Hello Google Spreadsheet
02/06/2016 at 13:52 • 0 commentsFor working with the sensor input I would like to test out some different sensors, look at their output during a washing/drying cycle and use that information to figure out how to interpret the output and pick the best sensor for the task. I really like to make informed decisions (I guess my academic background is to blame here) and I think this could also be very useful for future projects. To do this I would like the pi to store the input from the sensor regularly (e.g. every 30 seconds or so) and preferably in a way that lets me graph it easily, e.g. csv or perhaps a spreadsheet.
Last night I got my Pi up and running, set up ssh and ftp on it (and strongly considering VNC) to support developing on it without connecting peripherals. I can highly recommend the guides on the official Raspberry pi site in this regard, https://www.raspberrypi.org/documentation/remote-access/.
The first gen raspi I'm prototyping on until I can get my hands on a zero. So far the ethernet cable is providing network access, but I hope one of the USB wifi dongles I have will work with the Pi and be able to connect to my wifi from the basementHaving the basics up and running I started googling around to figure out how to save the sensor output. In the best of worlds the Pi would save the data on the internet/cloud so I did not have to fetch it directly from the Pi and it turned to be a lot easier than I expected, as I feared I would have to set up an SQL server or such.
Having done a lot of work in excel in the past and some in google sheets I decided to look into if there was an easy way to interface with sheets. Turns out google has made an API for it and better yet, I found an easy to follow guide on how to use it with example code from LadyAda, https://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging/connecting-to-googles-docs-updated. After 20 minutes of poking around, I had a cloud connected python application making timestamped rows on a google spreadsheet! I was stunned, I though this would be one of the biggest challenges of the project. Having the data directly available in google sheets suits my likings and the scope of a project like this very well.
So far I just hardcoded some text for the application to output. Next stop connecting actual sensors to the Pi
-
Washing machine agnosticism
02/02/2016 at 19:45 • 0 commentsYesterdays decision of going Pi has made me reflect a bit. Many projects don't progress past the idea phase because things like trying reducing cost or development difficulties get in the way. Reducing cost often means using e.g. a smaller processing platform which can make it harder to do development, doesn't have well supported libraries, etc. This solidifies my choice of Pi as processing platform over e.g. the 8266 modules I have laying around, as development is likely to be better supported. Besides - with the $5 Pi-zero, it is only a minor difference in cost.
Guess my Digistump Oaks will have to wait for another iteration or project.
Furthermore the Pi platform has the benefit of being widespread in the hacking community meaning my project (if succesful) should be easier to replicate for others. To support further replications I'll try to pick hardware which is widely available and fairly cheap (no exotic solutions) to broaden appeal. It should also be a "washing machine" agnostic solution, so hooking into the machines hardware, placing e.g. lightsensors on strategic positions are not valid options.
While keeping these considerations in mind the singlemost important goal is to complete the project, by at least creating a working prototype. Without that all the considerations are without value, and it is always possible to make later iterations which optimize on cost and such. A great example of this (perhaps taken to the extreme) was featured recently in a picture frame project which could e.g. easily have been made on a Pi, but which used a 27" iMac.
With that said, it is time to get cracking! I've got a pi coming my way tomorrow and some of the sensors I'm considering using have already arrived, more about those in a later post
-
The engine room
02/01/2016 at 20:27 • 0 commentsThe project needs a processor, preferrably with wireless networking capabilities. Originally I had considered using a ESP8266 but the recent Pi Zero contest has brought my attention to the Pi Zero again. A popular platform amongst other hackers I know I have direct access to a lot of information about Pi's, not to mention the vast amount of information already available on the internet. Having only made a single project on a Pi previously it is a good opportunity to expand my experience with the platform and the small zero seems perfect for the job. Perhaps the Pi could even host a website displaying sensor output - more about that it the next update.