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

HVT Dave's picture

Additional I/O on the Arduino Pro Mini?

Geoff,

Is there a particular reason you don't use pins A6 and A7?

Installed the Arduino IDE and downloaded the latest .zip files from both of your decoder projects and the LocoNet files from http://mrrwa.org  Spent several hours at http://arduino.cc/ 'Learn' and 'Resources' trying to get my head around the basics.  A look at SparkFun and AdaFruit tutorials will be next.  Still waiting for the boards from China.

LocoNet accessories use sensor and switch address numbers rather than a DCC address and functions as found on your projects.  Any comments?

A sincere thank you for your inspiration, it is causing me to get outside my comfort zone and learn something new!!!

Dave

Dave

geoffb's picture

@Dave IO Pins

Hi Dave,

It is one of the vargarities of the Atmel mega328P processor that all pins can be used as digital outputs except pins A6 and A7, which can be analog inputs only.

The OpenDCC people (google them) if I remember correctly are also focused on Loconet. I have not focused on Loconet, even though I use Digitraxx systems. My localized animations sometimes use DCC sound decoders like the Digitraxx SDN144PS because I can completely reprogram not only the sounds in them, but the sound sequencing and control as well. This is not for the faint of heart! While I have learned a great deal about decoders, DCC and timing of such, I would not recommend this course for the casual modeler-- really. Nonetheless, one can take these cheap microcontrollers, make them into DCC base stations, throttles, and decoders, as well as operate completely independently of DCC to model some really neat scenes and ideas. In doing so, I can control DCC powered models and those that are not. They can work with DC layouts and DC systems. It is the flexibility of working with the combination that fascinates me. They're low risk (very low cost) and high payback options. But I always try to focus on their modeling value. There are allot of other people and places to learn about the depths of these devices if your interests take you there too.

Above all, have fun!

Best regards,

Geoff Bunza

 

A6 and A7

Dave,

A6 and A7 were not wired to pins on the original SparkFun designed Pro Mini. Pins for A6 and A7 were added on one of the latest revision ( I think rev.14) of the board. Second A4 and A5 and now A6 and A7 pins were are not laid on 0.1" centers so they can not be used on standard 0.1" x 0.1" perf board (See image of back of board below). Beware some boards from China do not use the latest design revision and do not have A6 and A7 wired. So if you install any of the A4 - A7 pins you will not be able to mount it in standard perf boards without drilling new holes. You will also not be able to mount a board with these pins installed in a solderless prototype breadboard.

Ken K

HVT Dave's picture

@ Geoff and Ken

Thanks for the info.  As analog inputs it looks like the A6 and A7 pins should work just fine with push button switches so I will plan that way.  I am aware of the spacing of the A4 - A7 pins and short pieces of wire will fix that.  The boards coming from China have the A6 & A7 pins on the end like the board in Geoff's first post, also with non-standard spacing.

The first application I am working on is modeling a roadway with servos used to control the routes and stop points for Faller cars on the layout.  Just trying to add detection feedback into the mix which I believe is not possible thru DCC.  The learning continues.

Thanks again,

Dave

Dave

pierre52's picture

@Ken & Geoff

Many thanks for your helpful and informative responses.  I am currently working my way through the LadyAda tutorials and will continue to work through the various other links you provided. A long time ago I used to do some Dbase IV programming but have nil experience with C. On the plus side my son in law is a professional programmer so I have assistance on tap.

From what I have seen so far tho a Uno R3 Starter kit seems like it might be a good idea. Mainly because I have very little of the extra bits needed to get the basic skills under way.

in the meantime lots more learning to do smiley

Peter 

The Redwood Sub

the optocoupler

Could you please explain that bit between the track bus and the optocoupler.  Is that diode just a half wave rectifier?  Is it chosen for some critical value?  This whole discussion is making my brain bleed but I can't stop. And would end it be easier and less noisy to connect to the locobus rather than the track?

Michael the Confused

geoffb's picture

@Michael re: Optocoupler

Hi Michael,

Inside the optocoupler is a photodiode (like a LED) that turns on for half of the symmetrical (excepting pulse stretching) DCC signal. The resistor limits the current to the photodiode since the DCC signal switches fom +14 to -14 Volts (or close). The external diode is a fast switching diode which protects the optocoupler LED when the DCC signal is reversed. The LED can't handle the reverse voltage present in the DCC signal. The small capacitor (270pf) together with the resistor acts as a low pass filter, reducing the high frequency noise to the fast optocoupler, often found on the DCC bus.

I don't know the detailed specs for the loconet (only used by Digitrax) and I haven't interfaced to the loconet directly so I can't comment on that.

"Hope this helps.

Best regards,

Geoff Bunza

 

LocoNet vs DCC

Hi Michael,

It is possible to interface decoders to LocoNet; however, this would limit the decoders to those DCC systems that support LocoNet. Geoff's design should work with any DCC system. Also note that LocoNet interfaces and the supporting software are many bits more complicated.

Ken K

Optocoupler bits

Geoff,

The diode that you used, the 1N4152, is difficult to find and, according to Fairchild, has been obsolete for 4 years.  The 1N4148 is is half as fast (4ns rather than 2ns) but otherwise the sameish.  Am I missing something or would that work?

Ken,

I see that the loconet interface is more bitsy, but why is it more codey?  I don't really know enough about DCC to ask an intelligent question here so I'll have settle for reeeeeeally basic ones.

Michael the Confused

HVT Dave's picture

LED as a diode

Michael,

I read somewhere this week that an LED has been used in place of the diode so that you can see if there is track power connected so I suspect that the specific diode is not that critical.  The 1K resistor works with many LEDs.

BTW I do agree that if you have LocoNet you can bypass some of the electrical noise found on the rails.  Also I believe you should be able to pull the DCC signal off the Railsync pins on the LocoNet cable. 

Most of the components have arrived and I plan to build both a LocoNet version and a DCC version this weekend.  Then will come the Arduino code learning curve.  laugh

Regards,

Dave

Dave


>> Posts index


Journals/Blogs

Recent Blog posts: