XO can measure external inputs with its microphone jack
Standard 3.5mm 2-pin switched mono microphone jack; selectable 2V DC bias; selectable sensor-input mode (DC or AC coupled); (1)
If using a stereo plug it is the red wire plus the earth.
It is protected at the input by a 5V zener diode and has a measurement range of 0.3V to 1.9V. The allowable input is -0.5V to 5V Inputs outside this range will cause excessive current and damage. (2) (3)
Addition of a 150k ohm series resistor would (I expect, no guarantee) give a reduced sensitivity in voltage mode (0-4V) but allow inputs to +- 100V without damage. Input impedance in resistance, volume and pitch modes is much lower but a 1k ohm series resistor should still allow inputs to +-12V.
350 ohms to 10 k ohms (0.2V to 1.78V, open circuit is 2.2V) the volume slider on the sound tab has no effect on sensitivity, half scale is 1.1V or 2.8k ohm resistance
DC coupled, 0.3V to 1.78V
there is still 0.6V bias at open circuit, input resistance =140k ohms
Selecting the sound tab which allows sensitivity and timebase adjustment applies 2.2V bias and has AC coupling. Sensitivity is adjustable from 1mV peak-peak full screen to 0.2V peak-peak full screen.
(sensor input is disabled in V42, maybe this stuff is irrelevant)
Measuring resistance with Turtle Art
299 = 16 k ohms (maximum)
150 = 3.2 k ohms
0.2= 350 ohms (minimum)
The bias voltage is only applied briefly, approximately 140 mS, any circuitry would need to stabilise in this time. The cycle repeats quite quickly in the above program.
Bias voltage, reading resistance in Turtle Art
When doing forever print voltage, open circuit gives a reading of 221. The bias is still applied but the cycle time is much slower, 500 mS for a program cycle
The voltage readings are inconsistent, when applying 0.3 V at the input ( from a source impedance of 30 K ohms), the output jumps between zero and full scale. Maybe its too sensitive, reading millivolts with a 0.3V deadband?
Forever print pitch is broken, error: global name real fft is not defined
With the internal microphone, forever print volume gives an unstable reading, 30-200. Forever print volume wait 1 gives a background level of round 30
External input shown below, 1 kHz square wave applied through 4 uF and 100 k ohms, reads 30 for low inputs but jumps to 200 for a 2V p-p square wave in the unbiased state, note that for the period bias is applied, the early period, the input impedance is lower and the square wave has a smaller amplitude.
Forever print volume wait 1, screen size 0-3V height and 200 mS width, for the earlier part bias is applied, initial pulses of bias as in previous shot are just visible
Turtle Art Experimental V18V19
forever print pitch fails on the 8th loop, error audiograb.py line 65 unpack requires a string length of n. This is a buffer underrun issue and does not occur for manually repeated print pitch. Specifically, unpack() is failing if the buffer from alsaaudio has an odd number of bytes. In the trace below, odd length buffers were hacked to return zero. Doesn't seem to be doing anything sensible.
pitch for a 30 mV 1 kHz square wave, Turtle Oscilloscope
forever print resistance 500 ohms to 15 k ohms but unstable at zero ohms, alternating between 0.2 and 150 . Again, the 150's are caused by undersize buffers, this time even length.
forever print voltage 299 for 0V and 1.9V, 0.2 for 1.2V
This can be fixed by replacing the code in audiograb.py at line 87
sensor_val1 = (audioop.avg(buf, 2)*0.00152333) + 50.0
Giving a range of 0.4V to 1.9V for 0-299 but similarly to resistance returns occasional 150's for zero volts input. Again, the 150's are caused by undersize buffers, this time even length.
Turtle Oscilloscope, 0V input, values of 0 occasionally returned by audioop.avg, which after scaling (x+50)*3 =150
At line 358
changing set_capture_gain() seems to have little effect on mode 3 (voltage)but
changing set_mic_boost() gives a range of 1.06V-1.2V in mode 3 (voltage).
forever print volume 299 is 40 mV p-p, occasionally gives 0 or large negative number. Again, the errors are caused by undersize buffers, -ve for buffer length =1.
Volume, Turtle oscilloscope, 30 mV 1 kHz square wave, note spikes to zero
Microphone input: standard 3.5mm 2-pin switched mono microphone jack; selectable 2V DC bias; selectable sensor-input mode (DC or AC coupled); (1)
"What is the maximum voltage I can put into the mic/input port on the XO without risking damaging it?
Short answer -- 0.3V to 0.9V . ... -- there is a 5V reverse biased Zener diode at the input that protects the input ...
My measurements (I used a current-limited adjustable voltage supply) indicate no more than -0.5 volts to +5.0 volts. Beyond these voltages my audio input port drew large, potentially-destructive currents. This voltage is measured relative to the "chassis common" (the outer "shell" of the audio plug). Therefore: even a little AA 1.5 volt battery improperly applied (i.e. "backwards") may damage the laptop.
The Analog Devices AD1888 sound chip has the ability to sample DC voltages. Experimentally it has been found out that the range is fairly linear, however the range that it can sample is restricted to 0.3V - 1.9V, with all the internal gains turned to the minimum."
"The XO hardware has been designed to facilitate measurement of DC voltages by the addition of an electronic switch that can be controlled via a setting on the Alsamixer called 'Analog Input' . The high-pass filter can also be turned on/off by a setting 'High Pass Filter' in Alsamixer. The ability to control V_REFOUT (bias voltage) is also available and is done by the control 'V_REFOUT' in Alsamixer.
Measured between the center conductor and the shield (ground, i.e. +0 volts). When an input voltage is greater than +5.0 volts or less than -0.5 volts the input-protection circuitry draws currents greater than 100 milliamperes and will damage the laptop. Also, the AD1888 codec's absolute maximum voltage (given a 5.0 volts supply) is -0.3 volts to +6.3 volts.
You must use input protection resistors and voltage divider if voltages greater than +5 volts will be applied. Resistors and a fast-blow fuse are recommended. Resistors should be present in both the ground circuit and the signal circuit, and this may introduce noise. A better circuit is a high-impedance differential-input amplifier."
John Graham-Cumming:Building a temperature probe for the OLPC XO-1 laptop
An XO Oscilloscope to Measure Children's OLPC Learning, One Laptop Per Child News
Labels: olpc, Sugar, XO_input