Eve Weinberg

Accelerometer is not my friend

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

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

9) shut everything down

10) reopen everything

11) upload an example sketch to the Bean

12) open virtual server

13) serial monitor streaming the data perfectly

14) upload our sketch to the bean ( button and accelerometer)

15) open virtual server

16) stream data in serial – looks good (but haven’t pressed button)

17) open locahost 8000, accelerometer data and button data streaming

18) press button (connect 2 wires) – console log stops, Bean disconnects

19) check battery- it’s at 2.17

20) replace battery

21) recheck new battery by reconnecting Bean and uploading voltage sketch

22) battery reads 2.7

23) upload our button/accelerometer sketch to Bean

24) now it works in serial monitor

25) run sketch via p5 and ‘start server’ – it works

26) run localhost 8000 – it works


Next Post

Previous Post

1 Comment

  1. Tom Igoe December 15, 2015

    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.

© 2017 Eve Weinberg

Theme by Anders Norén