I am wanting to make a Persistance of vision wand that times lighting up and the order of displaying the leds to show the message based on detecting a waving motion and its direction, my plan is to use a 3 axis accelerometer.
The plan would be
add all three accelerometer axis value together to produce a resultant acceleration vector R where
R= Sqrt(x^2+y^2+z^2)
if the accelerometer is slowly moved around rotated but not vigorously waved my theory would be that this vector would just represent G due to gravity and would be close to 1G (using whatever scale factor the accelerometer uses)
If the resultant vector R was significantly different from 1G ie <0.5 or >1.5 than then this would imply that it had received significant additional acceleration (>0.5G) and was being waved. I would then check that this acceleration was along the axis of the message ie right angles to the wand by checking that the acceleration in this direction had also changed significantly, if this was so i would start lighting up my leds in an order determined by the direction of the acceleration.
Before i start building and coding do people think my theory is correct or do i need a more complex movement detection system system
Ummm ok these are quite pricey, my understanding is that with the three axis gyroscope you can extract the effect of gravity from the accelerometer and so use the accelerometer to identify all non gravitational accelerations and also detect rotational motion and orientation this is great but i think for my specific requirement this maybe overkill as all i'm interested in is if the wand is being waved quickly in 1 axis so with the following algorithm:
step 1 look for significant change in the resultant acceleration vector R (this means the accelerometer is being accelerated externally not just tilted around) if yes then step 2 if no step 1
step 2 detect if there has been significant change in the acceleration along the axis of the message if yes step 3 if no step 1
step 3 record direction of significant change in the acceleration along axis of message then step 4
step 4 display message forwards or backwards depending on direction of acceleration
I think this will work if you disagree then please explain why ??
Off course yeah, The tilt on a single axis can work forya, I think when you'll wave the wand or hand I mean make waving movements on one side, the accelerometer is going to repeat the movement on that side more than one time and as such I think you can code to recognize such multiple travelling movements to a single side.
i suppose the ×best way is to record data from the three axis whilst waving the wand around and look at the data and see if it makes sense.
We do not need to load the MCU with extra axis data and commence on some conditions the reason is that the only time other axis would be useful is when you want to note that whether the waving hand or wand is tilted backwards or forwards which I think isn't needed by you.
The easiest and fastest but somewhat inaccurate way to implement what you are talking about is to use the Portrait and Landscape register data which is available in most of the accelerometers out there, so if its like potrait and goes to landscape right then it means 50% of the wave thats one way is completed ,so something like that added with some additional tricky coding may help recognizing the wave in the correct direction the easy and fast way.
i think it only has the three axis output my idea is that if we position it so that y is along the length of the wand x is right angle to the wand and so the axis of the message and z perpendicular to xy plane then if you hold the wand vertical z should have no component but acceleration due to G will be split between x and y as vector but R=sqrt(x62 + y^2) the resultant vector should always equal G as long as Z is zero if you move the wand from horizontal then X=G and y=0 if vertical x=0 y=G but at any angle the R =G as you move the wand from vertical to horizontal v slowly then a v small additional acceleration will be detected and R will vary slightly from G but if the movement is slow then the r=variation of R from G would be small if you then wave the wand quickly say from an angle of 45 degrees with 0 degrees being vertically upwards to -45 degrees or 1:30pm to 10:30 am on a clock then this would add siginificant additional acceleration to axis x which you should be able to detect ??
ok i have outputed data from all axis and it seems that i can simply trigger the pov from the y channel on the acceleromter the graph above shows the y channel adc value as you wave the wand and can be triggered using a negative threshold of the peak acceleration corresponding to initiating the wand waving from left then postive threshold from the right shown on graph above seem to work fine so well chuffed thanks for all your input
Im back after sunday night(although its still sunday night but done with the Purge 2 so..)
It's good that you got it but... I did say that Actually first of get a good serious Accelerometer and then pour your inputs into it, I did a lot of studying before I chose the accelerometer I have to work with, the one you have I had that on list but this one's takes a lot of power + is analog, I would suggest an Accelerometer such as a MMA 8451/52.
ONe of the many positives in these i2c or serial based Accels are that there is one comm line for communication get all the axis data is respectvie registers and take what you want! plus portrait landscape and freefall register get fucntionality going fast.