Note that you can click on any of the images to make them larger.
This page describes the most common, recommended, configuration, but you will see some brakeouts on the right of the page the covers some of the many optional configurations.
For this install, you’ll need the items listed on the Purchasing Parts page.
For a video on how to do this, click below: Setting Up Your Command Station
By default, the motor controller shares its power supply via the pins, with the power supply of the Arduino. This can supply too much voltage to the Arduino.
If you do not cut this trace or bend out the Vin, you could damage or destroy the Arduino if you apply more than 12V to the motor shield.
In the same way, if you don’t bypass Vin and use the 2 power supplies as recommended, they would be connected to each other which could also cause damage.
We recommend you use two separate power supplies (or one power supply that can deliver two different voltages). One for the Arduino Mega, and the other for the Motor Controller to power your tracks.
So BEFORE YOU BEGIN It is very important that isolate the power between the two devices.
You will need to turn the motor controller board upside down and do ONE of the following:
Cut the Vin trace on the bottom of the board. (Recommended - described below)
Bend out or cut off the Vin Pin
Cutting the Trace
Cut the trace indicated in the picture with a razor blade or x-acto knife. 2 or 3 firm scratches through the trace should do it. Do not cut too deep. Both a magnifier and an ohmmeter would be helpful here. The little vertical line in between the two solder pads is the scratch mark from where we cut through the little solder trace.
If you have an ohmmeter, touch your probes to each side of the trace pads and make sure the resistance reading is infinite. In other words, make sure the trace is cut and there is no longer continuity between the two pads on the trace.
It is very easy to misalign the pins and then either have trouble diagnosing problems or damage the board!
Follow the instructions precisely and you should not have difficulties.
Here are some tips before you start:
There are power connectors on both boards. They must point in the same direction.
There are outdented “tabs” on the opposite end of the board. They must point in the same direction.
The pin numbers on both boards must align (pin 1 goes to pin 1, gnd goes to gnd, etc).
With the power connectors to your right, align the pins facing you first (pins 0-12, aref, gnd, etc).
Look at the pins on the motor shield and make sure they are all straight and line up in a neat row.
Place both boards on the table with the power connector end facing in the same direction.
Did you remember to cut the trace on the motor shield?
If not, see above.
Otherwise, sight down both rows of pins on the motor board and make sure they are all straight. They should all line up in a row and not be bent in any plane, just like the teeth on a comb. If any look like the photo below, bend them with your fingers and/or needle nose pliers.
Line up the pins on the side of the board closest to the USB with the header connector on the Mega first.
You want to line up pins 0-7 on the Mega with the same pins on the motor board.
On the other side, IOREF, RESET, 3V3, etc, and A0-A5 need to line up on both boards.
See the picture below and notice the small gap between the two sets of pins to match the two pin header sockets.
Just align them and start to push them in but don’t push them all the way.
Use your fingers to try to push the pins to get them to all go into the holes.
Do the same on the other side.
Get all the pins aligned and start to press gently to get them into the holes. Notice on this side, you have more holes than you do pins. This is normal.
Now, being careful to not bend any pins gently press, using a rocking motion if you need to, in order to get the motor board to seat firmly onto the Mega. Press gently until you feel you can’t put the pins in any further. Don’t force anything.
You may notice that the soldered pins on the underside of the power connector hit the top of the USB connector on the Arduino.
You can either lift the board slightly, it will still connect properly, or take diagonal cutters and carefully trim the ends of the pins a bit.
The boards should be seated. Note the pins are longer than the headers. It is normal for you to see a few millimeters of the pins between the bottom of the motor board and the top of the headers. The boards when fully seated shows the boards as they look properly seated.
Check your work. Look under and through where the boards connect, make sure no pins missed the holes and got bent so that they run along the outside of the headers.
But don’t plug it in yet!
Make sure you have cut the trace on the motor control board. If not, see above first. Once you know the trace is cut, connect power to the motor board
Make sure you have a power supply with the correct voltage and current rating. For help on selecting your power supply, please see compatible Power Supplies
If you are using a “bench” or metal box type power supply, simply connect the DC output of the power supply to the DC input of the motor shield. Make sure that the positive screw terminal (+) is connected to the positive terminal (Vin) of the motor shield and the negative terminal (- or gnd) is connected to the negative (gnd) terminal of the motor shield.
If you are using a laptop style “brick” power supply or an adapter that plugs into the wall (aka wall wart), use the barrel connector to screw terminal adapter to connect your power supply to the Vin and ground pins on the motor shield. Be careful to use the correct polarity. Make sure the positive terminal on the screw terminal adapter connects to the positive (+) on the motor shield and the negative terminal (- or gnd) connects to the negative terminal.
If you don’t have a screw terminal adapter, you can cut the end off your power supply and strip the wires. The outer wire braid is usually the negative connection and the center wire is the positive connection. Check the wiring image on the power supply itself.
But don’t plug it in yet!
There are two sets of output connectors on the motor shield,
B. A is the Main or Operations (also called ‘Ops’) track while
B is the Programming or Service track. Connect twisted pair wire of the proper gauge to each track. Polarity is not important here, but if you will be using a siding track instead of a separate, unused piece of track, make sure that the ‘positive’ and ‘negative’ for both tracks match.
In other words, if you view one side of your main track as having a ‘left’ side and a ‘right’ side, and connect positive output A to the left side, connect the positive from the B side to the left side of the programming track. In electrical terms, we want both tracks to be “in phase” with each other. Here is the diagram from above repeated again for reference.
Connect the 2.5mm barrel connector from your separate 7-9V DC power supply to the barrel connector on the Arduino.
If you have a power supply with bare wires, you can bypass the barrel connector and connect your power supply to the
Gnd pins on the Arduino.
Click here or click the “next” button to learn how to connect the WiFi shield to your EX‑CommandStation.
Wire Gauge - The Arduino motor controller can only provide about 1.5 Amps of power (despite being rated for 2A), so 18 AWG wire is ample. If you use a different motor controller and deliver more current to your track, you may need thicker wire (lower number gauge).
See the DCC Track Wiring Information page for more information on wire gauges.
Power Supplies - Why do we recommend a 7-9V power supply for the Mega when the manual says it can handle 12V or even 20V? Can’t you just use one 12V power supply to power both of them? Short answer; NO. You want two supplies (or one supply that splits out 2 voltages). The Arduino Mega only needs around 7V to operate. Any voltage over that is wasted as heat and can burn out the regulator on the board. And most people want a minimum of 12V into the Motor Board, while many want 14V (for N and HO Scale). Where your Mega could run hot for a while with 12V, if 14V from the Motorboard was connected to the Mega, it would destroy it. Cut the trace and use 2 power supplies.
Using a 5V Supply - There is one more option for powering the Mega. If you have a 5V DC regulated power supply, you can bypass the barrel connector and the regulator and connect it directly to the 5V and Gnd pins on the Arduino. Do NOT connect anything to the barrel connector if you do this! You would still need to cut the Vin trace on the Motor Shield and use your separate power supply that plugs into the shield. For more information, see Power Supplies