Best vibration sensor for Spark?

I got a Spark Core and a small Arduino-compatible vibration sensor, but while I could get the Spark to recognize it, it needed a good tap to be recognized even after adjustment.

I was hoping to put the sensor on our dryer to measure vibration for an “email when your wash is done” type app. Does anyone have experience out there with a particular sensor that would be good for this?


Building the exact same project at the moment (but with texting). I have one of these guys - and am still prototyping but it works pretty great. You just need you need a 1M ohm resistor to get readings out of it.

I’m guessing that sensor you linked to needs to be mounted in a PCB by the pins then? How well does it work just in the breadboard?

@eschatfische what kind of sensor are you using?

It works fairly well. I recently soldered some wires and the resistor onto the pins and am experimenting with taping the sensor directly to the washer/dryer (using a sensor without a weight for that - this guy. Going to see how that compares with 1. just sticking it in the breadboard, 2. taping the soldered wires to the washer/dryer so the sensor is still in the air, but directly in contact with the machine. Now I just need to find some more laundry to do.

I believe the weight will be necessary because the way the sensor works is to flex the piezo element. So fix the base of the sensor to the dryer, so that the weight can bend the sensor perpendicular to the axis of most vibration. I would guess like this:

If you don’t want any dangly bits, I would suggest an accelerometer… You can even calibrate it looking for the average of the peak acceleration in all axis when the dryer is running (and use the axis that generates the highest value), and then divide that value in half for a good threshold to know when it’s running or not. This can be completely automated in a simple for() loop for calibration.

Some interesting PDFs for your Sparkfun sensor: (this one talks briefly about a shielded form of the sensor that might be necessary)

EDIT: I checked out my side load washer when it was on the spin cycle… same way a typical dryer works. The vibration seemed worst right in the center of the top panel, due to resonance and the panel being thin. Nearer to the edges of the machine, there was very little vibration. Then again this is a newer machine and everything is probably pretty tight… it usually only “gets crazy” with offset loads. Still though, with a cantilever style vibration sensor like the Sparkfun one… you may need to adjust it for your specify vibration frequency for best sensitivity. I still think the accelerometer is great universal way to go.

@BDub thanks a bunch for the thought and diagram, ran the washer last night with 2 different sensors collecting data. One with a weight exactly as you suggested, and a weightless one taped directly to the machine. Kept track of the maximum value within every minute and pinged the Spark Core API for the variable every minute. Here are the results graphed out: The blue line on the bottom is the weighted sensor, looks like that’s definitely the way to go.

No problem! Are those two graph lines on the same scale? I’d be surprised if you got that much reading out of your non-weighted sensor.

They are. Weighted went from about 60 to 230. Unweighted from 370 to 510. The low values are when nothing was moving. I attribute the high base value to the unweighted sensor to the fact that it was taped to the machine itself, and the tape was applying some force that it would not have had otherwise.

I guess 337 days isn’t too long to pick up a conversation…

I’ve been having great success with these sensors from MEAS and my Arduino, but am having a hell of a time getting things working on my Spark. At the moment, I’m pointing my finger at a problem reported by others whereby the analog pin is reading 1.7v as soon as analogRead starts running. I have read through the below thread and understand why this occurs on unconnected inputs. I don’t understand why this sensor is behaving like its not connected. Or maybe I should say why the analog input doesn’t seem to see the sensor. btw, I see its at approx 1.7v (aside from my DMM) because my adc readings for that pin jump right to 2048 on power up.

Thanks as always.

Hi @techbutler

Maybe you could tell us more about how you have hooked up the vibration sensor. For instance, in this blog the author hooks it up with an LM358 used as an amplifier and comparitor.

I would think that an approach like this would work great with Spark. The difference between analog inputs on Spark versus Arduino is really only that the chips typically used in Arduino-land have an internal op-amp buffer before the actual ADC whereas the chip used on Spark does not.

Hey @bko

Well, I was kinda close… I had a LM393 comparator on hand and was trying that wired up pretty much the same as the blog example sans the trimpot, but I guess I’m hearing you say that the secret sauce is the op-amp. Need to add those to the inventory I guess :slight_smile:

Hate being a complete buzzkill… For sensing if a large appliance is running/stopped, I’d think that something monitoring the current drawn by the appliance would be much easier and more reliable. Something like this:

That LM358 did the trick @bko

I think I like that trimpot linked to a digital pin rather than the analog route for what I’ve got planned. Makes calibration in the field a bit easier.

Thanks again.