Top of blog

Electronics - 19 Sept 2019

Below is yet another signal input program written in C and GTK, shown with test data:

Here is the numerical output: daq001.log

Next is a plot of the signal derivative (in volts/second) for the first channel (yellow) above.
The different colors correspond to 10 different "frames" (plots) of data. Note that the
derivative is greatest (both plus and minus) near the middle of the signal range, and it goes to zero
at the minimum and maximum voltage values, as is the case with sinusoidal signals:

One of the simplest physical circuits of any interest is a binary oscillator made from a resistor, capacitor, and an inverting
schmitt trigger. The latter is a kind of comparator that takes a
real valued input (from 0-5 V) and produces a binary output (either 5 V or 0 V), and thus acts as a signal rectifier and
amplifier:

By connecting the output to the input, the output will bounce back and forth between 0 and 5 volts:

- When the input is low (0 V), the output will be high (5 V) and will act to charge the capacitor through the resistor.
- When the capacitor reaches the high switching level, the output goes low and begins discharging the capacitor.
- When the capacitor reaches the low switching level, the output goes high and begins charging the capacitor again.
- Etc... The rate of oscillation is determined by the resistor-capacitor (RC) combination.

This circuit is implemented on a breadboard and uses a microcontroller (Sparkfun Redboard AVR) to acquire the signals from
the input and output and send them to the computer:

A plot of the input (yellow) and output (orange) shows the capacitor charging and discharging and the binary nature of the
output:

Numerical output: daq002.log

Here is a plot of the derivative vs. input voltage of this circuit:

Note that the derivative is greatest positive when the capacitor begins to charge up, and greatest negative when the capacitor
begins to discharge down. The banding is caused by the integer nature of the microcontroller analog inputs, which go from
0 to 1023 in whole units. Rather than a continuous range of slopes, only a limited number of combinations are possible with integers.

This circuit performs a similar function as the software accumulate-and-threshold component shown last time. However, there are some notable differences between the software and this hardware implementation:

- The rate of change of the accumulator (the capacitor) is not linear. For a capacitor, this rate should be proportional to the difference in the voltage across it. Thus, in the plot above, the positive derivatives should all lie on a straight line which goes through 5.0 V at the right end of the x axis, and the negative derivatives should all lie on a straight line which goes through 0.0 V at the left end of the axis. Well, so much for theory and practice agreeing well...
- The output of the comparator is the opposite of the input: high output for low input, and vice versa.
- There are two thresholds for comparison: one for positive going signals, and another for negative going signals.
- There is no additional drain on the accumulator, other than the input, although one could be added via another resistor between the input and ground (or +5 V).

Nevertheless, this circuit provides a simple physical approximation of the software accumulate-and-threshold component (without the pulse trigger). And, as will be shown below, it is fairly easy to modify the software to take these differences into account. My guess is that the exact details of the circuit are not too important to the resulting range of computations, as long as the basic operation is similar.

The frequency of oscillation can be changed by changing the value of the resistor or capacitor. Here is a plot of the input
and output for R = 55 K ohms:

Numerical output: daq003.log

A plot of the derivative vs. input voltage looks similar to that above, with the constant of proportionality being different
(note the different y axis max and min values):

Here is a plot of the input
and output for R = 27.5 K ohms:

Numerical output: daq004.log

A plot of the derivative vs. input voltage:

Next time: 2-threshold inverter (software).

©Sky Coyote 2019