I am currently trying to fit a 3d printer head on a cheap chinese CNC mill. So far I have successfully been able to control the fan, heating element (including reading a thermistor) and the feeder motor using an Arduino Uno.
The CNC itself has a terminal that connects to the mill spindle motor. This produces a 24V 2MHz PWM signal meant to control the speed of the spindle motor.
After I install the printer head, I would like to be able to control the speed of the filament feeder motor by using the spindle speed setting of the CNC. For this, I need the Arduino to be able to read the output of the spindle speed terminal.
Now to my question: how is it possible to shift a 24V PWM signal down to 5V so I can read and measure the duty cycle with my Arduino?
My first thought was to use an opto coupler: this seems like a possible way, but my opto couplers (LTV-817A) have a cut off frequency of 80 kHz, so as far as I understand, they are too slow for a 2MHz PWM signal.
What alternatives do I have?