sinking only outputs

Forgive me for more OT posts. I'm pretty weak on EE work. And I'm getting good advice here. So there will be a lot of queries on my high tunnel
ventilation project.
I ordered this board to deal with my IO shortage: http://www.efx-tek.com/downloads/dc-16_docs.pdf
Turns out this board can only sink the outs, not source. I need to run a dc motor both directions. The only solution I see is to also have a pair of double pole ice cube relays. Close relay 1 for up relay 2 for down. Am I missing another solution?
This works and I'm moving on. But its a kludge - Module to expander to relay pair. VS just a brain attached to an Opto22 board and use four outs for up and down.
I got the same query on how to direct the IO group to which one of the four motors. The plan here is to have four outs that turn on all the IO for motors one, two, three, or four. (each motor has power up, power down, upper limit, lower limit, rotation counter) Only deal with one motor at a time. I always think in terms of sourcing - turn the power on to the group I'm using. With sinking only outs, I'll have 12 volt everywhere and only ground the group I'm using. Is this a problem? I don't feel comfortable with it. Should I also have four ice cube relays to direct power to the right motor? Again, this will work but its a total kludge.
You guys are going to start thinking I'm just like that "Stryped" fella building his garage.
Karl
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
wrote:

I'd drive an H bridge from the open-collector outputs, which are an advantage because they let you shift the logic levels to the higher voltage of the motor power supply.
Leave some OFF time between directions. Transistors and especially relays close faster than they open.
jsw
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
wrote:

If you use one double-pole double-throw relay for reversing, and another for on/off, there will be a physical prevention from attempting to drive the motor both ways at once.
Dave
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

A subtle danger: one DPDT or "2 form C" relay with mechanically connected contacts should work, but if you assemble it out of two paralleled relays and one is faster they can short out the power supply when the motor reverses with power applied.
Four single pole, normally open ice cube relays will make an H bridge. One I/O bit pulls in the two relays on say the NorthWest and SouthEast legs of the H to drive in one direction, the other bit pulls in the NE and SW relays for the other direction. The motor is in the crossbar, power above and below.
Both bits together short the power supply and light up the series- connected headlight bulb that means Operator Attention Required. Always assume relay contacts can weld shut or semiconductors fail shorted.
jsw
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Tue, 12 Jan 2010 07:01:18 -0800 (PST), Jim Wilkins

One more warning. Small relays, like the cube relays mentioned by Karl, can have problems switching DC inductive loads. Best case, the relay contacts will have a short life. A bigger problem is that the arc initiated when the relay opens may not quench and will deliver enough current keep the motor turning. Obviously the potential for problems with arcing is greater with a 90V motor than a 12V motor.
--
Ned Simmons

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Karl Townsend wrote:

You're missing a few things, not the least of which is "off".
Digital I/O has two states, 1/0, on/off, true/false, etc. It takes two I/O bits to control a motor for fwd/off/rev, typically as run and dir outputs.
The next thing you're missing is current capacity as nearly all I/O boards only have sub Amp capacity on the I/O lines to drive other circuits, not big devices like motors directly. The ULN2803 drivers on your board are rated at 500mA per output, and total package dissipation is limited to about 2W or less depending on ambient temperature (see graph in ULN2803 data sheet). 500mA at 12V is 6W, so you can't even run one output at full load continuous without exceeding package dissipation.
There are various "H Bridge" motor drive chips, typically in a big TO-something heat sinkable package, as well as the obvious mechanical relays.

Look at your wiring for a relay for up and a relay for down configuration and you'll likely see additional power supply complexity and a failure mode to short the power supply. Run and dir is simpler and safer with a DPDT reversing relay and a SPST run relay. Or an "H Bridge" chip for solid state control.

Unless your rotation counting encoder is on the output side of a slow rotating gear motor you are going to have potential to miss counts if you are not careful. Your limit switches should protect you, but be sure they allow for some mechanical over travel as the micro reacts and shuts off power and the motor coasts to a stop since you have no braking.
You could potentially add braking resistors to a relay motor drive configuration of use an drive chip that supports braking to help limit coast.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Tue, 12 Jan 2010 06:36:17 -0500, Karl Townsend wrote:

You're getting at least as good of advice here as you'd get from sci.electronics.design -- particularly because over 50% of the people there wouldn't understand that you don't want to custom build 50 boards.

Close both relays for Pffft!
I think it's mentioned already -- one DPDT relay for reverse, one SPST relay for 'on'.

If you mean four outs for an H bridge, yea -- see my "pffft" comment above. As a career embedded software guy, I always like to see a bit of hardware in between the software I may write on a bad day -- and a contractor may 'improve' on a worse day -- and any direct paths between the power supply rails.

I'm confused by this -- what are you really trying to do? Why not just use two outputs for each motor, with their relays, and (if that's what you want) constrain software to run one motor at a time, or gang them, or whatever. It seems that directing power around in hardware would just be redundant.
If you really need to be parsimonious with I/O you could use one line as a master reverse line and a bunch of DPST relays to connect in each motor. This would constrain you to never having two motors going in different directions simultaneously, but it sounds like this isn't in your game plan.

Not yet. Different classes of questions.
--
www.wescottdesign.com

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Tim Wescott wrote:

Most of the various "H bridge" driver chips will have control protection built in and provide run and dir inputs.

Actually this is a pretty good idea and could reduce relay count as well. One larger DPDT relay to reverse the master motor power supply, and then just one DPST relay per motor for run control, vs. two relays per motor.

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
"Pete C." wrote:

Also, if he's polling for encoder counts it's best not to move more than one motor at a time. Honestly, I think a better and easier plan would be to use 1/4 scale RC servos and one of the various serial servo controller boards available. One I/O line could control a master servo power connection to provide for a power down standby for the long periods between motion commands.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
OK, group. Thanks for the help. Best plan here is each of the four motors has two ice cube relays. One for power on and one for forward/reverse. Uses 8 total outputs. I got eight left to use.

I'm looking for a way to conserve inputs. Each motor has two limits and a count pulse for a total of twelve. There's no need to look at more than one motor's inputs at a time. So, I'm looking for a scheme to use only three inputs and have all the forward limits on one input, all the reverse limts on one input, and all the pulse counts on one input. I got spare outs that only sink unless I go to a circuit description I don't quite understand in the doc: http://www.efx-tek.com/downloads/dc-16_docs.pdf
I guess my question boils down to "how to wire it?" using four outs and three ins and need to read twelve devices.
Karl
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Karl Townsend wrote:

I don't know if this will help, Karl, but this is how I would do it...
The 74LS151 is a 1 of 8 input multiplexer. http://www.futurlec.com/74LS/74LS151.shtml
One of the eight inputs is addressed by three address bits. There is also a strobe pin, but it isn't needed here and can be grounded.
There is a singe data bit from each of these chips that will be wired to an input port bit. This is the bit you read.
According to the above, we need three of these guys.
One chip for each function - top limit, bottom limit, position pulse.
The three bits used for address are wired to all the mux chips in parallel so that, for instance, when motor 1 is selected, the mux chips all select the data from unit one.
So, set three output bits to select the inputs from unit (0 to 3). Read the respective input bits on the three input port bits.
So that lets you have up to eight channels.
If there are only going to be four, a 74ls153 will suffice. That a dual 1-of-four chip.
Now, for OUTPUT bits, consider my all time favorite, 74ls259. http://www.futurlec.com/74LS/74LS259.shtml
Eight addressable single bit output bits. This guy really helps simplify the software! No byte-wide bit masking required in software. Just out a 0 to set 0, or out a 1 to set 1.
--

Richard Lamb
http://www.home.earthlink.net/~cavelamb /
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

74LS259 is good for logic level outs. Allegro has a whole assortment of chips that can do the same thing, but drive relays directly - including protection diodes.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Sorry, guys. I don't build and design cirucit boards. I'm trying to build a working prototype with modules I can purchase. I'm looking for the best way to do it with the basic stamp with 16 opto isolated IO and 16 output expander that I've purchased.
Karl
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Tue, 12 Jan 2010 15:54:38 -0500, Karl Townsend wrote:

I don't know if there _is_ a way to do this without building the odd circuit board, or finding more inputs. Although this is about the easiest circuit board in the world to make, assuming you can still get the circuit boards from Rat Shack with their proto board pattern.
The alternative would be to go back to the idea of a basic stamp for each motor, and a supervisory basic stamp for the whole system. That's a programmer's delight, and may be a good architecture for a production system (as you just package motor and micro together into a 'smart motor'), but it's getting away from the Kludge it Kwik philosophy that I think you want.
You may be able to do this with RDL (resistor-diode logic) and tell yourself it's not "really" electronics. But that's kind of cheating.
--
www.wescottdesign.com

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
wrote:

As I understand this you want to control four bidirectional DC motors with a Basic Stamp and are willing to run only one motor at a time. See what you think of this:
For each motor you have one open collector output driving one series motor relay, with a pushbutton switch in parallel with the I/O to activate the relay manually for testing. Two normally closed limit switches with bypass diodes interrupt the motor current at the travel limits.
The motor power supply has a DPDT relay on its output to swap polarity, driven by the fifth I/O or pushbutton.
You build a little wirewrap board containing a current sense resistor and DIP dual comparator with setting pots. Each comparator compares the sense resistor's voltage drop to its pot setting. You set one comparator to trip a little below the normal motor current and the other at twice that. The comparator outputs drive two Stamp input pins. I'd pick the resistor to drop a few tenths of a volt. You might need an RC low pass filter between the resistor and comparators for motor noise.
That's 5 outputs and 2 inputs.
The high comparator detects problems, such as stuck linkages or two motors on at once. The low comparator tells you whether the motor is running or has tripped a limit switch. It should also detect broken wires, loose connectors, etc.
You estimate position by first running a calibration, measure the number of timer ticks to travel between limits. Then you enable the motor for some number of ticks and add or subtract that from the position register.
This ought to get you going.
If you buy DIN rail relays they have the manual pushbutton built in.
jsw
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
wrote:

How are you going to combine the limit inputs? Since they can be in random states they can be neither ANDed nor OR'd together. You could XOR them, but vibrating another motor off the stop would give you a false transition. I think they are more useful to cut motor power, with the diode that allows reverse motion.
Does this thing have an A/D converter? If so you could watch motor current to hopefully detect a jam or binding or the shutoff at the limit. You might not need the pulse sensor. The position control would be open loop based on cumulative run time but you could get it up and running faster and cheaper and then see what improvements are needed, maybe string pot absolute position sensors which would recover from power loss without having to HOME all the motors. http://www.celesco.com/faq/cet.htm
jsw
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
What's that Lassie? You say that Karl Townsend fell down the old rec.crafts.metalworking mine and will die if we don't mount a rescue by Tue, 12 Jan 2010 14:37:44 -0500:

You don't need to use any inputs for your limits if your motors are DC.
Just wire the limit switches in series with the motor. Then add a diode across the switch to allow the motor to back off the limit in the opposite direction. The controller won't know that your system has hit a limit, so if that is important you may need to use your inputs.
--

Dan H.
northshore MA.
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

A way to get 12 inputs from 3 inputs and 4 output would be to use one output to supply power to three switches at a time. For example, switches for motor 1 are powered by output 1, switches for motor 2 are powered by output 2, and so on. The switched side of all the switches are paralleled so that all 4 UP switches are wired to one input, all 4 down switches are wired the 2nd input, all 4 counter switches are wired to the 3rd input.
In the Basic stamp, the outputs are set to inputs so that they can float high or low, 1 output at a time is turned ON and the inputs will read the state of that set of switches, then that output is changed to an input and the 2nd output is turned on to activate the 2nd set of switches. The other switches that are tied together will float high or low because their outputs are configured as inputs and are floating.
turn all outputs to inputs so they float
turn output 1 ON, read inputs for motor 1, turn output 1 to input turn output 2 ON, read inputs for motor 2, turn output 2 to input turn output 3 ON, read inputs for motor 3, turn output 3 to input turn output 4 ON, read inputs for motor 4, turn output 4 to input
Does that make sense?
RogerN
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

I've done something similar to allow a PLC to read a 12 button keypad on 3 inputs. I was also going to suggest this 'scanning' input method but I spotted a potential problem and had to stop and think a bit. The sinking outputs will require a pull up resistor to give a logic '1' to the inputs. The inputs need to be inverted in software because they will always be high until the selected output is activated and pulls the input down to logic '0' if the limit switch or encoder is closed. Resistors need to be chosen sufficiently high to not dissipate too much standby current, but low enough to allow enough current to drive the input impedence. The whole thing might not work if the outputs can't pull low enough to get below the logic 0 threshold voltage.
You could use an ammeter to measure the input current requirements and calculate a starting value for the pull up resistors. You probably should consider fuses on the outputs to help protect the drivers in case you have a pinched wire.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

    [ ... ]

    [ ... ]

    Or -- you can use only two outputs, and decode those as a binary number to select one of four sets of inputs. (or -- you can use all four, decode as binary, and get sixteen sets of inputs).
    Enjoy,         DoN.
--
Email: < snipped-for-privacy@d-and-d.com> | Voice (all times): (703) 938-4564
(too) near Washington D.C. | http://www.d-and-d.com/dnichols/DoN.html
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.