Mill-Machine Motor Controller Project and Downloads
The project for a complete and high performance stepper and dc motor controller. Part of the XYZ Stepper project.
The Motor Controller
The project for the Motor Controller is one of the core elements to build a robust and performance milling machine. To develop the controller I followed a series of primary guidelines, so the controller should:
- To be as cheaper as possible using a basic Arduino board (Arduino duemilanove).
- Be able to work with multiple voltages powered by an external power supply.
- Work with high torque stepper motors.
- Work with strong and variable-speed DC motor.
- Manage currents over 1A per channel for the devices.
- Work with more than one kind of device (for H-Bridge, Darlington Arrays, EEProm etc).
- Interface the computer CAM controller with high level commands.
- Work with a wide range of motor devices.
- Manage a heating control feedback.
- Support macro commands
- Store information defining the working environment (calibration, tools information and more)
- Work independently by any software (e.g. g-code and other CAM applications) and must be platform independent.
- Interface via the USB port CNC software that work with calls.
- Manage via software low-level movement commands exposing high level instructions.
- Automate axes rototranslation for non-orthogonal object positioning.
To satisfy these requirements Mill-Machine Motor Controller is a modular board that can be connected to an external Arduino duemilanove (or any other kind of Arduino compatible boards). The original project was built including a 28-pin Arduino connector.
The pin on the board are the same as om328p Integrated Microcontroller, a very good Arduino compatible board developed by Oak Micros. This is the micro controller unit I'm actually using for XYZ Stepper Milling Machine.
Electrical Drawing
The diagram is downloadable in PDF format.
As shown in the electric design below, the circuit is divided in eight parts, defined by the grey thick rectangles.
Stepper Connectors
The three six-wire connectors connect the board to the X, Y and Z axis stepper motors. The stepper section of the controller is powered with an external +5V source as needed by the stepper motors I'm actually using: Songyang SY42STH38-1206A (six-wire, unipolar stepper motors) distributed by Robotshop. Stepper datasheet can be downloaded here.
It is possible to connect other unipolar or bipolar stepper motors to the controller, powering the motors through the external power connector X1-1 with any voltage between +4.5V and +30V.
Stepper Control
Every stepper motor is controlled by the Arduino PWM signals using a Half-Bridge controller. In the Circuit Design the scheme reports three L293A devices, but with the steppers described above it may occurs an excessive heating, due to the high current of the motors (1.2 A) and the device can be seriously damaged. Thus the circuit can work with other kind of Half-Bridge devices: in the matter of fact for my application I used three SN754410 Half-Bridges.
The circuit use only two PWR coupled signals to drive every couple of coils of the motor. This scheme doesn't support microstepping technique.
Note: every stepper motor has two cables per-coil. It does no matter the order the coils are connected, but special attention is needed in coupling every two-wire coil without crossing the cables (connector pins 3-4 and 5-6). Both 1 and 2 pins of every motor connector are wired with the external power supply.
Cooler Fan and DC Motor Control
Both Fan and DC Motor operates with the external +12V power. The difference is that the cooler fan needs about less than 500 mA while the DC Motor needs About 1A.
This problem was solved using two paired ULN2004 Darlington Arrays controlled by the remaining two PWM signals of Arduino board.
Input signal 1 of the darlington array goes to both the arrays, to give the needed current to the DC Motor (output 1), while the input signal 2 to the Cooler Fan output 2 use only the first array.
Temperature Sensor Control
The board can support several temperature sensors. Due to its low price, the controller uses the high precision temperature sensor LM35 (sensing in the range between 0° to 100° C).
Note: the temperature sensor is calibrated to start the Cooler Fan detecting a temperature of 40° C, lower than the temperature that is on the devices dissipators. Thus we must consider that the environment temperature of the board is lower than the temperature you can measure with a thermometer directly to the devices dissipators.
EEProm Memory Device
The board uses a EEProm device AT24C256 but can work also with the pin-compatible device 24LC256. The eeprom device is the single-module version as described in Bank project.
Limiter Switches
With the reduced number of digital I/O pins on Arduino duemilanove boards, it seems impossible to manage all the needed limiter switches. As a matter of fact to control both end sides of every axis sliding plane in the XYZ Stepper Milling Machine are needed at least six switches. The solution is to use a single digital input to manage all the limiters together. When a switch is pressed, Arduino software detects an alarm: the software knows exactly what the machine is doing so it is not difficult to associate the alarm with the right machine behavior answering with the right feedback.
LCD Display Connector
The controller has a 16rowx2col LCD characters display that monitor its working activity. This device is connected through the Arduino board using three pins only. The Design Scheme reports only the five wires connector (three digital pin plus VCC and GND) because the device is connected as described in the project of Chris Parish Controlling and LCD Display with a Shift Register in its blog Arduino Adventures.
Part List
Part Value Device Package Library
IC1 Arduino Connector DIL28 DIL28-6 ic-package
IC2 L293D L293D DIL16 st-microelectronics
IC3 L293D L293D DIL16 st-microelectronics
IC4 L293D L293D DIL16 st-microelectronics
IC5 ULN2004AN ULN2004AN DIL16 uln-udn
IC6 ULN2004AN ULN2004AN DIL16 uln-udn
IC7 AD590ZR AD590ZR TO92 linear
IC8 AT24CP AT24CP DIL08 atmel
J1 LCD Shift MTA03-100 10X03MTA con-amp
R1 240 R-EU_0204/7 0204/7 rcl
R2 10K R-EU_0204/7 0204/7 rcl
R3 10K R-EU_0204/7 0204/7 rcl
R4 10K R-EU_0204/7 0204/7 rcl
R5 10K R-EU_0204/7 0204/7 rcl
R6 1.5K R-EU_0204/7 0204/7 rcl
R7 1.5K R-EU_0204/7 0204/7 rcl
R8 1.5K R-EU_0204/7 0204/7 rcl
R9 1.5K R-EU_0204/7 0204/7 rcl
R10 10K R-EU_0204/7 0204/7 rcl
R11 10K R-EU_0204/7 0204/7 rcl
R12 1.5K R-EU_0204/7 0204/7 rcl
R13 1.5K R-EU_0204/7 0204/7 rcl
R14 10K R-EU_0204/7 0204/7 rcl
R15 1K R-EU_0204/7 0204/7 rcl
R16 1K R-EU_0204/7 0204/7 rcl
T1 BC547 BC547 TO92 transistor
T2 BC547 BC547 TO92 transistor
T3 BC547 BC547 TO92 transistor
T4 BC547 BC547 TO92 transistor
T5 BC547 BC547 TO92 transistor
T6 BC547 BC547 TO92 transistor
X1 External Power AK300/4 AK300/4 con-ptr500
X2 MPT3 3POL254 con-phoenix-254
X3 DC-Motor AK300/2 AK300/2 con-ptr500
X4 X-Stepper AK300/6 AK300/6 con-ptr500
X5 Y-Stepper AK300/6 AK300/6 con-ptr500
X6 Z-Stepper AK300/6 AK300/6 con-ptr500
X7 Limiter Switches AK300/12 AK300/12 con-ptr500
Board Layout
Eagle board layout and electric diagram can be downloaded in zip format here.
Software Libraries
XYZ-DC Motor Controller software work with a software package discussed in details in the knowledge base. The sketch works with third party libraries covering some of the basic interfaces with the components and devices of the board.
Enhanced Database Library
EDB Library is the enhanced database library developed by jwhiddon (see Google source code for details) based on the database library for Arduino. Thus, for all the data structures that should be permanently stored (calibration data, configuration tables, macro libraries and user-defined macros) there is a database table that manage the data. Database library is directly interfaced with AT24C Library to manage I2C EEProm on-board device.
EEProm Management Library
AT24C Library is the library to manage more than a single kind of I2C EEProm devices. Inspired by AT1024C Library for Arduino, this library was developed to support Bank Project and can be found also in Arduino Playground.
LCD Shift Library
LCD Shift Library is the library developed by Chris Parish accompanying its Shift Register LCD Project. I'm using with success this library in all kind of applications where I need LCD display output signals.
Temperature Sensor Library
It's not difficult to check analog values from LM35 temperature sensor (or compatible device) converting the read voltage to the corresponding temperature value. There is still the LM35 Library that does the work for us with conversion in Centigrade, Fahrenheit and Kelvin so it may be a good idea its application.
![]()
Buy the controller at our store!
To see all the versions of the controller sold at our store, click here.
