I can't reverse the spindle rotation.

More
23 Jun 2026 21:26 #347286 by Ismacr63
I can't reverse the spindle rotation. was created by Ismacr63
Hey everyone,

I'm stuck with a weird problem and could use some advice.

I've got a 3-axis mill with a 1.8kW AC servo on the spindle. It used to run perfectly from a parallel port and a Chinese BOB. I'm now upgrading to a Mesa 7i92, still using the same BOB.

To reverse the spindle I've always used a PC817 optocoupler module. When the REV signal is active, the module pulls the servo driver's DI4 pin to GND, and the spindle reverses. Simple.

Now with the 7i92, everything else works (motion, outputs, etc.), but the spindle reversal doesn't. The LED on the PC817 module lights up when REV is on, but the spindle doesn't reverse. If I take a piece of wire and manually jumper DI4 to GND, it reverses instantly. I've even tried a brand new PC817 module – same behavior.

Wiring of the PC817:

Input side: IN → pin 9 of the BOB, GND → BOB GND

Output side: V (collector/output) → DI4 on the servo driver, GND → servo driver GND

The BOB GND and the servo driver GND are common.

What puzzles me is that this exact setup worked fine with the parallel port. Why would the 7i92 cause a problem with the same BOB and wiring? Is there something different about the 7i92 outputs that could mess with the PC817?

 Is there a better or more reliable alternative to these PC817 modules for this kind of level shifting?

Thanks in advance

Please Log in or Create an account to join the conversation.

More
23 Jun 2026 21:51 - 23 Jun 2026 21:52 #347289 by tommylight
Replied by tommylight on topic I can't reverse the spindle rotation.
Do i understand correctly, you have a BOB attached to Mesa, and then from BOB to PC817?
That seems redundant as you already have the GND's wired together, so might want to get rid of the PC817 as it is not isolating anything.
Is there any resistor on the input side of the PC817?
There must be one, probably a 47-100 ohm should work.
also, might want to try the pull down version, so the pin 9 to the other input of PC817, and the input that was on pin 9 to +5V. This might also require inverting the pin in hal.
Last edit: 23 Jun 2026 21:52 by tommylight. Reason: typo
The following user(s) said Thank You: Ismacr63

Please Log in or Create an account to join the conversation.

More
23 Jun 2026 21:58 - 23 Jun 2026 21:59 #347290 by PCW
Replied by PCW on topic I can't reverse the spindle rotation.
Is it a hal setup error?

For Mesa FPGA cards you need to know the GPIO pin number
for the pin and to set that GPIO pin into output mode.
Last edit: 23 Jun 2026 21:59 by PCW.

Please Log in or Create an account to join the conversation.

More
23 Jun 2026 22:02 #347291 by tommylight
Replied by tommylight on topic I can't reverse the spindle rotation.

The LED on the PC817 module lights up when REV is on, but the spindle doesn't reverse.

Please Log in or Create an account to join the conversation.

More
23 Jun 2026 22:13 - 23 Jun 2026 22:29 #347292 by PCW
Replied by PCW on topic I can't reverse the spindle rotation.
Can you check the output of the module with an ohmmeter?

If the PC817 module needs 5V drive you would have to connect it in sinking
mode to the 7I92. ( +5V to PC817 module IN+ 7I92 output to
PC817 module IN-  and active low output )

Is there some other issue with reverse in the hal file
( like PWM connections if you have spindle speed control )
Last edit: 23 Jun 2026 22:29 by PCW. Reason: clarify
The following user(s) said Thank You: Ismacr63

Please Log in or Create an account to join the conversation.

More
24 Jun 2026 19:47 #347312 by Ismacr63
Replied by Ismacr63 on topic I can't reverse the spindle rotation.

Do i understand correctly, you have a BOB attached to Mesa, and then from BOB to PC817?
That seems redundant as you already have the GND's wired together, so might want to get rid of the PC817 as it is not isolating anything.
Is there any resistor on the input side of the PC817?
There must be one, probably a 47-100 ohm should work.
also, might want to try the pull down version, so the pin 9 to the other input of PC817, and the input that was on pin 9 to +5V. This might also require inverting the pin in hal.
 

 

Your understanding is correct:

Mesa 7i92 → Chinese BOB (5 V outputs) → PC817 module → DI4 of XP200 servo (24 V input).

I use the PC817 to adapt the 5 V level to the 24 V input of the servo, because the BOB cannot drive a 24 V input directly. Even though the grounds are connected together (no isolation), the optocoupler's output transistor acts as a simple NPN switch to pull DI4 to ground.

Can you check the output of the module with an ohmmeter?

If the PC817 module needs 5V drive you would have to connect it in sinking
mode to the 7I92. ( +5V to PC817 module IN+ 7I92 output to
PC817 module IN-  and active low output )

Is there some other issue with reverse in the hal file
( like PWM connections if you have spindle speed control )
 


I tested the sinking configuration exactly as described:

+5 V from BOB → IN+ (anode) of PC817 module

IN- (cathode) → pin 9 (GPIO12, 7I92)

Output V → DI4 (XP200), G → 24 V GND

HAL: spindle-ccw → GPIO12 with invert_output true

The LED now lights up when I activate REV (M4), and turns off in FWD (M3), exactly as expected. However, the spindle still does not reverse.

Thanks again!

 
Attachments:

Please Log in or Create an account to join the conversation.

More
25 Jun 2026 21:28 #347327 by Ismacr63
Replied by Ismacr63 on topic I can't reverse the spindle rotation.
ok this is driving me crazy. today i fired up the machine, turned on the spindle, hit reverse... and it worked. first time since swapping to the 7i92.

i thought maybe the gremlins had left, so i shut down the machine, powered it back up again, tried reverse — nothing. spindle just keeps going forward. led on the module still lights up, wiring is solid and untouched. literally didn't touch a single wire between the time it worked and the time it stopped.

any clue what could cause this?

Please Log in or Create an account to join the conversation.

More
25 Jun 2026 22:04 - 25 Jun 2026 22:47 #347328 by tommylight
Replied by tommylight on topic I can't reverse the spindle rotation.
Deleted as i missed the 5V to 24V level shifting mentioned above.
Last edit: 25 Jun 2026 22:47 by tommylight.

Please Log in or Create an account to join the conversation.

More
25 Jun 2026 22:07 #347329 by Ismacr63
Replied by Ismacr63 on topic I can't reverse the spindle rotation.
What do you recommend I use instead?

Please Log in or Create an account to join the conversation.

More
25 Jun 2026 22:10 #347330 by PCW
Replied by PCW on topic I can't reverse the spindle rotation.
I would check the output of the direction control PC817 with a voltmeter/ohmmeter

Please Log in or Create an account to join the conversation.

Time to create page: 4.359 seconds
Powered by Kunena Forum