Maker Pro
Maker Pro

Optoisolator in a stepper controller circuit

I will be driving a unipolar stepper motor with an old 68HC11. I'm
thinking about using this http://www.aaroncake.net/circuits/stepper.asp)
circuit control the motor so the microcontroller can focus mostly on
sensor input. I've been told I need to isolate the microcontroller
from the stepper coils via optoisolators. I have three, possibly
three questions about this:

1. I'm assuming this means I will need two power supplies, one for
the microcontroller/sensors and one for the steppers?

2. The optoisolators I've looked at don't mention a built-in resistor
in the schematics, do I need to provide one

3. Would I put the optoisolators between the microcontroller and the
control circuit (IE on the clock/step and reverse lines) or would I
need to also isolate the controller circuit (IE place the opto-
isolators between the JK Flip-flops and the power transistors?)

4. If I need to isolate the controller circuit as well, would the
4027 be able to sink the (10ma if I'm reading the 4Nxx spec right)
current from the opto-isolator? I don't see info on maximum power
dissipation on the 4027's spec sheet (http://www.futurlec.com/
4000Series/CD4027.shtml) though I admit I'm no EE.

Thanks in advance!
 
C

Chris

Jan 1, 1970
0
I will be driving a unipolar stepper motor with an old 68HC11. I'm
thinking about using thishttp://www.aaroncake.net/circuits/stepper.asp)
circuit control the motor so the microcontroller can focus mostly on
sensor input. I've been told I need to isolate the microcontroller
from the stepper coils via optoisolators. I have three, possibly
three questions about this:

1. I'm assuming this means I will need two power supplies, one for
the microcontroller/sensors and one for the steppers?

2. The optoisolators I've looked at don't mention a built-in resistor
in the schematics, do I need to provide one

3. Would I put the optoisolators between the microcontroller and the
control circuit (IE on the clock/step and reverse lines) or would I
need to also isolate the controller circuit (IE place the opto-
isolators between the JK Flip-flops and the power transistors?)

4. If I need to isolate the controller circuit as well, would the
4027 be able to sink the (10ma if I'm reading the 4Nxx spec right)
current from the opto-isolator? I don't see info on maximum power
dissipation on the 4027's spec sheet (http://www.futurlec.com/
4000Series/CD4027.shtml) though I admit I'm no EE.

Thanks in advance!

Hi, Richard. Starting with your questions:

1) You'll need two power supplies anyway, unless your 68HC11 operates
on 12VDC. Inductive loads like motor coils create voltage spikes and
sags on supply lines, which can cause uC problems. Optoisolating the
uC from the inductive load is probably a pretty good idea.

2) Optoisolators usually have an LED on one side, and a
phototransistor on the other that picks up the LED's light and turns
on. You do need a current limiting resistor for the LED, otherwise
you'll stress out the uC output port pin.

3) You can put as many or as few optoisolators wherever you please.
Usually it's done right at the STEP and DIRECTION signal, because that
means you'll only need two optoisolators.

4) Probably a bad idea to drive an optodiode with a 4000-series CMOS
output -- it just can't source/sink enough current. Again, best to
drive the optoLED from your 68HC11 output.

Now for the rest of the story, as Paul Harvey would say. First off,
the 4N26 is a miserable choice for logic optoisolation. Its current
transfer ratio (the relationship between how much current is going
through the LED and the current you can coax out of the
phototransistor on the other side) is a ruinous 20% -- you have to
pump five times as much current through the LED as you get at the
output.

Look -- use the KISS principle (keep it safe and simple). The H11L1
is an optoisolator with built-in schmitt trigger logic output. It's
been around for a long time, and it's relatively inexpensive. Drive
the LED with only 3mA (for a 5V supply on the 68HC11, use a 1K series
resistor from the port output pin to the LED). hook up the H11L1 pin 6
to the isolated +12V, pin 5 to the isolated power supply common, and
attach a 10K pullup resistor from pin 4 to pin 6. You can then read a
guaranteed logic level for your step and dir driver control signals.

The other issue is that you've probably got the wrong transistors
there. It looks like you're asking the 4027 outputs to drive 10mA or
so. That's not realistic. Not only that, but the current gain of the
TIP31 transistors isn't going to be able to drive any but the smallest
stepper motors, even with 10mA of base drive current. Do yourself a
favor. Replace R1-4 with 4.7K resistors, and use an NPN darlington
transistor like the TIP121 for Q1-4. Your transistors will be glad
you did.

Cheers
Chris
 
J

John Popelish

Jan 1, 1970
0
I will be driving a unipolar stepper motor with an old 68HC11. I'm
thinking about using this http://www.aaroncake.net/circuits/stepper.asp)
circuit control the motor so the microcontroller can focus mostly on
sensor input. I've been told I need to isolate the microcontroller
from the stepper coils via optoisolators. I have three, possibly
three questions about this:

1. I'm assuming this means I will need two power supplies, one for
the microcontroller/sensors and one for the steppers?

If you use one supply, there is not much reason to isolate a
signal and then reconnect it to the same supply.
2. The optoisolators I've looked at don't mention a built-in resistor
in the schematics, do I need to provide one

Probably. Most isolators are an LED and a photo transistor
of some kind. You have to add the components it takes to
drive the LED with a reasonable (for it) current from your
signal source and to produce an output signal from the
transistor.
3. Would I put the optoisolators between the microcontroller and the
control circuit (IE on the clock/step and reverse lines) or would I
need to also isolate the controller circuit (IE place the opto-
isolators between the JK Flip-flops and the power transistors?)

I think you should isolate the step and forward/reverse
signals, if anything. But with correct supply connections,
you probably don't need the isolation, at all. Use two
supplies, one for the logic and one for the motor, and
connect them at one point... near the emitters of Q1-4.
The CMOS logic shown could be powered from the 5 volt
processor supply, if you can get enough base drive through
R1-4. You might need to add a current boost stage if the
logic chips cannot supply enough base current to saturate
transistors.
4. If I need to isolate the controller circuit as well, would the
4027 be able to sink the (10ma if I'm reading the 4Nxx spec right)
current from the opto-isolator?

Doubtful. That would make the chips pretty warm, even if
they could. Add emitter follower outputs and they can drive
lots more current.
 
First, thanks for the response Chris.

I'm curious about the dual power supply situation since this will be
powered via batteries. Can I just plop a 7805 in front of the
microcontroller and optoisolate as discussed, or do I really need a
second set of batteries?

Also, do you know of a multi-package for the H11L1 so I can keep the
chip count to a minimum? I was eying the ILQ74, but it of course
doesn't have the built in Schmitt triggers.

Thanks again!
 
Top