Thorsten online

A Microcontroller as NC-control:

Introduction Hardware

Atmel 89C52

My most ambitious (and probably most extensive) project: Controls of the milling drilling plotter with a micro controller.

Most available control programs for small NC-machines run on a PC. Control of the stepper motors require a real time processing system. As a result, they usually run within DOS because it is not a multitasking OS. This makes it relatively simple to obtain sufficiently good results. It is obvious, however, that pure DOS programs are no longer state of the art, and hence, undesirable.

A possible solution is the use of a real time operation system (e.g. RT Linux, Lynx, Qnx...). Such systems, however, often tend to deter most semiprofessionell and hobby users. Therefore, some companies actually try to port their DOS software over to Windows 9x by developing near-operating-system drivers. This is probably a relatively awkward solution, and will probably obtain only reasonable results.

My first idea of putting all functionality in a micro controller instead of implementing everything in a PC program failed quickly due to the high complexity and to the limitations it places on the human machine interface (display, etc.). Peter Waltenberg send me his sources for a simplified, 8051 based solution (under GPL), so that I can now offer them for download. This makes it possible to control a milling drilling plotter like a 'normal' pen plotter via Windows drivers, CorelDraw exports etc. It isn't as comfortable as a complete PC based suite, but it's free and it works! Additionaly there's an emulator which runs on the PC. The sources should work for DOS and Linux too.

Another practicable possibility consists of letting a micro controller calculate only the real time section. All graphic editing, handling, completing etc. of the data has to be done on the PC. You must already have one PC to generate the milling data, so it can be used for preprocessing, too. For generation of the engine clocks and the interpolation of the courses, a cheap 8-bit micro controller is efficient enough. Since I've always tried to avoid programming complex Windows projects, I needed to be encouraged by Holger Hassel, who provided me with the inspiration for this solution.

Together we now want to create a fully functioning system. Holger's job is the Windows program for the editing of the data, while I will take over the hardware and software for the micro controller board. The PC and the controller board communicate via a serial interface with the simplest possible protocol. Since NC-machines usually operate more slowly than printers, the data rate of the serial connection probably will not represents the bottle neck. The coordinates are converted into engine steps on the PC in order to relieve the MC from arithmetic exercise as much as possible.

Introduction Hardware

Blockschaltbild zur NC-Steuerung

The hardware for machine control will be distributed on a Master-Slave processor system. An encoder (as jogdial or turning wheel) and optionally a small keyboard matrix and graphical display for the display of important data are attached at the 'Slave'. Hence, the current coordinates can be displayed, executed to hand movement, etc. Since the connection takes place between both MCs serially, a portable operating controller which can be carried around the machine is effectively available.

The 'master' represents the actual connection between PC and the machine, whereby the interface to the power electronics should be compatible to usual stepping motor cards. The first developement step contains only the 'Master' MC, including the stepping motor interface, the reference and limit switches, a small SRAM as scratchpad memory and a text display to show the coordinates and error messages.

On Claudio Lanconelli's homepage I found a schematic for a programming adapter for the AVRs, which gets along with a 6-wire connection to the micro controller board. You can find a ready-made eagle layoutfile here.

Top Home