DC Servo Controller v1.0

Overview

flickr:5361789292

The DC Servo Controller is a specialized Arduino designed to control a DC motor in with feedback from an encoder. This is what is called a 'closed-loop' system and more commonly a 'servo' motor. When most people think servo motor, an image of the hobby servo comes to mind. Hobby servos are special motors with a motor, gearbox, and control electronics built into one single package. These motors are cheap and easy to control. This board is more flexible, and is the big brother to that type of setup. With the MakerBot DC Servo Controller, you have the freedom to fully program your servo, and is also designed to work with our Magnetic Linear Encoder or Magnetic Rotary Encoder which give you an amazing amount of accuracy and flexibility in your design. You can also use much stronger motors that can draw up to 2.8A! With this board you can build awesome, accurate, and easily programmed robots.

Specifications

flickr:5361178511
  • Arduino based design with ATMEGA168 microprocessor
  • Fully programmable with 16K flash, 1K ram, 512B EEPROM
  • Simple interface with standard connectors
  • Runs on 12-36V @ 2.8A maximum
  • Preprogrammed as a stepper driver emulator
  • Accepts a standard ATX power connector for +12V power
  • Plenty of extra IO for hackability and expansion

Interfaces

Stepper Control Header

flickr:5361915674
PIN NAME FUNCTION
1 GND Connect to ground for proper functioning.
2 GND Connect to ground for proper functioning.
3 D11 / STEP For stepper emulation, input STEP signal on this pin.
4 D12 / DIR For stepper emulation, input DIRECTION signal on this pin.
5 D13 / ENABLE For stepper emulation, input ENABLE signal on this pin. Active LOW.
6 A0 / EXTRA Extra IO pin connected to Arduino A0 pin.

The DC Servo Controller is designed to be drop-in compatible with the MakerBot Stepper Motor Driver v3 board. It includes a compatible interface header, identical hole spacings, and is pre-programmed to accept step, direction, and enable signals on the stepper control header. The DC servo controller makes it much easier to add closed loop servo control to your 3D printer or CNC machine.

Quadrature Input

flickr:5361917330
PIN NAME FUNCTION
1 VCC This pin supplies 5V to the encoder board.
2 GND This pin supplies GND to the encoder board.
3 B This pin is where the servo controller expects the B signal to arrive.
4 A This pin is where the servo controller expects the A signal to arrive.

Closed loop servo control requires the use of some sort of feedback mechanism. The MakerBot DC Servo controller has standardized on Incremental Quadrature Encoding as its feedback method of choice. This type of encoding system is very common, and there are many chips and devices capable of generating the required signals. If you don't like our magnetic rotary and linear encoders, interfacing your own will be a snap. The theory and background on quadrature encoding is discussed in more detail later on in this document.

Motor Output

flickr:5361304589

The servo controller is designed to drive a DC motor at up to 36V @ 2.8A. It uses the A3949 chip which is an integrated full H-bridge driver. Simply wire your motor up to the A/B channels and you're ready to rock and roll.

ATX Power Input

flickr:5361915942

This board comes standard with an ATX power header. It takes the 12V, 5V, and GND directly from this header. If you wish to drive your motors at >12V, then you can simply supply a higher voltage on the +12V input line. Be aware that the board supports a maximum of +36V for motor voltage, and that voltages higher than +12V will require disabling the power LED or it will most likely burn out. The board requires exactly 5V for the digital power supply.

Serial Header

flickr:5361917044

The board comes with a serial header that is compatible with the USB2TTL cable from FTDI. This cable contains a USB to Serial converter chip and allows simple programming of the board from any computer. This cable is available from the MakerBot Store.

ICSP

flickr:5361304339

Should you need to program the ATMEGA168 chip at a low-level, we have included an ICSP (In Circuit Serial Programming) circuit that allows you to completely reprogram the chip. This is how we install the Arduino bootloader at the factory. Most users will never need to use this part of the board.

I2C

flickr:5361916422

The ATMEGA168 has hardware functionality built into it that implements the I2C protocol. We've provided a simple header for this with integrated 4.7K pullup resistors. Simply connect your favorite I2C device to this header and you're good to go.

Extra IO

flickr:5361303847

The ATMEGA168 chip has more IO pins than we needed to construct the servo controller, so we've made them available through headers scattered across the board. These are available for whatever repurposing you want.

Usage

Servo Motor Test Rig

flickr:5361182501

For development and testing, we created the servo motor test rig seen above. It has a mounting point to attach the DC Servo controller, a Magnetic Rotary Encoder, a 37mm DC Gearmotor, and a place to put the magnetic strip for the Magnetic Linear encoder. It is a handy little device if you want to test various control algorithms or just play around with the design. This design is open source and located on Thingiverse.

Stepper Control Interface

flickr:5361792770

Using the stepper control interface is very simple. Plug in a standard 6-pin MakerBot Stepper Driver v3.6 IDC cable into the header as shown. Make sure your DC Servo Driver has the latest stepper driver emulation firmware loaded onto it.

WARNING: The Stepper Control and ICSP headers are very similar, but extremely difficult. Be very careful that you do not plug your stepper driver into the ICSP header.

Quadrature Interface

flickr:5361180657

The DC servo controller was designed to work with our Magnetic Linear and Magnetic Rotary encoders. Simply connect them using a MakerBot endstop cable and you're ready to go.

Motor Output

flickr:5361179623

The motor output uses a screw terminal. Strip the end of your motor wires and insert them into the terminal. Screw down the terminal and you will have a solid electrical connection. If your motor is running backwards, simply reverse the wires.

Power Input

TODO: NEED PICTURE OF POWER INPUT

The servo controller board is designed to accept a standard power connector from an ATX power supply. Simply plug it in and it will pull the 12V and 5V it needs automatically.

Serial Programming

TODO: NEED PICTURE OF SERIAL PROGRAMMING

There is a serial header included on the board which can be used to program the board, send/receive data, and any other uses you can dream up. Make sure you have it plugged in correctly as shown above.

Programming and Usage

The DC Servo Controller contains an ATMEGA168 chip which allows it to be programmed to do all sorts of interesting and useful tasks. For example, we've created 2 different programs for it. The first one, the 'Stepper Emulator' is capable of receiving standard Step/Direction/Enable signals and will control the connected DC motor accordingly by matching its speed and position to the inputs. The second one, the 'Hobby Servo Emulator' is capable of receiving a standard servo signal and directing the DC motor to move to that exact position.

Of course these are just 2 example. There are many different ways you could program your servo controller to operate. You could send exact coordinates over serial, you could send coordinates over I2C, you could hook up analog sensors and make a self contained robot that reacts to environmental inputs. That's just the beginning.

We have created a GitHub Repository called DC-Servo-Controller where we will be collecting and sharing any firmware that has been developed for this board.

Quadrature Encoding

flickr:5360678825

First, a word on one of the most important subsystems on the board: the feedback signal. The feedback signal for this board is called quadrature encoding (also known as incremental encoding). This is a method for precisely measuring movement (usually rotation) using only 2 wires. An understanding of this technology is critical for programming the DC Servo Controller board. You can read more about it on Wikipedia and at this excellent National Instruments tutorial. Of course the code to interpret this input and convert it to an integer value is already written for you in the sketches below. Feel free to stand on our shoulders and see what heights you can see.

Stepper Emulation

The stepper emulation code is pretty neat. This code transforms your DC Servo controller into a board that will act just like a stepper driver. It's written to emulate the standard Step/Direction/Enable interface common to many stepper drivers, including the MakerBot Stepper Driver v3.3. What that means is you can replace your Stepper Driver + Stepper Motor with a DC Servo Controller + DC Motor + Encoder to create a high quality, closed-loop positioning system. This will allow you to do all sorts of awesome things!

For ease of use and simplicity, this firmware is written as an Arduino sketch. You'll need the latest version of Arduino and a USB2TTL cable. You can download the firmware from our repository. Choose "Arduino Pro or Pro Mini (5V, 16mhz) w/ ATMega168" as the board type when uploading your custom sketch.

Once you have downloaded the firmware, upload it to your DC Servo controller. Once the firmware is on your DC Servo controller, it's ready to be used as a stepper motor emulator. We're going to assume you are using MakerBot Gen4 Electronics. If you're using other electronics, you will need to adapt the instructions to fit your situation.

Wire it Up

Connect all the various required wires: ATX power, stepper control connector, your DC motor, and your encoder.

Adjust ReplicatorG

ReplicatorG needs to know how many steps equals 1mm. Your DC encoder is pre-programmed such that 1 step = 1 pulse. That means the number of steps per mm is based on both the encoder resolution and the gears or pulleys attached to the motor output. Look at the table below to help determine how many steps per mm.

Encoder Used Resolution / Pulses Per Revolution Drive Setup Steps Per MM Formula
Magnetic Linear Encoder 15 microns N/A - measures linear movement directly 1mm / 0.015mm = 66.667 steps/mm
Magnetic Rotary Encoder 0.35° / 1024 Pulley of diameter PD 1mm /(PD * (pi / 1024))

You can edit the machines.xml and adjust the steps_per_mm setting for each axis and your system should now function normally.

Hobby Servo Emulation

Hobby Servo Emulation is a work in progress. The idea is that you can hook up a standard 3 pin hobby servo connector from a microcontroller to the DC Servo Controller. The firmware will sense the signal coming in, and control the DC Servo Controller appropriately. It should have a function that allows it to be driven in standard positioning mode, or continuous rotation mode.

The firmware will be located in the Github repository.

Schematic

flickr:5360587959

Partlist / BOM

Source

flickr:5361554243

The DC Servo Controller v1.0 is Open Source Hardware and is licensed under the GNU GPLv3.

Download

History

The DC Servo Controller v1.0 is an original design by MakerBot Industries in collaboration with Will Sakran of Metre Ideas.

Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.