Attiny85 led die.

I am making some led dice with an attiny85 (programed via arduino) and I need a sensor to detect when the die is shook. I need the sensor to be small, cheep (under $5 or homemade), and take 2 or less input (analog or digital) pins to use. Would a tilt sensor work? I have found examples online on how to use a tilt sensor to detect shaking with arduino, but none of the codes do what I want. I want to know when the die is shaken a medium to large amount (like when you shake something in your hand). Also, another forum (Simple "Shake" Sensor? - SparkFun Electronics ) suggested a piezo with a weight attached, but it did not explain how the wiring or code would work.

Something like this? Tilt Sensor - AT407 - SEN-10289 - SparkFun Electronics. Or a tri- axial accelerometer.

Something like this? https://www.sparkfun.com/products/10289.

Maybe, but I don't get how you could detect shaking with it.

Maybe you could make one with a ball bearing (that conducts), some wire, and a small section of straw. Put both wires in one end of the straw so that when the ball comes in contact with them, it conducts.

2007jingz:

Something like this? https://www.sparkfun.com/products/10289.

Maybe, but I don't get how you could detect shaking with it.

It would be identical to using a push button switch and watching for someone rapidly pressing/depressing the button.

Thanks, but I decided to make my own sensor based off of the adafruit shake sensor with hot glue, solder, a spring, and the lead of a resistor.