Been thinking about that referenced old thread for the last few days, this afternoon I drew up the diagram below. Idea being to make a toy sword circuit that can reliably detect swinging motions and not be confused when the sword simply tilted in one direction or another.
I have done this project in the past with an accelerometer, worked really well. Problem being that accelerometer prices keep going up. I went to buy an accelerometer last weekend and found my chip of choice increased to over $20, yikes. Is a little much for a 1cm square.
Ok, so swing detection occurs on double state changes that occur in under X time. Double state changes can be defined as a single switch changing twice or either switch changing once. Additionally, like mentioned in that thread I would need some debouncing so I would throw out any swing events that were detected below Y time.
I am thinking 300ms for X and 50ms for Y. Am going to buy a big bag of tilt sensors soon and test out my theory.
I have done this project in the past with an accelerometer, worked really well. Problem being that accelerometer prices keep going up. I went to buy an accelerometer last weekend and found my chip of choice increased to over $20, yikes.
You may be chasing a "dinosaur". When chips go obsolete their prices tend to rise, this is a sign that something better/faster/cheaper has come out and there's really no reason to stick with that chip. For example, an MMA7660 accelerometer is only about $1. Would that work?
--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons
Probably, but I am not interested in accelerometers right now. I know it is not as accurate as an accelerometer, but I really want to see this tilt switch concept work.
Came up with a testing rig. What I'm seeing is a double state change on both inputs, which I find interesting and unexpected. My sketches above didn't take into account the stopping forces at the end of a swing.
The current rig has too much noise. I need to cut the wiring on all but two tilt switches and gather data from each angle XY pair individually.