DCC++ Setup with Vellerman KA03 Motor & Power Shield

DCC++ is an open source digital command system for model trains. The base station consists of an Arduino, which utilizes a Motor Power Shield hat as the controller.

This post will address the setup of the Velleman KA03 Motor & Power shield hat for DCC++, where I discovered some profound discrepancies between this unit and existing instructions for the setup. The Velleman KA03 is also readily available at Micro Center – another instant gratification if you have a store near you.

The first step is to set up your base station by downloading DCC++ from Github:

https://github.com/DccPlusPlus/Controller

Connect your Arduino, and open the DCCpp_Uno.ino file.We will need to make several changes to this file.

Change #1 is within the DCCpp_Uno tab:

Find and replace references to the A5 pin, and change to A4, per the following:

pinMode(A4,INPUT); // if pin A4 is grounded upon start-up, print system configuration and halt
digitalWrite(A4,HIGH);
if(!digitalRead(A4))
showConfiguration();

Next modify the DCCpp_uno.h tab; there are (2) motor shields that the Arduino attempts to identify. The Velleman will return a “0” identifying it as a standard Arduino compatible Motor Power Shield; in fact, it is closer to the “POLOLU MC33926 MOTOR SHIELD”. For simplicity, I changed the identifier for the standard Arduino Shield to “3” and the Pololu Motor Shield to a “0”, so the Velleman would be assigned the correct settings.

The entire modified section was thus:

/////////////////////////////////////////////////////////////////////////////////////
// SELECT MOTOR SHIELD
/////////////////////////////////////////////////////////////////////////////////////

#if MOTOR_SHIELD_TYPE == 3

#define MOTOR_SHIELD_NAME "ARDUINO MOTOR SHIELD"

#define SIGNAL_ENABLE_PIN_MAIN 3
#define SIGNAL_ENABLE_PIN_PROG 11

#define CURRENT_MONITOR_PIN_MAIN A0
#define CURRENT_MONITOR_PIN_PROG A1

#define DIRECTION_MOTOR_CHANNEL_PIN_A 12
#define DIRECTION_MOTOR_CHANNEL_PIN_B 13

#elif MOTOR_SHIELD_TYPE == 0

#define MOTOR_SHIELD_NAME "POLOLU MC33926 MOTOR SHIELD"

#define SIGNAL_ENABLE_PIN_MAIN 3
#define SIGNAL_ENABLE_PIN_PROG 11

#define CURRENT_MONITOR_PIN_MAIN A0
#define CURRENT_MONITOR_PIN_PROG A1

#define DIRECTION_MOTOR_CHANNEL_PIN_A 7
#define DIRECTION_MOTOR_CHANNEL_PIN_B 8

#else

#error CANNOT COMPILE - PLEASE SELECT A PROPER MOTOR SHIELD TYPE

#endif

Download the corrected settings to your Arduino. If these corrections are not made, you will see errors when the Arduino boots with the Velleman hat atttached.

Next, we need to verify pin settings on the Velleman:

Move your power jumper from “INT” to “EXT” – this step replace the “v connect” trace cut shown on the the original guides and videos.

We also need to verify the following jumpers are correctly set:

DIRB : Pin 8

PWRB: Pin 11

DIRA: Pin 7

PWRA: Pin 3

Attach your hat, and after verifying all jumpers, attach the external power supply.

You will need to add jumpers from “DCC_SIGNAL_PIN_MAIN” (Pin 10 on Arduino) to “DIRECTION_MOTOR_CHANNEL_PIN_A” (Pin 7 on Vellerman Hat).

You will also need the programming jumpers from “DCC_SIGNAL_PIN_PROG” (Pin 5 on Arduino) to “DIRECTION_MOTOR_CHANNEL_PIN_B” (Pin 8 on Vellerman Hat).

We use a Raspberry Pi 3B to run JRMI and were able to connect, program, and run with no issues after these adjustments were made to the Vellerman Motor and Power Shield.

 

Posted in DCC++ and tagged , , , , , .

One Comment

  1. I had just bought my stuff from Micro Center an Arduino Uno R3 and Velleman motor shield VMA03, I’ve been pretty lazy lately, and didn’t want actually try to find bottom on my bench,
    so I bought one that was already put together. After looking at the board and then the instruction, I realized. I had something different the original.
    I came across you blog, and bingo, the excellent article helped to get my Base station running. I had noticed in your instructions jumper from “DCC_SIGNAL_PIN_MAIN” (Pin 10 on Arduino) to “DIRECTION_MOTOR_CHANNEL_PIN_A” (Pin 7 on Vellerman Hat). jumpers from “DCC_SIGNAL_PIN_PROG” (Pin 5 on Arduino) to DIRECTION_MOTOR_CHANNEL_PIN_B” (Pin 8 on Vellerman Hat).
    I found I could do this all on the HAT board of the motor shield and it worked fine.
    Thanks your instructions got me going into the world of DCC++. Now all I need is a train, the one I bought from a train store was shipped dead on arrival.

Leave a Reply

Your email address will not be published. Required fields are marked *