I worked as an independent consultant from January of 1993 to October of 1995.
During this period, I had a number of small consulting contracts and a few large consulting contracts. To give a representative sample, I will describe the smallest, then the largest.
Industrial washing machine control:
This was my shortest project. A manufacturer of automated soap loaders for very large industrial washing machines sent me an email asking if I could consult on a problem they were having. They had heard from one of my recording studio clients that I was an expert on electrical noise.
It seems that their 8051 Microcontroller was randomly locking up while the soap dispensing solenoid was open, thus dumping an entire day's worth of soap into a single load of laundry. Their engineers had struggled with the problem for months with very little progress.
I negotiated a consulting fee with no charge if I couldn't solve the problem in one day. When I arrived at their plant, they had a big washing machine hooked up to the electronics, detailed notes on what fixes they had tried and what tests they had performed, and a full set of test equipment (oscilloscope, etc) all ready to go. I had all the test equipment needed in my car, but theirs was just as good as mine was.
The first thing I did was to look at the +5VDC power supply at the Microcontroller. Every time a solenoid deenergized the power supply would dip below 0 volts, then spike up to about +30VDC, and the Microcontroller would lock up. It was a wonder that it didn't burn out the chip!
The solenoids were buried inside of the washing machine, so I measured the solenoid drive signal on the microcontroller board. I saw that they had added the usual 1N4007 diodes to stop solenoid spikes and I measured almost no spike on the incoming solenoid wires. At this point, I had a pretty good idea what was wrong and how to fix it. The system in question only had a +5VDC and a +12VDC power supply (no +30VDC source), so I immediately suspected the solenoids. When a solenoid is deenergized, the collapsing magnetic field can generate hundreds of volts. The polarity of the spike was reversed compared to most solenoid spikes and the system had long runs of bundled wires, so I suspected inductive or possibly capacitive coupling rather than a conductive path.
I took the diode off of the board and connected it directly across the solenoid. Electrically it was the same circuit, but the +5VDC spike went from 30 volts to around half a volt. The collapsing magnetic field was creating a current that recirculated through the diode, and the wiring between the solenoid and the diode was acting like a big loop antenna, broadcasting the spike into the electronics. By placing the diode on the solenoid, the size of the loop was made much smaller, thus reducing the radiated noise and making the effective frequency range of the loop antenna much higher than the solenoid could generate. Total time, 25 minutes. The owner of the business then wrote me a check for the full amount of my consulting fee and said that it was money well spent.
I then offered to spend a few hours with their engineers reviewing their design and suggesting improvements at no extra charge, which they gladly accepted. I explained to them how to fill the unused ROM space with jumps to reset, how to implement a watchdog circuit, how to improve their wiring routing for increased noise immunity, and suggested replacing the hex inverters on the digital inputs with Schmidt triggers. Continuing the design review, I gave them a reset circuit for the 8051 Microcontroller that is more reliable than the one shown in the Intel data book, suggested changing the solenoid circuits so that deenergizing all solenoids would block the flow of soap (very important if there is a power failure.) We also touched on another project with a solenoid problem, which I solved by making the solenoids deactivate faster with Zener diodes instead of regular diodes.
Gas Analyzer / Smog Tester:
This was my largest consulting project. A small company had a contract with a large manufacturer of smog testing machines. The new California smog laws called for limits that the old smog testers could not measure. I was given the job of designing a new smog tester.
The new smog tester needed to be able to test for compliance with much stricter standards and to test for some pollutants that the old smog testers could not measure. It also had to be easy to use, reliable, rugged, and inexpensive if we wanted the average garage owner to buy one. This was too large of a job for one person, so a team was assembled consisting of a chemist, a physicist, another electronics engineer, and an electronics assembler. The other EE had much-needed experience with high-end gas analyzers, which fitted well with my experience in designing low cost, high volume products
The old smog tester had a system that stuck a small hose up the tailpipe and sucked the exhaust gas into the analyzer. This had the disadvantage of measuring percentages of various gasses when the specification called for grams per mile measurements. A small engine can emit a small volume of exhaust gas that has higher percentages of pollutants than a big truck that emits a large volume of exhaust gas, yet the big truck may emit more grams per mile. The old tester applied a correction factor based on gear ratios and engine displacement - an approach that would not provide the accuracy needed. Another problem with the old smog tester was that some gross polluting cars emit hydrocarbons at a rate that is hundreds of times larger than what a passing car emits. These hydrocarbons tend to condense on the inside walls of the hose, lowering the reading a bit. If the next car to be tested has low hydrocarbons, the liquid hydrocarbons in the hose will evaporate into the airstream and make the clean car fail with excessive hydrocarbon emissions. It usually took at least 30 minutes for the system to recover from testing a gross polluter - not popular with people who have an appointment to have their smog checked at a certain time. To solve these problems, we designed a large pipe that fits around the tailpipe and sucks in outside air and added a mass flowmeter to the tester. If you know the mass flow, the percentages of the pollutants in the gas stream, and the distance traveled on a dynamometer, you can calculate grams per mile directly.
There is one problem with the system described above; it feeds gasses to the analyzer that are diluted by up to a 20 to one ratio, so all of the tests have to be much more sensitive.
To solve this problem, we increased the amount of air sucked in, which diluted the hydrocarbons and raised the hydrocarbon dew point above the temperature of the hose. This forced a mechanical redesign to accommodate a larger air blower and larger tubing. We were now diluting the pollutants by up to a 100 to 1 one ratio, so all of the tests had to be even more sensitive.
When automobile designers make an engine that runs leaner and hotter, there is a tendency for unburned hydrocarbons, carbon monoxide, and ozone to decrease as these pollutants react with oxygen to create water and carbon dioxide. At the same time, the nitrogen in the air tends to react with oxygen to various oxides of nitrogen. Together, these oxides are called "NOx."
It is very important to measure NOx in order to force engine designers to try to minimize both kinds of pollutants. The old smog testers could not measure oxides of nitrogen at all. Expensive gas analyzers were available but they used "cherry picked" photomultiplier tubes that cost too much for use in a smog tester, so we decided to use a solid-state design instead of a vacuum tube
The basic concept of NOx measurement is to mix the exhaust gas with ozone. This causes a very faint glow as the NO reacts with the O3. You then subject the gas to intense UV radiation, which converts any NO2 to NO, causing a faint but measurable glow. The glow is very dim indeed - it takes days to get an image of it on film. I knew that our only hope of measuring NOx within our cost constraints was to use a photodiode instead of a photomultiplier tube. I calculated that a photodiode with 250 square millimeters of light gathering surface should be able to meet the specification. Normally, a photodiode can't come close to the performance of a photomultiplier tube, but the glow in question was largely outside of the spectral range of the photomultiplier tube.
I obtained some sample photodiodes, a good nanoammeter, and a supply of gasses that had a mix of air and NOx at a level exactly ten times higher than the legal limit after our dilution. I set up an experiment with the reaction at the surface of the photodiode and measured roughly one hundred picoamps with the gas turned on, and about ten picoamps of noise with the gas off. Because I knew that the noise is greatly influenced by temperature, I knew that we could meet the specification by adding a thermionic cooler to reduce the noise. The only question was whether I could design a system that met the specification without the cooler.
At this point, I decided to conduct a sanity check of my results using alternative methods. I removed the photodiode from the chamber and set it facing a seven-watt light bulb one meter away in a darkened room. I then used a Variac to vary the brightness of the bulb. Everything worked fine with a standard digital multimeter measuring the current in the milliamp to microamp range, but the nanoammeter could not measure currents greater than two nanoamps, and I couldn't get the room dark enough to get the current that low. In order to get down to the one hundred picoamp range, I had to cover the photodiode with two layers of black electrical tape and move the bulb to three meters away. This told me that my calculations were close and that I was working with light levels that were roughly as low as expected.
Now it was time to optimize the design. I used a coaxial feed tube to reduce turbulence, designed a gold plated hemispherical reflector to double the light level at the photodiode, found the lowest noise opamp available, added a switched capacitor low pass bessel filter to reduce the noise, and installed an optical filter to eliminate a small error that I traced to an interaction between the ozone and carbon monoxide in the exhaust stream. This gave me sufficient sensitivity to meet the specification without a cooler, but the variation with temperature was still too high, so I duplicated the entire photodiode and amplifier in a dark chamber and fed the outputs of both chambers into a differential amplifier. At this point, all of the NOx specifications were met.
Now it was time to design the hydrocarbon measurement subsystem. We were able to re-use almost all of the design from the high-end gas analyzer, so most of the credit for this part goes to my fellow EE. The old smog tester could only measure the hexane portion of the total hydrocarbon emission, and applied a correction factor that assumed a constant ratio of hexane to total hydrocarbons. The problem with this is that the engine designers started optimizing their designs to lower the hexane and raise the level of the other hydrocarbons. In order to measure total hydrocarbons, we injected the exhaust gasses into a Hydrogen-oxygen flame that contained two gold plated electrodes, applied 1,000 volts across the electrodes, and measured the resulting microamp current. As the hydrocarbon content increases, so does the current. After that, it was a simple matter to design a burner that minimized turbulence by keeping the gas flow below the Reynolds number, and reusing the digital load-curve generator circuit that I had designed for Parker Hannifin.
At the end of all of this, I had a proof of concept prototype that was hand built and expensive but working, plans for a buildable production model, and plans for an assembly and test line. At this point, my customer built six copies of the prototype, sent them to automobile manufacturers, stopped all development, put all available resources into repairing the fragile prototypes rather than finishing the design. Meanwhile, our competition finished their design and won the contract.