Sensor input mode measurements, build 320, B2, user-space

Jim Gettys jg at laptop.org
Wed Mar 21 07:23:17 EDT 2007


Cool!
                     - Jim


On Wed, 2007-03-21 at 18:46 +1100, James Cameron wrote:
> G'day,
> 
> Thanks to some hints from Jaya Kumar, I've been able to obtain data from
> the analog sensor input.
> 
> The pretty sample graphs:
> 
> http://dev.laptop.org/~quozl/quozl-6-b2-mic-input-analog-test-1.png ...
> measurements through a voltage divider of my UPS battery voltage during
> a five to ten second power down of the charger.  This sudden jump in the
> curve is due to my plotting the absolute value of the sample instead of
> treating it as 16-bit signed integer.
> 
> http://dev.laptop.org/~quozl/quozl-6-b2-mic-input-analog-test-2.png ...
> UPS charger output voltage during normal operation, showing the combined
> effects of the charger switching and the inverter switching at 50HZ,
> this is 1000 samples at 8000 samples per second, therefore 1/8th second,
> so 6.25 cycles should be visible, and they are.
> 
> How it was done:
> 
> 0.  assemble a voltage divider to bring 13.57V DC input down to 1.184V,
> (though an instrumentation amp with an offset would have been better),
> 
> 1.  disconnect the B2 unit from any other devices on the bench, then
> connect the output of the voltage divider to the MIC input,
> 
> 2.  use alsamixer to set Analog Input to "on",
> 
> 3.  use "arecord -t raw -f S16_LE -r 8000" to record samples,
> 
> 4.  post-process the samples to generate one line decimal value per
> 16-bit sample in the file, (used od(1) and awk(1)),
> 
> 5.  plot with gnuplot.
> 
-- 
Jim Gettys
One Laptop Per Child





More information about the Devel mailing list