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

rovilazz's picture

17 Channel Configurable Multifunction DCC Decoder For Servos

Hello Geoffb.
I found this today your wonderful, wonderful site.
I am interested in achieving the 17 Channel Configurable Multifunction DCC Decoder For Servos.
Looking at the schematic but I did not understand where they connected the SERVO_PIN_CONNECTORS F1 to F16. Must be connected to the Arduino pin removing resistors and LEDs?
Thank you and congratulations!
Roberto from Italy.
geoffb's picture

@Roberto Re: SERVO_PIN_CONNECTORS F1 to F16.

Ciao Roberto,

where they connected the SERVO_PIN_CONNECTORS F1 to F16. Must be connected to the Arduino pin removing resistors and LEDs?

The servo pins labeled F0 to F14 connect to the wires (above in the schematic diagram)  labeled F0 to F14. For example Sevo Pin F1 would connect to Pro Mini D4 (this is the number on the inside of the Pro Mini rectangle in the diagram -- the schematic editor has number 7 on the outside of the rectangle), Correspondingly, Servo Pin F0 connects to Pro Mini D3, SP F2-D5, SP F3-D6, SP F4-D7, ... through SP F14-D17/A3.  What is not shown in the diagram, but explained in the schematic text is that SP F15 connects to D18/A4 and SP F16 connects to D19/A5. Different Arduino Pro Minis locate the A4 and A5 connections in different places on the Pro Mini Board. Since this was a blog entry, I did not explain every detail. With new found hindsight, given the amazing popularity of this project, I should have written it up with the attention I usually give to articles-- my fault.  sad

If you use high value current limiting resistors in series with the LEDs, so the LEDs draw little current-- say 1ma or less, you can leave the LEDs in place. Otherwise I would suggest you remove them completely when driving a servo with the same pin.

I'm very glad you can make use of this project! Have fun and share your modeling with us!

Best Regards,

Geoff Bunza

 

rovilazz's picture

@GeoffB Re: SERVO_PIN_CONNECTORS F1 to F16.

Mr. Geoff Bunza, thank you for the detailed answer ... and fast.
I have an Arduino Uno rev.3 and I intend to adapt your project to this version of Arduino. If I can I will post my work.
Many many thanks again for your kindness.

Roberto.

geoffb's picture

@Roberto Re: Using the Uno

Hi Roberto,

You should not have any problem using the Uno R3. You can also use a "Servo Shield" or a "Breadboard Shield" with the Uno to make the Servo connections easier. (You can google these to read up on them if you are not already familiar with them.)

If you are going to power more than 1-2 servos, I suggest you use a separate 5 Volt supply for the Servos because the instantaneous current demands can sometimes cause errors. That is why my circuit diagram adds the filter capacitors. This is a precautionary design measure. I have successfully powered 4 servos with a Pro Mini and did not experience any noticeable problems-- but this was not a thorough test at all.

Have Fun. Best Regards,

Geoff

 

 

Thank you for this useful

Thank you for this useful sharing!

In my modular diorama I will be using 18 switches. 6 of them needs servos (they are not motorised), so for 6 of them I can use your sharing directly! Thank you!

but 12 of the switches are already motorised. I use Lima switches (they are cheaper in my region). It needs 14V AC current to operate; but I guess 10-12V DC will also work fine with these switches. 

My main problem is: My switches have 3 cables. One is ground. Two 14V ac. When circuit is closed, one switches to right. The other cable switches back to left... What I need is a relay control. When I choose to change the switch from my dcc controller, relay should be opened for 1 second, when I choose to change the same switch to its original position, another relay should be opened for 1 second. By this, I can control one switch with two relays.

To give an example for what I need: 

Let's say at adress 15 of my dcc controller, there is one switch. When I click it to change direction, one led connected to Arduino should lighten up for 1 second. When I click the same switch to change direction again, another led should lighten up for 1 second. By this, I can use two relays for one switch and control 8 switches with one Arduino. 

I have very limited programming skills. If you can help me out, I'll be very happy. :)

geoffb's picture

@huseyinozsut

Hi (name?),

The easiest way for you to accomplish what you would like to do is to use one of the 17 function decoders in the simplest on/off  (configuration 0) mode and connect pairs of outputs to 5 volt DC relays at each output and toggle them on/off or find in my blog the code for the decoder that was requested to "pulse" the output when selected to activate the relays. You could then use the contacts from the relay the way you use your switches now.

A suitable relay would be something like: 5 VDC DPDT DIP RELAY CAT# RLY-625 from allelectronics.com: http://www.allelectronics.com/make-a-store/item/rly-625/5-vdc-dpdt-dip-r...

or from Digikey.com: RELAY GEN PURPOSE DPDT 2A 5V  part# 399-11056-5-ND:  http://www.digikey.com/product-detail/en/EE2-5NU/399-11056-5-ND/4291122

'Hope this helps.

Best regards,

Geoff

 

 

 

@geoffb

First of all thank you for your help. :) My name is Huseyin.

I actually think to use ready switch setups (16 relays that connect directly) for arduino. It is easier to set up. Before posting my message I searched your blog; but I couldn't find a pulse code. My technical English is also not so good. I may have missed out it. I made a search from this site; but couldn't find again. Can you give me the link?

I need to make the pulse code work for me; because I want to use PC based dcc system in the end and maybe I start to get automated some easy lines...

geoffb's picture

@Huseyin re:Pulsed Output Functions

Hi Huseyin,

First let me apologize for sending you looking in my blog listings-- I searched every one myself and I discovered the pulsed function sketch was never published. However, here it is in the new updated library for you (and everyone else too):

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!   smiley

Best Regards,

Geoff Bunza

 

@geoffb

Thank you for the code! :) I'll be trying it soon and won't use servos and relays together. :)

need additional pins?

This may be the answer to the problem of less servos to accomplish additional functions - inputs, indicators, etc.

http://www.adafruit.com/products/732

I've used this with both the Adafruit and the Pololu arduino compatible boards. Does require I2C pins on the miniPro which I assume it has. Can chain up to 8 chips on the bus with 16 I/O pins per chip.

Gary


>> Posts index


Journals/Blogs

Recent Blog posts: