CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Electronics > General Electronics Discussion


General Electronics Discussion Discuss basic electronics, power supplies and anything else electronic related here.


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 09-02-2009, 09:20 PM
 
Join Date: Sep 2009
Location: Australia
Posts: 4
mixotricha is on a distinguished road
Opto Couplers

Hi guys. This is my first posting to this forum and I apologize if this is not a suitable place to ask my question.

I am building a simple 2-axis plotter based around the components extracted from a craft-robo cutter. The hardware is complete and now I am half way through building the stepper controller to drive it all.

As the local electronics store here doesn't supply any bipolar stepper driver chips I decided it would be fun just to do it all using power transistors so I built an h-bridge that runs on 24 volts using TIP31C and TIP32C transistors.

I just sort of hacked my way through that and it seems to work great. Drives a stepper coil backwards and forwards no problem.

However I am up to the last part of the h-bridge which is the interface to the parallel port and I have run in to one snag and I do believe it is in my choice of optocouplers.



I picked triac ones and I can now see this was a mistake as the MOC3020 series turn on but not off!

I understand now that these were not really designed to run off a parallel port but for AC applications.

But I figure I got this far and the rest of the board looks good so one more little hack might just do the trick for me.

Anyway my question was if any trick exists to turn these opto couplers on/off via a parallel port.

I was thinking perhaps by putting a cap across the led side to force them to pulse?

As you may have gathered I am not an electronics Guru.

I just cobbled this together and am happy I got this far!
Reply With Quote

  #2  
Old 09-02-2009, 10:29 PM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,539
Al_The_Man is on a distinguished road
Buy me a Beer?

For the price, rather than try to commutate them off, buy transistor output type.
Also if you are going to drive a load from a parallel port, the convention has usually been to sink the load rather than source, as usually a parallel port has higher current capability in this mode.
Al.
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

  #3   Ban this user!
Old 09-03-2009, 01:44 AM
 
Join Date: Aug 2009
Location: Las Vegas
Posts: 126
fullspeceng is on a distinguished road

You need to add a pull down resistor on the base of the transistor to pull the voltage low to turn it off.

Also most opto couplers take 5-10mA per LED. That is too much current for the parallel port which is speced for 2mA.

For a simpler solution, go with a Silicon Labs Si8460. It is a digital coupler and can drive up to 10mA off the output and takes 0mA on the FET inputs.

If you need to build a PCB, check out this tutorial http://www.fullspectrumengineering.com/tutorial.html
Reply With Quote

  #4   Ban this user!
Old 09-03-2009, 04:53 AM
 
Join Date: Sep 2009
Location: Australia
Posts: 4
mixotricha is on a distinguished road
Pull Down Resistors

For the pull down resistors should these between each base and each collector on the transistors in the bridge?

Also what size would they be. I am thinking about 10k?

My local electronics shop is called jaycar and they do not have the Silicon Labs Si8460 but they do have these smaller opto couplers which are also a good deal cheaper.

http://www.jaycar.com.au/products_uploaded/ZD1928.pdf

I know I could just go for some solid state relays but those look to be a tad expensive.
Reply With Quote

  #5   Ban this user!
Old 09-03-2009, 06:26 AM
mkc2's Avatar  
Join Date: May 2008
Location: Perth ,Australia
Posts: 134
mkc2 is on a distinguished road

Hi maybe this site can help you,
They use the 4n25 optocoupler to control a 24volt relay coil


http://forum.allaboutcircuits.com/sh...ad.php?t=14812

Michael
Reply With Quote

Sponsored Links
  #6  
Old 09-03-2009, 01:26 PM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,539
Al_The_Man is on a distinguished road
Buy me a Beer?

Also see this recent posting.
http://www.cnczone.com/forums/showthread.php?t=88715
Also, if you end up driving a relay, there is no need for opto isolation, the relay can be driven off the PC 12v supply using 2N7000 or the drivers in the link.
The relay IS the isolator.
Al.
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

  #7   Ban this user!
Old 09-03-2009, 05:59 PM
 
Join Date: Oct 2008
Location: US
Posts: 115
bharbour is on a distinguished road

Hi,
A couple of things come to mind from looking at your schematic.

It does not look like there is enough current gain on the transistors. I looked at the data sheet on the TIP31C and they spec a current gain of 10 - 50. If you wanted to drive 1 Amp across the coils, you would need 100 milliAmps of base drive capability to insure that the transistor stayed saturated. I would probably want at least 500 milliAmps of base drive capability just to deal with unexpected loads. If you run short of base drive current, the transistor starts to dissipate a LOT of power and smokes pretty quickly. A darlington setup will give you the base drive you need at the expense of another smaller transistor. Ascii art does not work here, so I won't try to sketch one. Another choice would be to find Darlington transistors instead of the TIP31C and TIP32C.
Beta or hfe is the name of the parameter for current gain to look for. Take the Base drive current available x hfe (or Beta) and you get the absolute maximum collector current that you can handle without pulling out of saturation.

Look at the TIP122 for an NPN Darlington. It has a current gain of 1000 compared to 10 - 50. The TIP125 would be the corresponding PNP.

There is no interlock to prevent the high and low side transistors from being switched on at the same time. The parallel port does unpredictable things during switch-on and operating system booting, so this is kind of important. It should be possible to set up the transistors so that one opto controls both the high and low side transistors and there would not be a way to have both switched on at the same time.

You should have diodes protecting the transistors from the inductive kick when the coil switches off. On the low side transistors (-24V), put a diode with the cathode tied to the emitter and the anode to the collector. On the high side (+24V) tie the anode to the emitter and the cathode to the collector.

There are not really any graceful ways that I can think of to switch a TRIAC opto off in a DC powered circuit. I would replace the TRIAC optocouplers with darlington optocouplers.

Good Luck and keep asking questions!
BobH
Reply With Quote

  #8   Ban this user!
Old 09-03-2009, 07:36 PM
 
Join Date: Sep 2009
Location: Australia
Posts: 4
mixotricha is on a distinguished road

___

There is no interlock to prevent the high and low side transistors from being switched on at the same time. The parallel port does unpredictable things during switch-on and operating system booting, so this is kind of important. It should be possible to set up the transistors so that one opto controls both the high and low side transistors and there would not be a way to have both switched on at the same time.
___

I had thought about this as well since the parallel port can often just flash up random states when the computer is booting up and so on. For the final design I was going to put a little bit more npn/pnp transistor logic in between the opto couplers and the bridges or maybe a trigger somewhere between the parallel port and the couplers. I was also aiming to reduce the pins used on the port to because at the moment driving two steppers will use all eight pins!
___

Look at the TIP122 for an NPN Darlington. It has a current gain of 1000 compared to 10 - 50. The TIP125 would be the corresponding PNP.
___

Brilliant. This would explain why the transistors were getting so hot when they began to pull load through a coil. I just thought it was because I had not put the paste on them and heat sinked them yet. It can't hurt at all to go for some bigger ones. I did try to do the math around the hfe value from the sheet but I had not realised the coils were going to pull quite so much current. I hooked up one of the coils from the stepper to my MM and put the power supply through it to see what sort of current it was pulling and just sort of eye balled it. I think I got the math wrong though. But then I figured if the transistors were not big enough they would just explode and I would replace them.....

___

You should have diodes protecting the transistors from the inductive kick when the coil switches off. On the low side transistors (-24V), put a diode with the cathode tied to the emitter and the anode to the collector. On the high side (+24V) tie the anode to the emitter and the cathode to the collector.

___

Great. That is exactly what I was going to do as well. 4 diodes across the bridge in the right places to deal with the kick back from the coil.

____

There are not really any graceful ways that I can think of to switch a TRIAC opto off in a DC powered circuit. I would replace the TRIAC optocouplers with darlington optocouplers.

____

Ok cool. This is really the critical bit I was missing. So I will dump the MOC3020's and go for a 4n28/4n25 instead.

I think I will go and buy a couple and try them today. When my final circuit is done I will post it up as it might be useful to somebody. Even if it is just as an abject lesson in how NOT to design a circuit!

Thanks everyone for your help. If all goes well I should be driving a stepper by this evening.
Reply With Quote

  #9   Ban this user!
Old 09-04-2009, 06:45 AM
 
Join Date: Oct 2008
Location: US
Posts: 115
bharbour is on a distinguished road

I was thinking about your project and some questions came up.

What is the DC resistance of the step motor coils?
What is the maximum current that they are rated to handle?
The reason that I am asking, is that 48 volts is pretty high for the type of drive that you are building. There are step motors designed for this high of a voltage, but most of the ones I have seen are designed for a much lower voltage. Usually high voltages in step motor drivers are used in some kind of a chopper drive circuit, where the motor current is sensed and when it reaches the desired value, the power is switched off and the current allowed to circulate until it gets too low or a new step comes along. This sensing is done in hardware, because it is pretty fast and can never be allowed to stop.
The safe way to pick the supply voltage for the driver circuit that you are building is:

(Power supply voltage - 2xVCEsat) / coil resistance < max rated coil current

VCEsat it the voltage across the collector to emitter when the transistor is saturated and it 2x because there are two transistors in the path. The transistor spec sheet lists it, but for the TIP31/32, you can probably assume 0.5 Volts. The TIP122/125 will be more like 1.2 to 1.5 Volts.



How fast do you want to step your motors?
The driver circuit you have sketched will not allow you to move very fast. With this circuit, the torque falls off with motor speed very fast. The chopper drive allows much faster step rates (maybe 10X to 30X). For information on chopper drives, look at the ST web site and search on the L297 and L298 chips. These are old parts, but still availible and pretty simple to undestand.

Good Luck,
BobH
Reply With Quote

  #10   Ban this user!
Old 09-04-2009, 11:50 AM
neilw20's Avatar  
Join Date: Jun 2007
Location: Australia
Age: 63
Posts: 2,338
neilw20 is on a distinguished road
Jaycar.

I see you purchase goods from Jaycar.
A simple solution is a ready made product, to save pulling out your hair.
You won't learn as much, but you will be up to speed (well rotating at least) with this.
AA-0352
http://www.jaycar.com.au/productView...2&form=KEYWORD
Software link available too.
Split rail supply required, so BEWARE, if you want to run from single supply.

Some bed side reading....
http://www.jaycar.com.au/productView...0&form=KEYWORD
__________________
Super X3. 3600rpm. Three ways to fix things: The right way, the other way, and maybe your way, which is possibly a faster wrong way.
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 09-04-2009, 01:46 PM
 
Join Date: Sep 2008
Location: Germany
Posts: 142
der_fisherman is on a distinguished road

You cannot use Triacs (meant for AC loads) on DC, they lock on. They need the AC crossing over zero to allow them to turn off....There is NO WAY to change this. Replace the Otocouplers with transistor ones....

Look for optocouplers that run with 6ma or less LED current, so that the load on the printer port is reduced. Size the series resistor accordingly. Some printer ports cannot supply more than 6ma, so be careful.

In a worst case situation, you will have to buffer the new optocouplers with a transistor or chip to make a reliable system.

Its not a simple problem. You have done REALLY well to get so far with such limited knowledge, congratulations for hard work. New optocouplers are cheap, do not be dismayed. Keep the Triac ones for later control of your spindle motor!!!

Think about the maximum frequency you need before buying any new optocouplers, if you wish, I can post some data sheets for you, just ask if you need them.

I am a bit late with my answers sorry.
Reply With Quote

  #12   Ban this user!
Old 09-07-2009, 02:13 AM
 
Join Date: Sep 2009
Location: Australia
Posts: 4
mixotricha is on a distinguished road
It works somehow ....

Hey guys just thought I would follow this up. IT WORKS!!!!! I have no idea how or why my rube Goldberg madness of many wires works without the magic smoke escaping but it does!!

I hooked it all up this evening to one of the steppers from the savaged remains of the Craft Robo and the stepper runs in both directions at a very decent speed quite happily.

I would say based on this observation that speed isn't actually a problem with this sort of design for the average home hacker and that this is an ok approach if you want to drive a bigger motor and your stupid local electronics shop does not supply bipolar chips!

Also I looked at all the Jaycar kits available and none of them were quite right or were just to expensive. Building this out of transistors was a lot more fun.

The spindles seem to turn just as fast as they did when driven by the board from inside the Craft Robo. I am not sure what will happen to the transistors under load but the basics seem sound. Parallel port has not exploded. Transistors have not exploded. But they do get very hot fast. I think I will need some big heat sinks.

Anyway in the final synopsis I would say you can indeed build a stepper controller this way and that it can work and that the opto couplers in this instance seem nice and fast for switching.

For future reference I used 4N25 couplers. Also here is my python code for driving the parallel port. I hope something in this post helps someone else out in the future.

# Damien Vincent Towning
# 2009
# Driving a stepper from the parallel port isn't hard

import binascii
import serial
import string
import time
import datetime
import win32api
import array
import subprocess
import os
import shutil


from ctypes import *

#################################################
# convert binary string to dec
#################################################

def bin2dec(val):
return sum(int(i) << k for k, i in enumerate(reversed(val)))


######################################################
# Write out data to para
######################################################

def write_paraport(port) :

i = 0
ii = 0

forwards = [[0,0,0,0,1,0,1,0],
[0,0,0,0,0,1,1,0],
[0,0,0,0,0,1,0,1],
[0,0,0,0,1,0,0,1]]

#backwards = [[0,0,0,0,1,0,0,1],
# [0,0,0,0,0,1,0,1],
# [0,0,0,0,0,1,1,0],
# [0,0,0,0,1,0,1,0]]


paraport = windll.inpout32

while ii == 0 :
for i in range(0,4) :
paraport.Out32( port , bin2dec(forwards[i]) )
time.sleep(0.01)

write_paraport(0x3BC)

Of course I am sure you can guess what the next problem is. Having built my stepper driver this way I have now consumed all output pins on my parallel port.

What I need to find now is some sort of decimal to binary chip I think. Something that will let me load up a nibble on one side and have it come out the other side as binary.
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
LoveJoy couplers ger21 EBAY ADS 1 09-09-2009 09:02 AM
Which Couplers? caleb105 Benchtop Machines 3 02-22-2009 08:49 PM
stepper couplers corrie Stepper Motors and Drives 6 06-02-2008 11:45 PM
Do the jaw couplers on MSC have backlash? radicooldude Benchtop Machines 6 03-17-2006 02:37 PM
shaft couplers dgalaxy Benchtop Machines 4 02-01-2006 11:18 AM




All times are GMT -5. The time now is 04:51 PM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361