DCC Controller, 2 Boards, 1 PSU, No Soldering!

by Computski in Circuits > Arduino

2035 Views, 3 Favorites, 0 Comments

DCC Controller, 2 Boards, 1 PSU, No Soldering!

20211206_090054.jpg

Build a low cost DCC controller with just two boards off the internet.

You will need:

WeMos D1 R1 board. Note the R1 is now obsolete and can be picked up cheaply. There's a later version, the D1 R2 which has different pin-outs but you'd need to figure out the configuration.

L298 motor shield or clone. Get the one with the large L298 chip on it (see pic). This can handle a total of 4 Amps.

12v 2Amp switch mode power supply with a 2.1mm jack plug, centre positive. Do NOT use an old train-set transformer.

Optional: 2.1mm jack socket on a pigtail if you wish to run at 2Amps or more.

Load the Software Into the WeMos D1

20211206_091803.jpg

The WeMos D1 is an Arduino-format board. You can load software into it using the Arduino IDE via a USB cable.

The software is available at Github. https://github.com/computski/ESP_DCC_Controller

The software for this project is the same as my other instructable. In Global.h, you will find a section that defines various board + power module configurations. For this project we are using the

WEMOS_D1R1_AND_L298_SHIELD

option. This sets up the various pin configurations.

Download the PDF for details on how to setup and compile using the Arduino IDE.

You will need to upload both the main program and the "data files" which are the web pages the system needs.

Control of your locomotives is through a mobile phone or tablet running Engine Driver (Android) or WiThrottle (IOS)

2023-05-08 software note: Use Arduino IDE v1.8x only. The new v2x does not support uploading files to the WeMos board (the web pages) this is a known limitation of v2. Also, if you find that Arduino will not connect via serial to the WeMos board (no port, or communication failure) its likely to be the CH340 driver. Download v3.5 from this link. Then go into device manager, find the port, delete the existing driver and immediately run the CH341SER.EXE which will install v3.5. By default windows installs the latest version 3.8 which has this no-connect bug.

Cut the BRAKE Jumpers on the L298 Board

vlcsnap-2021-12-06-09h32m13s499.png

See the video in the next step also.

On the back of the L298 motor shield, there are two jumpers called BRAKE. These are pairs of solder pads and they have a small track between each pair that links the pads. You need to cut these tracks so that the pads are separated and have a gap between them. Do this with the tip of a small knife, e.g. an Xacto blade.

You need to cut the jumpers because we don't need a brake function, and the pins will be used for I2C communications. If you leave them connected, it wil interfere with the DCC signal.

Wire It Up, Plug the Boards Together and Run Some Trains

DCC controller, 2 boards, no soldering!

On the L298 board, run a short piece of wire between A+ and B+ terminals, and also the A- and B- terminals. This will common the L298 outputs to give a total of 4 Amps of power. Then take A+ A- to the track.

Next plug the L298 shield on top off the WeMos D1 board, plug in a 12v supply, and run some trains!

Further details are in the video. This system is a JMRI server and has quite a lot of features.

  • Supports 8 locos, 8 turnouts.
  • Service Mode (program track) including reading CVs
  • Program on the Main (POM) mode
  • Can connect to 4 mobile clients simultaneously
  • Short circuit protection

It does not support LocoNet or DCC+