DCC
Function Decoder
Usually locomotive decoders control motor and locomotive lights depending on march sense, some even have a pair of outputs to control other accessories like the smoke generator or the cabin lights.
Standar DCC allows to control up to 28 additional functions in each locomotive, to add functions you can fit in the locomotive or in a wagon a function decoder that allows to activate devices with the same address that controls the locomotive decoder, we can install in a wagon a function decoder to activate the inner light or the tail light at the same time the lights of the locomotive.
There are several homemade function decoders that usually are PIC based like the one of Georg Ziegler , here you can find different function decoders
TuShuuu | Function decoder with sound |
DCC-Func | Function decoder with 4 outputs |
DCC-Func5 | Function decoder with 5 outputs |
DCC-Func-Servo | Function decoder with 2 servo and 2 outputs |
DCC_Rail | RailCom transmitter with light and brake functions |
TuShuuu. Function decoder with sound
I have made a simple decoder with few components based on the PIC 16F628 that controls 2 outputs and adds sound, I called it TuShuuu.
The sound generator is based on the operation of the Ay-3-8910 chip that was the one that have computers like the ZX Spectrum, or Oric Atmos or Amstrad CPC.
Basically is a white noise generator of which we can select its base frequency and a tone generator of which also we can select its frequency. Taking advantage of that the PIC can generate a variable voltage we can select the volume or to select an envelope type for the sound selecting the period or making to vary it in agreement with the speed of the locomotive.
With the defect values indicated in the manual of TuShuuu programmed in the CV of the function decoder we will get a sound of steam locomotive that we can activate with F1 and changes with the speed, a whistle that we activated with F2 and FL and BL outputs activated in agreement with the direction of travel when we activate the lights of the locomotive. Click here to hear a steam locomotive accelerating and whistling.
As you see in the schematic you have to connect the DCC signal (track) to connector JP1. As we are not going to generate a sound of high fidelity, the loudspeaker can be a simple piezo buzzer (I have found for scale N one of 11mm of diameter and 9mm of height) or a tiny loudspeaker of a toy or a telephone (I have one of 27mm of diameter and 8mm of height), it can be connected a LED for the frontal light between FL and ground and for the back LED between BL and ground, if output is going to consume more than 10 or 15mA or it is needed to feed the accessory with track voltage you have to use a NPN transistor on each exit. In order to program the PIC you use this HEX file. The source programm for the PIC is here .
TuShuuu have to be programmed with the same values that the locomotive decoder in CV1, CV17, CV18, CV19 and CV29. The activation of the functions and the sound can be done with the CV33 to CV38 and the characteristics of the sound with the CV49 to CV58. See the manual for details.
Carlos Viva has sent me the design of the PCB and a photo of sound decoder installed in a H0 wagon. In the photo you can see welded capacitor to one of the bridges and to another capacitor because in the prototype he forgets to include this capacitor (C5). Also he puts an adjustable pot (not in the PCB), to adjust the volume, it is a variable resistor in series before the loudspeaker. Also he has used a 7805 instead of 78L05 and normal diodes instead of the rectifying bridge.
Fernando Rey has sent me a new design of the PCBe, but smaller (50x15mm), and a photo of sound decoder installed in a N scale wagon.
Function decoder with 4 outputs v.2
This small SMD decoder has 4 outputs, you can also mount in normal size if you have enough space.
Can be configured as 4 independent outputs controlled by F0 and F1 to F8 functions or as fluorescent lights controlled by F0 function. Can work in analog and DCC digital modes and can be programmed in PoM mode.
The manual can be downloaded here, if you want to build your own PCB or identify componets see this tutorials.
You can download the program for the PIC here. When programming the PIC12F629 you have to save the last programm address value , so it will be convenient to read first the PIC and remenber the value, program and check the last address contents.
Function decoder with 4 outputs v.3
This is a new version for the tiny function decoder with 4 outputs in SMD format.
Has 4 independent outputs controlled by F0 and F1 to F28 functions, or while is stand or drive. For every ouput can be selected an effect between incandescent light, fluorescent, broken fluorescent and flashing.
Furthermore, permits to detect the phase of the DCC signal, so it can be used as tester to tune layout with several boosters or as tester of the type of power in our layout like this one that Salus send me:
Can work in analog and DCC digital modes and can be programmed in PoM mode.
The manual can be downloaded here, if you want to build your own PCB or identify componets see this tutorials.
You can download the program for the PIC here. When programming the PIC12F629 you have to save the last programm address value , so it will be convenient to read first the PIC and remenber the value, program and check the last address contents.
Function decoder with 5 outputs
The dccFunc5 decoder is a function decoder specially created for lighting with LED diodes controllable by a short or long locomotive address with 5 outputs.
It has 5 programmable outputs that are fed directly from the PIC, selectable with functions F0 to F28, or with the locomotive stopped or running for each direction or DCC polarity of the rail. Function outputs can have incandescent, fluorescent or flashing light effect and brightness selection.
The decoder internally incorporates the resistors for the LEDs. It can be used with the PIC12F629 or the PIC12F683.
This decoder uses the board developed for the UniSemaf25 so it only works with DCC, its use in analog is not planned.
You can download the manual and the program for the PIC here. When programming the PIC12F629 you have to save the last programm address value , so it will be convenient to read first the PIC and remenber the value, program and check the last address contents. The PIC must be programmed with the corresponding HEX file before mounting it on the board.
dccFunc5 decoder definition for JMRI |
Function decoder with servo
This small decoder has 2 servo and 2 outputs, to open doors of rolling stock, etc.
Can be configured to be controlled by F0 and F1 to F8 functions. Can work in analog and DCC digital modes and can be programmed in PoM mode.
The manual can be downloaded here, if you want to build your own PCB or identify componets see this tutorials.
Hans sended me some photos of his decoder to open the doors in a wagon.
You can download the program for the PIC here. When programming the PIC12F629 you have to save the last programm address value , so it will be convenient to read first the PIC and remenber the value, program and check the last address contents.
Function decoder with servo v.3
This is a new version for the tiny function decoder with 2 servo and 2 outputs.
Can be controlled by F0 and F1 to F28 functions, or while is stand or drive. Each servo can have 2, 3 or 4 stop positions.
Can work in analog and DCC digital modes and can be programmed in PoM mode.
The manual can be downloaded here, if you want to build your own PCB or identify componets see this tutorials.
You can download the program for the PIC here. When programming the PIC12F629 you have to save the last programm address value , so it will be convenient to read first the PIC and remenber the value, program and check the last address contents.