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:
Attachment 416670
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.