I just bought an Esplora. It's my first product from Arduino. Most of its features work perfectly. My only problem relates to the accelerometer which is doing several unexpected things. I'm using the built-in example code to test the accelerometer, here's the code:

Serial.print("x: "); // print the label for X Serial.print(xAxis); // print the value for the X axis Serial.print("\ty: "); // print a tab character, then the label for Y Serial.print(yAxis); // print the value for the Y axis Serial.print("\tz: "); // print a tab character, then the label for Z Serial.println(zAxis); // print the value for the Z axis

delay(500); // wait half a second (500 milliseconds)}

Shouldn't the accelerometer report changes in all 3 dimensions? When I rotate the Esplora around a vertical access (think: spin it on a table) none of the three readouts change. Nothing! (They all stay around 15,15,160.) When I hold it like I would a game controller, then raise my hands in opposite directions (left=up, right=down) the X_AXIS and the Z_AXIS results change approximately the same amounts. When I tilt it forwards or backwards the Y_AXIS and the Z_AXIS results change approximately the same amounts.

Am I just misunderstanding how accelerometers work? To me they should independently map the three different axes. But as far as I can tell the value for Z_AXIS represents some strange axis that I'm unable to pin down. So I've only got two dimensions that work, and they aren't my preferred ones.

A second problem is that I would have imagined they would report values something like "0..359" or maybe "-180..180" but instead they peak around "-150" and "+170". And the peaks aren't the same for each axis. So the numerical range isn't 360 but around 320. Yes, I can map these values to proper mathematical values, but it's a minor complication I could do without.

A third problem is that they should be proportional to the amount that you turn them. But when I turn my Esplora very very slowly the numbers often go like this: "120 121 122 123 150 151" Why does it jump so suddenly? And at other times it doesn't change the reading at all even though I've turned the Esplora a lot!

The label on the Esplora board next to its accelerometer shows where the X, Y and Z axes should be located. Based on what I observe when I run the program above they mixed up the X and Y in the diagram, and the Z doesn't work when I rotate the device around the Z-axis.

I think so.They work by detecting forces on them and they are detecting mainly gravity. Any acceleration of the sensors looks like gravity but a constant velocity would not. There are three sensors mounted orthogonally. So when you rotate this round on your desk the sensors are at right angles to gravity and so do not change. If you were to make it rotate fast enough you would see a difference due to the centripetal force on the sensors. When moved around in free space they respond as gravity acts on each sensor differently depending on the angle.The way they work is that each sensor has tiny silicon hairs on it, these hairs are bent depending on the orientation of the base and it is this bend that is being measured by producing an electrical signal proportional to the bend.

They are not angle detectors which is why the output is not calibrated in degrees. A sensor in free fall will register zero.

Maybe I am misunderstanding what an accelerometer measures. Thanks for the ideas. Still, some of the problems I'm reporting could either be a defective unit or worse maybe a problematic implementation.

A second problem is that I would have imagined they would report values something like "0..359" or maybe "-180..180" but instead they peak around "-150" and "+170". And the peaks aren't the same for each axis. So the numerical range isn't 360 but around 320. Yes, I can map these values to proper mathematical values, but it's a minor complication I could do without.

Yeah, its kinda confusing, and you are confused.

I suggest reading;http://en.wikipedia.org/wiki/Inertial_navigation_systemhttp://en.wikipedia.org/wiki/Accelerometerhttp://en.wikipedia.org/wiki/Gyroscope

The short answer - the accelerometers output is a measurement of 'g-force' (often expressed in units of ft/sec/sec) a measurement that is about how much change in some period of time. so you measure time change while in accelerating/decelerating to calculate orientation in 0-360 or -180 to 180. But it doesn't measure orientation. Gyroscopes do that.

edit/ ps: accelerometers, as you can see in the wiki, are SOOO MUCH more versatile than a gyro alone. detecting taps on a touch screen, pedometers, earthquake/vibration detection.... an accelerometer is a very useful device indeed - albeit confusing. (I think its the multiple axis' that contributed to my learning curve that Im still on.) /edit