Monday, February 1, 2021

Rescue that Printer Port ADC

 Probably anyone younger than 30 would be hard pressed to describe a parallel port on a computer.  We used these 25 pin monsters for all sorts of scientific hacking in the days before USB ports.  And so it was 20 years ago when I began promoting and supporting the use of the MAX186 analog to digital (ADC) converter controlled through a parallel port.  The simple circuit is shown below. Given that this IC was an excellent performer and that you could sometimes get the MAX186 as a free sample from Maxim Integrated Circuits for the asking, this was a very attractive option.

MAX186 IC connected to a parallel port.

The MAX186 IC showed up in another printer port connected circuit in KIT118 from kitsrus.com. It appears to still be available from them.  For sometime I have thought about writing a program for the Arduino which would interface with the MAX186 IC pins and allow ADC data to flow through the Arduino USB serial port instead of the printer port.  The issue recently came up again so this time I rummaged around and found a MAX186 IC and an  Arduino Uno.  A few resistors  and 2 capacitors later I had the circuit breadboarded. There is no reason why a Arduino Nano couldn't be used instead of the Uno board. Arduino Nano boards can be purchased for much less than $10.  


If your already-built MAX186 device terminates in a 25 pin connector, you can simply run the 6 jumper wires to the connector from the appropriate pins on the Arduino board.  You can purchase breadboarding jumpers with double male or male/female configurations that will make the job easy. In my test circuit shown above there are only 4 grounded resistors on the 8 channel inputs.  In the real world you will want all of the MAX186 analog pins to have a resistor of 10K or so leading to ground. If left floating, the inputs will produce seemingly random signals and the channels may cross-talk.  

Code

For the latest Arduino code for this project go to https://github.com/radiosky/MAX186_Rescue/tree/main .  

This project is an extension of an earlier effort to make the Arduino act like a User Data Source (UDS) for Radio-SkyPipe described here:

http://cygnusa.blogspot.com/2013/02/arduino-and-radio-skypipe.html

and

http://cygnusa.blogspot.com/2017/06/programming-multiple-channels-in.html

The UDS follows a format outlined here http://radiosky.com/skypipehelp/V2/UDS_model.html .

As written, the code has some limitations.  It always transmits all eight channels of the MAX186 ADC.  All that is needed to change to a different number of channels is to change the code below in the GetD() function so that the '8' in the for statement is the number of channels you want.

void GETD(){

         int u;

         for(u=1 ; u<=8; ++u)

         {

            dat = MaxRead(u-1);

         }

         Serial.print("^^3001"); // This tells RSP to time stamp it

         Serial.write(255); // all commands end with this character.

         return;

  }

To change the sample rate, adjust the delay(100); statement right after the void loop() statement.  Another improvement would be to use an Arduino timer and interrupt to change the sample rate.

The channels selected must begin with channel 1 and be sequential.  You could make any number of modifications and I encourage you to try some.   Let me know what you come up with.

Connecting to Radio-SkyPipe

The point of this is get the data into a strip chart.  Radio-SkyPipe is a strip chart program that can plot a wide number of input sources.  Go to Options and select the Data Source tab.


Set up the number of channels you have indicated in your Arduino code. (Defaults to 8), then press the UDS Set Up button.


To connect to the MAX186 via the Arduino,  we configure a Serial UDS connection. Our Arduino has the ability to follow the UDS commands directly so no UDS exe driver program is necessary.  Thus the EXE File is not used. The Com Port is the com port used by the Arduino. Set it so that the UDS Pushes Data.  This means that Arduino will use it's timing to set the sample spacing. Note the Connection Type is Serial.  




Save your options. That is just about it.  All you need do now is to press the Start button.

No comments:

Post a Comment

RF Noise Source NF-1000 SZ evaluation

  I have been working on an automated step calibrator project in recent months, so I was excited when I saw the device shown above on eBay. ...