Optical interupt switch implementation.


Page 1 of 2 12 LastLast
Results 1 to 20 of 27

Thread: Optical interupt switch implementation.

  1. #1
    Registered
    Join Date
    Jan 2004
    Location
    United States
    Posts
    231
    Downloads
    0
    Uploads
    0

    Default Optical interupt switch implementation.

    We all need limits...

    This is a continuation of a thread that was started here.

    As I am sure many of you know, limit switches detect the position of moving parts when they are near the extreme ends of their linear positions. This prevents collisions of things like ballnuts at the ends of the ball screws, and are also used as points of reference for when the software resets the table to go to the "home" position. Some systems use mechanical switches but in my case I chose to use optical interupter switches made by Fairchild. The advantages of optointerupters like the H21LOB are that they create TTL logic and are fairly accurate.

    After some testing I came up with this circuit diagram ( jpg pdf ) for the interupters. In this circuit you'll note that in order to daisy chain the optointerupters together it was useful to solder a resistor directly to the interupter. The H21LOB wiring was bundled up with lots of heat shrink tubing (also shown here). The circuit diagram also shows the pinouts for each of DIN connectors which eventually will plug into the back of the electronics enclosure.

    Although its very difficult to see in the picture, my cnc table came with a nice mounting bracket (note red arrow) which had some old school interupt switches. I pulled off the bracket, removed the switches, and strung in my interupter circuit into the mount (view here and here). Hot glue was used to make all the wiring that was crammed into the rail stay in place.

    The pictures look kind of crappy but once the rails were bolted into place everything looked really good. There are two rails, one for each axis, and each rail has three switches: limit+, limit- and home. The table comes equiped with small pieces of sheet metal that project down onto the rails. When the table slides towards the ends of its total possible travel (around 18 inches) the sheet metal tabs travel between the opto-interupters. The state of the opto-interupters changes, the universal stepper controller picks up the change, and my software throws a complaint.

    owen

    Similar Threads:


  2. #2
    Banned
    Join Date
    Apr 2004
    Location
    Norway
    Posts
    678
    Downloads
    0
    Uploads
    0

    Default

    These interrupters are very accurate and dependable. But it may be worth mentioning that this is for a laser cutter. I don't think Lasers don't generate swarf or dust, so it will be fine. But for others reading this and thinking of using it for metal or wood cutters, please consider this: A small piece of debris landing in the reading fork, and it will signal "limit! end operation.".



  3. #3
    Gold Member High Seas's Avatar
    Join Date
    Sep 2003
    Location
    Malaysia/Australia/NZ/USA
    Posts
    1113
    Downloads
    0
    Uploads
    0

    Default

    owhite -
    Say Owen, thanks for that great summary! I've salvaged a bunch of similar opto-limit switches from printers and 5.25 floppy drives (thanks to Big AL for his connection notes too), so I may have a purpose for them now!
    And Einar, sure understand your point regarding swarf and dust. I'll mount "high and dry" overhead - SYSTEM2 sorta sits "above" some of the mess.
    Thanks guys! - Jim

    Experience is the BEST Teacher. Is that why it usually arrives in a shower of sparks, flash of light, loud bang, a cloud of smoke, AND -- a BILL to pay? You usually get it -- just after you need it.


  4. #4
    Registered
    Join Date
    Mar 2004
    Location
    Delta BC Canada
    Posts
    150
    Downloads
    0
    Uploads
    0

    Default

    Sounds interesting. I think I am going to try something like this.



  5. #5
    Registered
    Join Date
    Apr 2009
    Location
    United States
    Posts
    10
    Downloads
    0
    Uploads
    0

    Default

    I'm not sure I understand what the OP means when he says "The advantages of optointerupters like the H21LOB are that they create TTL logic and are fairly accurate. "

    I'm not familiar with the use of that type of opto interrupter. It looks like the phototransistor side is set up like a darlington pair. Is that for current gain?

    How do the H21LOBs compare to a 4 wire slotted optical switch, like an H21A1 (commonly found inside old computer mice). I would really like to implement this type of limit switch in my design, but I'm having trouble wrapping my tiny brain around the wiring of the switches.

    Can anyone help out on this?

    I only ask about the H21A1's because that is what I have, but I'd really like to understand the differences between the two types, before I make a final decision. What is the benefit of using one type over another?



  6. #6
    Registered
    Join Date
    Apr 2009
    Location
    United States
    Posts
    10
    Downloads
    0
    Uploads
    0

    Default

    Also, my circuit will require the limit switches on all axises to be chained together in series, so that if one switch is closed, the whole machine stops.

    This is what I had so far. Does this look like it would work?

    Attached Thumbnails Attached Thumbnails Optical interupt switch implementation.-untitled2-jpg  
    Last edited by AlmostHandy; 04-08-2009 at 09:54 PM.


  7. #7
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    24221
    Downloads
    0
    Uploads
    0

    Default

    I do not see this working at all, you have the LED's all in series across the 5v supply, with no resistance in series you will most likely blow one.
    You need three wire between each switch, and you have the NPN transistors which have no final load resistor.
    See post #7 http://www.cnczone.com/forums/showthread.php?t=77324
    Al.

    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.


  8. #8
    Registered
    Join Date
    Apr 2009
    Location
    United States
    Posts
    10
    Downloads
    0
    Uploads
    0

    Default

    Thank you Al! That file is just what I was looking for! I understand how to connect them one at a time now, which is a step in the right direction.

    My problem is that my circuit calls for limit switches to be connected in series, so that if one of them is broken, the whole loop is broken. They are all connected to the same pin on the parallel port (S6), and a 5v source with a 4.7K pull up resistor.

    Is there a way to connect the opto-interrupters in series, so that they are all connected to the same loop? I can't figure out how to daisy chain them all together in series.



  9. #9
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    24221
    Downloads
    0
    Uploads
    0

    Default

    I will repost with the series circuit.
    Al.

    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.


  10. #10
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    24221
    Downloads
    0
    Uploads
    0

    Default

    This is a series circuit, it has been tested, the resistor values may have to be adjusted if any opto's are added or subtracted.
    Al.

    Attached Files Attached Files
    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.


  11. #11
    Registered
    Join Date
    Apr 2009
    Location
    United States
    Posts
    10
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by Al_The_Man View Post
    This is a series circuit, it has been tested, the resistor values may have to be adjusted if any opto's are added or subtracted.
    Al.
    Awesome! That makes sense! Even seems, dare I say, simple?


    I found a box in my junk that has 6 of the same type of opto-switch. They are Sharp, model number GP1S58. I've looked at the datasheet, and it says that the typical rating is 1.2Vf @ 20mAIf on the LED side. Now, my math isn't that great, but I'm pretty sure that since I'm using a +5V supply, I'll only be able to chain together four of these in series, before the forward voltage becomes too low for the LEDs to make any light, closing the circuit.

    Does that make sense? I'll be trying to put 6 of them in series.

    What I've done is attempt to separate the power to the LED half of the switches, without breaking the chain in the output side. My attempt seems logical, but again, these little optical switches baffle me for some reason. Do you think this would work?

    Attached Thumbnails Attached Thumbnails Optical interupt switch implementation.-untitled4-png  


  12. #12
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    24221
    Downloads
    0
    Uploads
    0

    Default

    You could probably go with three LED's in each string with a 50 ~ 70ohm resistor.
    Unless you want to keep them in pairs?
    Al.

    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.


  13. #13
    Registered
    Join Date
    Apr 2009
    Location
    United States
    Posts
    10
    Downloads
    0
    Uploads
    0

    Default

    Awesome. I think I've almost got this thing finished on paper.

    Then it's off to the breadboard!!

    Thank you so much!!



  14. #14
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    24221
    Downloads
    0
    Uploads
    0

    Default

    If you have more than three transistor outputs in series, you may have to adjust the 1k load resistor, the idea will be to keep the FET gate at around 1.2v in the un-triggered state, WRT common.
    The respective currents through the devices can be obtained by using ohms law after measuring the voltage drop across the resistor load.
    Al.

    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.


  15. #15
    Registered
    Join Date
    Apr 2009
    Location
    United States
    Posts
    10
    Downloads
    0
    Uploads
    0

    Default

    Ok, A couple more questions.

    How far can a logic signal travel?

    Is there such a thing as too far? I mean, I know that the resistance and capacitance of wires, traces, and connectors can come into play with small signals, but I don't know the math involved or even how to apply the data from internet calculators to my application. I don't really have a frame of reference for that sort of thing, since all the circuits I've ever played with were very small in comparison. Factoring the gauge of wire, or the width of a trace based on current is relatively simple for me, but I'm just not sure how capacitance or resistance of those components will affect the system.


    Since I've got some of those optical switches from printers that have been wired onto very long leads, I don't imagine that the switch's resistors need to be physically close to the switch, but is there a limit?




    Another question I have deals with the chaining together of those optical switches.

    I was wondering if I could wire 6 of the switches individually, like you have in the slotiso.dxf diagram, and run the outputs from each of the switch's #4 pin to a 6 input AND gate, and then run the out put of the AND gate to the PC.

    Does that make sense? Would I be able to directly interface a single Logic Gate like that? Would it need some sort of pull-up or pull-down resistor network on either side of the gate? Looking through the Jameco and Digikey catalogs, it looks like there are many different kinds of logic, and that they all have different voltage and current requrement/limits. How do I know which one to use in my circuit? Are all parallel ports the same? I mean, do they all use the same kind of logic family?


    Google is awesome, and I've been doing a lot of reading about logic lately. I'd love to implement more of it into my circuit for the learning aspect. I'm also thinking about interfacing some small LEDs to the front panel, that will indicate which opto switch has closed. That way, if one of the switches closes unexpectedly (like when none of the moving parts have come close, and the machine just stops), it will be nice to be able to see at a glance which switch might have some dust in it, or a loose connection.


    Anyways, thanks again for all your help.



  16. #16
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    24221
    Downloads
    0
    Uploads
    0

    Default

    You should be able to use a AND gate.
    If you want to indicate each switch with a LED, look at wiring one in the collector lead of the OPTO output transistor, use a low current device and suitable resistor.
    This give you some idea of the logic level of different technologies.
    http://www.interfacebus.com/voltage_threshold.html
    On a side note, if you need a TTL driver for high current output purposes, the ULN2003 will substitute for several 2N7000's and also have a reverse EMF diode fitted.
    Al.

    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.


  17. #17
    Registered
    Join Date
    Apr 2009
    Location
    United States
    Posts
    10
    Downloads
    0
    Uploads
    0

    Default

    Right on. I think I finally understand these little optical deals. Are Opto-isolators pretty much the same thing, except sealed in a case so that they can never be interrupted? I've been considering running a dozen of those in between the motor controllers and the driver HEXFETS.


    Oh one more thing. I have never really seen any reference to the opto-interruper switches being N.O. or N.C. , and I gathered that they were always N.C. switches, simply by design. That being said, can you (or anyone else) recommend a non contact switch that would be normally open? The design I'm using calls for N.C switches at the axis limits, which we've covered, but the home switches call for N.O. switches, and I'd prefer them to be as accurate as possible. I have several of these little micro switches with the roller ball on the end, but I'd love to go with non-contact switches if it's possible.


    I thought of using some type of encapsulated magnetic switch, but they might be more sensitive to vibration than I'd like. I guess hall effect switches might be a good alternative, and since I don't really know anything at all about them, it would a be another great learning opportunity.

    So is there such a thing as a N.O. Optical Interrupter switch?



  18. #18
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    24221
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by AlmostHandy View Post
    So is there such a thing as a N.O. Optical Interrupter switch?
    There is, but it is more sophisticated (expensive) than the simple slot opto as it has on board electronics, they are termed either operate on light or operate on dark.
    But really the homing application you are describing by N.O. or N.C. switch means the switch takes the input low or high which can be accomplished by means of inversion if necessary, In fact the 2n7000 inverts the signal shown in the dxf.
    Al.

    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.


  19. #19
    Member
    Join Date
    Dec 2005
    Location
    UK
    Posts
    1408
    Downloads
    0
    Uploads
    0

    Default

    Dear AlmostHandy,

    What accuracy do you want from your limit switches?

    Best wishes,

    Martin



  20. #20
    Member
    Join Date
    Dec 2006
    Location
    USA
    Posts
    947
    Downloads
    0
    Uploads
    0

    Default

    Using the type of optical limit switches described here what kind of repeatability can you get? Thanks. What do big Hass VMCs use for accurately homing?



Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Optical interupt switch implementation.

Optical interupt switch implementation.