Using the Gadgeteer accelerometer

I want to detect an event in any axis at some G level. When I use EnableThresholdDetection and I call RequestMeasurement in the event handler, I get back values fo all axis’ that are lower than the threashold. In fact they dont even add up to the threshold. There seem to be two options - the event is triggering at a much lower threshold than I set or the RequestMeasurement method misses the levels that triggered the event and returns later ones that are lower. If that is the case, how do I get the levels that triggered the event?

Dear customer,

I’m not sure what value that you said is too low?
Any code or more detail?

From your description I just get your problem is the triggering value is not correct may be lower which you want to trigger.Right? But how it is possible?

I would try to help you.

Yuri

Thanks Yuri
Here is an example

I set the threshold at 2.0 in any direction like this:

accelerometer.EnableThresholdDetection(2.0,true,true,true,true, false,true);
When I start the program, I have the accelerometer still and flat on my desk and calibrate it. I write out the acceleration values in the treshold detection evbent handler like this:

Accelerometer.Acceleration acceleration; acceleration = sender.RequestMeasurement(); display.SimpleGraphics.DisplayText("acceleration event", AutoMonitor.Resources.GetFont(Resources.FontResources.small), GT.Color.White, 10, 10); display.SimpleGraphics.DisplayText("X Axis = " + acceleration.X.ToString("F2"), AutoMonitor.Resources.GetFont(Resources.FontResources.small), GT.Color.White, 10, 30); display.SimpleGraphics.DisplayText("Y Axis = " + acceleration.Y.ToString("F2"), AutoMonitor.Resources.GetFont(Resources.FontResources.small), GT.Color.White, 10, 40); display.SimpleGraphics.DisplayText("Z Axis = " + acceleration.Z.ToString("F2"), AutoMonitor.Resources.GetFont(Resources.FontResources.small), GT.Color.White, 10, 50);
In this instance for example, I got back an X Axis Value of -0.44, a Y Axis value of 0.56, and a Z Axis value of 0.56 - too low to trigger the event handler I would have thought.

Colin

Dear customer,

I know what happen to you.
The value is correct. Because it is has x,y,z axis,so if you turn one way that another direction could get negative value. It is give you the direction. So what you need to do is make sure the absolute value.

Good luck.

Yuri

?? I set the absolute value to ‘true’ and now it triggers continually with no movement with the threshold set to ‘2’. The values that are returned are X axis = 0.06, Y axis = 0.56, and Z axis = 0.75. I’m afraid that I am still confused.

My bad - I changed the freefall detect instead of the Absolute value setting. When I change the Absolute Value setting, it makes no difference in the behavior - I still get triggers on very slight movement and it reports very small x,y,and Z values. Can you show me how to initialize teh threshold so that I will get a threshold even when acceleration in any axis exceeds 2.0?

Thanks

Colin

Hi customer,

About initialize, you should refer to the chip Datasheet.