I've been playing around with a few different configurations of accelerometer, for this project I need:
- 3-axis, potentially deriving from this a general movement indicator (threshold), accelerating/braking, tap gestures (for changing flash modes etc)
- Very low power, I have to be able to pick up a general movement indicator reasonably quickly, say within a few seconds, while in the lowest power mode of the light (standby, no light on). Although I probably only need to do this when the light is mounted to the bike (as indicated by the hall effect sensor that will also be on-board).
- Low cost: For this reason I'd started out looking at a pretty generic analog output unit
The difficulty with using such a device with the psoc4 became apparent pretty quickly, the output impedance of the three measurement channels of this device is around 32k Ohms. So ideally any ADC input/buffer would need to be 1M or better for my purposes. Unfortunately the raw inputs to the psoc4's SAR are far lower than this at a mere few k ohm. A lower input impedance wouldn't be such a show stopper if one were able to ensure a reasonable guaranteed range of impedance, essential then you could just build a divider using it (though these are particularly low), again with the SAR inputs there isn't any data. So with a big part of my project being about part/size minimisation (not to mention cost) an external buffer solution was not an option. Turning to the psoc4's other internal peripherals there is obviously the op-amp, but with one already in use in my project for the light sensor and 3 channels to measure I'd have to use an analog mux to feed it, and then subsequently feed the output of the single op-amp into the SAR, then manually controlling which channel I was sampling by setting the MUX. In addition to this the input impedance data for the op-amp component (and specs for the mux) are pretty well non-existent, but all of that just being another sign pointing me to somewhere else. Now ultimately for my purposes (lowish accuracy, low update rate) this is probably a workable solution, but far from the elegant one I was after.
I turned to the serial output version of the chip, the MMA7455, actually I'm using the ADXL345 (http://www.analog.com/static/imported-files/data_sheets/ADXL345.pdf), which is roughly the same. Both are a little more costly than the simple analog output version, but there are benefits other than avoiding the complexity outlined above. The 345 offers some configurable interrupt outputs, tap detection and a raft of low power operating modes. I've yet to explore all of these, that will come later when tuning for power etc. But for now I've written some code to pull off channel data using an SCB I2C (the 345 can run in SPI or I2C mode), while the I2C is slower it's not really a concern in this case, and it can easily be implemented with fewer pins.
I received some 'B' version of the WS2812 serial LEDs, not sure if they are all that much brighter than the previous version, but I'm almost convinced they are the way to go, even if it means using more LEDs than I'd originally intended.
I've also been doing some rudimentary testing of the MCP73833 based Lipo via USB charger, no surprises with that one, a basic logic interface in addition to a battery voltage measurement via the psoc ADC should be all that's needed. Next on the list, now that I've sorted the bigger hardware pieces, is to spin a PCA to sit on top of the kit with all the hardware options I'm looking to, this will essentially be a large size prototype of the final bike light electronics.