Do you like my hacking? If so, please consider leaving something in the
Fediverse (Mastodon etc): @Sprite_tm@social. spritesmods.com
After giving it some thought, I eventually designed this schematic for
the logger:
As you can see, the sensor outputs of the acceleration sensor are connected
to the A/D-inputs of the AVR via an 1K resistor. The datasheet of the sensor
specifies this: in combination with a capacitor this forms a low-pass filter
which filters out the high-frequency crap of the internal oscillations going
on in the sensor. I decided on leaving that out and replacing it with software:
measuring each pin a few hundred times and averaging the measurements would
have the same effect and such a software routine would be lighter than
any capacitors. The resistors stayed, though: I wasn't sure if the sensor
needed them and I could abuse the resistance to implement a computer interface
over the same pins as the sensor used. More on that later.
The rest of the schematic is quite simple: a 3.6V LiIon-battery will feed the circuit through an on/off-switch, the piece of EEPROM is connected to the microcontroller and a small decoupling capacitor is in the power supply line to suppess transients. Looks easy enough: let's build it!
As the whole package had to be small, I decided on starting with the
acceleration sensor PCB and putting the other components on there without
using a PCB, dead-spider style:
And then I remembered I still had to find a power-supply. I used a LiIon-cell
from an old picture frame I had. While the cell
is really small, it's still huge when compared to the circuit!
I wish I had a smaller cell or perhaps the time to invent something using a
gold cap or something, but time was of the essence and this was the best I could
come up with.
For added sturdyness, I glued everything together using cyanoacrylate ('super glue')
and globbed some hot glue over all that. In hindsight, the hot glue did make the
construction quite a bit more heavy, so I'd probably be better off using some other
way to fortify the device.
And this is what it looks like when connected to a laptop, for size. The laptop
is an Acer A110 netbook.
The software in it is written in assembly and quite simple; on bootup, it will emulate an autobauding uart on pins PB3 and PB4. If I want to read out the device or start a new logging session, I connect these to an USB-to-serial converter on which I've bypassed the MAX232-like chip so it directly outputs 3.3V signals. As soon as the AVR receives a char on the serial line, it'll autobaud on that and dump the output of its EEPROM to the attached PC. A new character received will then initiate a new logging session. On the PC side, I've written a really simple program to convert the hex readouts into a nice decimal file which can then be loaded in gnuplot or a spreadsheet program. The software is, as usual, licensed under the GPLv3 and downloadable here.