Blog_2
27 Apr 2019
Software Design and its relation to our Hardware
Our hardware consists of two transducers: a force-to-resistance transducer, and a displacement-to-inductance transducer. Both of these transducers take a mechanical property and create a physical change which can be observed and measured in a circuit.
For the force-to-resistance transducer, the change can be measured simply with a voltage divider. Since the piezoelectric resistors change exponentially with applied force, it is not necessary to use a Wheatstone Bridge or other high-sensitivity configuration.
The displacement-to-inductance transducer is more challenging. Since the radius of the inductor is small, the inductor is sensitive to small changes in magnetic fields. It can detect very small distances as a result, but is only sensitive to small distance changes. Moreover, the inductance changes only slightly in response to a changing magnetic fields due to the Eddy Current effect- the primary physical mechanism for designing our linear displacement sensor. To overcome this, in the analog circuits realm a CMOS buffer is used to translate the sinusoidal response of the LC resonant tank to a square wave. Then, a frequency multiplier with variable duty-cycle is used to increase the frequency of the waveform to 2x the resonant frequency.
This is important because of the way in which a frequency change can be detected. In order to detect and measure frequency response, our microcontroller samples the output waveform and counts spikes. Imagine that the output waveform is centered at 1kHz, and changes to 1.1kHz in response to a change in distance. If the microcontroller waits to sample 1000 spikes, it will take 1s for the original distance and 0.910s for the changed distance. This is easily detectable with a microcontroller; however, this implies that the rate of change of distance is small. If the distance returned to center within a second, it would be very difficult to detect the transient distance change. Instead of waiting for 1000 spikes, consider what happens when waiting for 10 spikes. For the centered distance, it takes 10ms. For the changed distance, it takes 9.1ms. Now, the timing difference is much smaller. While the resolution is better since the sensor can detect faster changes in distance, the noise is much higher- small changes in the output waveform can lead to miscounting and an incorrect timestamp.
The solution to this problem on the circuit-side is to make the output frequency as fast as possible, so that the most spikes can be counted at a reasonably high resolution. On the digital side, higher resolution can be accomplished using DSP techniques to smooth the output timestamps, relying on the fact that the circuit’s frequency response is constant for a given distance.
This leads to a 3-variable digital signal processing system:
- Resolution- the number of spikes counted. The more spikes counted, the smaller the change in frequency can be detected.
- Sampling Time- the amount of time the displacement sensor operates, which must be greater than the minimum time it takes to count the requisite number of spikes defined in resolution.
- Granularity- the size of samples (as in, the output timestamps defining how long it took to count a certain number of spikes) in which a digital low-pass filter (achieved by performing a DFT) is applied.
Lower granularity greatly reduces the effect of noise; however, certain high frequency changes in displacement will be lost. Higher granularity leaves more noise in the output, but allows for faster changes in displacement to be observed. Higher resolution allows for smaller changes in frequency (and thus distance) to be detected, but limits the rate at which changes in displacement are detectable.
Processing the force sensor output is much simpler, and only involves reading the voltage divider waveform using the mbed’s ADC.
2-bit Analog Controller
One of the major design constraints on our project is the number of available ADCs on the mbed. While this could be ameliorated by using a mux which connects the ADC to the relevant sensor, this causes problems for the displacement sensor since it limits the speed of operation. As a result, we wanted to minimize the number of ADC inputs required to create an external control system to determine which sensor should be operated. We accomplished this with a two-bit analog controller. Depending on which buttons are pressed, the system is a voltage divider with variable output resistance. The truth table is as follows:
| Button A | Button B | Voltage Out | System Response |
|---|---|---|---|
| 0 | 0 | 1.00 | Do nothing / Continue previous operation |
| 0 | 1 | 0.66 | Sample force sensor until button B pressed again |
| 1 | 0 | 0.50 | Sample displacement sensor until end of samp time |
| 0 | 0 | 0.38 | Kill switch |
This solution allows for a sensitive control system using only a single input pin.