SMA12 - 17 Channel Configurable Multifunction $5 DCC Decoder For Servos

geoffb's picture

One of my earlier entries:  SMA10 – Build a 17-Function DCC Decoder for about $5 ( http://model-railroad-hobbyist.com/node/19070 ) generated a considerable amount of interest regarding the possible enhancement for controlling Servomotors (Servos). This is my next version of a 17 Channel Multifunction DCC Decoder based on a low cost $2.56 Arduino Pro Mini. This version supports configuring each of the 17 function pins for On/Off (LED/TTL) Control, or Configurable Blinking Control, or Configurable Servo Control, or Configurable Pairs Blinking Control. Yes, that does mean it can support 17 servos, each with rate, start point, and end point setting via DCC CV’s, per pin, as well as new LED configurable functions. Read On. Additional doc found here: http://model-railroad-hobbyist.com/node/19775 There is another decoder version added herein. Look for "New Decoder Version to Control Lighting Groups" in Page 12 of the Comments: http://model-railroad-hobbyist.com/node/19446?page=11   The most recent Update can be found here: SMA20 New Low Cost 17 Channel DCC Decoders with PC Boards & Dual Motor, LED, & Servo Control    http://model-railroad-hobbyist.com/node/24316

Comments

geoffb's picture

@Stan re: setting servo speed

Hi Stan,
In the description you mentioned that a higher value  will speed up the servo travel. Could you tell me what is the highest value ( quickest travel speed I can use) or what I am doing wrong
First, you should use the latest library of decoder sketches. Go to SMA20 New Low Cost 17 Channel DCC Decoders & Dual Motor,LED, & Servo Control Updated: 6 Ftns/Pin & New Features  http://model-railroad-hobbyist.com/node/24316  and find the latest version here:  http://model-railroad-hobbyist.com/sites/model-railroad-hobbyist.com/files/users/geoffbfiles/new-dual-multifunction-decoderv5_4.zip  This is the version I will refer to. 
 
Individual servo speed is controlled 2 ways:
Each servo has a CV (the second CV in each group of 5) which affects the rate -- slowest is 1 increase the number to increase the speed but I would recommend you set the number between 1 and 64. 64 will be fast.
 
Next, using the  5.4 library find the line:
#define servo_slowdown  3   //servo loop counter limit
increasing servo_slowdown will have a dramatic decrease in ALL servo transit times. servo_slowdown=1 will be the fastest, increasing to 10 will make it very slow.
 
'Hope this helps. Have fun!  smiley
Best regards,
Geoff Bunza

Food for thought

So many possibilities! Thanks for sharing.

Tom

geoffb's picture

@Tom

Hi Tom,

You are most welcome.

Even though there are many comments to wade through, there are even more variations reported in the comments.

Enjoy and have fun!  smiley
Best regards,
Geoff Bunza

optocoupler 6N137

Hi Geoff,

would there be a reason not to use this optocoupler: CNY17? Here a NPN transistor can be switched as either open collector or as emitter-follower. It is not as fast as the 6N137 but more flexible; and I have plenty in stock.

Grts, Erik

 

geoffb's picture

@Erik re:6N137 substitute

Hi Erik,

Unfortunately, the CNY17 is likely not going to work. It looks to be more than 100 times slower than the 6n137 and is similar to a couple of opto-couplers I tried before settling on the 6N137. Like you, I had acquired a number of these slower couplers via surplus sales over the years. It might be a "learning" exercise to try a few of the CNY17's. The ones I tried either never worked at all, or generated errors under different operating conditions. There is a possibility you might be able to "select" a few that will work out of a large number, which is sometimes done in industry. I don't think this is worth it, and I would just go with the 6N137. Also, I have seen people omitting the 270pf capacitor C8. I recommend it always be included, based on my actual experimentation and results.
'Hope this helps. Have fun!  smiley
Best regards,
Geoff Bunza

@Geoff: re:6N137

Hi Geoff,

thank you so much for your concise and detailed reply! So amazing that although we are thousands of miles apart we get almost instant replies!! Indeed I will not waste time with the CNY17.

I am planning a Eagle schematic and board using SMD: would I be able to upload the .sch, .lbr and .brd files here for others' use?

If not, I would send them to you for your use.

Grts,

Erik

 

geoffb's picture

@Erik re: New Board

Hi Erik,

I would be delighted for you to share your work. For files I want to share with others, I usually create a zip file, as it is usually smaller, and zip files are readily accepted here on the MRH site, and in many email servers. If you have trouble uploading (you can use the link icon above and upload the zip file) you can also send it via a private message (PM) and I'll make sure it is put right.

Good luck with your project. Have fun!  smiley
Best regards,
Geoff Bunza

@Geoff: question about examples in library for this project

Hi Geoff,

for the link: do you mean the one in the commentary section, second row, third from right?

As soon as ready I will upload the zipped files.

About the examples in the NmraDCC folder from this project download, there is an example "Dec_15Serv_2LED_6Ftn" as well as "AccDec_15Servos_2LED_6Ftn" but no "Decoder_15_Servos_1_LED_4FTN" as per your description above page 1.

Did I miss something?

Grts,

Erik

 

geoffb's picture

@Erik

Hi Erik,

for the link: do you mean the one in the commentary section, second row, third from right?

Yes, that is correct. If you hover over it with your mouse pointer "Link" should appear.

About the examples in the NmraDCC folder from this project download, there is an example "Dec_15Serv_2LED_6Ftn" as well as "AccDec_15Servos_2LED_6Ftn" but no "Decoder_15_Servos_1_LED_4FTN" as per your description above page 1.

Did I miss something?

No, you did not miss anything... I did! My apologies. The article has since been corrected to correspond to the Version 5.4 download:

There are two folders in the zip file: NmraDcc and SoftwareServo

If you have set up and installed the Arduino development code from http://arduino.cc/en/Main/Software  (Read on for details)

Then copy both folders to \My Documents\Arduino\libraries on yourcomputer. Then look for examples in NmraDcc and you will find Dec_15Serv_2LED_6Ftn,Dec_13Serv_4LED_6Ftn, Dec_10Serv_7LED_6Ftn, and Dec_17LED_1Ftn.

Respectively representing pre defined decoders with 15 Servos F0-F14 and 2 LED F15-F16, 13 Servos F0-F12 and 4 LEDs F13-F16, 10 Servos F0-F9 and 7 LEDs F10-F16, and last 17 LEDs F0-F16 like the original decoder I presented.

I very much appreciate you pointing this out. Many thanks!  yesyes
By the way, where are you located?

Have fun!  smiley
Best regards,
Geoff

@Geoff

Hi Geoff, it is my pleasure.

And my location: https://tinyurl.com/r7o6bpz

Gent, Belgium, right near this place above (by the way: the cathedral had its scafolding removed last year.
Best of greetings,
Erik
 

>> Posts index


Journals/Blogs

Recent Blog posts: