Geoff Bunza geoffb

With exactly the same low cost hardware and a library of examples ready for anyone to download and use, you can now configure six “mobile or multifunction” decoders to respond to DCC Functions and a similar set of six Accessory decoders to respond to DCC Switch commands. The neat feature is that the Accessory decoders ALSO respond to a programmable single mobile decoder address, so you can configure each of the 17 pins to perform different functions, including their use as a 17 servo accessory decoder driver. This has been updated (Jan 12, 2014) with a Back and Forth Servo configuration in the Examples-- see later comments. The library was updated again Feb.15,2015  to add a new pulsed output function per channel in the Examples folder-- See later comments. As of Sept 16,2015 two new decoder varriants have been built-- See: http://model-railroad-hobbyist.com/node/20739?page=8#comment-209513 (Page 9 of this Blog). Most reccent Update can be found here: SMA20 New Low Cost 17 Channel DCC Decoders with PC Boards & Dual Motor, LED, & Servo Control    https://forum.mrhmag.com/post/sma20-low-cost-17-channel-dcc-decoders-ver-6-01-with-soundtriggered-soundstepperdual-motorled-and-12201920

l%281%29.JPG 

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
Geoff Bunza geoffb

12 pre-configured decoder variations —10 reconfigurable per pin

Hopefully (for me) this will be the last release (for a while) of this decoder series. The original details can be found here: https://forum.mrhmag.com/post/sma12-17-channel-configurable-multifunction-5-dcc-decoder-for-servos-12198051 ), and an update here: https://forum.mrhmag.com/post/sma-13-update-to-the-17-pin-configurable-multi-function-decoder-accessory-decoder-version-added-12198262 . This is a good example of why a modeler might get interested in using the cheap Arduino Pro Mini’s—with NO change in the hardware,  you can make many interesting variations to suit your modeling needs. This project(s) has taken me beyond where I originally wanted to go. The great interest on the part of many modelers all over the world has spurred this work on, rather than leave the many, great, suggested changes as “an exercise to the reader!”

What is new here is a slightly different kind of Accessory decoder that you can also access as a “mobile” or “multifunction” decoder so you can configure the functions at each pin, but as an accessory decoder these will respond to DCC Switch commands not DCC Function set commands. You have six of each provided, preconfigured. This is not an original idea, just a little different one.

The new libraries and examples can be downloaded from here:  http://mrhpub.com/files/users/geoffbfiles/new-dual-multifunction-decoderv5_4.zip
and are also be made available on the Model Railroading with Arduino website:  http://mrrwa.org/  

(If you download from http://mrrwa.org/  make sure the file date is after Dec. 21, 2014).

Installation is the same as described previously. Delete your previous version and simply replace it with the new NMRADcc folder (Old examples will not necessarily work with this edition).

There are 12 preconfigured Decoders in the examples ready to roll:

Mobile/Multifunction Decoders:               Accessory Decoders w/Dual Addresses for CV Programming:

Decoder_15_Servos_1LED_4Function        AccessoryDecoder_15Servos_2LED_4Function

Decoder_13Serv_4LED_4Function              AccessoryDecoder_13Servos_4LED_4Function

Decoder_10Serv_7LED_4Function              AccessoryDecoder_10Servos_7LED_4Function

Decoder_7Servos_10LED_4Function          AccessoryDecoder_7Servos_10LED_4Function

Decoder_17LED_4Function                          AccessoryDecoder_17LED_4Function

These 2 Configurations are simpler LED drive per pin only:

Decoder_17LED_1Function                          AceesoryDecoder_17LED_1Function

The servos are preconfigured on the lower numbers of pin, contiguously, followed by the “LED” drivers. The name of the files says it all, so pay attention. Remember you can set each pin to do to what function you would like, including a 19 servo driver. Load them into your Pro Mini and you are good to go! If you haven’t read the earlier entries in the series, they will tell you how to build and load the Arduino Pro Mini (which when last I checked were still going for $2.25 quantity one -- http://www.ebay.com/itm/230795578198 ).

Included below is a brief description of a detailed working example for a 7 servo 10 LED configuration that may help people configure their own versions for their particular modeling needs. Before changing the CV settings take a look at the initial settings and make small changes first to observe the effects. This should give modelers a starting point, and a better understanding for customizing their decoders.

I doubt very much that I would have pursued all these variations, especially the accessory decoder variants, without the interest and enthusiasm shown by scores of modelers, literally, around the world. To all of you—many sincere thanks! And special thanks to Alex Shepherd for his work on the original NMRADcc library!

One last thing, for those with DC layouts I will soon release a low cost, fascia panel, pushbutton operated servo/switch controller for turnout operation via servos. No commitment yet for ETA though! [smile]

Comments and appropriate suggestions are always encouraged.

Have Fun.  Best regards, and Merry Christmas,

Geoff Bunza

Decoder Configuration Details

The multfunction decoder examples all for 4 functions to be assigned to any of the 17 available pins: on/off control, single line blinking with variable rate, servo control with start position/stop position/transit rate CV setting and end to end control via the function (on/off), and paired line blinking with variable rate.

When first loaded the decoder is set to short DCC Mobile address 24 and/or Acecessory decoder address 40. The decoder can be reset to the original parameters by loading CV 120 with 120 (decimal). This will reset everything including the decoder address, when the pushbutton on the Pro Mini is pushed (reset) or by powering the decoder off then on. You will know when the default CV setting are being reset as the decoder will flash Digital Pin 14 (A0) for one second. The multifunction decoder address can be changed to another short DCC address by changing CV 1. The accessory decoders have 2 addresses: the Accessory range start Address is in CV1 and the multifunction address (with which you can program CV's for the Accessory decoder functions) in CV 121 and 122

The 7 Servo 10 LED decoder configuration

Arduino Pro Mini Pins are set as follows: 3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19

Pro Mini Pin          Function

3                                  F0 Servo

4                                  F1 Servo

5                                  F2 Servo

6                                  F3 Servo

7                                  F4 Servo

8                                  F5 Servo

9                                  F6 Servo

10                                F7 Single LED Blink

11                                F8 Single LED Blink

12                                F9 Single LED On/Off

13                                F10 Single LED On/Off

14                                F11 Single LED Blink

15                                F12 Single LED Blink

16                                F13 Double LED Blink F13 and F14 LEDs (Pins 16 & 17)

17                                F14 Single LED Blink (Ignored because of F13)

18                                F15 Double LED Blink F15 and F16 LEDs (Pins 18 & 19)

19                                F16 Single LED Blink (Ignored because of F15)

(Blink rates are set differently for demonstration purposes)

Correspondingly, for the 7 Servo 10 LED decoder configuration, CV’s are initially set to the following:

{CV number, Value}    Description

{1, 24}  Decoder Initial Address

{30, 2}, //F0 Config  0=On/Off,1=Blink,2=Servo,3=Double LED Blink

{31, 1},    //F0 Rate  Blink=Eate,PWM=Rate,Servo=Rate

{32, 28},   //F0  Start Position F0=0

{33, 140},  //F0  End Position   F0=1

{34, 28},   //F0  Current Position

{35, 2},  //F1 Config  0=On/Off,1=Blink,2=Servo,3=Double LED Blink

{36, 1},    // Rate  Blink=Eate,PWM=Rate,Servo=Rate

{37, 28},   //  Start Position Fx=0

{38, 140},  //  End Position   Fx=1

{39, 28},  //  Current Position

{40, 2},  //F2 Config  0=On/Off,1=Blink,2=Servo,3=Double LED Blink

{41, 1},    // Rate  Blink=Eate,PWM=Rate,Servo=Rate

{42, 28},   //  Start Position Fx=0

{43, 140},  //  End Position   Fx=1

{44, 28},    //  Current Position

{45, 2}, //F3 Config  0=On/Off,1=Blink,2=Servo,3=Double LED Blink

{46, 1},    // Rate  Blink=Eate,PWM=Rate,Servo=Rate

{47, 28},   //  Start Position Fx=0

{48, 140},  //  End Position   Fx=1

{49, 28},    //  Current Position

{50, 2}, //F4 Config  0=On/Off,1=Blink,2=Servo,3=Double LED Blink

{51, 1},    // Rate  Blink=Eate,PWM=Rate,Servo=Rate

{52, 28},    //  Start Position Fx=0

{53, 140},    //  End Position   Fx=1

{54, 28},    //  Current Position

{55, 2}, //F5 Config  0=On/Off,1=Blink,2=Servo,3=Double LED Blink

{56, 1},    // Rate  Blink=Eate,PWM=Rate,Servo=Rate

{57, 28},    //  Start Position Fx=0

{58, 140},    //  End Position   Fx=1

{59, 28},    //  Current Position

{60, 2}, //F6 Config  0=On/Off,1=Blink,2=Servo,3=Double LED Blink

{61, 1},    // Rate  Blink=Eate,PWM=Rate,Servo=Rate

{62, 28},    //  Start Position Fx=0

{63, 140},    //  End Position   Fx=1

{64, 28},    //  Current Position

{65, 1}, //F7 Config  0=On/Off,1=Blink,2=Servo,3=Double LED Blink

{66, 1},    // Rate  Blink=Eate,PWM=Rate,Servo=Rate

{67, 1},   //  Start Position Fx=0

{68,35},  //  End Position   Fx=1

{69, 1},    //  Current Position

{70, 1}, //F8 Config  0=On/Off,1=Blink,2=Servo,3=Double LED Blink

{71, 1},    // Rate  Blink=Eate,PWM=Rate,Servo=Rate

{72, 1},   //  Start Position Fx=0

{73, 100},  //  End Position   Fx=1

{74, 1},    //  Current Position

{75, 0}, //F9 Config  0=On/Off,1=Blink,2=Servo,3=Double LED Blink

{76, 1},    // Rate  Blink=Eate,PWM=Rate,Servo=Rate

{77, 1},   //  Start Position Fx=0

{78, 10},  //  End Position   Fx=1

{79, 1},    //  Current Position

{80, 0}, //F10 Config  0=On/Off,1=Blink,2=Servo,3=Double LED Blink

{81, 1},    // Rate  Blink=Eate,PWM=Rate,Servo=Rate

{82, 1},   //  Start Position Fx=0

{83, 5},  //  End Position   Fx=1

{84, 1},    //  Current Position

{85, 1}, //F11 Config  0=On/Off,1=Blink,2=Servo,3=Double LED Blink

{86, 1},    // Rate  Blink=Eate,PWM=Rate,Servo=Rate

{87, 1},   //  Start Position Fx=0

{88, 5},  //  End Position   Fx=1

{89, 1},    //  Current Position

{90, 1}, //F12 Config  0=On/Off,1=Blink,2=Servo,3=Double LED Blink

{91, 1},    // Rate  Blink=Eate,PWM=Rate,Servo=Rate

{92, 1},   //  Start Position Fx=0

{93, 20},  //  End Position   Fx=1

{94, 1},    //  Current Position

{95, 3}, //F13 Config  0=On/Off,1=Blink,2=Servo,3=Double LED Blink

{96, 1},    // Rate  Blink=Eate,PWM=Rate,Servo=Rate

{97, 1},   //  Start Position Fx=0

{98, 35},  //  End Position   Fx=1

{99, 2},    //  Current Position

{100, 0}, //F14 Config  0=On/Off,1=Blink,2=Servo,3=Double LED Blink

{101, 1},    // Rate  Blink=Eate,PWM=Rate,Servo=Rate

{102, 1},   //  Start Position Fx=0

{103, 4},  //  End Position   Fx=1

{104, 1},    //  Current Position

{105, 3}, //F15 Config  0=On/Off,1=Blink,2=Servo,3=Double LED Blink

{106, 1},    // Rate  Blink=Eate,PWM=Rate,Servo=Rate

{107, 1},   //  Start Position Fx=0

{108, 60},  //  End Position   Fx=1

{109, 20},    //  Current Position

{110, 0}, //F16 Config  0=On/Off,1=Blink,2=Servo,3=Double LED Blink

{111, 1},    // Rate  Blink=Eate,PWM=Rate,Servo=Rate

{112, 1},   //  Start Position Fx=0

{113, 4},  //  End Position   Fx=1

{114, 1},    //  Current Position

{120, 0}   Master Reset CV When set to 120 and Power cycled resets all CV’s

Each Function is controlled by a maximum of 5 CV’s.

For example F0 is initially set for servo control:

{30, 2},     // F0  Pin Function Configuration  2=Servo

{31, 1},     // F0  Rate  Blink=Rate, Servo=Rate

{32, 28},   // F0  Start Position  F0=0  Initially 26

{33, 140},  // F0  End Position   F0=1  Initially 140

{34, 28},    // F0  Current Position or State

F7 is initially set for single LED blinking control:

{65, 1},    // F7 Pin Function Configuration  1=Blink

{66, 1},    // Rate  Blink  1= Slowest

{67, 1},    //  Start Count Set to 1 or 0

{68,35},   //  End Count 2-255 -- 255 = Slow Blink

{69, 1},    //  Current State of LED

F13 is initially set for double LED blinking control of F13 and F14 LED Pins:

{95, 3},    // F13 Pin Function Configuration  3=Double LED Blink

{96, 1},    // Rate  Blink  1= Slowest

{97, 1},    //  Start Count Set to 1 or 0

{98, 35},  //  End Count 2-255 -- 255 = Slow Blink

{99, 2},    //  Current State of LED

F9 is initially set for single LED On/Off control:

{75, 0},    //  F9 Pin Function Configuration  0=On/Off

{76, 1},    //  Ignored

{77, 1},    //  Ignored

{78, 10},  //  Ignored

{79, 1},    //  Ignored

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
HVT Dave

Mind Boggling

Geoff,

The possibilities appear to be endless.  Thank you for helping some of us neophytes cut our teeth with these wonderful little Arduino decoders.  Now to figure out how to implement them into ...........

Merry Christmas to all.

Dave

Dave

Member of the Four Amigos

 

Reply 0
rsn48

This is almost enough to make

This is almost enough to make me want to learn electronics, or at least some of it.

Reply 0
MLee

Thanks,

That is what I like about this site - It just keeps on giving - Thanks for this info.  To be honest, I did not know this stuff existed three months ago.  As I see it this will expand what I will be able to control.  Another place to have fun.  I am doing N scale but I am a closet Lionel guy in having working accessories.

Thanks again,

Mike Lee 

Reply 0
pierre52

Geoff has opened an exciting new world for me

Don't for a moment think that this stuff is beyond you. Geoff has helped me through a solution to a major control problem using these wonderful little boards and as the old saying goes " if I can do it anyone can".  To be sure there is a learning curve but the tiny cost of these things makes it a no brainer.  I can guarantee that if you need help you will get a rapid and helpful response on this forum.  Think of an idea and ask some questions the water here is warm so dive on in.

Peter

The Redwood Sub

Reply 0
debaker02

YOU ARE AWESOME

This is amazing, I was just thinking about this kind of stuff. 

Do you have any pointers on how to make this thing speak to a loconet?  Even if this means using RR circuit kits loconet to simple serial bus.  

David

Reply 0
Geoff Bunza geoffb

@David ( debaker02 ) re:Loconet

Hi David,

You may already know that the Digitrax loconet uses a different protocol and a different electrical interface than the DCC signals on the tracks. The loconet cable carries the Railsync signals on 2 of the wires in the cable which is a copy of what is transmitted to the tracks-- this you can interface to with these decoders. Railsync is a lower power signal. You can get your own copy of the loconet specs here: http://www.digitrax.com/support/loconet/loconetpersonaledition.pdfand an over view here: http://www.digitrax.com/support/loconet/loconetoverviewapp.pdfboth off the Digitrax site. I do know that there has already been work done to interface Arduinos to the loconet. Start here: http://www.scuba.net/wiki/index.php/Arduino_Loconet and you can google arduino loconett interface and come up with more. Arduino libraries have already been written! Again, this is why I recommend using them-- much work has already been done and they're cheap. Unfortunately, I don't have much interest in the direct loconet interface myself, but other modelers may publish their successes.

Have fun! Best Regards,

Geoff Bunza

 

 

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
Logger01

Embedded LocoNet Site

Seasons Greeting David,

Digging into LocoNet can be fun, but getting into the software and hardware can be a huge time sink. You should probably check out more of Alex Shepherd's work on the Embedded LocoNet pages. In addition to being the primary developer of the OpenDCC Arduino library Alex has also done a lot of the fundamental work by developing the EmbeddedLocoNet Arduino library. The schematic on the LocoDev Board page will give you a sense of what hardware is required to interface to the LocoNet.

One of the best ways to keep up with Alex's work is to follow his Model Railroading with Arduino blog.

Ken K

gSkidder.GIF 

Reply 0
chr15sc

Magic Decoders

Geoff, thanks very much for the effort you have put  in to these decoders. I have been working with DCC most of the year having coded my own DCC controller using Picaxe. I did this because I could not afford to buy a system and the MiniDCC system did not do what I wanted. I wanted to control the engines with a knob not a button. Having seen the first of this series I saw the 17 functions and immediately had to adjust my controller software to accommodate them. Now I ned to tet=st these new decoders to make sure my software works with them, The first ones worked "out of the box".

Happy Christmas Chris

Reply 0
Geoff Bunza geoffb

@Chris

Hi Chris,

If you were successful with one of the others this new set should all work fine. I tested each one on the same hardware as before with no changes. Just remember to replace the NMRADcc library that you had loaded before with the new one. All 12 Decoder configurations are in the Examples folder.  Also remember that you can change the configurations in the sketch too (probably obvious).

Have Fun! 

Best regards and Merry Christmas,

Geoff

 

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
chr15sc

NmreDcc Libs

Geoff, please clarify the following for me.

The Libs I have encountered are NmraDcc then NmraDcc1 then ,the latest, is NmraDcc. I have changed to the very latest one as you have instucted. Does the latest Lib supersede all the previous ones and can I remove NmraDcc1? Using only the latest for all of your decoders to date changing the #include... as required.

Chris

Reply 0
Geoff Bunza geoffb

@Chris re: :Libraries

Hi Chris,

Yes, the latest Library supercedes all the prior ones. The accessory decoder required some minor changes and I wanted to get back to compatibility the Alex Shepherds changes that he incorporated as a result of this decoder series. If you started with either of the preceding libs, some of the preceding examples will not work with this latest version, so all examples have been updated and included with this last release (and all have been tested too),

Do not try to leave the prior versions in place (unless you don't want the new version) or you will run into subtle problems. The good new is-- it's a straightforward swap. If the old version is all you need you don't have to change-- the old one works too, There were allot of requests for the accessory decoder versions, so I tried to accommodate them.

If you modified the old examples to suit your own needs and they work-- that's great just don't update. If you want to update and use your own modified code, you may have to start over from one of the new examples provided. But if you are only using the provided versions-- you are good to go with the new update.

Currently, I have no plans to continue adding new decoder versions, but I have said that before! 

Best Regards,

Geoff

 

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
lceggering

parts list

forgive me if it has been posted, but do you have a parts list and recommended sources?

Lawrence Eggering

CEO, COO and head engineer of the WDCNP Lines.

Reply 0
Geoff Bunza geoffb

@lceggering rearts

Hi lceggering (sorry Mr CEO you didn't list your name),

There are a sries of Blog entries SMA10, SMA12, & SMA13 (found here: http://model-railroad-hobbyist.com/blog/geoff-bunza)that have additional info. That said, here is some relevant info for you:

Construction Materials and Notes:

Arduino Pro Mini atmega328 5V 16M    (  from EBay:   http://tinyurl.com/kexh66b)   $2.59
(This price varies. I've seen it as low as $2.25. Search Ebay for "Pro Mini." Price often includes free shipping.

Digikey example parts (http://www.digikey.com):
160-1791-ND                   6N137 OPTOCOUPLER HS LOGIC OUT 8-DIP         0.73
493-5914-1-ND                CAP ALUM 220UF 25V 20% RADIAL            0.38
P5149-ND                        CAP ALUM 22UF 25V 20% RADIAL              0.20
445-8421-ND                   CAP CER 0.1UF 25V 10% RADIAL                 0.29
BC1018CT-ND                CAP CER 270PF 50V 5% RADIAL                  0.35
CF14JT10K0CT-ND        RES 10K OHM 1/4W 5% CARBON FILM      0.10
CF14JT5K10CT-ND        RES 5.1K OHM 1/4W 5% CARBON FILM     0.10
1N5819-TPCT-ND           DIODE SCHOTTKY 40V 1A DO41                 0.39

LEDs: try looking for some at Surplusgizmos.com like Part Number LBT30W2C-CUA-C   3mm LED 20ma Bright White 15,000 MCD  0.30     or at Allelectronics.com like CAT# LED-83  3mm diameter T-1 LED. Ultrabright white   0.95

I usually buy white LEDs and then color them with Clear Tamiya paint to suit the situation.Learn more about using LEDs here: http://model-railroad-hobbyist.com/magazine/mrh-2012-02-feb/points_of_light

The boards I use can be found here:  http://tinyurl.com/lkhpkmd    They're cheap, double sided with plated through holes.

Construction Comments Addendum
1. Use only the library I provided in the Zip file, previous editions will not work.
2. The green LEDs used as Function indicators are especially bright even with very low current. With a 10K dropping resistor normal LEDs you might have may not light up. Try using a lower value resistor -- closer to 1K for more normal LEDs. (I get these from surplusgizmos.com listed as 3mm green LED).
3. To get the LEDs to fit side by side on .1inch centers, I used a sanding disk mounted in a moto tool to sand the sides down just a bit in parallel with the LED pins. They are plugged into an IC socket cut and soldered to the board-- it keeps them in somewhat neat order.

'Hope this helps. Have Fun! 

Best regards,

Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
Quackers69

Perfect! Thank you.

Geoff,

I just finished installing the pro mini with your code (modified with your help to provide pulses-thanks again).  It works great.  I can switch 6 switches with either pushbuttons, by selecting address 24 with functions, or using i2c with another pro mini that is monitoring a tv remote.  I was just thinking I wonder if anyone has written code for accessory dcc packets because I would rather use the switch functions for turnouts.  I researched the nrma standard to try and understand mobile and accessory packets and decided it was beyond me to modify the code.  Then I check out your blog and you've already done it.   Thank you!    Larry

Now I have to update my code

 

 

Reply 0
Babbo_Enzo

Well, friends, GOOD

Well, friends, GOOD NEWS!

despite some family problems here on the new year jump... I've "breadboarded" ?....  one sample of the accessory decoder and it's working very well with my NCE system.

Now what next? I've still to try to configure a sample Panel in JMRI to drive my future signal.

See here : http://jmri.sourceforge.net/help/en/html/tools/signaling/SignalingSetup.shtml

http://jmri.sourceforge.net/help/en/html/doc/Technical/Names.shtml#systeminfo

and here for NCE systems specific: http://jmri.sourceforge.net/help/en/html/hardware/nce/NCE.shtml#names

My idea was to configure one decoder as "all inputs" to read the block and occupancy sensors,

Well... my dumb!!! It's NOT POSSIBLE as DCC protocol don't do this possibility! I've just forget it, my old two neurons was in a coffee-break pause! So the two only ways to solve this problem are: a) replace the DCC library with a Loconet protocol library AND wiring a separate bus for inputs" decoders ORb) but is valid ONLY for NCE users , use the NCE MiniPanel ( that basically is a CAB emulator on the NCE CAb Bus!  Have to think about this a bit....

and a second decoder type ( or more depending on signals head quantity ) as "all outputs" to drive my signals heads LEDs. "maybe" this need some ( hope light!) modification to be able to select via CV (complicated?) a) drive a bicolor led obtaining 3 colors (Red-Green-Yellow) orb) drive a couple of consecutive outputs as Red-Green signal..... we see....

Anyway don't expect a rapid implementation from me as now I'm busy with "real life" , sorry.

When I've some more feedback to share I will report sure.

Happy new year to all the RR gang!

Reply 0
Paul55

Newbie Question

Geoff,

I’m a Newbie when it comes to DCC and I was hoping you would help me out when it comes to using your 17-MULTIFunction-Decoder board. I loaded the Arduino code as is and then loaded it again after un-commenting the “#define DECODER_LOADED”. I have a NCE Power Pro throttle connected to the input pins. With a scope, I can see the data going to the input of the Arduino board. The LED with current limiting resistor that I connected to the designated F0 pins, blinks momentarily when I power-up or press the reset button..

  1. When I set the throttle to Program Track Mode I enter a CV of "30" and it says it can’t read the CV. Should it be able to see the current CV value?
  2. When I set the throttle to Main Track Mode, I enter the Address of “24” and set CV “30” to “1”. Should the LED start blinking?
  3. I also tried setting CV “31” to “1” and nothing happened.

What am I doing wrong (or right) ?

Thank You,

Paul Jacques

Reply 0
Geoff Bunza geoffb

@Paul Re:CV Reading

Hi Paul,

Quote:

When I set the throttle to Program Track Mode I enter a CV of "30" and it says it can’t read the CV. Should it be able to see the current CV value?

Short answer, No. The library I used for these decoders appears to have some support for reading CV's, but I did not implement any CV read functions (via the DCC bus) at all.  For my purposes I just didn't think it was important. Remember you can "set" any CV you want in the list by simply changing the appropriate value in the sketch before loading. Normally, once I decide what I want the decoder to do, I set the respective CV's in the sketch and then leave it so it always reloads the CV's on power up. CV changes would then only last until reset or power cycling. This is just my personal preference, you can handle it any way you would like.

Quote:

When I set the throttle to Main Track Mode, I enter the Address of “24” and set CV “30” to “1”. Should the LED start blinking?

If you set up a multifunction decoder, after setting CV30 to 1, you would need to turn Function 0 "ON" (F0 address 24) before the connected LED should blink (assuming a LED is connected correctly to the Pro Mini pin D3).

If you set up an accessory decoder, after setting CV30 to 1, you would need to throw Switch 40  before the connected LED should blink (assuming a LED is connected correctly to the Pro Mini pin D3).

Quote:

I also tried setting CV “31” to “1” and nothing happened.

CV 31 would only control the blink rate assuming CV30 is set to 1.

'Hope this helps. Ask questions if I'm not clear, and have fun! 

Best Regards,

Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
Paul55

Paul Re:CV Reading:

Hi Geoff,

      Thanks for the help, it works just as you described! I'm working on an animation that has a stubborn mule kicking backwards and the guy trying to push him leaning back at the same time to avoid getting kicked., The servo action would be forward and then back to complete a cycle. Your servo board requires an additional command to return the servo back to it's start position. Would it be possible to add a servo function that would command the servo one direction and then back to its start position with just one command?

 

Thanks,

Paul

   

Reply 0
Geoff Bunza geoffb

@Paul re: Kick Ass Animation

Hi Paul,

Quote:

Would it be possible to add a servo function that would command the servo one direction and then back to its start position with just one command?

In a word... Yes.   (For an animation example -- Of Course!  [smile]  )

You can download the updated library and examples here:

http://mrhpub.com/files/users/geoffbfiles/new-dual-multifunction-decoderv5_4.zip

In the examples you will find "AceesoryDecoder_7ServoBackandForth.ino"

This skecth will implement an accessory decoder (7 servos) where ALL servos configured will swing from start to stop and back to start, quickly. If you need the original type of servo control, use one of the other configurations and build another decoder. Note that the Servo rates (CV31,36,41,46,51,56,61) are all set to 3. Lowering the setting will slow the transition, increasing the rate increases the transition speed.

Also, in exec_function (int function, int pin, int FuncState) you will find:

case 2: {   // Servo
      if ((ftn_queue[function].inuse == 0) && (FuncState==1)) {  // We have an OFF-> ON transition
        ftn_queue[function].increment = char ( Dcc.getCV( 31+(function*5)));
        ftn_queue[function].start_value = Dcc.getCV( 32+(function*5));
            ftn_queue[function].stop_value = Dcc.getCV( 33+(function*5));
        for (servo_temp=ftn_queue[function].start_value; servo_temp< ftn_queue[function].stop_value; servo_temp=servo_temp+ftn_queue[function].increment) {
          set_servo(function,servo_temp);
          SoftwareServo::refresh();
          delay(4);
          }
        for (servo_temp=ftn_queue[function].stop_value; servo_temp> ftn_queue[function].start_value; servo_temp=servo_temp-ftn_queue[function].increment) {
          set_servo(function,servo_temp);
          SoftwareServo::refresh();
          delay(4);
          }

Changing the delays highlighted will also affect the speed of the servo throw-- hence the "kick." They do not have to be equal so the kick back could be arranged to be fdaster than the recovery if you so wanted.

The servo will ONLY move when switched from thrown to closed. You will have to switch back to thrown after the cycle is completed, and then switch to closed to activate the servo again.

'Hope this helps.  Have fun!  [smile]

Best Regards,

Geoff Bunza

 

 

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
MartinDk

Great work - but....

Hello,

Very nice work, and i intend to try if i can get it to work despite my limited skills.

As far as i can see, you take the track signal, and convert it to a straight 5v dcc signal instead of whatever voltage that is actually on the track (12v for my n scale layout)...  Is that correct?

If correct, could i then just add multiple decoders to the same 5v dcc signal in parallel?

How many arduino decoders in parallel could be added?

/Martin

 

Reply 0
Geoff Bunza geoffb

@Martin D re:Multiple Arduinos

Hi Martin,

Yes, you are correct the 6N137 converts the DCC signal to a 5V signal and it isolates the Arduino circuit from the DCC bus.

You should easily be able to drive more than one Arduino from a single 6N137 output. The limiting factor may very well be the capacitive load that the 6N137 has to drive. Try to keep you wire runs from the 6N137 as short as possible. I would think you should be able to drive maybe 4-8 arduinos, maybe more?

Have Fun. Let me know how many you succeed in using.

Best regards,

Geoff Bunza

 

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
Geoff Bunza geoffb

New Library Update for Pulsed Output Function

Hi,

Here is the new updated library for all to enjoy:

http://home.comcast.net/~gbglacier/Articles/New-Dual-MULTIFunction-Decod...

Note that there are 2 new examples in the library: an accessory decoder and a function decoder with all 17 pins configured as pulse outputs. The CV controlling the rate/increment stores the pulse duration 1-255 which is configured in tens (10's) of milliseconds. They are currently set at 10 for a 100 (1/10 second) pulse every time the function is set or the accessory switch is thrown.

I do NOT recommend you mix these with servo outputs in the same decoder as the timing for the servos will be disrupted.

'Hope this helps! Have Fun!  

Best Regards,

Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
dogz

how to get it to work with JMRI

Well i have built the circuit but it is not talking with JMRI via a sprog2. I am very new to DCC although i have some familiarity with loading programs onto arduinos thanks to the multi copter hobby. 

first is a request, from what i can see there isnt programming track feedback for this decoder and also the command station cant "read" the decoder.  is there a way to add this functionality to this hardware set. 

second
I have not yet succeeded in getting it to receive the dcc signal. I have gone over the schematic and am pretty sure everything is how it should be, although there could be a mistake. 

Can someone advice how to setup(add to the roster) the decoder in JMRI. 

 

dogz

 

 

Reply 0
Reply