You're reading ...

Arduino DCC Function Servo Sound decoder

Railway hobby friend Erik Holewijn came with the idea to add sound to the Arduino Function / Servo decoder. And moreover … he had created the Windows PC software to make it possible!

In a joint effort, we shared some ideas and worked them out together. We’re proud to present here … the combined Arduino DCC Function / Servo / Sound Decoder with accompanying PC sound software.

Sound_DecoderWhat can be done with the DCC decoder is:
•    Control digital outputs (max 16)
•    Control servo motors (max 12)
•    Control playback of sounds on a PC that is connected via USB
•    Start / stop of a function can be delayed for a specified time

You do not need to be a software expert to create your own function decoder. All that needs to be done is to configure the functions, the servos and the sounds. It’s all explained in the User Manual.

The software plus a User Manual will be available for download over here as soon as it has had it’s final touch. Please check back in a few days, we will add a new post when it is here. is available for download over here (edit 2015-02-15)

Function config:
accessory[0].address = 1; // The DCC address to react to
accessory[0].mode = 3; // 1=Continuous, 2=Oneshot, 3=Flasher
accessory[0].outputPin = 13; // Arduino Pin where the hardware is connected to
accessory[0].outputPin2 = 12; // Every Flasher has 2 outputs with opposing states
accessory[0].invert = 0; // 0=output HIGH if DCC enabled, 1=output LOW if DCC enabled
accessory[0].playsound = 1;  // 1=plays a sound via DCCSound.exe, which sound is configured there
accessory[0].ontime = 300; // Time that outputPin is HIGH and outputPin2 is LOW
accessory[0].offtime = 700; // Time that outputPin is LOW and outputPin2 is HIGH
accessory[0].ondelay = 2000; // Delay in ms before function switches on after DCC enabled
accessory[0].offdelay = 4000; // Delay in ms before function switches off after DCC disabled

Servo config:
servos[0].accessorynumber=0; // CONNECTION BETWEEN FUNCTION (accessory[n]) AND SERVO
servos[0].servo.attach(10); // Arduino pin number where servo is connected to
servos[0].angle=70; // Angle of servo. Make this the same as offangle to avoid startup jitter
servos[0].offangle=70; // Setpoint angle when DCC disabled
servos[0].onangle=110; // Setpoint angle when DCC enabled

Sound config: DCC address , soundfile , duration (0=no limit) , min_random_repat_time , max_random_repat_time



About RudyB



5 thoughts on “Arduino DCC Function Servo Sound decoder

  1. Hallo Rudy,

    Gefeliciteerd met je uitstekende website met alle informatie over Arduino en hoe hiermee decoders te bouwen!
    Ik heb inmiddels bij wijze van proef enkele van je decoders met succes nagebouwd. Het betreft de accessory en de servo decoder.
    Bij die servodecoder heb ik wel een vraag. Die servodecoder gebruik ik om wissels om te zetten. Bijkomend wil ik die servodecoder ook gebruiken om een bistabiel (latching) relais aan te sturen dat op het einde van elke servobeweging geactiveerd wordt. De contacten van het relais worden gebruikt om het hartstuk van de wissel te polariseren. De mogelijkheid “outputpin” en “outputpin2” worden hiervoor gehanteerd, gelijktijdig met de “oneshot” optie. Probleem is dat die pinnen alleen geactiveerd worden bij één bepaalde servorotatie. Draait de servo terug, dan worden de pinnen niet meer geactiveerd. Heb jij een oplossing om bijvoorbeeld “outputpin” te activeren indien de servo in één bepaalde richting beweegt en “outputpin2” in de andere richting?
    Ik heb van alles geprobeerd, maar tot nu toe tevergeefs.
    Zeker en vast dank voor mogelijke suggesties.
    Oprechte groeten, Hans


    Posted by Hans Ledegen | September 16, 2017, 12:15
  2. Hi the link to download does not work cheers Ray.


    Posted by Raymond salter | March 3, 2016, 13:42
    • Monthly download limit at Box is reached. Please use the link called ‘Arduino DCC, S88, and more Download link’ for the complete package on the Software page.


      Posted by RudyB | March 3, 2016, 15:02
      • Thank you down loaded it and have go it working today Rudy much thank you very much for your hard work great cheers Ray.


        Posted by Raymond salter | March 3, 2016, 20:40

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Archive of all posts

%d bloggers like this: