I am trying to use a router as a spindle motor for a cnc machine. The problem with cheaper controllers that are available is that the motor will slow down when load is applied. Here is what I have been experimenting with. The schematic is pretty straight forward and isolation from the mains is provided via the optocoupler. The code is also very straightforward as I'm not much of a programmer. It is only a proportional control so the motor does slow down but still has plenty of torque to machine wood or alloy without problems. The feedback sensor is a 2mm magnet inserted into the collet body and the pickup is just a coil housed in a metal body from a very very old hard disk drive. Any suggestions by members to improve the software would be much appreciated.
Unfortunately I don't know how to insert the code so hopefully doing it this way won't annoy anyone to much. I just need to reduce the proportional error and it would be simple and work well. The Picaxe 08M doesn't seem to have a /16 option for the pwm which would be nice or an 8M clock speed which would really help. Is there a newer version of the 08M that has these options?
Thanks folks,
RogerRabbit
['Universal Motor Controller'
'Using Picaxe08M 08.02.25.
symbol setpointport=1 'reference setting
symbol setpointvalue=w0
symbol tachoport=4 'tacho
symbol tachovalue=w1
symbol pwmport=2 'pwm to optocoupler
symbol sum=w2
start:readadc10 setpointport,setpointvalue 'read setpoint
readadc10 tachoport,tachovalue 'read tacho
tachovalue=tachovalue *2 'bring tacho into range
w2= w0-w1 'setpoint-tacho fb
pause 5
if w1>w0 then start 'if it's -ve do nowt
pwmout pwmdiv16,pwmport,255,sum 'output difference
goto start]
The schematic:

Unfortunately I don't know how to insert the code so hopefully doing it this way won't annoy anyone to much. I just need to reduce the proportional error and it would be simple and work well. The Picaxe 08M doesn't seem to have a /16 option for the pwm which would be nice or an 8M clock speed which would really help. Is there a newer version of the 08M that has these options?
Thanks folks,
RogerRabbit
['Universal Motor Controller'
'Using Picaxe08M 08.02.25.
symbol setpointport=1 'reference setting
symbol setpointvalue=w0
symbol tachoport=4 'tacho
symbol tachovalue=w1
symbol pwmport=2 'pwm to optocoupler
symbol sum=w2
start:readadc10 setpointport,setpointvalue 'read setpoint
readadc10 tachoport,tachovalue 'read tacho
tachovalue=tachovalue *2 'bring tacho into range
w2= w0-w1 'setpoint-tacho fb
pause 5
if w1>w0 then start 'if it's -ve do nowt
pwmout pwmdiv16,pwmport,255,sum 'output difference
goto start]
The schematic:
