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

@Gary

Hi Gary,

Consider the distinct feature that a second Arduino Pro Mini costs less than a MCP23017.

Not to say that I couldn't invent a reason to use this -- I can. But I have yet to use all 17 function pins myself, and pushed it to the limit in the project to demonstrate its utility.

Nonetheless, thanks for pointing out the expander. Others might have the need that I don't.  Have fun !  smiley

Best regards,

Geoff Bunza

Parts

Hi 

Please forgive the ignorant question but I am new to both the model railroad hobby and electronics so going through a very steep learning curve but DCC and full computer control is what has interested me in the hobby. I am trying to match up the parts list to the schematic. There seems to be more parts in the list than in the schematic. E.g. the parts list has a 1N5819-TPCT-ND and a 1N5819FSCT-ND but the schematic only refers to a 1N4152. This has confused me somewhat. Should I be looking at another schematic in conjunction with the one one this post? Also Capacitors 3 to 5 are not in this schematic. Is that because they are no longer required? Thanks in advance

Purnima

...

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.

Wow, 8*16...that's 128 outouts from a single chipset??!

I CAN see a use for it, though.  Let's suppose you want to run a city full of lights...instead of each streetlight requiring it;s own decoder, you'd have each light on an output.  This would be limiting in the total effects that the light could have, they'd would be either on or off...software may be able to supply random flickering.

---------------------------------------------------------------------------------------------------------

Benny's Index or Somewhere Chasing Rabbits

geoffb's picture

@Purnima re: Parts

Hi Purnima,

The schematic diagram is correct. Either a 1N5819, or a 1N4152, or a 1N4148 can be used here. I usually use what I have on hand in my collection of components collected over many years. Sometimes those parts are out of date/no longer readily available, so I will suggest others that people can get. All these are small signal diodes. All will work.

Capacitors 3 to 5 are not in this schematic. Is that because they are no longer required?

They don't exist in this project. My blogs are usually written at the end of a project that I may have been working on for weeks, sometimes months. In this case there is a story behind this project. I originally put the DCC circuit together and it worked-- but not always -- and it became very frustrating. After a week I isolated the problem to noise spikes on the DCC bus in the test setup I built. I noticed that circuits shown on the web had added a filter after the 6N137 circuit, so I tried a similar circuit. It helped a bit, but was not completely effective. Moving the "filter" to the front end, with what amounted to be C8 ad R18 solved the problem in every example that I could inflict on the decoder. Along the way, I probably re-worked the circuit a dozen times, adding, changing and removing components over a 2 week period. I even consulted with other designers how they might approach the problem. Sometimes, what looks simple is the end result of an involved process. My thoughts are that most modelers don't care about that-- they want to know what works -- period. The end results are what I put here.

This blog, and its corresponding schematic are the end result of that effort. Hence the gaps in the component number assignments, which the drawing program simply increments one at a time as I add components. By trying new designs, and then eliminating components as the design evolved, I created gaps in the numbering sequence. Just ignore them.

A close examination of my circuit boards may also show you that from time to time I will add power filtering capacitors here and there. This is also part of my attempt to defeat problems along the way. The schematic and description in the blog act as the design of "record," and that's what works.

'Hope this adds some clarity. Keep building -- you will create some satisfying results -- and smiles!

Have fun!  smiley

Best regards,

Geoff Bunza

 

@Geoff re: Parts

Thank you so much for the quick reply Geoff. This clarifies things for me immensely. 

This is great information. Keep up the awesome work. It is very much appreciated.

Now on to the doing.....

Kind regards

Purnima

 

Oberdorfer's picture

word of warning

I have been following some Arduino lessons using the Pro Mini and had no problems until I got to lesson 16, controlling a servo.

I must add that I was using external power for the 5 volts and ground for the servo and the Arduino.  The first part of the lesson was to find the end of throw, you don't actually get 0 to 180 range of motion.  Mine was about 15 to 145.  Worked fine. Then I set it up to use a trimpot to drive the servo, and the sketch was in a loop.  Reading the trimpot and writing, the servo set midway (75), it died.  I figured I had done something wrong and popped in another pro mini.  Again everything worked fine, for a while, it also died.  

The lesson was using the Uno, and driving the servo constantly. 

My conclusion is that driving it repeatedly was too much for the tiny processor.  There was a 25 milisec delay in the loop, but I would make that a whole bunch larger, or do away with looping altogether.  Use a wait command for an input from the user so servo only moves when it is asked to.  

This only applies to the testing/learning process.

 

geoffb's picture

Lesson 16?

Hi,

What Lesson 16 are you referring to? What exactly died? The Pro Mini? What kind of servo are you using? Perhaps a small 9G servo? Was the external 5 Volt power supply connected to VCC or +5 (depending on how it was labeled) or was it connected to RAW sometimes labeled VIN?

If the power supply directly to the servo is independent of the Pro Mini, the Pro Mini will rarely damage itself. If the power to the servo is through the Pro Mini, the servo (particularly a cheap one) can draw at peak over 1.5 Amps which is way too much for the regulator on the Pro Mini to provide. Trying to force the servo to go beyond its end of travel will often cause a higher than normal power drain and should be avoided.

Before you toss the Pro mini, try driving the servo from a different output pin, and also try to load the "BLINK" sketch to see if the Pro Mini is still functioning at its most basic level.

Have fun !

Best Regards,

Geoff

 

 

 

Oberdorfer's picture

lessons

www.toptechboy/arduino

Internet is crazy for how much you can find with a simple search.  Figured that was a good place to start.  9g micro servos, I've already used them with some more expensive controllers.  I am using a powered breadboard to power the servo and the arduino.  The first part of this lesson was to find those end points. The second part was to drive the servo back and forth between those end points.  and it was at idle, when it quit working. I did try to load the blink program.  After they quit working, I can't load anything.  

However, as I sit here with three defective Pro Minis, I have managed to load and run a program, and am beginning to think I may have a bad cable.  I bought 20 of the Arduinos, but only one cable.  Going to order another, see what happens.

 

geoffb's picture

Cables !

Odd that you should have this problem,. I just encountered an intermittent connection in my cable as well -- it drove me crazy until I noticed that when I moved it the Pro Mini would reset and restart for no reason.

Relatively easy fix once you find out what is wrong, but what a distraction ! sad

Have fun !

Best Regrads,

Geoff

 

...

It seems to me with these variation sin servo power levels and currents that it would be wisest to use relays with the control circuit and a separate power supply to power the relays.

This way, no matter what the servo does or however long it runs, there's never any threat to your control circuit.

---------------------------------------------------------------------------------------------------------

Benny's Index or Somewhere Chasing Rabbits


>> Posts index


Journals/Blogs

Recent Blog posts: