The soap project


Full frontal SOAP In the soap project I describe how to make a simple analog to digital converter with modest tools.

The schematic drawings (Soap00.Sch, Soap01.Sch and SoapAux.Sch) show how the project is built up. Please use the PADS package for viewing and processing these files. You can find the PADS CAD package on this website. Just follow the link.
If you have a PCL compatible printer (all laserjets and most inkjet printers do) you can also use the files called SOAPxxx.LPR since these are laserjet ready. Just unpack them from Soap.Zip and copy them to the PRN device. If the printer starts spitting out almost empty papers, abort the operation. Each file should produce one and only one schematic on an A4 size sheet.

In this project I use the Texas Instruments TLC 2543 AD converter. To find out more about this marvelous chip, visit TI.

In the top right, you see a picture of the frontside of SOAP. It was built into a nice BOPLA box, which is now very hard to get (for me).
On the far left of the front plate is a LED status indicator and the 25 pin connector brings out all important signals (11 ADC channels, reference voltage, power, ground, etc).

Soap with powersupply attached and running On the left is a view of the backside of SOAP and its (dedicated) power supply. The powersupply is a small transformer with two separate secondary windings: one for the COLD side and one for the HOT side. At the time of taking this picture, the power supply still had glass fuses. Now it has polyswitch fuses. Which will be subject of a future fruttenboel topic.

SOAP test rig Here you see the connector that I used to test SOAP. It is a mating DB25 connector with a lot of (unequal) resistors in series.

The top level is Vref, the bottom level is GND. And all taps in between go to an ADC input.

This way, I could easily and reliably test the software.

The name

Soap is a twisted abbreviation. It stands for:

   S erial
   A dc
   O n
   P rinterport
but that would produce the unpronouncable 'SAOP'.
With a little twist the 'SAOP' became 'SOAP'. Soap is also a nice name since due to the high accuracy of the ADC, it will wash out the noise from the real world.

I favour safety over speed when it comes to PC interfaces. Therefore I put opto couplers between the PC printerport and the actual analog to digital converter. Please study the drawing of Soap00.Sch with the PADS package. This drawing shows the "cold" side of the design. The side that is connected to the PC and which may NEVER be fried, no matter what happens.

The "COLD" side

The cold side is the opposite of the HOT side. The latter is the side of the real world where sooner or later some moron will connect a TV deflection unit to a 4 V full scale input. That's why I call it the HOT side. If things go wrong, this side gets very hot and gets fried.

The COLD side is the side which is connected to the computer. No matter what happens on the HOT sidem the COLD side may never be damaged. Therefore strict separation must be maintained between both sides. In the drawing below you find the schematic of the COLD side:

The cold side has a separate power supply, off a separate winding of a transformer. The AC is rectified, filtered with a 1000 uF capacitor and fed into the 78L05 voltage regulator. It produces power for all the IC's on the cold side.
Perhaps a printer port can supply enough drive to do this without a power supply, but I chose for safety. And if you're about to make a power supply for the HOT side, why save on performance and not install a power supply for the cold side? Pennywise and poundfoolish.

The control signals to the ADC come from the datalines of the LPT port. They are buffered by a 74 HCT 14 Schmitt trigger inverter. This way, the LPT port is not loaded and the Schmitt triggers will filter out the occasional digital noise, should it pop up.
Each HCT 14 output sinks current from one of the 6N137 opto couplers. Why such fast couplers? Just to be safe, if in the future faster LPT ports come available. These couplers draw almost no current and they have a very high current transfer ratio. Plus some built-in electronics that produce very sharp output wave forms.
All these factors breath two things: quality and reliability. Don't save pennies on these chips. They are here to protect the investment on your expensive PC.

Control lines between PC and SOAP

There are three signals needed to control the TLC 2543 ADC:

Input pin Bit Inverted?
ChipSelect D0 Yes
Serial Clock D1 Yes
Serial Data In D2 Yes

In order to keep the chipcount on the hot side low, I did not place inverters between opto coupler output and TLC 2543 input. This can be considered a design flaw and it might be something to add yourself. In such a case, don't forget to alter the software!

From the ADC come two signals of which only one is used until now:

Output pin Bit Inverted?
Serial Data Out /Busy Yes
End Of Conversion ACK No

The EOC could be tied to an IRQ line, but this is not really necessary. The TLC 2543 is fast enough to keep up with the inherently slow PC printerport.

This concludes the cold side of the project. Not much to do. There is one extra thing: I put a status indicator on the front of the cabinet. In order to save on holes and to make it easier to follow, I used a seven segment LED display with all relevant signals to one segement. I took all signals from the hotside of the print. But I also wanted to display that there was power on the cold side. So I reserved one segment to this power.
This could mean that I would use a lot of effort to separate hot and cold sides and then connect them via the LED display. This is dangerous. So I added one extra opto coupler (a cheap 4N25) which detected the cold side power and transfered it to a buffer on the hot side.

I put the auxiliary schematic in SoapAux.Sch. Please study it in detail. I want to emphasize once more:

The power sections derive their power from an external transformer. Both AC and DC will power the unit. I put a bicolour LED across the powerinputs. If the LED is yellow, we have AC power. If it is red or green, we have DC power. Based on the colour we can then derive which terminal is positive or negative.

I use another HC 14 to buffer the signals which drive the LED segments, apart from the hot power supply, this is potent enough to drive the LED directly.

Status LED's

The segments of the 7 segment LED display are assigned as follows:

Segment Signal name
A COLD power
B EOC : End Of Conversion
C SDO : Serial Data Out
D SDI : Serial Data In
E CS  : Chip Select
F HOT Power
G CLK : Serial Clock

It is much easier and also better not to use a common electrode device. Common anode, common cathode, it doesn't matter. They both provide a means for high powered signals to break a barrier and penetrate the cold side.

We want to prevent this, so any LED array without common electrodes is better than this 7 segment design. If you have equipment for drilling 7 holes in a straight row, please do so (drill to insert 3 mm LED's). But there are also flat type multi-LED's. Kingbright is a well known supplier of this type of solid state lamps.
When you use non-common electrode devices you don't need the 4N25 opto coupler to show the state of the cold side power supply.

The "HOT" side.

The HOT side of Soap is shown below and in schematic Soap01.Sch. Please make sure you have printed it out.

The REAL-WORLD side of the circuit

On the left, the hot sides of the 6N137 opto couplers are shown. The 6N137 opto couplers provide sharp, clean edges to the output signals. For this reason there is no technical reason to put Schmitt trigger buffers between opto coupler and A/D converter. From the software point of view this could be more wanted, but that's a personal choice.

It's all very straightforward: the three control signals are fed into the TLC 2543 ADC. Two signals emerge from the chip: EOC (status information) and SDO (result information). Neither of these signals can deliver more than a few milli amps. This would be enough for the 6N 137 opto coupler, but it would certainly not be enough for the LED which I put on the board for status information.
Therefore these two signals are buffered by an NPN transistor. For battery powered devices these LED's should be omitted unless your battery is BIG. :o)

All analog inputs are protected by two diodes. No current limiting resistors were built into this section. That is part of the signal conditioning box that needs to be used between ADC and real world.
The diodes make sure that there will be no excessive voltages over the inputs.

On the hot side of the printed circuit board is also an amplifier to get the right reference voltage. By means of an LM 336-2.5 chip, a stable and temperature compensated voltage is supplied to the input of an LM 358 opamp.
The drawing mentions a TLC 272 but in my case the LM 358 is better. These chips are functionally equivalent and pin-compatible, so you can check things easily in your own project. The TLC has a better input offset voltage compensation. The 358 is more like a powerhouse with more margin in supply voltages.
The opamp/LM 336 design produces a 4.095 reference voltage. This is very convenient since this makes the ADC represent one mV per bit.

In fact, this is soap. The signal conditioning is a separate subject. If the signals are high power and stable enough no signal conditioning will be necessary. When weak signals are involved they need amplification and then conditioning (of both raw and amplified signal) are needed.

A general rule for getting stable ADC results is to add a small integrator between aplifier and ADC. Any size filter will do, as long as there is a capacitor. If there is room for one and only one part, omit the resistor and choose the capacitor.

More about this in a follow-up project

In the other document you will find information of the TSR which is used to make sampling a piece of cake and about the Modula-2 program that will use the Soap box for emulating a fast recorder or a slow scope. Nay sample rate below 6000 per second is achievable. Higher rates are also possible but then you cannot sample all 11 channels at once.

Click in the navigator on the righthand side for related topics. Also check out the Modula-2 section. Soap and Modula-2 are inter related.

Page created in the year of the horse,