sinking only outputs

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

Reply to
Jim Wilkins
Loading thread data ...

;-)

If that's your motor DC supply, yes.

Yes.

Yes.

Exactly.

Now, if you want to supress contact sparking from the motor switching you could connect an inexpensive diode on each COM to +12 and 0V (reverse biased, of course, or they'll smoke) for a total of 4 diodes.

1N4004 etc. is okay for a 1A or a bit more motor, 1N5404 for up to several amps (see above- I've added one half the diodes).

Best regards, Spehro Pefhany

Reply to
Spehro Pefhany

On Tue, 12 Jan 2010 06:36:17 -0500, the infamous "Karl Townsend" scrawled the following:

--snip--

Not a chance, Karl. We know you as an intelligent guy, not a troll. We respect you and know that you only ask the few questions you don't know the answer to. You're his opposite.

-- What helps luck is a habit of watching for opportunities, of having a patient, but restless mind, of sacrificing one's ease or vanity, of uniting a love of detail to foresight, and of passing through hard times bravely and cheerfully. -- Charles Victor Cherbuliez

Reply to
Larry Jaques

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

Reply to
RogerN

"RogerN" wrote in news:fv-dnSVVYYJ5udDWnZ2dnUVZ snipped-for-privacy@earthlink.com:

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.

Reply to
Charles U Farley

From your comments, I'm not quite sure you grasp exactly what "sink only" outputs mean vs. outputs that both sink and source.

You seem to be under the impression that an output that can both sink and source has a third off state, which is not the case. Such outputs are sinking or sourcing - period unless the circuit is powered down. Thus a motor connected to such an output (assuming it can handle the current draw of the motor) would be running forward or reverse, but never stopped.

An output that sinks only still has only two states, one pulling the output to ground level and one open which allows the output to float, or commonly a pull up resistor to pull it to +V.

With the exception of items like RC servos which have their own position control system and only need a single pulse width modulated signal to command position, pretty much all other motor controls will require two output bits for run (or step) and direction.

My two suggestions:

- Look at using 1/4 scale servo motors and one of the available serial input 8 output servo control modules, along with one master drive enable output to power down the servos during idle times.

- Alternatively, use a single direction output, a single limit input and a single encoder input, along with individual motor run outputs and just focus on positioning one motor at a time, which for your application should be fine.

Reply to
Pete C.

Besides, welding relay contacts is actually kind of on topic... :)

Reply to
cavelamb

[ ... ]

[ ... ]

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.

Reply to
DoN. Nichols

I was thinking of something along that line before he got his Output expander. Perhaps use a 74xx138 3 to 8 line decoder to enable up to 4 octal tri-state buffers for inputs and 4 octal latches for outputs. Maybe another output to enable the latch if required, from 12 pins you could get access to

32 inputs and 32 outputs a lot faster than serial I/O. And he'd have 4 pins left over that could do serial I/O to an operator interface, perhaps keypad and LCD.

Karl's giving me all kinds of ideas for little electronic projects to work with the Basic Stamp that should be useful to many others.

I have a schematic design and board layout that will take a 40 pin PIC microcontroller and plug into an Opto22 G4 I/O board for up to 24 digital I/O. I've been gathering info for in circuit programming and a bootloader to allow it to be programmed from a PC. About my next step is building the circuit on a breadboard to try it out, make corrections to the schematic and board, then have some boards made. My plan is to ship them pre-programmed for serial I/O but they could be reprogrammed for whatever, there's even 13 analog inputs with 10 bit resolution but only one of those pins are available. Most of the I/O got tied up with 24 digital I/O, in circuit programming connections, and serial connections. If this works out I may try a version with a surface mount microcontroller to interface with the

32I/O Opto22 board.

I have another board in mind that plugs into an Opto22 16 I/O board and has a socket for the Basic Stamp. It would allow an easy interface between the Basic Stamp and opto isolated AC and DC I/O.

Another idea is to connect a microcontroller to a keypad and LCD and program it to communicate with a Basic Stamp, PC, or other microcontroller to make a simple operator interface.

RogerN

Reply to
RogerN

A little late, but just ran across this book on sale: RUNNING SMALL MOTORS WITH PIC MICROCONTROLLERS. at

formatting link
Sounds like a fit for your project to me.

Stan

Reply to
stans4

How are you doing on the project?

I have a PIC on my breadboard to try to program for an I/O expander to work with the Basic Stamp. I was able to compile a test program, nothing usable but just to verify the circuit and an output. I ordered parts to make a small batch of these. They can be reprogrammed to completely replace the Basic Stamp if desired.

RogerN

Reply to
RogerN

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.