Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

Opto-Isolators

Opto-Isolators

2004-11-25 by Chuck Hackett

I was going through the Digi-Key catalog to stock up on some components for
upcoming projects so as to avoid the $25 minimum and I need some guidance.

I'd like to purchase some opto-isolators to be used to buffer AVR digital
outputs to field wiring and also to buffer digital field wiring inputs.  All of
these are "status' I/Os so no hi frequency stuff involved.  I expect all to be
in the 3v to 5v range, low current.

1) There are a mind boggling number to choose from (transistor, darlington, fet,
etc.).  Can you give me some guidance as to a 'general purpose' device for this
type of use and what general conditions the device would not be suitable.

2) If driving a low current PC board relay is it good practice to connect the
coil directly to the AVR (w/snubber diode) or should I use a opto here too?

3) I think I've seen reference to "opto-isolators" and "opto-couplers".  I
assume these terms refer to the same device?

4) Is there a good web resource for MCU interfacing practices so I don't have to
bug you guys with this kind of stuff?

5) I also have a need to drive a 12vdc motor (around 1A) using the PWM (speed)
and direction from an AVR.  Can someone recommend an H-Bridge module or web
circuit diagram resource?

BTW: My applications are personal interest, not production.

Thanks,

Chuck Hackett

Re: [AVR-Chat] Opto-Isolators

2004-11-25 by Dave VanHorn

>
>1) There are a mind boggling number to choose from (transistor, 
>darlington, fet,
>etc.).  Can you give me some guidance as to a 'general purpose' device for 
>this
>type of use and what general conditions the device would not be suitable.

Each type has it's strengths.
Two things to look at carefully, are speed, and current transfer ratio.
Most are relatively slow, and have a ctr that results in less output 
current than is put in.  There are exceptions to both rules.

>2) If driving a low current PC board relay is it good practice to connect the
>coil directly to the AVR (w/snubber diode) or should I use a opto here too?

I don't think you need an opto, but I'd definitely use a transistor.

>3) I think I've seen reference to "opto-isolators" and "opto-couplers".  I
>assume these terms refer to the same device?

More or less.

RE: [AVR-Chat] Opto-Isolators

2004-11-26 by wbounce

For H-Bridge 
I am using http://www.hvwtech.com/pages/products_view.asp?ProductID=68
for 1 robot. And 
This 
http://www.bdmicro.com/include/display_image.php?img=deadbug_lmd18200t.g
if
for my bigger bot (3 amps)

You will need 6 outputs for the 1st Hbridge or only 4 for the 2nd 

------------------
5) I also have a need to drive a 12vdc motor (around 1A) using the PWM
(speed) and direction from an AVR.  Can someone recommend an H-Bridge
module or web circuit diagram resource?

BTW: My applications are personal interest, not production.

RE: [AVR-Chat] Opto-Isolators

2004-11-26 by Chuck Hackett

Thanks to wbounce and sami for the info on H-Bridges.  

I particularly like the looks of the LMD18200T. 

Cheers,

Chuck

RE: [AVR-Chat] Opto-Isolators

2004-11-26 by Chuck Hackett

> From: Dave VanHorn
> 
> 
> >1) There are a mind boggling number to choose from (transistor, 
> >darlington, fet, etc.).  Can you give me some guidance as to a 'general 
> >purpose' device for this type of use and what general conditions the 
> >device would not be suitable.
> 
> Each type has it's strengths.
> Two things to look at carefully, are speed, and current transfer ratio.
> Most are relatively slow, and have a ctr that results in less 
> output current than is put in.  There are exceptions to both rules.

Thanks for the pointers Dave.

> >2) If driving a low current PC board relay is it good practice to 
> >connect the coil directly to the AVR (w/snubber diode) or 
> should I use a opto here too?
> 
> I don't think you need an opto, but I'd definitely use a transistor.

Yes, I'm currently using a transistor but didn't know if a more preferred
practice was to use an opto.  I'll continue with the transistor.

Cheers,

Chuck

RE: [AVR-Chat] Opto-Isolators

2004-11-26 by Dave VanHorn

>
>Yes, I'm currently using a transistor but didn't know if a more preferred
>practice was to use an opto.  I'll continue with the transistor.

This is the fun part, where you get out of the software side, and have to 
deal with a little hardware. Everything has it's weaknesses.

The transistor, for example, should have a resistor between the port pin 
and the base, to limit current when the port pin is high, to some 
reasonable value, determined by the load current requirement and the 
transistor beta.

It also needs a resistor to ground, so that you can be sure that it is OFF 
when the pin is tristated during reset.

You can use a 2N7000 Mosfet, which eliminates the base current requirements 
and calculations, but that also needs a turn-off resistor. In this case, 
just large enough to keep the maximum guaranteed leakage current from the 
AVR pin from getting up to the mosfet's threshold voltage.

If these are driving inductive loads, you can protect them by adding an 
appropriately sized zener from collector/drain to ground, but beware, this 
is dumping the flyback current into your processor ground.  You can and 
should also put a conventional diode across the inductive load.  Both may 
not be needed, but I'd want some measurements before removing either 
one.  "I tried it and it worked" doesn't count as a measurement. :)

Too many hobbyists miss that last bit, and publish designs that "work" in a 
controlled environment, with parts of the right date code, etc.

Re: [AVR-Chat] Stepper motor control

2004-11-26 by Dave VanHorn

>
>Would this be the way to go or are there other possibilities?

It works nicely. Remember to ramp down as well, you can't stop a motor 
instantly unless it's running very slowly.

You may find that you need more timers, but you can share timers to a degree.
I use T0 (because it's relatively dumb) for my 1mS opsys tick, that runs a 
bunch of Dec-to-zero timers for different tasks. You might be able to do a 
similar thing, depending on your other needs.

Stepper motor control

2004-11-26 by Geert De Pecker

Hi all,

I'm new to this list and would like to use an avr to control a
couple of stepper motors.

To control the acceleration/deceleration I was thinking about
a timer interrupt cycle for which I could change the time between
step pulses to accelerate till a given max pulse rate.

Would this be the way to go or are there other possibilities?

Regards,

Geert

Re: [AVR-Chat] Stepper motor control

2004-11-26 by Dave VanHorn

At 07:02 PM 11/26/2004, Geert De Pecker wrote:


>Dave,
>
>Am I correct in understanding that your dec-to-zero timers then
>would trigger a pulse, and depending on the acc/decel you set the
>timers to a greater/smaller count to influence the time between
>the interrupt and thus the step pulse?

Those are different, I use them for system events in the 2-200mS range.
When I've done steppers, I do them with timer 1, and reload the time on 
each step according to my accel table.

So to accelerate, index Z to point to the table, get the index, increment, 
store it back.
Now mult the inc'd index by 2, and add to Z. Pull two bytes from where Z is 
pointing, and use that to reload T1.

Re: [AVR-Chat] Stepper motor control

2004-11-27 by Geert De Pecker

Dave,

Am I correct in understanding that your dec-to-zero timers then
would trigger a pulse, and depending on the acc/decel you set the
timers to a greater/smaller count to influence the time between
the interrupt and thus the step pulse?

Geert


Dave VanHorn wrote:
Show quoted textHide quoted text
> 
>  >
>  >Would this be the way to go or are there other possibilities?
> 
> It works nicely. Remember to ramp down as well, you can't stop a motor
> instantly unless it's running very slowly.
> 
> You may find that you need more timers, but you can share timers to a 
> degree.
> I use T0 (because it's relatively dumb) for my 1mS opsys tick, that runs a
> bunch of Dec-to-zero timers for different tasks. You might be able to do a
> similar thing, depending on your other needs.

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.