Optocoupler

Kiwi Bruv

Member
I have a 4N25 optocoupler and I want to use the PWM function of the picaxe to drive it. The 4N25 would be switching an IRF 530 supplying a largish motor (24V 5A).

How do I work out if the 4n25 can switch fast enough. All I can find on the datasheet is the non saturated turn on/off time. This is 2 micro secs, so can I assume the opto can deliver a duty cycle of 4 micro secs? At 4mhz I think the duty cycle on the picaxe is 26 micros secs, so I assume this is no problem.

Then I need the opto to switch fully on/ off, how do I do it with this device?
 

BeanieBots

Moderator
The PWM from a PICAXE is around 3kHz so a 2uS switch-on is nothing to worry about. What I would be more concerned about is driving the IRF530 from the opto. I know very little about either device but driving an FET with PWM into its highly capacitive gate directly from an opto isolator sounds like trouble. You will probably need some sort of intermediate drive between the opto and the FET. By the way, with PICAXE PWM being in the mid audio band, your motors will make some really horrendous noises!
 

Kiwi Bruv

Member
thanks Beaniebots. I will give it a go to see how noisy it is.

I do have a circuit I would like to use which uses a 555 and an op amp to produce a full duty cycle PWM at non audible freq. But, the duty cycle is set using a pot.

How can I get a 0 - 12V analogue signal suitable as an input to the opamp and driven from a picaxe?
 

BeanieBots

Moderator
Several ways.
Either, use the PICAXE PWM to produce a 0 - Vcc analog via an RC and then amplify with an op-amp or use PWM to drive a transistor that has its collector pulled up to 12v via a resistor. The latter will give 12v PWM which can then be fed into an RC to give a 0 - 12v control voltage. (the R of the RC needs to be significantly bigger than pull-up resistor).
Worth trying with the raw PICAXE first to see if the noise is acceptable.

I often use just 3 or 4 digital outputs and an R-2R ladder to produce a 7 or 15 step analog output for speed control. This is usually more than enough speed resolution for most robots.

Edited by - beaniebots on 10/14/2005 8:34:36 AM
 

Kiwi Bruv

Member
Thanks Beanie bots.

The ladder sounds like what I actually need. Can you explain further. Are they different resistances in parallel and one capacitor and the output you choose selects the R/C combo by virtue of how far up the ladder it connects?

Or are the resitances the same but in series?
 

BeanieBots

Moderator
Not quite. An R-2R is the classic way that a tradional digital to analog converter works. Output0 has a resistor of value R connected, output1 has R/2, output2 has (R/2)/2 output2 has ((R/2)/2)/2 = R/8 etc. etc.
All the other ends of the resistors are then connected together to a common point. For best results, the common point should be a current input device such as an op-amp virtual earth input such that the voltage will not increase but the input current can be measured. However, in practice, feeding it into a resistor and measuring the voltage across that resistor gives good results.
Now, as each output is turned on, the current (via each resistor) doubles with each successive output. This leads to a doubling of voltage across the resistor at the summing point. Thus you have D-to-A.
Do a google on "resistor ladder" for a better explanation than I can give.

The RC is only required when you use PWM. It is to convert the PWM to analog by means of filtering the duty cycle to give a steady voltage. The values of the R and C depend on what frequency your PWM is running at and how much ripple the next stage can tollerate.
 

Michael 2727

Senior Member
The 4N25 or 4N28 can switch quite fast and
they should be able to drive the MOSFET
without much trouble.
Just look at any switchmode or computer
power supply they all use similar arrangements to switch (Optocoupler/Mosfet)
 

BeanieBots

Moderator
Michael 2727, that was my point of concern, "Just look at any switchmode or computer power supply they all use.. " bipolar drive for the FET. The 4N25 is open collector which would mean that to turn the FET on would rely on the pull-up resistor discharging the gate capacitance. While it does this, the FET is in linear mode and getting hot.
I may be wrong about the particular device quoted (I've no idea what its gate capacitance is) so appologies if I am wrong, but it is something I would be concerned about. May well be fine at 3kHz, but if it gets hot at higher frequencies, then you know why.
 

Michael 2727

Senior Member
Years ago I made a PWM supply to drive a 24V
MIG welder wire feed motor.
They draw 2 to 4 amps from memory, I just used a 555 to drive the MOSFET I think the high frequency end was around 3kHz.
The MOSFET only got warm.
 

Kiwi Bruv

Member
OK I am going to try the opto, to learn but also because I fried the last PWM input when I tried to drive a motor from PWM.

If it works, phase 2 will be to make it less noisy.

How do I size the flywheel diode and capacitor for the motor?
 

Michael 2727

Senior Member
You may find this web page of interest.

http://www.ece.uvic.ca/~ece499/2003a/group14/product.htm#diode

1N4004 rated @ 400V 1A
1N4007 rated @ 1000V 1A
5404 rated @400V 3A
5408 rated @ 1000V 3A

Try a 1N4004 if it gets hot try the 5404.
If they fail go for the higher voltage 5408.

A 0.1µF to 1.0µF class X2 AC mains cap may be worth a shot.

Its hard to say really there are a lot of
variables, unless you can "google" a
similar circuit.

You are probably going a bit beyond what most people would normally use size wise.

I din't think I used a capacitor on my circuit, or a diode for that matter, it was
acoustically noisy and probably electrically noisy as hell, but it was on a farm and only used it rarely and in short
bursts.
 

BeanieBots

Moderator
The diode in the circuit shown is essential because with the inductance of the motor it forms the other half of the conduction path of a conventional buck converter. Without the diode, you will loose half of your effeciency and the extreme flyback voltage will be many kilo-volts which will kill your transistor.
Its size should be several hundred volts with enough current capability to keep the current going when the transistor is off. In brief, about twice the current that would flow if it were in series with the motor. The exact voltage that it will see depends on how fast it is to conduct. The faster the better. The INXXX series are not very quick and I do not think they will handle enough current for your application. Have a look at the MUR range.
 

Michael 2727

Senior Member
Yes Beaniebots the IN400 series may be a bit slow, I am not familiar with the other types.
As I said Kiwi bruv you are getting into
heavy duty territory here.
You may find some answers at the Nuts & Volts forum I think they have a Robots section.
Some of these guys get into the heavy duty robots like the ones you see in battle on the TV.

PS: have a look at the Oatleyelectronics site,,[http://www.oatleyelectronics.com/motors.html]
they have these, SPC350, they are a motor speed controller rated @ 24V 350W, they are
for those battery bikes/scooters and only
$24.00 bucks AUD.





Edited by - Michael 2727 on 10/16/2005 12:24:38 PM
 

Kiwi Bruv

Member
Update:

I can't get enough current out of the picaxe to drive the LED enough to produce enough current in the detector to drive the mosfet directly with the opto I have. I don't want to complicate it and add in transistors, so I am going to drop this idea and use the picaxe pwm to replace a pot controlling a 555 based pwm drive. If that doesn't work I'll probably buy the oatley electronics unit.

I need some help with the analogue output design so I'll start a new post.
 

evanh

Senior Member
http://nz.farnell.com/jsp/endecaSearch/partDetail.jsp?SKU=3940287&N=401

This needs one milliamp to fire so should be low enough for the picaxe to drive.

Also, always add a 15 volt zenor diode across the source-gate pins and a series resistor (10 ohms should be fine) between the driver output and the gate.


Evan

Edited by - evanh on 10/18/2005 11:02:01 AM
 
Top