If you're on the highway and Road Runner goes beep beep

by Ivan Hamilton 4/29/2008 11:10:00 AM

The servo controller I've been building is meant to interface to a motion generation system. In the hobby CNC world, that's probably Mach3 or EMC2.

Mach3 uses the parallel port to generate signals that describe motion. It's often referred to as DIR+STEP signals. One line is the direction, the second is pulsed for each increment of movement. My servo controller was written to interpret these signals, but I didn't have a parallel port on my "legacy free" desktop to test this. A trip to the PC shop got a 2 Port PCI parallel port card (a Sunix 4018A Multi-I/O Adapter) for $35 (I could get one a few bucks cheaper, but the cheap shop had around 25 people queued at the counter!).

Unfortunately the Sunix card isn't just a "standard" parallel port. It doesn't appear at IO address 0x378 & 0x278 like a "standard" port (these are the addresses set by default in Mach3). Being a Plug & Play card, the IO addresses are assigned by the BIOS/OS. Windows XP's Device Manager shows the addresses the card had acquired.

   

I was hoping that the few ranges it had were still IO compatible with a standard parallel port. I entered 0xC000 as the port address into Mach3, attached the CRO to the port, and jogged the axis. Success!

A couple of wires were added from the parallel port break out board to my controller, and a test was in order.

The background is the standard Mach3 screen. Lower left is the motor. Lower right is the serial terminal output from my controller. The terminal output is: [0] positional error, desired position, output strengthtemp diag numbers

The error sits at around 30 and peaks at 100. The motor is fitted with a 1200 pulse encoder (Mach3 configured for 0.25"/rev screw), meaning that's 9-30 degrees (0.16-0.55mm) out respectively. That's not bad for a system that's not been tuned properly (at all really - Kp=100, Ki=100, Kd=0).

I've added simple serial command processing to the controller, and you can adjust the PID parameters on the fly now. This will certainly help in getting the final tuning values.

More thorough testing is still needed. I need to push it until it breaks, and see what it can withstand. I also need to do some "quality" PID tuning. But for the moment... I'm a little pleased with myself.

Currently rated 1.5 by 34 people

  • Currently 1.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Electronics | Mechanics | CNC

Related posts

About the author

Name of author Ivan Hamilton
"My inner nerd can beat up your inner nerd."

E-mail me Send mail

Adsense

Calendar

<<  April 2018  >>
MoTuWeThFrSaSu
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

View posts in large calendar

Recent comments

Tags

None

    Entropy

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2018

    Sign in