Having got the ADXL202 working, I wanted to show it off, and then get it installed in a little project that I’ve had waiting in the wings. Showing it off has the side benefit of demonstrating the accuracy of my assumptions about how it works and how it interfaces, above and beyond being able to view its signal on my scope.
So this weekend, I breadboarded some LED drivers onto the sensor. I didn’t remember how much current the ADXL202 would source or sink; plus I wanted one LED to get brighter when it tilted left and another to get brighter when it tilted right. So I plucked a 7404 hex inverter out of my parts bin and wired one of the ADXL202′s outputs to a couple of inverters, then the output of one of them into a third inverter. This gave me two buffered outputs, one inverted and one non-inverted, which I wired through resistors into a couple of LEDs.
And because I wanted it to be portable so I could show it off, I left the benchtop power supply behind and strapped on a 9V battery and a 7805 voltage regulator. I cleverly soldered the black and red leads onto the wrong terminals on the battery connector, which I didn’t discover until I had covered the solder joints with nail polish (pink coral, if you’re curious) and cleverly smeared it around the breadboard when I accidentally touched the connector before it was dry.
Since the sensor’s PWM output is dramatically visible on the scope, I figured it’d be dramatically visible on the LEDs. Wrong-uh. Even knowing what was supposed to be happening, and with the LEDs’ domes carefully aligned in the same direction, in a dark room, I could just barely tell that one brightened and one dimmed as I rotated the assembly back and forth.
Feh.
Well, the ADXL202 is a +/- 2g sensor, and tilted vertically, it’s only experiencing 1g. That means my PWM duty cycle isn’t changing from 0% to 100%; it’s changing from 25% to 75%. I would still think that’d be enough to see a difference in brightness of my LEDs!, but apparently not. So I have to get smarter.