26
DCC++ Using an Arduino to build a Dcc base station for your layout

DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

Embed Size (px)

Citation preview

Page 1: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

DCC++Using an Arduino to build a Dcc base station for your layout

Page 2: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

What is DCC++• DCC++ is an open-source hardware and software system for the

operation of DCC equipped model railroads

• The system consists of multiple parts:• Hardware: DCC++ Base Station • Software: DCC++ Controller or optionally JMRI

• The DCC++ Base Station consists of an Arduino UNO or MEGA micro controller fitted with an Arduino Motor Shield R3 or a Pololu Dual MC33926 Motor Shield that can be connected directly to the tracks of a model railroad

• The DCC++ Controller provides operators with a customizable GUI to control their model railroad. It is written in Java using the Processing graphics library and IDE and communicates with the DCC++ Base Station in one of multiple ways: Through a standard serial connection over a USB cable, wireless over BlueTooth, or with a Ethernet Shield via JMRI.

Page 3: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

What makes DCC++ different• DCC++ conforms to the NMRA standard

• The initial developer devised a way to use an Arduino to generate the DCC signal and using a motor shield, to amplify it to the level of voltage needed to apply to the tracks or other DCC decoders

• Rather than throttles, the initial development used a computer to control the layout (trains and stationary decoders)

• It is an open source project and not available commercially (you don’t have to build it yourself, you GET to build it yourself!)

• Support is not available from a manufacturer but there is a solid support base on the Internet in a variety of places.

Page 4: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

What is an Arduino

• Arduino is an open source, computer hardware and software company, project, and user community that designs and manufactures microcontroller kits for building digital devices and interactive objects that can sense and control objects in the physical world.

• Through programming, an Arduino can accept an input signal, and through programming, generate an output signal.

• These signals can be from other electronics or something as simple as a switch. Outputs can be digital or analog.

Page 5: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:
Page 6: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

How DCC++ came to be• The original developer, Gregg E. Berman discovered that he could

generate a DCC signal using an Arduino and through manipulation of the outputs and using what is called a “motor shield” produce a usable DCC signal.

• A circuit board that has been developed to connect to an Arduino is called a shield because of the way it connects on top of the base board.

• Since the author used the C++ programming language to create the code for the Arduino, he named the project DCC++. In his words, the pun is intended!

Page 7: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

Building a base station• The base station consists of an Arduino Uno (or Arduino Mega)

and an Arduino Motor Shield, and that's the only hardware needed (with the exception of a 15 to 18 volt DC power supply).

• As above, there are two boards that can be used. The Mega, as it name implies is a larger board with more connections that can be used for other purposes. For our demonstration we are going to use an Uno.

Page 8: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

Building a base station• The Arduino is available online in North America.

https://store.arduino.cc/usa/ The cost is $24.95 USD. Plus shipping.

• Because Arduino is open source, you can buy from a variety of manufacturers, from all over the world.

• Amazon.ca offers a UNO clone for CDN$13.99

• If you are adventurous, you can buy from China through eBay.ca, aliexpress.com or other online retailers and obtain a UNO clone for as little as CDN$4.10 with free shipping.

• As always, your mileage may vary and the clone units can be of varying quality. I bought a clone and had no problems.

Page 9: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

Building a base station• The motor shield is purchased similarly. The online discussion and

documentation has a couple of shields that will work but I chose to use the one the original author used so I would not have to modify the code.

• The genuine Arduino motor shield is $22.00 USD

• Keywords as you search for clones are:• L298P Shield R3 DC Motor Driver Module 2A H-Bridge 2 way UNO

• Again, these can be bought for as little as CDN$8.02 with free shipping.

Page 10: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

Building a base station• The fortunate part of this motor shield is that it has two outputs

for a motor, allowing us to have both a Main and Programming track

• The motor shield does not care that we are not connecting a motor to the outputs, it just takes the digital signal and amplifies it.

• A DC power supply is needed for the motor shield.

• Good sources are used or new laptop power supplies.

• You need something that is between 15V and 18V and between 1 and 2 amps. The maximum output is 2A from the shield

Page 11: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:
Page 12: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

Building a base station• There is no other hardware needed aside from 2 wires that will

be used as jumpers.

• A note on construction• We have a small modification needed to the motor shield.

• The Arduino UNO can be powered three different ways. 1. From the USB port

2. From the power jack on the UNO board

3. From the motor shield

• However, we cannot power the UNO with more than 12V.

• Therefore we have to cut a trace on the motor shield board to prevent the voltage we are going to use to power our track from going to the UNO and burning it up.

Page 13: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:
Page 14: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

Building a base station• Before we connect the hardware, we have to program the

Arduino.

• Download the DCC++ software from the GitHub repository:• https://github.com/DccPlusPlus/BaseStation

• Download the Integrated Development Environment (IDE)• https://www.arduino.cc/en/Main/Software

• Using a USB cable, connect the UNO to your computer and allow it to discover the hardware.

• Using the Arduino IDE software, upload the code you downloaded to the UNO

Page 15: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

Building a base station• You can disconnect the UNO from the USB cable

• Connect the motor shield to the UNO by lining up the pins and pressing down.• You MAY see that you cannot completely press the pins down. If you are

using a clone board, not all the components are as they are with a genuine board. As long as there is a connection, don’t worry

• Connect 2 jumpers• 22awg solid wire or similar

• Pins to connect:• 10 to 12

• 5 to 13

• That’s it! You’re done!

Page 16: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:
Page 17: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

Building a base station• A note about power.

• The stock motor shield is rated for 2Amps. Some clones have been found to have less than stellar cooling and will overheat when drawing 2A. Your mileage may vary.

• You are limited to the available current of your power supply.

• The original code is designed to limit the current to about 800mA. This is because the original author was only driving a few N scale locos.

• To use the full 2A of the motor shield, a change has to be made to the code. This is possible with a text editor.

Page 18: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

Building a base station: Modifying Code• In file CurrentMonitor.h the max. current can be changed on line

16:

• #define CURRENT_SAMPLE_MAX 300

• You must change 300 to a greater value. The following is a table that has been developed to give you an idea of what you might change it to.

• These values were developed using a genuine Arduino motor shield. Clones may behave differently. Be careful you don’t overheat and destroy the shield.

Page 19: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

Running trains• The original intent was for the author to automate his N scale

layout through a computer. Thus, he wrote software for his PC to do so.

• This software can be difficult to configure for your layout and as such I have not used it.

• Luckily, JMRI (Java Model Railroad Interface) supports DCC++

Page 20: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

Running trains• It is beyond the scope of this clinic to fully describe JMRI.

• If you have successfully set up JMRI with a commercial DCC system, the process is the same. DCC++ is simply one of the options during setup.

• JMRI will allow you to use the computer based throttles or, by using a computer connected to WiFi, setup WiThrottle server and use your smart phone as a wireless throttle.

• JMRI is available at: http://jmri.org/

• DCC++ specific information is here: http://jmri.org/help/en/html/hardware/dccpp/index.shtml

Page 21: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

Running trains• An alternative I’ve discovered is called RocRail.

http://wiki.rocrail.net/doku.php

• Open source

• Good online support

• Based overseas

• Supports DCC++ and many other DCC systems

Page 22: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

Moving beyond the basics• 2A Limit

• If you reconfigure for 2A, the Base Station may be adequate for your needs. However, if you want more power, you have options.

• Dave Bodnar has developed a booster that, in theory, could deliver over 40A. http://trainelectronics.com/DCC_Arduino/DCC_Booster/index.htm

• Tam Valley has a suitable booster that delivers 3A continuous and 5A peak.http://www.tamvalleydepot.com/products/dccbooster.html#booster

• MERG (Model Electronic Railway Group) Has a Booster Kit available.http://www.merg.org.uk/merg_resources/dcc.php

Page 23: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

Moving beyond the basics• There are a few people developing throttles for DCC++ that will

allow you to operate without a computer.

• Dave Bodnar has an extensive discussion with video:http://trainelectronics.com/DCC_Arduino/DCC++/Throttle/index.htm

• The thread on Trainboard will give other ideas and optionshttp://www.trainboard.com/highball/index.php?threads/dcc-hardware-throttles.90315/

Page 24: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

Moving beyond the basics• Raspberry Pi is a small board computer that you can connect a

keyboard/mouse/monitor to and run a version of Linux for around $50

• Linux will run JMRI and you could have a dedicated computer for your DCC++/JMRI setup. The latest version of the Pi has built in WiFi and can be configured as an access point (AP) to allow the use of WiThrottle

• http://jmri.org/install/Raspbian.shtmlhttps://mstevetodd.com/jmri-raspberrypi-access-point

Page 25: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

Links, Tutorials and More:www.gregstrainyard.com

www.facebook.com/gregstrainyard

Page 26: DCC_PP - · PDF fileWhat is DCC++ •DCC++ is an open-source hardware and software system for the operation of DCC equipped model railroads •The system consists of multiple parts:

?QUESTIONS?