• Years of disassembling old printers and scanners yielded a lot of stepper motors which lay unused in a drawer for a long time. This was the inspiration to design a small and easy to use interface for a stepper motor. The first idea was to use the standard combination of the L293 motor controller and the L297 full bridge driver, but those chips take up a lot of space and do not provide microstepping functionality. A better option is an integrated stepper motor controller, like the Allegro A3984, which includes a microstep sequencer and the MOSFET bridge in a very small package. It can drive motors with up to 35V and 2.5A, which is enough for most small and medium stepper motors, especially those harvested from printers.

    To provide an easy interface, the motor should be controllable from the PC. This leaves an RS232 or an USB interface to connect to a microcontroller which in turn connects to the stepper motor driver. While there exists a (very good) software USB stack for the AVR microcontrollers, I chose the LPC11U24. After having worked with LPC microcontrollers at my job a lot, I was already familiar with the LPC11C24 and the lpcXpresso IDE.

    The LPC11U24 has an integrated hardware USB interface and a built-in USB bootloader which shows up as an mass storage device to the computer. Flashing a new firmware is as easy as dragging the binary file to the USB driver!

    Additional to controlling the motor via USB I wanted some methods of direct input on the motor. For that reason I added three buttons and a potentiometer on the circuit board. To connect limit or reference switches, some pinheaders are included. Three LEDs provide feedback from the LPC.
    As one motor is seldom enough to do something interesting, a way of connecting several motors together. My solution to this problem was to add a CAN-bus interface using the MCP2515 CAN controller and the MCP2551 CAN transceiver. The MCP2515 is connected to the LPC via SPI. The CAN bus and power connections (5V and motor power) are available on pin headers on each side of the PCB to make the controllers cascadeable.
    The A3984 provides an input for a reference voltage to control the motor current. An 10bit DAC (MCP4716) was added and connected to the LPC via I²C.
    The circuit board was designed to fit on the back of a NEMA17 (42x42mm) stepper motor.

    USB Stepper Motor Driver

    USB Stepper Motor Driver

    As of yet the USB communication is basically working and the motor is turning. The microstepping works quite well and the motor runs very fast and smooth. I have already implemented velocity ramping but apparently still have some calculation errors as the positioning is not exact. Software modules for reading the potentiometer and the buttons are completed, too. Sending and receiving CAN message is also working. The next step is to make the controllers talk to each other and to enable the master to discover other attached motors. After that the USB communcation has to be improved. In the end, the master should store a sequence of motion commands (maybe G-Code?) and control all attached motors.

    As a first test I used the motor to wind a coil for an electromagnet. I wrote a litte delphi program that sends commands via USB and constructed a frame from lasercut plexiglass to hold the bobbin.

    USB Stepper Motor Control Software

    USB Stepper Motor Control Software

    Coil Winding with Stepper Motor

    Coil Winding with Stepper Motor

    When the project is a little more advanced, I will publish the circuit board layout and the full source code for the firmware and the control software.

    Tags: , , , , ,

  • CNC

    About a year ago, i decided to build a cnc router. First drafts were made in 3dsmax and the final drawings in CATIA.

    As I wanted to fabricate as many parts as possible by myself, i had to find a shop with adequate machinery which i could use. Fortunately there is a public shop with all the tools i needed in Munich. They offer use of their machines for 5€/h, but students only pay half of that.

    Raw aluminum parts

    Aluminium parts

    One of their employees recommended a firm where i could buy the raw aluminiumparts quite cheap.
    All parts i could not manufacture myself where bought from eBay. There are many shops which concentrate on cnc-parts, so i quickly found what i needed.

    At first i had planned to buy steppermotors and make the control- and driverboards myself. I already had ordered the H-bridges and layed out the boards, when i met a guy at the shop who had build a very big cnc-router in his basement and offered my to give me motors and controlboards for free.

    Motors and boards (a nice 19″ rack with slide-in cards) are from dismantled photomachines. The motors are, in contrast to the steppermotors you find in printers/scanners, 5-phase steppermotors.

    Control circuits

    Control circuits

    Two of them are 1.4Nm and one is 0.9Nm. The weaker one will drive the z-axis, which has a 1:2 transmission. The other two drive y- and x-axis. All axes have 14×4 trapezoidal screws and nylatron nuts.

    The z-axis is guided by four linear ballbearings on two 12mm steelshafts. 12mm might proof to be a bit sparse, but i think i can fit in 16mm shafts without major redesigns.

    The y-axis is also guided by four linear ballbearings, but on two 20mm steelshafts.

    The x-axis sits on four linear-rail wagons which run on two rails.

    The frame is made from aluminium profiles and everything is held together by steel screws.

    Due to exams in September/October 2007 and February/August 2008 (and my laziness) the progress was very slow.
    At the moment the mechanics are almost ready (only the couplings between the motors and the spindles are missing). Some of the limitswitches (light barriers) are mounted and the steelframe for the powersupplys and controlboards is nearly complete.

    Limitswitch at the x-Axis

    Limitswitch at the x-Axis

    The next step is to etch the interfaceboards, which distribute the signals from the parallelport to the motordrivers, and connect all the cables.

    I will try to post regular updates on the progress from now on.

    Tags: , , ,