Trains4Africa
Because all Boys (and some girls) love Trains

DCC Decoder with 16 Relays

This project was developed by Petr Šídlo and provides a simple DCC accessory decoder with 16 relay outputs
The Decoder is built around the Arduino platform.

Notes:

  • The decoder will not set any CV
  • The decoders address is set by the DCC controller
    (The first address the decoder sees when you operate the controller will be used)
  • The decoder will occupy a specified address plus an additional 15 consecutive addresses.

r16_1

Description

The micro controller used in this project is the Arduino Pro Mini (ATMEGA328 5V 16M)
The Decoder module consists of the Arduino board, with a sketch (program).


The Sketch File: DCC_R16_v02
(rename .txt to .ino for arduin)

Electronic Circuit:

R16_schema_3Terminals P2:    Supply voltage of 5.4 V (D1 act as protection diode against reverse polarity)
Pins 4 – 5:            Connected to the connectors P3 and P4 which are connected relay control.
DCC Terminal:   Connected to the track (DCC signal from the track)
The DCC Signal is fed through optocoupler 6N137 to the Arduino.
Limiting resistor R1 is set to 1k5 Ω  (based on a 20V voltage at DCC terminals- adjust if DCC voltage is lower)

 

Software

This project uses the NmraDcc library.

The library is available on the project website Model Railroading with Arduino http://mrrwa.org/

A description of the installation of the library in the development environment is described on page 12 Arduino programmer.

The program has DCC_R16_v01.ino on line 15 of the registered address of the first relay. This address can be when recording a program to change the Arduino.

Be careful not to use a reserved DCC address when the changing the address of the module.

 

Connecting the relay

The development board is connected to the relays via an optical isolated circuit.

The project uses a custom board with 8 relays
(Opto-Isolated 8 Channel Relay Board http://yourduino.com/sunshop2/index.php?l=product_detail&p=156)

OptoRelayChannelData-575

 

The project file can be downloaded as a zip file:  R16_03