Controlling a pump with a DB9 port using a PC

Ok so I have a pump which has a DB9 port for external control.

From the user manual, I know what the pin configuration should be:

- Pin#2 and pin#3 should be attached to a current source (4 - 20 mA)

- Pin#6 and pin#7 should be linked together with a jumper

Depending on the current (4 - 20 mA), the pump will operate at a certain speed.

Assuming I have a standard db9/db9 cable, is it possible to hook the pump to the serial port of a PC computer and use the computer to send a certain current ? (in other words, control the pump speed from the computer)

Reply to
Euh
Loading thread data ...

"DB9" just refers to the connector -- not what the electrical 'meaning' of the pins are.

Electrically, the pump wants a current loop. That's a very different critter from a serial line.

You need a serial to current loop converter (or USB to current loop, or an output card with current loop). I'm sure such things exist, but I wouldn't know where to tell you to start looking.

Reply to
Tim Wescott

... and searching on "serial current loop converter OR driver" yields about a bazillion implementations of RS-232 signaling over a 4-20 mA current loop and nothing that I could find in the noise to implement a serial I/O to simply set a current loop value.

Looks like the guys at Measurement Computing have a single-channel model CB-7021 that runs about US$260.

Reply to
Rich Webb

Pricy. I didnt think it would be that hard to implement.

Reply to
Euh

It isn't. I think that I could probably throw one together on a breadboard using a microcontroller that's sitting around, an SPI DAC from the same drawer, an opamp, a few passives, don't forget the serial level converter, and run it all from a benchtop power supply.

However, put it on a circuit card; add reasonable protections on the I/O; considerations for temperature drift so that it runs as well in freezing weather as in summer heat; a power supply with proper filtering, overcurrent and reverse-voltage protection; a decent case and connectors; and get it agency approved so one's insurance company wouldn't be unhappy with one's using it and the cost goes up.

There may well be cheaper commercial options available. I've used Measurement Computing components in the past and guessed that they might have such a device. Thought of B&B also but they don't seem to have one.

Reply to
Rich Webb

Don't forget: make it in small volumes and sell it to folks who will lose hundreds of thousands, if not millions of dollars a day if it causes a line down condition.

What's the cost of a backed up sewage pipe to 100 homes divided by $260?

Reply to
Tim Wescott

Ok so if I forget about the serial port... Would there be a PC card that would allow me to output a user-defined variable current ?

Reply to
Euh

Omega seems to have one. About US$440 for the small (4-channel) model.

Reply to
Rich Webb

ok maybe I'll forget about the variable output. Assuming I can live with a fixed voltage (anywhere from 2 to 10 V), can't this be done with a parallel port ?

Reply to
Euh

Not directly. PC I/O ports are digital, not analog.

Also, the pump is current controlled, not voltage controlled.

Reply to
Rich Webb

Try this (view in fixed-width font).

VCC + | .---------. | in | | out '-----o LM317 o--------. | | | '----o----' .-. | | | 56 adj | | | | '-' | | | | | | | .-. '--------o-->| | | | | 250 | '-' | | '----o-------o------. | .-. | | pump | | controller '-' | | .--------------------------------o------' | === GND (created by AACircuit v1.28.6 beta 04/19/05

formatting link

The LM317 regulator "tries to" maintain a constant 1.2 VDC between its output and adjust pins. When the potentiometer is all the way to the bottom, the 306 ohms between out and adj will cause the LM317 to deliver about 4 mA. When the pot is all the way at the top, the resistance is reduced to 56 ohms so the regulator will supply about 21 mA.

The input voltage should be set so that you have about 3 volts headroom over what is dropped in the pump controller. For example, if the pump controller is using a 100 ohm resistor as its "current to voltage" converter, then it will develop a drop of 2 volts at 20 mA and you'll want a Vcc of at least 5 VDC. More is okay but the excess will be dissipated in the LM317, which can get hot (add a heatsink).

This is just the skeleton of a complete controller. You'd need the aforementioned fuses, reverse-polarity protection, some filter caps, maybe an indicator, connectors, enclosure, ....

Your best bet is to get one of the certified and spec'd commercial units. From your questions, I suspect you're not entirely comfortable in this area, so consider the consequences if something goes wrong before trying a DIY.

Reply to
Rich Webb

I've seen various 'whatever' to current loop controllers in the hobbyist literature over the years. You may want to do a Google search. Parallel port -> DAC -> voltage to current loop would get you what you want.

Reply to
Tim Wescott

That's what I want to control if that may help:

formatting link

Reply to
Euh

Question 1. Do you really need to run this pump from a PC?

Assuming the answer is NO, then a simple DC supply, single transistor, zener diode, resistor and potentiometer. This will give you a variable 4-20mA current source.

Assuming the answer is YES, you would be best off getting a very cheap micro-controller kit board and programme it to accept the speed value and convert it to a PWM signal which you can convert to a 4-20mA current and hence to your pump.

Reply to
Paul E. Bennett

********************************************************

My goal:

A little program running on the PC would ask a user

1) How often do you want the pump to work (the frequency...eg 24 times per day) 2) How long do you want the pump to work each time (eg 5 min)

Based on that, the program would somehow send the appropriate command to the pump (run 24 times for 5 min per day)

Reply to
Euh

So, no speed control requirement then. The solution gets quite easy. A simple power supply with a transistor to switch the current on and off could be driven from the RS232 port by programming to toggle the handshake line DSR. Max out the current (20mA) for ON and current off for OFF.

The RS232 port itself is not guaranteed to be able to generate 20mA of drive which is why you will need the PSU and transistor (with a few other passive components).

Reply to
Paul E. Bennett

Pricy. I didnt think it would be that hard to implement.

Bit slack of the supplier to use a DB9, screw terminals are more common for

4-20 mA loops.

You often find with these loops that the actual input is 1-5 volts, there's a 250 ohm resistor on the input. If you remove the resistor, you can drive the device with a voltage output direct from the DAC, which will probably be more convenient. However, earthing can be an issue with current loops, sometimes the 1-5V is referenced from a supply rail such as 24V.

Takes me back, I was sorting out these sorts of problems 25 years ago.

Reply to
Bruce Varley

Down-thread the OP posted a link to the pump he's trying to control and it does indeed have an option to control it by means of a voltage level. It's a peristaltic pump rather than, say, a bilge drain pump, which implies that some degree of precision may be indicated, so he probably ought to just bite the bullet and get a good quality interface.

The good stuff never really goes away ... ;-)

Reply to
Rich Webb

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.