opto-isolator / limit sw advice.


Results 1 to 9 of 9

Thread: opto-isolator / limit sw advice.

  1. #1
    Member
    Join Date
    Jun 2012
    Location
    SA
    Posts
    153
    Downloads
    0
    Uploads
    0

    Default opto-isolator / limit sw advice.

    Hi,

    I have spent most of the day digging the best way to use an opto-isolator for a limit switch and I've come down the this:


    v5-test.pdf

    I'm running GRBL modified for STM32F411RE. The circuit will be duplicated for the three limit switches ( more accurately used as home switches ) and a Z-probe.

    The main power supply is coming from an HP printer switched mode PSU, 32V @ 2A. This is feeding one of my stepper motors via an STM PowerStep01 IHM031 demo board. Since it will be a bit noisy, I added a linear regulator to step it down to a smooth 12V.

    The detector side of the opto is powered from the STM32 Nucleo ( Arduino format ) MCU board. Light load on the onboard 5V regulator is allowed.

    The STM32F411 has Schmitt triggered inputs, so the RC filter should provide some debounce and noise protection.

    I got to wondering whether the 7812 was necessary or whether it would be better running the switches directly from 32V to get higher noise immunity.

    I've done a fair bit of electronics but I've not had experience in this kind of machine environment.

    Can anyone who is more familiar tell me if this looks credible. Any other comments or things I've got wrong?

    TIA.

    [EDIT] Just noticed I have two R2s there. Please regard the output of the the 817 as being connected to R3.

    Similar Threads:
    Last edited by reg.miller; 04-02-2019 at 06:00 PM.


  2. #2
    Member
    Join Date
    Mar 2017
    Location
    United States
    Posts
    411
    Downloads
    0
    Uploads
    0

    Default Re: opto-isolator / limit sw advice.

    I think your circuit looks like it would work.

    However, for the input low pass filter, R2 doesn't do anything but divide the voltage of the incoming signal. And, you don't need the power supply to create the 12 volts at the switch. You could put the 36 volts directly to the switch. You would have to work out new resister values though.

    Finally if your controller or BOB has a input pullup resistor, you don't need the +5V supply.
    opto-isolator / limit sw advice.-swfilt-jpg

    Attached Thumbnails Attached Thumbnails opto-isolator / limit sw advice.-swfilt-jpg  
    Last edited by maxspongebob; 04-02-2019 at 05:39 PM.


  3. #3
    Member
    Join Date
    Mar 2017
    Location
    United States
    Posts
    411
    Downloads
    0
    Uploads
    0

    Default Re: opto-isolator / limit sw advice.

    Wait, I may have spoken too soon.

    Are the switches Normally open or normally closed?



  4. #4
    Member
    Join Date
    Jun 2012
    Location
    SA
    Posts
    153
    Downloads
    0
    Uploads
    0

    Default Re: opto-isolator / limit sw advice.

    Thanks Max. The i/p can be configure as pull-up , I had not looked at it like that. Seems to make sense.

    I don't think you are correct that R2 will divide the voltage. The photodiode has a max forward voltage drop of 1.2V so will effectively short out r2 once it starts conducting. R1 is a current limiting resistor.

    R2 is there to ensure that C4 discharges once the switch re-opens.

    Part of my question was the merit of having the linear regulator or not. Sure, I could just connect to 32V but that is likely to be noisy since it is feeding the motor driver cct. Having a regulator with a substantial voltage drop should clean that up a lot.

    Are the switches Normally open or normally closed?
    N/O.



  5. #5
    Member
    Join Date
    Mar 2017
    Location
    United States
    Posts
    411
    Downloads
    0
    Uploads
    0

    Default Re: opto-isolator / limit sw advice.

    Yes, I spoke too soon. What about this one?
    opto-isolator / limit sw advice.-swfilt-jpg
    First, if you can keep from sending power out to the switch, that might be good. Eliminate shorts of high voltage if a cable gets pinched. The switch can just provide a short to ground to generate it's signal. Using a Normally closed switch is also a good idea so that a broken wire or disconnected cable will look like an activated limit switch so you will know there is a problem right away.

    Regulating the voltage down, is good, but the RC filter at the input will do the same thing.

    Doesn't the Arduino board have a 10K pullup on the input pins?

    Attached Thumbnails Attached Thumbnails opto-isolator / limit sw advice.-swfilt-jpg  


  6. #6
    Member
    Join Date
    Mar 2017
    Location
    United States
    Posts
    411
    Downloads
    0
    Uploads
    0

    Default Re: opto-isolator / limit sw advice.

    Let me think out loud about this for a sec.

    Sitting still, the switch will be closed (NC switch) and current will flow from 36V to ground through R1 and C1 will be discharged. When the switch hits the limit the current through the opto will stop and C4 will begin to charge. So, this might work however C4 would have to be a 36Volt cap. Not so easy.

    Maybe just stick the RC filter on the output of the opto? Then you have smaller capacitors.


    Oh, wait. You said that the switch is NO. So you will not be able to detect a broken cable. But it still works the same.



  7. #7
    Member
    Join Date
    Jun 2012
    Location
    SA
    Posts
    153
    Downloads
    0
    Uploads
    0

    Default Re: opto-isolator / limit sw advice.

    SW1 can be either N/O or N/C.

    It's not an Arduino. The pull ups are 40k. Are you still suggesting dropping the output resistor and using just the internal pull-up?

    Eliminate shorts of high voltage if a cable gets pinched.
    Good point.

    Last edited by reg.miller; 04-03-2019 at 05:24 AM.


  8. #8
    Member
    Join Date
    Mar 2017
    Location
    United States
    Posts
    411
    Downloads
    0
    Uploads
    0

    Default Re: opto-isolator / limit sw advice.

    More thinking...

    What was the time delay of the RC circuit? Will that reduce the accuracy when you use the limit switch for homing?

    Do you really need to debounce a limit/home switch? It's not like an encoder where a noisy signal looks like extra pulses. The switch bounce will not occur until you are at the limit so any signal however small means STOP. I bet the controller will use the edge as the trigger. I have mechanical switches on my mill and none of the signals are debounced and I have not had a problem. I also use the same circuit for my probe and it is not debounced.



  9. #9
    Member
    Join Date
    Jun 2012
    Location
    SA
    Posts
    153
    Downloads
    0
    Uploads
    0

    Default Re: opto-isolator / limit sw advice.

    I did say I'm looking for a bit of noise immunity too.

    Current RC is 0.1ms, the mechanics are not going to move far in that time. Modern, current limiting, stepper motor drivers do a lot of h.f. switching which I have seen folks finding it being picked up on limit switch cabling.

    I think I will go with your switch to ground configuration, for the reasons you give, plus it is compatible with a N/C Hall effect proximity detector I may want to use instead, if the switches are not reliable / accurate enough.

    Thanks for you comments.

    Last edited by reg.miller; 04-03-2019 at 07:38 AM.


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

opto-isolator / limit sw advice.

opto-isolator / limit sw advice.