Universal Controller Board v1.1

From RepRap
(Redirected from UniversalControllerBoard)
Jump to: navigation, search

This page describes something which is no longer the most recent version. For the replacement version see: UniversalControllerBoard 1 3


Depreciated! Use Universal Controller Board v1.2 instead unless you are making your own PCB from scratch.

UniversalControllerBoard-universal-finished.jpg

RepRap uses the same printed circuit design for both the stepper controllers and the extruder controllers, but different components (and some common ones) are needed for each. This page describes how to put the common components together on the PCB and test them.

In fact, there is very little extra that needs to be added to the PCB that you will assemble from the instructions on this page and the complete stepper controller so, as you will see below, you can use a stepper motor to test the board at this stage, even if the board is actually going to end up as an extruder controller.

File Locations
All the KiCad circuit and PCB files are in Subversion at svn/reprap/electronics/Universal-pcb


Build It

Printed Circuit Board

UniversalControllerBoard-drilled-and-trimmed-component-side.jpg
UniversalControllerBoard-drilled-and-trimmed-copper-side.jpg

The PCB is double-sided. The component side (obverse) is on the left; the reverse is on the right.

Files Needed for Printing

Component Traces (obverse - left) Postscript PDF
Copper Traces (reverse - right) Postscript PDF
Component Silkscreen Postscript PDF

Use those and follow the instructions on how to make your own PCBs.

Common Components

Component Value Quantity Description Mouser Part#
U1 78L05 1 a 5V voltage regulator 512-LM78L05ACZX
U2 L298N 1 a motor driver chip 511-E-L298N
U3 PIC16F628 1 the microcontroller 579-PIC16F628A-E/P
n/a 18-pin DIL 1 a socket for the PIC16F628 575-199318
D1 - D8 1N4005 8 a Diode 512-1N4005
C1 1000uF 25v 1 an Electrolytic Capacitor UVR1E102MPD
C2 100uF 12v 1 an Electrolytic Capacitor UVR1E101MED
C4 0.1uF 1 a Ceramic Capacitor 647-UVR2A0R1MDD
R4 220R 1 a Resistor 291-220-RC
R2 10K 1 a Resistor 291-10K-RC
D9 LED 1 a LightEmittingDiode 859-LTL-4234
P1 power connector 1 2.54mm screw PCB connector 651-1725656
K1, K2, P5, P8, P9, P10 12 pins 1 PCB transition connector 571-41032390


The transition connector pins are like A, and the power connector is like B:

UniversalControllerBoard-conns-small.jpg

Soldering - first stage: the vias (through links)

UniversalControllerBoard-via-positions.jpg

If you have bought a commercial PCB then the vias should be through-plated and you won't need to do this. But if you've made the PCB yourself then you will. The picture shows where all the vias need to go. Right-click on it and select "view image" for a high-resolution version.

You need to solder a length of wire (leads cut from old resistors and capacitors are ideal, so save them...) through each via. Print the image, and cross each one off as you do it so you can keep track.

The simplest way to do the job is to support the PCB a little proud of a flat surface (putting it on four M4 nuts works well). Drop the wires through the holes, then solder them on just the top side. When you've finished cut the excess off the tops with side-cutters, turn the board over (no M4 nuts this time - just flat on the surface supported by the sticking-out and freshly-cut wires) and solder the other side.

If your board will become a stepper controller solder two vias where the green dots are. If it will be an extruder controller a resistor and a capacitor will go there and make the connections, so no green vias are needed.

If you don't want to run a slave stepper (and the standard RepRap design doesn't) you will not need the connector P10. If you leave that off, put vias where the three blue dots are.

Soldering - second stage: power, PIC holder, communications and LED

UniversalControllerBoard-ready-for-voltage-check.jpg
Component Value
U1 78L05
C1 1000uF 25v
C2 100uF 12v
D9 LED
C4 0.1uF
P1, P5, P8 2 pin header
K1, K2 3 pin header
R2 10K
R4 220R
R7 (220R) shorting link
R8 (220R) shorting link
U3A 18 pin DIL PIC socket

Soldering Order

  1. U1 - the orientation is important here. With board as in the photograph, the flat on the chip faces down and to the left.
  2. C1 - negative faces up.
  3. C2 - negative faces up.
  4. D9 - the LED anode (+) is the longer of the two leads. This goes to the right.
  5. P1, P5, P8, R2, R4, C4 - the orientation doesn't matter.
  6. R7 and R8 - these are not needed on a standard RepRap machine and should be replaced by shorting wire links.
  7. PIC socket - notch down.

R7 and R8 allow the use of non-standard opto-switches and are usually not needed; replace them with wire jumpers.

The PIC will eventually be mounted in the 18-pin DIL socket, as it will need to be removed and re-inserted for programming. Leave it in its anti-static packaging for the moment.

Take particular care to get the polarity of the electrolytic capacitors and the LED correct. (The right-angled LED that I used and that you can see in the picture had a little + marked on it, which makes things easy.)

There is no need to solder to an isolated pad. Always solder to pads that have tracks going away from them on each side of the board where there is such a track. The circuit sometimes uses the component leads to make a through connection from one side to the other; in these situations there will be tracks on both sides going away from the component's lead(s).

Use a couple of jumpers to short the left-hand pairs of pins of K1 and K2, as in the picture. In a stepper controller these connect the end-stop sensors, and shorting the middle pins to ground is the signal the the carriage is not at the endstop. In an extruder they are used to log the extrude speed and to check for the exhaustion of the material being extruded.

Testing Rounds

First test - power

This picture shows the finished board with more components on, but it is testable at the stage shown in the previous picture above.

Wire the Communications and Power Distribution Board to your new circuit like this, but leave the PIC out of its socket, leave the transmit and receive wires disconnected, and do not connect the RS232 cable to the computer.

Take Great Care to get the polarity of the power leads (red and green on the picture, and with + and - labels) correct.

Connect 12v power to the Comms board and check that there is 5v between sockets 14 and 5 of the PIC holder (- to pin 5, + to pin 14). This 5v comes from the regulator U1 (78L05).

Take the + probe of the voltmeter and check all the pin-sockets of the PIC connector relative to its socket 5. Most should be at 0v; one or two should be at about 3v. None should be more than 5v.

Switch off the power.

Second test - program chip

Now program up a PIC 16F628 (U3) with the file ~your-id/workspace/firmware/build/16f628/stepmotor/stepmotor.hex. This is the X-axis PIC control program for your RepRap machine that was created when you downloaded and built the RepRap software. Observe the usual CMOS anti-static precautions when handling the PIC. Plug in the programmed PIC, notch to the right in the orientation shown in the picture.

Switch on the power. The LED on your new board should light; it is instructed to do so by the PIC program. Switch the power off again.

Third test - exercise command

Connect an RS232 cable between your computer and the Comms board. Connect transmit (T) on the Comms board to receive (R) on your new board, and recieve (R) on the Comms board to transmit (T) on your new board. The R and T connections to the board are not very clear on this picture - see the one below from a different angle for a better view. R is the left-hand pin of its pair, T is the right of its pair. The two in between are both ground and are not normally used (they are intended for twisted-pair communications if that is ever needed; more wires, but better noise immunity...)

Open the Eclipse Java development program. Open the Reprap project, and walk down the tree: src -> org.reprap. Right-mouse click on main.java and go down to Run as... -> Java Application.

Select Preferences from the File menu and set the port to the one your RS232 cable is connected to.

Click on the Axes tab and select Cartesian as the geometry. (The default is Null Cartesian, which is a dummy RepRap machine inside the software for testing purposes.) Cartesian is an honest-to-goodness real RepRap, such as the one taking shape on the end of your RS232 cable...

Click on OK in the Preferences box.

Turn on the power.

Now, from the Tools menu select Stepper exerciser. This should open a window that looks like this:

UniversalControllerBoard-stepper-exerciser.jpg

As you can imagine, this window allows you to move your RepRap machine around just by draging those pointers with the mouse. Drag the X-axis pointer to the right. The LED on your new board (which was on continuously) should begin to flash. Whenever one of the stepper controllers is moving its motor it flashes its LED, and this is what's happening. Of course you don't actually have a motor connected, or even the motor driver, U2 (L298N). But the PIC doesn't know that.

Close the program and all the windows, and turn off the 12v power.

Soldering - second stage

UniversalControllerBoard-universal-finished-rt-aa.jpg

Remove the PIC and place it in its anti-static package.

Components for this stage

Component Value
D1 - D8 1N4005
P9 4 pin header
U2 L298N

Soldering Order

  1. The header/connector
  2. U2 -- do this before diodes... otherwise it will be hard to reach
  3. then the diodes. Note the polarity of the diodes: the stripe / bar to the right in the picture.

The picture shows the second stage of soldering complete.

Testing Rounds

Fourth test - voltage reading

Reconnect the power connection to the Comms board, put a voltmeter on sockets 5 and 14 of the PIC holder (- to pin 5, + to pin 14), and turn on the power. The voltmeter should read 5v.

Take the + probe of the voltmeter and check all the pin-sockets of the PIC connector relative to its socket 5. Most should be at 0v; one or two should be at about 3v. None should be more than 5v.

Turn off the power.

Fifth test - led flashy

Plug the PIC back in.

Reconnect the transmit and recieve lines. and re-run the Third Test above. The LED should still flash.

Turn off the power.

Sixth test - action!

UniversalControllerBoard-stepper-pcb.jpg

Connect a 4-wire RepRap bipolar stepper motor (follow that link for details, suppliers, and wiring) to the connector at the top of the picture (P9). (In fact any bipolar stepper with a coil resistance of more than 10 ohms and less than about 50 ohms should work for testing if you don't have your RepRap steppers yet. Connect one coil between pins 1 and 2 of P9, and the other between pins 3 and 4. If you have no stepper motors at all, see LED Stepper Diagnostic below)

Plug the stepper motor socket onto the connector at the top of the picture (P9), red wire towards the centre of the PCB. Open the Eclipse Java development program. Open the Reprap project, and walk down the tree: src -> org.reprap. Right-mouse click on main.java and go down to Run as... -> Java Application. From the File menu select Preferences, and from that select Axes. Set the X axis power to 100%, and click OK.

For all the following tests, don't run the motor for more than a few seconds because the L298N chip doesn't have a heat sink on it yet - it'll get hot. Between each test, uncheck the Torque box for the motor to turn the current to it off when it isn't doing anything.

Repeat the third test, but first drag the motor speed bars on the left of the window down to about two-thirds of the way. The LED should flash and the motor should rotate (stick a short piece of wire to the spindle so you can see what's happening; see the picture).

Finally, select the X-Axis "Home" button in the window. The motor should rotate continuously in the opposite direction.

Pull off the jumper on K2 (the one further away in the photograph). The motor should stop as this is the signal to the PIC that the endstop has been reached.

Congratulations!

You have finished the common circuitry for the Universal PCB!

Continue on to making:

Technical

LED Stepper Diagnostic

UniversalControllerBoard-led-diagnostic-pic.jpg

Here is a useful diagnostic device that you can plug in in place of a stepper motor to test your RepRap controller boards. It is very simple to solder up on an old offcut of stripboard.

It consists of two green and two red LEDs wired back to back with current limiting resistors. As the L298N (U2) steps the motor the polarity sent to its two coils changes in sequence. If you plug this device in to the stepper connector and use the Step + and Step - buttons on the control window you can see this hapenning.

UniversalControllerBoard-led-diagnostic-schematic.jpg
  • Both LEDs off: all L298N outputs at ground.
  • Red: this output goes + -.
  • Green: this output goes - +.

PIC 16F628 Pinout:

One obvious common component is the PIC - a 16F628. But some pins do different things in the two devices:

[i] = input, [o] = output, [b] = bidirectional

Pin Stepper controller Extruder controller
RA0 L298 [o] L298 (Fan) [o]
1 Sync [b] Thermistor [i]
2 L298 [o] L298 (Fan ) [o]
3 Sync [b] Heater [o]
4 LED [o] LED [o]
5 Max [i] Material out (input only) [i]
6 - Thermistor [i]
7 - Thermistor [i]
RB0 Min [i] Slotted-wheel for extrude speed [i]
1 Rx [i] Rx [i]
2 Tx [o] Tx[o]
3 L298 Enable [o] L298 Enable [o]
4 L298 [o] L298 (Extrude) [o]
5 L298 [o] L298 (Extrude) [o]
6 - -
7 - -

Board Modifications

R7 and R8 are only needed if you use an alternate design for end-stop, material-out, and extrude-speed sensors. Normally they are replaced by wire jumpers.

Without L298N

Components marked (A) are for an alternate extruder design without an L298N, and so can normally be left out. (This extruder is cheaper to make, but can't reverse the extrude motor - to make it just leave out U2, D1...D8, and P9, then add in these components.)

R6 220R
R7 220R
R8 220R
R9 220R
Q3 TIP110
Q2 TIP110
P6 CONN_2
P7 CONN_2

Slave Motor

It's also possible to drive a slave stepper from this board using another L298N chip. There is a connector (P10) for the slave stepper driver should you want to drive more than one stepper. P10 brings out all the signals from the PIC to the stepper driver, so just connect another L298N on a separate board up like the first one to those five signals (also don't forget the diodes) and plug in another stepper, which will run in synchronisation with the first.

Add your own electronics

The connector P11 has several of the PIC lines running to it and power (see the circuit diagram in KiCad). It is intended to allow users to experiment by adding extra electronics. If you want to do this, put a 7-pin connector in for P11, make up your circuit (stripboard is probably easiest), and put a 7-way socket on the board that will plug into P11.