Wireless vibration sensor


I have a project in mind and I think it would be a good opportunity to discover the Arduino universe. I would like to build a wireless vibration (piezoelectric?) sensor. It would be attached to a table football game on one side and the other side would be connected to a PC. The PC would have a web server showing if the table is being used or not.

I have a good experience in software development but the hardware side that is more challenging for me. I have a little experience in electronics, enough to do some soldering for example but not enough to design my own circuit board and pick every component. That's why I am hoping to find some guidance here on where to start and what components to use?

Thanks in advance for your help and suggestions,


Sensing the vibrations will be pretty easy and cheap. You can get a piezo knock sensor here:

And wire it to your Arduino like this: http://www.arduino.cc/en/Tutorial/Knock
You'll also need a 1 mega ohm resistor for the circuit.

There's a code example on that page as well.

After you get the data you can Serial.write something to your computer.


Thanks a lot for the reply. The tutorial seems clear (meaning simple) enough for me. Now how would you go about the wireless connection. The FIO board looks meant for that. But would I need 2 FIO boards and 2 xbees, one for each side? And is that all I need or am I missing something else?



Since you have coding experience and intend to send the data to a web site anyway, I would suggest Roving Networks Wifly module. Sparkfun has a shield for this that i have used myself, it works well.

Basically, it will work in two modes that seem relevant to your project. It can act as a telnet server waiting for a wifi equipped PC to connect to it, or it can act as a client, automatically starting up every so often and attempting to connect to your server and deliver it's information.

Here's an excerpt from page 38 of their reference guide:

When the module wakes up or is powered on the autoconn timer will cause the module to attempt a
connection to the stored remote IP address and port. While this connection is open the sleep timer will not
decrement. While data is flowing the idle timer will not decrement. Once data stops for 5 seconds the
connection will be closed. The sleep timer will the kick in and put the module in deep sleep. Finally the
wake timer will start the whole cycle again one minute later.
set ip host X.X.X.X ( set up the IP address of the remote machine )
set ip remote_port num (set up the IP port of the remote machine )
set sys autoconn 1 (automatically connect out after READY )
set com idle 5 (disconnect after 5 seconds with no data activity )
set sys sleep 2 (sleep 2 seconds after connection is closed )
set sys wake 60 (wakeup after 1 minute of sleeping )

See what you can do? Once you set the device up, it can wake up every so often, connect to your web site, provide the table's status, then go back to sleep. The Arduino just checks the piezo sensor on demand and controls the SPI channel communicating with the module.

I don't know much about the Fio board. You wouldn't need two of them.
If you use xbees you would have 1 connected to any type of arduino and 1 connected to the computer, and they communicate with each other.

an xbee tutorial:

Just my point of view, you may use an accelerator like this one I used:


It is so sensitive that if you secure it to the table and tap on the table, it will sense it.
I used it to sense tapping on my music box:

With an accelerometer, you can even sense if someone is cheating when they tip the table :grin:

Awesome! It's all very exciting.

I like the idea of using wifi and I had considered it but I am worried about two things:

1 - The room where the table is sitting is a bit far from our wifi router. My phone has trouble getting wifi signal there for example but it's not the most sensitive wifi device. I can run Kismet to get a sens of strength of the wifi signal but then is their a way to estimate if the wifly will be able to connect? Do you have some sens of the sensitivity of the wifly?

2 - I am worried about power consumption. In my limited electronics experience, I've got the feeling that the smarter the device, the more power it requires. But maybe I am wrong, Sparkfun's site says "ultra low power [...] allows the WiFly GSX to run for years on two standard AAA batteries."

Regarding the accelerometer, it's a good idea. Both an accelerometer and a knock sensor means twice the fun!

Ok so if I summarize, I think I'll get:

1 Arduino Uno
1 WiFly Shield (RN-131C)
1 Triple Axis Accelerometer (ADXL335)
1 Piezo Element
1 Piezo Vibration Sensor
1 6Ah LiPo battery
1 LiPo Charger

Am I forgetting something?



PS: I don't need to check if they tip the table, I know they do! Sportsmanship is long gone with us :slight_smile:

Nice list. Sure more people will chip in suggestions. From me, I'd use the one I posted from Modern Device. I purchased from them, much cheaper than sparkfun. Sparkfun is making too much money selling their stuff.

By the way, it is pretty easy to find out how hard the table is being knocked/kicked from standard deviation of your acceleration data.

Indeed the bill is getting up there pretty fast...

That why I'll start with the board and the sensors first, to get my feet wet. Then I'll add the wifly shield which is more expensive. But I have one more question. I have read these:

The tutorial for the piezoelectric element is using analog input 0. The tutorial for the 3-axis accelerometer is using analog input 0 to 5. liudr is doing the same (I love the music box by the way). Does this mean both sensors can't cohabit on the same Arduino Uno board? Or is there a way around that?

Thank you all for the tips and pointers, I can't wait to get into it.


The 3-axis accelerometer only needs 3 analog inputs. The tutorial uses 5 because they're hooking VCC and ground to them... essentially powering the 3 axis off the A/D pins. Power the 3 axis with the 3.3 volt supply, instead.

heh, yeah. the bill can get up there pretty quick. But the fun of doing something complicated yourself is priceless.

Great, I am all set then.

Thanks again,


One more detail. You specified an Arduino Uno and a LiPo battery. Uno needs 5 volts. LiPo puts out 3.7 That's also a really big LiPo.

The biggest current draw in the house is the WiFly, but it can easily be in power down mode the vast majority of the time. (see my comment earlier.)

If you use the Arduino Pro 328 3.3 volt version, you can run it directly off a LiPo battery. I have one of those with a 1000 mAh LiPo, a micro USB charger, and WiFly module sitting right here, it all fits together into a tiny package with the LiPo and the charger stuck to the bottom of the Arduino with foam tape. You could easily put the 3 axis and piezo circuits on the WiFly's prototyping area.

Doing the math, you have about 5 mA for everything but the WiFfy. The WiFly uses 40 mA while on and more while transmitting, but only 4 uA while asleep. Since it only needs to be on for a few seconds a minute... that's only a few mA on average.

That 1000 mA LiPo will last for over 4 days at that rate.

This is the parts list for the module I'm using as part of a project I'm working on:

Arduino Pro 328 3.3V/8 MHz: Arduino Pro 328 - 3.3V/8MHz - DEV-10914 - SparkFun Electronics
The Wifly, of course: http://www.sparkfun.com/products/9954
The 3.3 volt FTDI basic to program it: http://www.sparkfun.com/products/9873
1000 mAh LiPo: Lithium Ion Battery - 1Ah - PRT-13813 - SparkFun Electronics
LiPo charger: http://www.sparkfun.com/products/10217

You gotta be careful with LiPo powered projects, EVERYTHING has to be 3.3 volt.

I see, good to know.

I like the size of the Arduino Pro. Maybe I'll start with the Arduino Uno for prototyping (using the USB for 5 volts power). And then switch to an Arduino Pro and a LiPo battery for the final version. I have a feeling I'll find something else to do with the extra Uno anyway.

The reason I was considering using a 6Ah LiPo battery is because I am lazy :blush: I don't want to recharge the device every 4-5 days. Beside price and bulk, is there any problem using a 6Ah battery? Voltage will be the same right?



The reason I used all analog pins was to just plug the accelerometer on the arduino so the two are vibrating together and it's easy to wire (analog 4 and 5 provide power).

You can certainly mount the accelerometer on the table and run 3 wires to analog inputs and save 3 analog inputs.

There's no real problem that I know of with using the 6 Ah LiPo. It's actually 3 2 Ah LiPo's wired in parallel, but the cells are matched, so it SHOULD act like a single battery. It outputs the same voltage as the smaller ones and SHOULD program the same.

I've never used them myself, I haven't needed the capacity.