Extruder Controller 2.2

From RepRap
Revision as of 10:03, 27 October 2010 by AgeingHippy (talk | contribs) (Overview)
Jump to: navigation, search

Overview

Jump to the Index / Table of Contents

Extruder Controller 2 2-extruder-controller-small.jpg

This board is a combination of the PWM Driver Board, DC Motor Driver Board, Temperature Sensor Board, RS485 comms, and an Arduino! All on one board. It has screw terminals for easy hookup, as well as a power jack for power and an IDC header for the rotary encoder. Its an all-in-one solution for controlling an extruder. The RepRap configuration is shown at the top, the MakerBot one underneath.


Some highlights:

  • Onboard atmega168 - program it just like an Arduino because it is an Arduino.
  • 3 x MOSFET drivers for controlling up to 14A @ 12V. Perfect for heaters, fans, solenoids, etc.
  • 2 x H-Bridges capable of up to 2A each. Control 2 motors, or control one stepper motor.
  • A temperature sensor circuit for reading the standard 100K thermistor.
  • RS485 connection for noise-free communications with the motherboard.
  • IDC header for connecting a Magnetic Rotary Encoder.
  • Polarized ICSP header for simple, easy programming.
  • It mounts directly to the Pinch Wheel Extruder!
  • It is plug and play with the RepRap Motherboard.

WARNING!! This board produces an awfull whine in the extruder motor if you use a stepper-motor due to the fact that it has been designed for DC motors and a hack is applied to use it as a stepper controller. see this forum post


Hacks

Firmware

Hardware

  • See Hacks to the RepRap Extruder Controller v2.2 for details of how to use a K-type thermocouple rather than a thermistor with this board.
  • When driving stepper motors with the on-board H bridges, heat sinks are highly recommended to reduce thermal shutdown.

Get It!

Fully Assembled

  1. The fully-assembled Extruder Controller

If you are building a RepRap you will have to desolder a couple of components from the fully-assembled board. See below.

Do it yourself

  1. [[1][Buy the PCB from MakerBot Industries]
  2. Buy the components with ease from the list at parts.reprap.org

If you build the board yourself, you will be able to configure it exactly as you want.

Files

You can download the release file from SourceForge that has a bunch of helpful files for this board. It contains:

  • GERBER files for getting it manufactured
  • PDF files of the schematic, copper layers, and silkscreen
  • Eagle source files for modification
  • 3D rendered image as well as POVRay scene file
  • exerciser code to test your board.

If you just want to peek at the files easily, check them out on Thingiverse.

If you want to roll your own PCBs from the files, take special care of the GND-GNDA device, getting this right needs special care and advanced knowledge of EAGLE, and seemingly the right version of that software. Not a big thing - but you have been warned.


Schematic

Extruder Controller 2.2 Schematic

Interface

Pinout

Here is a handy reference that tells you what pins are hooked up to what features of the board.

<iframe width='500' height='520' frameborder='0' src='http://spreadsheets.google.com/pub?key=pmEMxYRcQzzBcERTyThl9Pg&output=html&gid=0&single=true&widget=true'></iframe>

H-Bridges

Name Function Common Usage
1A H-bridge Positive #1 Motor 1
1B H-bridge Negative #1 Motor 1
2A H-bridge Positive #2 Motor 2
2B H-bridge Negative #2 Motor 2

The extruder controller has two separate H-bridge chips onboard. The chips are the Allegro A3949 which is a pretty sweet and modern full H-bridge chip with a simplified interface. This makes it really easy to control DC motors. Since there are two h-bridges onboard, you can control 2 DC motors either forwards or backwards. You could also control a single stepper motor if you like.

The interface for controlling these motors is very easy. There are two pins: PHASE and ENABLE. I like to call these pins DIRECTION and SPEED. The DIRECTION/PHASE pin controls the polarity of the output, aka which direction the motor turns. The ENABLE/SPEED pin controls if the output is on or not. By using PWM on the ENABLE/SPEED pin we can control the speed of the motor. Yay!

The outputs are labeled Motor 1 and Motor 2. Each motor has an A and B output. There are also LEDs associated with each chip nearby. There is a direction LED which lights up when the direction pin is HIGH, and a speed LED which lights up when the enable pin is high. Blinking LEDs FTW.


MOSFETS

Name Has PWM? Common Usage
A No Valve
B Yes Heater
C No Fan

The extruder controller has three separate power MOSFET chips onboard. The chips are the NIF5003 which are protected 42V 14A N-Channel MOSFET chips. These bad boys can handle a lot of current, which is good for us and good for you.

Basically, these chips act just like little switches that can run a lot of juice. Two of the chips are wired up to normal Digital pins and can only be turned on or off. One of the chips is wired up to a PWM pin and can be controlled in full PWM mode. All of the chips are wired directly to the main power supply voltage which is usually 12v. The table below lists which pins have what functionality and their common usage.


Thermistor

Name Function
1 One end of the thermistor
2 The other end of a thermistor

The extruder controller has the onboard circuitry required to measure the temperature of a standard 100K RepRap thermistor. If you wish to measure a thermistor with a different value, all you have to do is change the resistor value. There are screw terminals for you to hook up your thermistor which makes doing temperature measurement very simple. Just wire it up, use the proper thermistor table in your code, and you're good to go. The circuit is identical the the circuit in the previous Temperature Sensor Boards so you can easily re-use the old code.


RS485 Comms + Power

Name Function
1 RS485 A
2 RS485 B
3 +12V
4 +12V
5 +12V
6 GND
7 GND
8 GND

This is one of the major new features of the Generation 3 electronics. RS485 is a robust serial communications channel. It uses differential signaling to provide very noise tolerant communications over relatively long distances, such as in a RepRap machine. RS485 is how the RepRap motherboard communicates with all the tool controllers. It is a very mature technology and is also pretty cheap. Definitely rad.

RS485 is a half-duplex channel, which means data can either be transmitted OR received at one time. This makes things a little bit tricky, but don't worry... we have it under control. What you need to know is that there are two wires that need to be hooked up: A and B. These are arbitrary names for the wires due to the differential signaling. Basically, you just have to make sure that all the A's and all the B's are wired up together.

To give a bit more insight into the way RS485 is implemented on the Extruder controller, we have given full control over the RS485 chip to the controller. It can independently enable or disable transmitting and receiving. One of the cool things about RS485 is that you can listen in to your own transmissions. This is a critical feature we exploit to ensure that we keep the transmit functionality enabled until all of our data has had a chance to be sent out.

Since RS485 only takes up 1 of the 4 pairs of wires in a Cat5e cable, we decided to use the rest of the pairs as power. This allows us to send something like 10 amps over the wire which is more than enough for most extruder needs. The extruder controller has an onboard voltage regulator to produce the 5v required for powering all the logic chips, as well as the optional servo motors. The H-bridges and MOSFETs are powered directly from this input voltage. The maximum allowable voltage is 18v to avoid overheating the 5v regulator.


Quadrature Input

Name Function Arduino Pin
1 No Connection N/A
2 No Connection N/A
3 No Connection N/A
4 No Connection N/A
5 No Connection N/A
6 No Connection N/A
7 Quadrature B 3
8 Quadrature A 2
9 GND N/A
10 +5V N/A

This is a handy little feature of the extruder controller board. It has a built-in header to accept the quadrature encoder input from the Magnetic Rotary Encoder board. Since it uses and IDC cable, its very easy to hook up. Just plug and play!

Alternatively, if you'd like to use your own rotary encoder that outputs quadrature signals you can easily hack an IDC cable and plug it directly into the board.


Serial Header

Name Color Function
1 Black GND
2 Brown CTS#
3 Red VCC
4 Orange TXD
5 Yellow RXD
6 Green RTS#

This is the serial communications header for programming the board. It uses the same USB<->TTL header format as the Sanguino, Boarduino, or any of the other minimal Arduino clones. You can find out more information about the cable and where to get it on the Sanguino website. Its very easy to use.


I2C Headers

PIN FUNCTION
1 VCC (5v)
2 GND (0v)
3 SDA
4 SCL

The extruder controller has left the I2C pins open for use as an I2C bus. This means you can use any number of really cool peripherals very easily! One idea is to use an I2C based LCD screen to print out information about the extruder for example.

The SDA and SCL pins even have built-in 4.7K pullup resistors to make configuration of the I2C bus hassle-free and automatic. The table below lists the pin-out of the header. The labeling in the v2.0 board is not too good, so pin 1 is towards the top of the board and in to the top and the right in the picture.


Servo Headers

PIN FUNCTION
1 Signal
2 VCC (5V)
3 GND (0V

This may be my favorite feature of the extruder controller: servo headers! We had a few extra pins left on the Arduino after implementing the required functionality, so we decided to have some fun. Thats why the extruder controller has the capacity to control two servo motors in addition to everything else! Its really, really, really easy too, thanks to the Arduino Servo library. Simply plug your servo in and its ready to go.

We use Arduino pins 9 and 10 for the servos because they are connected to the timer output pins. If you want to use pins 9 or 10 for something, you can just hook up to the headers directly. We supply the pin, 5v, and a ground pin which means you can easily hook them up to whatever you want. The pinout is the standard servo pinout, which is displayed below. The pins should be labeled, but it may be hard to see. Pin 1 is closest to the D9/D10 silkscreen.


Extra Headers

PIN FUNCTION
1 Signal
2 VCC (5V)
3 GND (0V

We had a few pins left over, so we decided to break them out for you to use however you like. The pins are A0, A6, and A7. The SMT version of the atmega168 has 2 extra analog pins, which means you get even more awesomeness. The pins are broken out exactly like the servo pins with the exception that they do not have Servo control built-in to the hardware. It is possible to use software to control extra servos, but it might be a bit tricky. However, it is easy to use the extra pins to measure analog signals. The pinout is below. They should be marked on the silkscreen, but like with the servos, the signal pin is closest to the pin name (A0, A6, A7, etc.)


Trimpot

This is a new addition to the v2.2 board. It's simply an onboard trimpot that is hooked up to the Analog 0 pin. Its an easy way to allow run-time configuration of various things by adjusting the trimpot. It's currently unused in the software, but we'll definitely find a use for it soon.


Circuit Board

You can either buy this PCB from a supplier, or you can make your own. The image above shows the professionally manufactured PCB ready for soldering.

Components

<iframe src="http://parts.reprap.org/embed/module/Extruder+Controller+v2.2" width="800" height="900" frameborder="0">Visit http://parts.reprap.org/embed/module/Extruder+Controller+v2.2</iframe>


Build Process

This board contains surface mount parts. Trust me when I tell you that it is really, really, really easy! The hardest part about SMT soldering is getting over your fear and staying calm. I've shown complete beginners how to do it, and they had no problems.

There are four parts to building a surface mount board using the Hotplate Reflow Technique:

  1. Apply solder paste to every exposed SMD pad
  2. Place each SMD component on its appropriate pad
  3. Place populated board on a cold hotplate. Turn hotplate on. Board solders itself!
  4. Solder in remaining through hole components.

Tools You'll Need

Apply Solder Paste

Okay, so this part is pretty easy: get your solder paste syringe and start applying solder paste to every SMD pad. I like to use a squeeze/tap method. That is, I squeeze a bit of solder paste out, then tap the place where it goes, rinse and repeat for every exposed pad. Do not put solder paste on pads with holes in them. You'll solder those in step #4.


Place Components

TODO: get a pic of a board w/ all SMT components placed.

This is probably the trickiest part. Its easiest with tweezers and some sort of magnification. A bit of patience and you'll get it no problem. Since nothing gets soldered yet, you can easily try and try again if you mess up.


R8-R15, R29-R31 - 1K ohm resistors

This component can be placed in any orientation.


C3, C4, C6, C7, C10, C11, C14, C15 - 100nF ceramic capacitors

Extruder Controller 2 2-ecc.jpg
Extruder Controller 2 2-ecc.jpg
</a>


This component can be placed in any orientation.


C12, C13 - 15pf ceramic capacitors

This component can be placed in any orientation.


R2, R3, R6, R20, R21 - 4.7K ohm resistors

This component can be placed in any orientation.


R4, R5, R7 - 10K ohm resistors

This component can be placed in any orientation.


C5, C9 - 0.22uF ceramic capacitors

This component can be placed in any orientation.



R1 - 180 ohm resistor

[image:cache-3315142980_e647be1ec2.jpg|thumb|Original Photo]]

Optional Component: This is the termination resistor for the RS485 comms. The motherboard is located on one end of the bus, and only one extruder at the end of the bus should also have a termination resistor. You can remove it or omit it if you have multiple extruders and at least one has this resistor in place.

This component can be placed in any orientation.



LED1-9

These LEDs need to be placed in the right orientation. The green marking on one side needs to match up with the white dot on the silkscreen.


IC1 - 7805 - 5V regulator

The 7805 really only fits one way. Its easiest to grab it by the middle half-pin that sticks out.


Q1-Q3 - NIF5003

These are the MOSFET chips. They only really fit in one orientation. Pick them up like a hotdog on the black casing. Most tweezers will fit in that orientation.


IC2, IC3 - A3949

These are the H-bridge motor drivers. Match the dimple on the top of the chip with the dimple on the silkscreen. Grabbing them with tweezers is sort of tricky, so use one finger to slide the tweezers open, and then the same technique to let them go when you place them. Once you place them on the board, nudge them gently for final alignment.


IC4 - SN75176A

This is the RS485 transceiver chip. Match the heavy line on one side of the chip up with the heavy line / semicircle on the silkscreen. Drop it into place and nudge it into alignment if needed.


IC5 - ATMEGA168

This is the brains of the extruder controller. Its also the trickiest and smallest part. Take a calming breath and grab it. You'll want to align the dot on the chip with the little circle on the silkscreen. You may have to use the 'finger-to-push-open-tweezers' trick to pick it up. Only try to get it approximately accurate with the tweezers, and then do the final adjustment by nudging the chip.


C8 - 10uF electrolytic capacitor.

This must match up with the silkscreen. One edge of the capacitor has a black line on it. Match this up with the corresponding white line on the silkscreen.


C1, C2 - 100uF electrolytic capacitor

These must match up with the silkscreen. One edge of the capacitor has a black line on it. Match this up with the corresponding white line on the silkscreen.


Hot Plate Reflow

I prefer to start with the hotplate off. I burned a few boards one time by putting them on when it was already hot. Instead, carefully place the board on the cold hotplate, thn turn the heat up to a low temperature. Wait a few minutes for things to get cooking, and you'll see the small components begin to 'pop' as the solder goes molten. Keep an eye out for components that stick together. If that happens, simply nudge them apart with tweezers or other non-finger device. Wait until you see the largest component leads go silver (usually the big capacitors). If it starts to smell really bad, kill the power and solder the rest by hand. Sometimes the capacitors wont fully solder, so just hit the exposed pad with a soldering iron after the fact.

Once they have soldered, simply turn the hotplate off and let it cool down.

For detailed instructions on how to do hotplate reflow soldering, please see the Hotplate Reflow Technique guide.


Check for bridges!

Its important to check for potential bridging. It helps to have a magnifying glass, and backlighting. Just give it a thorough look-over. If you find bridges, they're easy to remove: Simply put some solder wick over the bridge, apply a hot iron over it, wait for the solder to wick up into the solder wick, then remove both. Double check the bridge. 90% of the time, enough solder will remain on the pins for a reliable connection. You may need to add a tiny bit of solder paste back onto the pin and re-solder it, but usually not.

Before

The second and third pins from the right are bridged:

After

The second and third pins are separate! No extra solder needed:

Check for Solder Balls

Sometimes if you use a bit too much solder, it will ball up and squeeze out the sides. These balls are fairly harmless, but you should definitely remove them with tweezers or even a small brush. Theres a chance that when they break free during use (and they will) that they will short something out, and you dont want that.


Solder Through Hole Components

10K ohm trimpot

This part only really fits in one orientation. Insert it, bend the legs slightly to hold it in place, and then solder it. Don't forget to trim the legs afterward.


16Mhz Crystal

This can be inserted in any orientation. Make sure you trim the legs afterwards.


Reset Button

The button will snap into place. Solder it in and you're good. You don't have to trim the legs, but it helps.


Serial Headers

These are the headers for the serial connection. The trick to soldering these nicely is to solder one pin into place. Once it dries, reposition so you can push on the other pins (not the one you soldered, it will get hot!) THen you re-heat the first pin so the solder melts, push the pins into a nice position, and then let it cool down. Then solder the rest of the pins. Voila, a nicely soldered row of pin headers.


I2C Header

These are the headers for the I2C bus. Use the trick described above to get them positioned nicely.


Extra Headers

These are extra headers for the unused pins. Use the trick described above to get them positioned nicely.


Servo Headers

These are the headers for attaching servo motors. Use the trick described above to get them positioned nicely.


ICSP Header

There is a notch on the part that lines up with the 'notch' on the silkscreen. It should face the outside of the board. Make sure to solder it in the proper orientation.


Quadrature Header

There is a notch on the part that lines up with the 'notch' on the silkscreen. It should face the outside of the board. Make sure to solder it in the proper orientation.


H-Bridge Terminals

These are the screw terminals for the H-Bridges. Make sure you solder them with the openings facing the outside of the board.


Thermistor Screw Terminals

Make sure you solder it with the openings facing the outside of the board.


MOSFET Terminals

These are the screw terminals for the MOSFETS. Make sure you solder them with the openings facing the outside of the board.


Power and RS485

Extruder Controller 2 2-extruder-controller-small.jpg

This shows the RepRap connectors needed for 12v power and RS485 communications. Solder a 2.54mm screw connector just to the left of A and a 2-pin 2.54mm header just under A. The screw connector is the power: +12v goes to the right, ground to the left. The RS485 connections are identical to those on the Motherboard; that is to say you connect corresponding pins with no crossover.


This is the MakerBot wiring of this connector - it uses an Rj45 jack.

THIS BOARD DOES NOT SUPPORT ETHERNET!

We're simply using an RJ45 jack and ethernet cable because they're cheap and ubiquitous.

This connector carries power and RS485 communications to and from the motherboard. Snap it into place and solder all the pins.


Burn the Bootloader

The atmega168 chips come totally blank, so you'll need to upload the special program called a bootloader to the chip so that you can then easily program it with the Arduino software. In order to do this, you'll need an AVR programmer. I highly recommend the USBtinyISP from LadyAda. Its cheap, simple, and easy to assemble. It is also rock-solid. I've used it to program almost a thousand chips and it works great.

Before you start, make sure your extruder controller board is not hooked up to anything. In order to program the chip:

  1. Plug the USBtinyISP into your computers USB port
  2. Plug the USBtinyISP into the Extruder Controller.
  3. Open the Arduino software, make sure the 'Arduino Diecimilia' option is selected in 'Boards'.
  4. Choose the menu option of "Tools -> Burn Bootloader -> w/ USBTinyISP".

Once you do that, a bunch of lights should start blinking and flashing (in particular, the MOSFET indicator LEDs) If everything is successful, then the debug pin will start flashing on and off every second. This is the 'blink' sketch which also gets uploaded to test the Arduino.


Program It!

Now that the bootloader is burned, you can burn any program you want to the board using a serial link through arduino. Programming the Extruder Controller is very easy. You'll need a USB -> Serial Cable to talk to it. In order to program it, follow these steps:

  1. Plug your USB -> Serial cable into your computer.
  2. Plug the other end of your USB -> Serial cable into the serial header. The silkscreen lists the colors of the wires that should match up with the cable.
  3. Make sure you have selected Boards -> Arduino Diecimila in the Arduino software.
  4. Load your program, and hit upload.
  5. On Windows and Linux it sometimes does not auto-reset. Simply hit the reset button as you click upload if it is not uploading properly.

Test Program

The program below will test all the MOSFETs and H-bridges, as well as the servo headers. What it does is ramps up the speed/power on all pins, then ramps it back down. For servos, it should rotate them back and forth smoothly. You should hook up motors or other devices like DC fans, etc. to the various outputs of the board. When you run it, the motors will speed up and then slow down. Yay!

To test this board for a RepRap, you can also follow this link.

//
//  Extruder Controller v2.2 Test Program.
//

#define MOTOR_1_SPEED_PIN 5
#define MOTOR_1_DIR_PIN 7
#define MOTOR_2_SPEED_PIN 6
#define MOTOR_2_DIR_PIN 8
#define SERVO1_PIN 9
#define SERVO2_PIN 10
#define HEATER_PIN 11
#define FAN_PIN 12
#define VALVE_PIN 15
#define THERMISTOR_PIN 3

#include <Servo.h> 

Servo servo1;
Servo servo2;

void setup()
{
  pinMode(MOTOR_1_SPEED_PIN, OUTPUT); 
  pinMode(MOTOR_1_DIR_PIN, OUTPUT); 
  pinMode(MOTOR_2_SPEED_PIN, OUTPUT); 
  pinMode(MOTOR_2_DIR_PIN, OUTPUT);

  pinMode(HEATER_PIN, OUTPUT);
  pinMode(FAN_PIN, OUTPUT);
  pinMode(VALVE_PIN, OUTPUT);

  servo1.attach(SERVO1_PIN);
  servo2.attach(SERVO2_PIN);
}

bool direction = true;

void loop()
{
  digitalWrite(MOTOR_1_DIR_PIN, direction);
  digitalWrite(MOTOR_2_DIR_PIN, direction);

  for (int i=0; i<256; i++)
  {
    set_i(i); 
    delay(50);
  }

  delay(1000);

  for (int i=255; i>=0; i--)
  {
    set_i(i); 
    delay(50);
  }

  direction = !direction;
}

void set_i(byte i)
{
  analogWrite(MOTOR_1_SPEED_PIN, i); 
  analogWrite(MOTOR_2_SPEED_PIN, i); 

  analogWrite(HEATER_PIN, i); 

  //these are not analog/PWM, but arduino just turns them on or off appropriately.
  analogWrite(FAN_PIN, i); 
  analogWrite(VALVE_PIN, i);

  servo1.write(map(i, 0, 255, 0, 180));
  servo2.write(map(180-i, 0, 255, 0, 180));
}

Arduino Slave Extruder Firmware

Once you've verified that the board itself is working, its time to put a firmware on it. There is a generic slave firmware which allows the motherboard to control your extruder controller board. This firmware is part of the RepRap 3rd Generation protocol, which is described in greater deal on the RepRap 3rd Generation Firmware page. Go there for detailed instructions on how to install that software.

History

Changelog

  • fixed the reset button bug
  • added a trimpot on analog 0

Previous Versions

Index