1) Is it true that the gyro is the more "power hungry" part of the IMU vs the accelerometer?
Yes - I think mainly it's that for the gyro to be useful everything needs to be running more quickly - so more power.
2) The puckjsv2-accel-movement module puts the accel/gyro sensor in a low power mode mostly by turning off the gyro, correct? Why does it put CTRL1_XL to 12.5Hz?
Yes - otherwise it's drawing a lot more power. Putting the accelerometer into the 12.5Hz mode helps it get much lower power consumption.
4) For instance, in the sleep() function, why run puckjsv2-accel-movement.off(), then wake(), then puckjsv2-accel-movement.on() in that order?
The function is using a callback for Puck.on('accel' so the indented code doesn't execute immediately.
So in reality it uses puckjsv2-accel-movement.on() to start listening for movement.
Then when movement is detected it does puckjsv2-accel-movement.off() to turn the accelerometer off and hopefully turn off movement detection, then calls wake() to configure it properly with the gyro.
5) I seem to be seeing some lag in the gyro output immediately after waking from sleep(). Is that to be expected? Does the gyro take a moment to turn on after being shut off with Puck.accelWr(0x11,0);?
I think that's possible, yes. I'm not sure but it may take a while to calibrate itself - it shouldn't be long though.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yes - I think mainly it's that for the gyro to be useful everything needs to be running more quickly - so more power.
Yes - otherwise it's drawing a lot more power. Putting the accelerometer into the 12.5Hz mode helps it get much lower power consumption.
The function is using a callback for
Puck.on('accel'
so the indented code doesn't execute immediately.So in reality it uses
puckjsv2-accel-movement.on()
to start listening for movement.Then when movement is detected it does
puckjsv2-accel-movement.off()
to turn the accelerometer off and hopefully turn off movement detection, then callswake()
to configure it properly with the gyro.I think that's possible, yes. I'm not sure but it may take a while to calibrate itself - it shouldn't be long though.