Accelerometer is not my friend

seemingly adorable Blue Bean, is actually just a pain in my ass

I’ve had a very frustrating 3 weeks working with a myriad of accelerometers that are unreliable capricious bastards. I finally switched to what is supposed to be the simplest, easiest to use accelerometer called the Light Blue Bean, which has it’s own IDE and arduino example sketches. After making my solder joints very clean, I tested it out, and the following steps happened. In the end, it is working again, but I’m not sure what to conclude. It honestly feels like black magic. These are the steps that I just did, and I would love to assume that the battery must be above 2.5(ish)V to work, but maybe it was something else??

1) de-solder the VCC pin so we can make a cleaner solder joint

2) re-solder the VCC pin (looks perfect and clean)

3) turn on/ connect the Bean via the Bean Loader

4) add ‘virtual serial’

5) in p5, connect serial port

6) in terminal run local server (need to do this to run some three.js stuff)

7) run localhost 8000 and the accelerometer data streams in perfectly

8) test out the button and it stops everything. The console log of streaming data just stops and the BLE connection disconnect

1 Comment

The accelerometer’s output voltage depends on its input voltage. So as the batter voltage drops, you’re likely to see a corresponding drop in the output voltage. As a test case, measure the output of one axis at rest on a level surface with a 3V battery, then do it again with a 2.2V battery. You want to check a known state of the accelerometer, hence the “resting on a level surface” part.

As a way to correct for this, there is an analog reference pin on the Arduino, called AREF. When you connect a voltage to the AREF pin, the Arduino assumes that’s the max voltage it will see on the analog input pins. Ideally, you want the AREF pin connected to the accelerometer’s voltage supply. On analog accelerometers, there is a “3Vo” pin, which acts as the accelerometer’s reference. On digital accelerometers like the Bean’s, it’s a bit more complicated. Fortunately you can getBatteryVoltage() on the Bean. Assuming the accelerometer’s output voltage varies directly with the input voltage (which may be wrong), then dividing the accelerometer output by the battery percentage would give you a more or less consistent reading as the voltage drops (I haven’t tested this). More on the Bean’s accelerometer here: http://legacy.punchthrough.com/bean/the-arduino-reference/accelerationreading/ Check their forum for examples of how to calibrate for changing battery voltage, and post a question there if you find nothing. It’s something they should be able to help with.

Short answer: you need to account for the changing voltage of your supply

I think your problem is not with the accelerometers alone, however. As I mentioned, do a test of the communication with a constant value. When you’re sure you’ve got solid communication, then do the accelerometer test.