View Full Version : Closed-loop on the cheap, maybe?


imf
06-16-2006, 09:24 PM
I built a serial interface for some linear scales I intend to mount to my small CNC machine for DRO. Since I have a laptop nearby with EMC it really wouldn't take much to modify EMC to read from the serial port for when I am manually controlling the machine. What I was wondering if anyone out there had done something similar or seen something similar.

Seems like it would be a very easy way to have a closed loop system. Instead of shaft encoders, though, you just have direct read-out from the linear scales. Also, with just a bit more work, EMC2 could "record" g-code (though I'm not sure how useful that would be) by monitoring how you move the different axis wheels around..

andy55
06-18-2006, 01:56 AM
hi imf,

closed loop machining at anything but very slow feeds will require fast position feedback. a position reading something like 1000 times a second. if you can do that over your serial link then it should work... you'd probably have to write the serial driver for EMC yourself.

imf
06-18-2006, 09:20 AM
Ahh, that is probably why folks do it directly in hardware, eh?

The actual signal is 24 bit, 90khz so I probably could get the raw position kinda fast, but the latency on serial link might be a bit much. What we do on PWM channels with shaft encoders though is go real fast until we're nearing the end of our travel and slow down logarithmically until we get where we want.

Granted, this probably isn't something for high-end machines. At the very least, I guess (if you have an old computer laying around) it is an easy way to get DRO on your mill.

andy55
06-18-2006, 02:03 PM
Ahh, that is probably why folks do it directly in hardware, eh?


Yes, if you wire a quadrature encoder to the parallell port and read it as fast as possible with EMC you can probably get count rates of 10 kHz, maybe 50 kHz.
Hardware encoder counters can do 0.5 - 1 MHz or more.
with a hardware encoder counter, EMC then reads the encoder counter value each time the PID loop is calculated, every 1 kHz or maybe 10 kHz.

The actual signal is 24 bit, 90khz so I probably could get the raw position kinda fast, but the latency on serial link might be a bit much. What we do on PWM channels with shaft encoders though is go real fast until we're nearing the end of our travel and slow down logarithmically until we get where we want.
Granted, this probably isn't something for high-end machines. At the very least, I guess (if you have an old computer laying around) it is an easy way to get DRO on your mill.

A cheap DRO is certainly possible.
Encoder counter hardware is not that expensive, the Mesa electronics m5i20 card which has up to 8 encoder counters and 4 axis motion + lots of IO bits is around 200usd.