Trains4Africa
Because all Boys (and some girls) love Trains

ORA-1 accessory decoder

ORA-1 accessory decoder

ContentHardwareRocrail


ORA-1 = Open Rocrail Accessory decoder to use with many systems including ORD-1

Introduction

ORA-1 is a multi purpose accessory decoder. It can be built in two versions; one version for turnouts driven by solenoids and for various signals and the other version for turnouts with servo motor.

ORA-1 is a based on and code compatible with Opendecoder (OpenDecoder Hardware 1). Many thanks to Wolfgang Kufer and his OpenDCC project.

Main features

  • Full Rocrail support
  • Compatible with ORD-1
  • 8 outputs ( 4 turnouts )
  • 100x70mm PCB
  • NMRA-DCC compatible
  • external power for outputs
  • runtime configurable for different kind of loads (turnouts or lights)
  • option for driving DC motors, with adjustable voltage
  • 0,5A or 1,0A current for solenoid drivers

Block Diagram

Files

Schematics and PCB artwork was created with KiCad, an Open Source (GPL) PCB Suite. Complete CAD files are accessible through RocRail Subversion repository.

Version 1.02:

No electrical changes since v1.01. Better layout clearance.

Get the Parts

Version 1 – Accessory Decoder for Turnouts with Solenoids and Signals

Version 1 can build with one or two ULN2803 driver chips. Every ULN2803 provides 0,5A max. short time power. For small gauges like N or TT, one ULN2803 may be enough but for H0 it may be better to build ora-1 with both drivers.

Name Value, Remark Quantity
C1, C2 18pF, 2,54mm pin spacing 2
C3 470µ, 5,08mm 1
C4, C6, C8 100nF, 5,08mm 3
C5 100µF, 5,08mm 1
D1 1N4148 1
D2 LED, 3mm, low current, 2mA 1
D3 rectifier B80C1500 1
F1 multifuse, 0,5A, If using 2 x ULN2803 you need 0,9A 1
JP1 jumper, 2,54mm 2
K1, K2, K3, K4 connector, 3 port, 5,08 mm pin spacing 4
OK1 optocoupler 6N136 or 6N137 1
P1 connector 2×10, 2,54 cut out the pins you need 1
P2, P3 connecter, 2 port, 5,08 mm pin spacing 2
R1, R4 resistor 1k5 small 2
R2, R3, R27 resistor 10k small (R2 is only needed if using OK1 = 6N137 3
SW1 switch, print 1
U1 ATTiny2313DIP 1
U2, U3 driver ULN2803A (each driver supports 0,5A ) 2
U4 voltage regulator LM7805 1
X1 10MHz chrystal 1

usefull accessories:

Name Quantity
IC-Socket 20 pin for U1 1
IC-Socket 18 pin for U2 and U3 2
IC-Socket 8 pin for OK1 1

You can get the parts at theese distributors:

Reichelt shopping cart (You have to select if you need 1 or 2 ULN2803. Preselected are 2. You also have to select if you need a 0.5A Fuse PFRA050 ore a 0.9A Fuse PFRA090)

Version 2 – Accessory Decoder for Motor driven Turnouts

For building the Version 2 Hardware you need all parts used in Version 1 plus the parts below. You need only one ULN2803 because of the BD678 booster circuits. The Heatsink is not a must but a small Heatsink is better as a burned LM317 ;-) Remember that you need a M3 screw for it.

Name Value, Remark Quantity
C7 100µF, 5,08mm pin spacing 1
D3 – D10 LED 3mm std. only if you like LED’s ;-) 8
Q1 – Q8 BD678 PNP Darlington uncooled 8
R5, R7, R10, R12, R15, R17, R20, R22, R26 resistor 1k5, small 9
R6, R8, R11, R13, R16, R18, R21, R23 resistor 5k6, small 8
R9, R14, R19, R24 resistor 1k small (only needed for LED’s) 4
R25 resistor R470 1
RV1 poti 5k 1
U5 voltage regulator LM317 1
U5 U-Form Heatsink for LM317 1

Instead of the BD678 PNP Darlibgtons you can use any PNP types who are able to drive 1A. If you use non Darlington Transistors you have to replace the 5k6 resistors with 1k5 types.

You can get the parts at theese distributors:

Reichelt shopping cart

Build your ORA-1

Version 1 – Accessory Decoder for Turnouts with Solenoids and Signals

  1. Mount the jumper near U2.
  2. Mount all resistors and diodes. If you use a 6N137 opto you have to mount R2, if you use a 6N136 leave R2 empty.
  3. Mount all IC Sockets. If you build the 0.5A Version mount sockets for U1, U2 and OK1. If you need 1A you have to mount U3 too.
  4. Mount all other small parts
  5. Mount the power supply, elko’s and the connectors.
  6. Connect power and check VAA and +5V
  7. Insert the IC’s
  8. Program the AVR
  9. Test – If you press the sw1 button longer than 100msec, LED2 will light up.

Version 2 – Accessory Decoder for Motor driven Turnouts

  1. Mount the jumper near U2.
  2. Mount all resistors and diodes. If you use a 6N137 opto you have to mount R2, if you use a 6N136 leave R2 empty.
  3. Mount all IC Sockets. Remember that you don’t need to mount U3 for driving motors.
  4. Mount all other small parts
  5. Mount the PNP Transistors, the power supply, elko’s and the connectors.
  6. Connect power and check +5V and VAA after the LM317. Test the Poti and measure the output voltage.
  7. Insert the IC’s
  8. Program the AVR
  9. Test – If you press the sw1 button longer than 100msec, LED2 will light up.

AVR programming

AVR programming is quite easy. You need a programming software and a small hardware adapter for the serial port.

We suggest to use Ponyprog2000 for Windows.

For Linux you can use Avrdude . Avrdude are available as binary package in many Linux distributions.

Hardware

The programming hardware is really small. You only need 4 resistors, 2 zener diodes, 1 transistor and two connectors. You may build it on a breadboard but for the more enthusiastic model railroader we have prepared a small Layout.

Version 2.1:

You also need a 1-to-1 cable to connect the 6 pin connector at your decoder with the 6 pin connector at the programmer board.

Software

First you have to setup the pic programmer. If you use the programming hardware described above you have to setup Ponyprog this way: Click on “Setup/Interface Setup” and setup the I/O Port as you can see in the picture below.

ponysetup7.jpg

Attention: If you are using ORA-1 with 10k Pullup at reset input, don’t check “Invert Reset” !!!

You have to tell Ponyprog the name of the device you want to program. Click at “Device / AVR micro / ATtiny2313”

The software for the decoder is found at Wolfgang Kufer’s Opendecoder page: http://www.opendcc.de/elektronik/opendecoder/OpenDecoder_V04.zip . (There may be newer versions available on this location.) Download and unzip the file. You need to program the OpenDecoder_10MHz.eep and OpenDecoder10MHz.hex into the atmel chip

Now it is time to connect ORA-1 with the pic programmer. Also connect 8V to 30V AC or DC Power to ORA-1. To program the chip you have set the fuses of the atmel. Click on “Command / Security and configuration Bits” Set the fuses as shown in the picture below:

ponyfuses1.jpg

Finalize by using “Write” to download the fuses to your decoder.

Afterwards you have to open the EEprom and the Program files. Click on “File / Open Program (FLASH) File …” and select the OpenDecoder10MHz.hex file at the place where you unziped it. Now click on “File / Open Data (EEPROM) File …” and select the OpenDecoder_10MHz.eep file. If both files are successfully loaded you have to click on “Command / Write Program (FLASH)” and after that is done click on “Command / Write Data (EEPROM)”

For Avrdude, use:

avrdude -p t2313 -c ponyser -P /dev/ttyS0 -e \
          -U flash:w:OpenDecoder_10MHz.hex \
          -U eeprom:w:OpenDecoder_10MHz.eep \
          -U efuse:w:0xff:m \
          -U hfuse:w:0xd9:m \
          -U lfuse:w:0xef:m

Now the chip is ready to test: connect power to ORA-1. Press the button at the ORA-1 board. The LED will light and displays that ORA-1 is in programming mode. Disconnect power and be happy, your ora-1 works.

Usage

Power and DCC

Connect your 12-18V AC Model Train Transformer to P3, connect the DCC signal cables with P2. It is also possible to bridge P2 and P3 and get both, Power and DCC from the tracks.

Version 1 – Turnouts and Signals

Connect your Turnouts to screw 1 to 3 of every Connector K1 to K4. Screw 1 is the green output, screw 3 is the red one. Screw 2 is Power (black cable at most turnouts).

Version 2 – Motor driven Turnouts

Connect your Motors to screw 1 and 3 of every Connector K1 to K4. ORA-1 is suitable for 5-18V DC-motors. Use mode 3, see below.

Setting up ORA-1

ORA-1 has 8 working modes:

Mode Function
0 Turnout decoder for solenoid driven devices, Pulse duration 0,25s
1 Turnout decoder for solenoid driven devices, Pulse duration 0,5s
2 Turnout decoder for solenoid driven devices, Pulse duration 1s
3 Turnout decoder for motor driven devices, Pulse duration 2s
4 Light signal decoder, 4 signals with 2 lights each
5 Light signal decoder, 2 signals with 3 lights each, one signal with 2 lights
6 Light signal decoder, 2 signals with 4 lights each
7 Trafficlight decoder

You can select the mode when sending a turnout command while ORA-1 is in programming mode. To enter programming mode press the button at ora-1. LED D2 will Light to indikate programming mode. Select the mode by sending the according turnout command. After ORA-1 received the DCC Command LED D2 will be off.

Example:

You want to setup ORA-1 for your motor driven turnouts No. 13 to 16. Mode 3 is the right one for motor turnouts. So you have to send a DCC command to the “green” output of Turnout 2 of this ORA-1 board. Turnout 14 equals Turnout 2 at the 4th ORA-1 board (every board is able to power 4 turnouts). To setup ORA-1 send the DCC command for the green output at Turnout No. 14.

Questions ? ;-)

Pictures

3D Picture from Kicad

Prototype picture

Picture of the prototype ORA-1 assembled with all the parts needed for signals and solenoids. (forget the trimmer, it’s only to adjust the voltage for motor switches)

ora-1a.jpg

Prototype picture

Picture of the prototype ORA-1 assembled with all the parts needed for motor switches.

ora-1b.jpg