PWM Driver 1 1

From RepRap
Revision as of 10:17, 15 July 2012 by Larsrc (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

PWM Driver v1.1

Overview

<div class="thumb tright">
Cache-2172343511 8ce6c58e80.jpg
</div>

This board is designed to allow you to control high power devices that only have a single polarity. Things like heaters, fans, solenoids, and even motors (you can only turn them in one direction, however.) It takes PWM (pulse width modulation) inputs from a microcontroller such as an Arduino, and amplifies them into high power outputs. It has 3 channels on each board, and can drive up to 5 amps on each channel with the proper heatsinks.

Get It!

Full Kit

  1. Buy the full kit (components + PCB) from MakerBot Industries

Raw Components

  1. Buy the PCB from MakerBot Industries
  2. Buy the components from the list below

The link above doesn't work any more, so here is a parts list sussed from the schematic and instructions:

Amount Type
4 560-ohm resistors (R4 - R7)
3 1k-ohm resistors (R1 - R3)
3 1N4004 diodes (D1 - D3)
4 standard(?) LEDs (LED1 - LED4)
1 100 nF capacitor "104" (C1)
1 100 uF capacitor (C2)
1 hard drive power connector
3 output headers (X4 - X6)
3 TIP120 power transistors (T1 - T3)


Files

<div class="thumb tright">
Cache-2173322108 17793074e4.jpg
</div>

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


Schematic

<div class="thumb tright">
Cache-2487838735 132ba5b293.jpg
</div>

Interface

Input

The PWM Driver has 4 input pins:

Pin Function
PWM1 Send a PWM signal from the Arduino directly to this pin to control channel 1. 0 = off, 255 = maximum. You may also be able to use a digital out pin to control it as on or off
PWM2 Same as above, but for channel 2
PWM3 Same as above, but for channel 3
GND It's recommended to connect this to the ground on your Arduino to share a common ground.
POWER This is a power input connector. We use a polarized disk-drive style power connector found on nearly every ATX power supply in existence. If you want to directly connect your own power, the board requires 12v input.

Output

Each channel is rated to drive up to 5 amps. Whether or not your heatsinks and power supply are up to the challenge is another story. Give it a try and let us know if you can break it!

Pin Function
channels 1-3 This is the output for the respective input pin. Each set of outputs has two pins: a positive and a negative. When you hook up your device, you need to double check to ensure that you have the polarity correct. Not doing so could result in your device going poof.

Circuit Board

<flickr>2172341901</flickr>

You can either buy this PCB from the RepRap Research Foundation, or you can make your own. The image above shows the professionally manufactured PWM Driver v1.0 PCB ready for soldering. Its also cheap, only $5.00 USD.


Components

<div class="thumb tright">
Cache-2173133024 e2410ce26f.jpg
</div>


<iframe src="http://parts.reprap.org/embed/module/PWM+Driver+v1.1" width="600" height="500" frameborder="0">Visit http://parts.reprap.org/embed/module/PWM+Driver+v1.1</iframe>

Known Bugs

The back EMF protection diodes are in the wrong place. Where they are at the moment does not provide any protection from inductive loads. They should be wired anode to the transistor collector, cathode to VSS. See [[1]] -- Main.ChrisPalmer - 10 Dec 2009

If you find any more, please contact us in the forums.


Build Process

<div class="thumb tright">
Cache-2172342367 df6447188a.jpg
</div>

Solder R4-R7 green-blue-brown

These are the 560 ohm resistors. There are 4 of them. They can be soldered in any orientation. Polarity doesn't matter. When you are done, clip the long wires sticking out close to the board.


<div class="thumb tright">
Cache-2172342429 6457b4d124.jpg
</div>

Solder R1-R3 brown-black-red

These are the 1k ohm resistors. There are 3 of them. They can be soldered in any orientation. Polarity doesn't matter. When you are done, clip the long wires sticking out close to the board.


<div class="thumb tright">
Cache-2173133348 3380932f98.jpg
</div>

Solder D1-D3

These are the diodes to protect the circuit when driving motors and such. There is a stripe on one end of the diode which corresponds to a stripe on the silkscreen. Make sure the diode is oriented in the same direction as on the silkscreen and solder it in. When you are done, clip the long wires sticking out close to the board.


<div class="thumb tright">
Cache-2173133510 990d460b38.jpg
</div>

Solder LED1-LED4

These are the LED's to tell you when the power is on, as well as when each channel is active. Simply line up the flat side of the LED with the flat part of the silkscreen and solder away! It is important that you insert them in the proper orientation. They will not work otherwise. When you are done, clip the long wires sticking out close to the board.


<div class="thumb tright">
Cache-2173133566 2bd1c01aba.jpg
</div>

Solder C1

This is the yellowish, circle shaped capacitor in the picture, though yours may not be either yellow or circle-ish. It may even be cryptically marked "104". Solder it into the rectangular area reserved for it. The polarity or orientation doesn't matter. When you are done, clip the long wires sticking out close to the board.


<div class="thumb tright">
Cache-2173133870 c03e23b0dc.jpg
</div>

Solder C2

This is the cylindrical black and grey capacitor. It has a negative and positive side. The silkscreen has a + sign where the positive side is supposed to go, and the capacitor has a - sign along its negative side. Insert the capacitor accordingly and solder it in. When you are done, clip the long wires sticking out close to the board.


<div class="thumb tright">
Cache-2173133982 3dbea2da5a.jpg
</div>

Solder the Power Connector

The power connector is the same one as you find on hard drives in a computer. There are angled parts on the inside of the connector that match up to the markings on the silkscreen. Insert the part according to those, and then solder it in.


<div class="thumb tright">
Cache-2172343301 90cc105d53.jpg
</div>

Solder X4-X6 (output headers)

These are the output headers that you'll plug whatever device you want to power. Solder the headers with the tabs facing towards the inside of the board. The silkscreen has a top-down representation that should help you if you are confused. Insert the part, and solder it in.


<div class="thumb tright">
Cache-2172343445 1746e189c3.jpg
</div>

Solder T1-T3

These are the power transistors, and they are what turn the signals from your microcontroller into high current to power your devices. Solder them with the flat heatsink tab facing outwards. After you are done, you can bolt a strip of aluminum to them (or use real heatsinks) During soldering they may come out of alignment, so it could be sort of tricky. It is probably a good idea to fit a heatsink to the transistor that will drive the RepRap heater coil as that has to dissipate about 4W.


<div class="thumb tright">
Cache-2173134434 62f88b2b6b.jpg
</div>

Solder input wires

Take about 2 feet of the wire from a Cat6 ethernet cable, and take 2 twisted pairs from that. If you want to use the official color scheme, take the orange and brown pairs. Strip about 1/4 inch from the ends of each wire, and solder them into the input holes. You will want to match them up like so:

Color Input
White/Orange PWM1
Orange PWM2
White/Brown PWM3
Brown Ground

When you are finished, twist all the wires into a single cord to keep things tidy.

You have now completed soldering your PWM Driver Board! Do a happy dance and get ready to see if it works.


Test Your Board

Now we have to test the board. Its very easy, and consists of a few steps.

IMPORTANT:

  • Always turn power supply off before making/breaking connections.
  • Always turn your power supply off before plugging it in. It won't fry things most of the time... but all it takes is once to damage things.
  • Its a good idea to ground yourself before touching components. You don't want to fry anything.

Test Power on PWM Board

<div class="thumb tright">
Cache-2172343647 0084334ac0.jpg
</div>

Simply take your hacked PC power supply and plug a power connector into PWM board. Once you turn the power, the power LED indicator should come on.


Wire up test devices

<div class="thumb tright">
Cache-2173134530 6e9d472ed2.jpg
</div>

I prefer using a computer case fan (preferably with LED's) but any sort of DC device you can find laying around will do: motor, light, etc. You could even make do with a resistor and a LED. You'll need 3 of these to test it easily, but you can make do with one if you feel like swapping it to test the other channels.

Once you have your devices, wire them each up individually to a channel. Make sure you get the polarity right. In the example of our fans, they probably just won't turn, but if you use a different object it might not like it, so be careful. (eg. destructo)

Connect PWM Driver to Arduino.

This part is very easy. Strip 1/4" from the end of the input wires (You used Cat6 ethernet innards right???) Now, insert the end of each input into the correct pin on the arduino, and then connect the Ground pin to Ground on Arduino. Use the table below to determine what pins to hook up to what:

PWM Pin Arduino Pin
PWM1 9
PWM2 10
PWM3 11
GND Ground


Upload Firmware to Arduino

<object type="application/x-shockwave-flash" width="400" height="300" data="http://vimeo.com/moogaloop.swf?clip_id=345954&server=vimeo.com&fullscreen=1&show_title=1&show_byline=1&show_portrait=0&color=01AAEA"> <param name="quality" value="best" /> <param name="allowfullscreen" value="true" /> <param name="scale" value="showAll" /> <param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=345954&server=vimeo.com&fullscreen=1&show_title=1&show_byline=1&show_portrait=0&color=01AAEA" /></object>

Now, feel free to turn on the power to your power suppply. Next, open the Arduino software, and copy/paste the code below into it. Upload the code to your Arduino.

Once the program is compiled and uploaded, the Arduino will restart and run the exerciser code. The basic execution of the exerciser code goes like this:

  • Gradually take all 3 channels up to maximum, then back down again.
  • Gradually take each individual channel up to maximum and back down again.
  • Repeat.

int pwm_a = 9;
int pwm_b = 10;
int pwm_c = 11;
int i;

void setup()
{
   pinMode(pwm_a, OUTPUT);
   pinMode(pwm_b, OUTPUT);
   pinMode(pwm_c, OUTPUT);   

   Serial.begin(9600);
}

void loop()
{
   //
   //fade all channels up and down.
   //
   Serial.println("Fading all pwm channels up to max.");
   for (i=0; i<=255; i++)
   {
      analogWrite(pwm_a, i);
      analogWrite(pwm_b, i);
      analogWrite(pwm_c, i);
   
      delay(100);
   }
   
        Serial.println("All pwm channels at max.");
   delay(1000);
        Serial.println("Fading all channels to 0");
        
        for (i=255; i>=0; i--)
   {
      analogWrite(pwm_a, i);
      analogWrite(pwm_b, i);
      analogWrite(pwm_c, i);

      delay(100);   
   }

   Serial.println("All pwm channels at zero.");
        delay(1000);
   
        fade_channel(pwm_a);
        fade_channel(pwm_b);
        fade_channel(pwm_c);
}

void fade_channel(int channel)
{
   Serial.println("Fading pwm channel to max: ");
        Serial.println(channel);
                
   for (i=0; i<=255; i++)
   {
      analogWrite(channel, i);
      delay(100);
   }

   Serial.println("pwm channel at max.");
        delay(1000);
        Serial.println("fading down.");
   
        for (i=255; i>=0; i--)
   {
      analogWrite(channel, i);
      delay(100);   
   }

   Serial.println("pwm channel at 0.");
        delay(1000);
}


Troubleshooting

First, if the LED lights up and the fan does not, then check the orientation of the fan. If there are still problems, you will need to check your soldering, double check component placement and orientation, and finally if all else fails, post in the [forums for help and we'll try our best. If you can post pictures of your boards and setup, that will help us out tremendously.

History

Changelog

  • changed to screw terminal outputs
  • laid out board a bit better

Previous Versions