CNC router controller

From The Munich Maker Lab's Wiki
Jump to: navigation, search

Goals

The controller board is where all the commands and status reports for the CNC mill come together. It's the first place that knows of problems, and should attempt to handle them as good as possible to avoid damage to the equipment. Also, it should integrate the different approaches to control preferred by different users.

Check optotransmitter connection

The motor drivers contain internal optotransmitters to isolate the controller from the motor power. The connection from the controller board to the driver board is treated as unreliable, as these cables can be removed easily.

When a signal is sent, the circuit verifies that the current is adequate for a LED (10mA to 30mA); when no signal is sent, the current should be zero.

During startup, a quick selftest routine checks all outputs:

  1. Activate ENABLE signal, verify current flow
  2. Deactivate ENABLE signal, verify no current
  3. Activate DIRECTION signal, verify current flow
  4. Activate STEP signal, verify current flow
  5. Deactivate STEP signal, verify no current
  6. Deactivate DIRECTION signal, verify no current
  7. Activate STEP signal, verify current flow
  8. Deactivate STEP signal, verify no current

This should test the connections, without moving the axis or changing the motor driver's microstep count (which may be important for the Z axis).

Check motor driver voltage/current

The motor drivers should be powered while the machine is active, and current draw should be adequate for the given control inputs.

A "power good" signal is generated using a zener diode and an optotransmitter in series. This allows a quick reaction when a fuse breaks.

A more detailed voltage measurement is achieved with a voltage to PWM encoder, supplied by the measured voltage, isolated by an optotransmitter.

The current is measured using a hall effect sensor and a voltage to PWM encoder.

The current measurement is used to detect a broken connection to the motor behind the voltage sensor.

Check endstop switches

When an endstop is hit, further movement in this direction should be stopped. A few steps might be acceptable for controlled deceleration.

Continuous position display

The current position should always be displayed on a large display.

Zero position

There should be a virtual zero position. When set, coordinate display becomes relative to this position.

Soft endstops

There should be a way to set two positions on each axis to serve as the new min/max positions. The controller then reports the endstop as having been hit.

Input selection

Control signals can be generated by internal controllers (Arduino compatible) or passed in from external interfaces. A switch interface allows selection of the signal source while the current source does not generate ENABLE signals and the emergency stop isn't active.

Spindle control

The VFD controlling the spindle can be interfaced through RS-485. The controller should periodically poll the current speed for display and monitors error conditions.

Manual control

A simple controller should be usable for quick commands as a separate input source.

Storage and communication

The controller should provide SD card slots, Ethernet, USB, parallel and serial connections that can be connected to the internal controllers.

Implementation

The current state can be found on GitHub, at https://github.com/GyrosGeier/cnc.git .