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

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
>> Posts index
Navigation
Journals/Blogs
Recent Blog posts:
Comments
Separate Power
Hi Benny,
Separating the power feed to the servos is a good idea especially once you get to powering multiple servos. The current surge and electrical noise the motors generate can be a problem. I don't think the use of relays is either necessary nor generally feasible to control servos.
Have fun !
Best Regards,
Geoff
Geoff Bunza's Blog Index https://model-railroad-hobbyist.com/node/42392
More Scale Model Animation videos at https://www.youtube.com/user/DrGeoffB
Home Page: https://www.scalemodelanimation.com/
...
The whole purpose of a relay is to separate a high power circuit form a low power control interface; it is an electrically powered switch. When the relay receives power from the control circuit, it turns on the servo circuit [completes it], and power turns off, it turns off the power circuit, depending on the delay and the time settings on the relay or if there are any caps in the two circuits, or the settings/qualities of the relay, whereas some will hold until the receive a second signal [so you could put an electrical stop in either direction of hte servo, at it's maximum throw points, and when that circuit is interrupted/completed, it would turn off the circuit/flip the diode/do whatever is needed to turn off the servo.
They're just switches controlled by a power circuit...
---------------------------------------------------------------------------------------------------------
Benny's Index or Somewhere Chasing Rabbits
Relay and Servo
Hi Benny,
I understand what you are saying, and this is do-able. However, a simpler technique is to simply turn off the servo control signal, and the servo will essentially idle.
Best Regards,
Geoff
Geoff Bunza's Blog Index https://model-railroad-hobbyist.com/node/42392
More Scale Model Animation videos at https://www.youtube.com/user/DrGeoffB
Home Page: https://www.scalemodelanimation.com/
LocoNet on the Arduino Pro Mini
Hi Dave
Just built my first arduino project < Geoff's crossing gate
Next is your loconet interface
Is this the final version and have you had it working
I use Railroad and co so presume that it will control and DCC address as normal as long as the device works?
Craig Hepburn
Perth Australia
More Features
Hi Geoff,
about one and a half month ago I've seen your projects for the first time. This is what I'm looking for since years.
You did a fantastic job and I enjoy it very much. Thanks a lot for this.
Your question about other feature came to the right time and I have some ideas.
Colorlight signals in Germany change the signal aspect by dimming the light and not only switch on and off.
This looks great and maybe it's the same for US signals.
Further there are diffenrent signal aspects and you have combinations like double red, green, green + yellow, double white and so on. If it is possible to combine output pins by a CV, a single F-Key could show the signal aspect.
For semaphore signal powered by a servo it would be nice if the servo moves a bit for and back while the signal has reached his endposition. This function could also be used by railroad crossing gates.
Thats it for the moment and thansk again
BR
Loeter
@Loeter re: Enhancements
Hi Loeter,
I'm very happy you can use this in your modeling -- Enjoy.
I think your last point is requesting a semaphore "bounce" as the servo arm reaches its maximum travel. That should be possible, although I'm going to have to think about how the timing should go. One of the big issues in designing the decoder is managing independent timing for up to potentially 17 independent servos. This will make the loop timing a bit more tricky. Do you want the semaphore to bounce at both ends of travel? I'm going crazy right now getting my animation clinics ready for the NMRA national convention next month, so I will have to put this in the queue to take a look at later.
The signaling issues and dimming the LEDs likely requires a little more information, as I am just plain ignorant concerning German railway signal standards. A single LED can be "dimmed" by using pulse width modulation (PWM) like commercial decoders do for motors and some do for dimmable LEDs. But consider the fact that if you add "LED dimmed" as a state then you have On, OFF, and Dimmed or 3 different states or conditions for a LED. How would you like to control this LED with one Function Key? Cycle through them? Each time you turn a function ON then OFF? So to get to all 3 LED states you would have to hit the Function Key 4 times, or to get back to the original state 6 times? (Ftn ON,OFF,ON,OFF,ON,OFF say to go from LED OFF, DIM, ON, and back to LED OFF)?
Likewise if you are trying to cycle pairs of LEDs how do you want to do that with one Function Key?
This is the problem I come to when I see:
The first thing that needs to be done is to explicitly define what behavior you would like to see. Then I can groan
and see if I (or some really clever person) can come up with a way to accomplish what you would like. There are many modelers outside the US who are using some form of this decoder, so some modeler may have tackled this problem already. Think about these issues, Loeter, and see if you can define a bit more precisely what you might need. Perhaps it is obvious, but this design has evolved way beyond what it was originally designed to do -- to control simple animations! ...and that's great!
Have fun!
Best Regards,
Geoff Bunza
Geoff Bunza's Blog Index https://model-railroad-hobbyist.com/node/42392
More Scale Model Animation videos at https://www.youtube.com/user/DrGeoffB
Home Page: https://www.scalemodelanimation.com/
Hi Geoff, here you can see
Hi Geoff,
here you can see the soft changes of the signal aspects: https://www.youtube.com/watch?v=37TEaiu0XZE
For each signal four F-keys are required. If you press for exaple F0 two red LEDs are on all others off, F1 green LED is on all others off, F2 green and yellow LED are on all others off, F3 one red LED and two white LEDsi are on all other off. I hope this explains the situation.
Best Regards
Loeter
@Loeter re: Signal Changes with fading
Hi Loeter,
After seeing the video you provided, I can see why you would like the fading on and off to be incorporated-- it is a really good effect. This is also relatively easily done. You can make some simplifying assumptions to make it workable. Also using 4 Function keys to set a group of LEDs makes this workable too. To be precise, four function keys (say F0-F3) would control a set of 5 LEDs: 2 red, 1 green, 1 yellow, and 2 white? Does this account for the full pattern? I think we could use CV's to set the pattern of each group of LEDs for each function, so you could get anything you want for each function and each group, but you need to be precise as to how many LEDs total are in each group. For example, are the lower and upper signal groups controlled independently? How many green, yellow, red, and white LEDs would actually need to be controlled independently?
I would approach this as a separate decoder, not as an additional assignable function. There is precedent for one function to control multiple LEDs, but the coding for this signaling would be easier if we treated it as another version of a decoder. It also could be configured as an accessory decoder too. What do you think?
Have fun!
Best regards,
Geoff
Geoff Bunza's Blog Index https://model-railroad-hobbyist.com/node/42392
More Scale Model Animation videos at https://www.youtube.com/user/DrGeoffB
Home Page: https://www.scalemodelanimation.com/
Led fading
It seems to me you could use a capacitor to achieve the fading. If you put a capacitor in parallel with the LED, when the power came on the capacitor will charge up and during that period the voltage should rise and the LED would fade up to full brightness. When the power was cut off from the LED, the capacitor with discharge through the LED causing it to gradually dim. It might take a fairly chunky capacitor, I don't know how to do the math so I would probably figure it out empirically. Might need a resister to deal with the inrush current of a capacitor that large.
LEDs don't work that way
An LED works at a fixed voltage, changing the voltage will only delay when the LED turns on/off, so we have to do it a different way. You might see a difference if you varied the current over the operating range of the LED, but I don't think it would really be noticeable and it would not start at off, it would be on and may get brighter, so we have to do it another way.
What we do is trick our eyes into thinking the LED is dim and gets brighter by Pulse Width Modulation (PWM), of which the Arduino pro mini has 6 pins that can do that. Other versions of the Arduino have more/less PWM pins. To create this PWM signal we use the function analogWrite, what happens under the hood is the Arduino pulses the LED with an square wave on/off. The pulses are at the full voltage needed for the LED to operate, length of the on pulse is determined by the value passed to analogWrite. As the on pulse width increases the amount of time the LED is on increases. The LED turns on and off with these pulses, but this happens so fast we can not see the individual pulse, our eye averages the pulses giving the impression the LED is dim and gets brighter. There is example code provided with the Arduino IDE to do a fade, it starts the LED off, fades up to full "brightness" and then fades back down to off, and continues as long as there is power to the Arduino.