Let's start with the basics and add as you see fit. For this install, you need the following:
- An Arduino Mega or compatible *
- An Arduino Motor Shield or compatible
- A USB-A Male to USB-B Male cable, aka USB Printer cable (or Micro USB for some Arduino Mega clones)
- 18 to 16 AWG twisted pair hookup wire to connect the CS (Motor Controller outputs) to your tracks
- A 7-9V DC Power supply with a 2.5mm barrel connector for the Mega
- A 12V-15V power supply for the Motor Shield (See fig for proper voltage)
- A 2.5mm x 5.5mm Female DC Plug to Screw Terminal (if you don't want to strip wires on your power supply)
Refer to the Starter Kit for more infomation about this list of what you will need.
figure 1 - basic setup
* For an Uno, Nano or other microcontroller, or if you wish to use a different motor controller (for example to have more current to operate more trains and accessories), see link coming soon
For a video on how to do this, click here link coming soon
1. BEFORE YOU BEGIN, Cut the Vin trace on the motor controller
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. You will need to turn the motor controller board upside down and 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 magifier 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.
By default, the motor controller connects its power supply via the pins, to the Arduino. This can supply too much voltage to the Arduino. If you do not cut this trace, you could damage the Arduino if you apply more than 12V to the motor shield. In the same way, if you don't cut this trace and use the 2 power supplies as recommended, they would be connected to each other. This would not be good.
figure 2 - Cutting the Vin 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.
2. You need to connect the motor shield on top of the Arduino.
It is very easy to misalign the pins and then either have trouble diagnosing problems or damage the board!
Here are some tips:
- 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 motorboard 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
Figure 3 - Properly orient the boards
a. 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.
figure 4 - Bent pins
b. 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. See the picture below and notice the small gap between the two sets of pins to match the two pin header sockets.
figure 5 - Line up left side first
c. 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 to into the holes.
figure 6 - Get all the pins started
d. 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.
figure 7 - Start the other side
e. 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.
figure 8 - Gently press the boards together
f. 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. Figure 9 shows the boards as they look properly seated.
figure 9 - The boards when fully 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.
3. Connect your power supply to the motor shield (But don't plug it in yet!)
WARNING: 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.
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
figure 10 - Power in to 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.
figure 11 - Screw Terminal Adapter to Motor Shield
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.
4. Connect the power wires to the tracks
There are two sets of output connectors on the motor shield, "A" and "B". A is the main or operations (also called "Ops") track while B is the programming or service track.
figure 12 - Out to Main and Program tracks
5. Connect the power supply to the Arduino (but )don't plug it in yet!)
Connect the 2.5mm barrel connector from your separate 7-9V DC powersupply 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 "Vin" and "Gnd" pins on the Arduino.
6. Install the optional WiFi board
You can connect a controller like JMRI or our exWebThrottle by using the serial cable to connect between your computer and the CS. BBut if you are installing a ESP8266 Shield or bare ESP8266 to connect wirelessly, click below, otherwise skip to setp 7.
7. Download and install the DCC++ EX Software for your Command Station
Keep your USB cable handy because we are going to need it in the next step. Click on one of the links below to see how to install the software.
If you are a "Conductor" (Click to see user levels / path choice), we recommend using our installer. It is the simplest and quickest way to get started since it walks you through a simple process by letting you select any options from easy to use selections and then installs everything you need.
If you are a "Tinkerer" or "Engineer", you may prefer using the Arduino IDE. Many of you may have already used the Arduino IDE and are familiar with it. The Arduino IDE is a very simple "Integrated Development Environment" that lets you open the DCC-EX project files, edit your config file or even your main program file, upload it to the Arduino, and then monitor or interact with the Command Station for testing.
Engineers may also use PlatformIO, this is like the Arduino IDE on steroids and is the development environment we use to develop DCC++ EX
You can skip the technical notes if you like and scroll down to the install instruction links.
Wire Gauge - The Arduino Motor controller can only provide about 1.5 Amps of power (despite being rated for 2), 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.
Power Supplies - Why do we recommend a 7-9V power supply for the Mega when the manual says it can handle 12V or even 20? 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 14 (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. Click here for more information about 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 direcly 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.
- If you are adding a WiFi Shield:
- If you are ready to install the software using the DCC-EX Installer
- If you are installing using the Arduino IDE