Geoff Bunza geoffb

One of my earlier entries:  SMA10 – Build a 17-Function DCC Decoder for about $5 ( https://forum.mrhmag.com/post/sma10-%E2%80%93-build-a-17function-dcc-decoder-for-about-5-12197796 ) 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/19775There 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    https://forum.mrhmag.com/post/sma20-low-cost-17-channel-dcc-decoders-ver-6-01-with-soundtriggered-soundstepperdual-motorled-and-12201920

Bemchtop.JPG 

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 2
stan urbaniak

servo speed

Hi. I builded decoder using a arduino nano, everything works perfectly (15 servos version)but I tried to change servo rate ( speed) without an a success. 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. I am complete noob with dcc++ but I am finding the topic very interesting. Thank you for your help

Reply 0
Geoff Bunza geoffb

@Stan re: setting servo speed

Hi Stan,
Quote:
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  https://forum.mrhmag.com/post/sma20-low-cost-17-channel-dcc-decoders-ver-6-01-with-soundtriggered-soundstepperdual-motorled-and-12201920  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! 
Best regards,
Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
Tom

Food for thought

So many possibilities! Thanks for sharing.

Tom

Reply 0
Geoff Bunza geoffb

@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! 
Best regards,
Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
Erik A. Erik84750

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

 

Reply 0
Geoff Bunza geoffb

@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! 
Best regards,
Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
Erik A. Erik84750

@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

 

Reply 0
Geoff Bunza geoffb

@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! 
Best regards,
Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
Erik A. Erik84750

@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

 

Reply 0
Geoff Bunza geoffb

@Erik

Hi Erik,

Quote:

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.

Quote:

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! 
By the way, where are you located?

Have fun! 
Best regards,
Geoff

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
Erik A. Erik84750

@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
 
Reply 0
Erik A. Erik84750

@Geoff: zipfiles uploaded

Hi Geoff,

I just finished a version of the PCB, can you please have a look at the files and let me know what your opinion is on the following:

1. 2 versions are available: one on a 10x5cm PCB (uploaded) and one on a compact 6x5cm version: what do you prefer?

2. I made F15 and F16 available on the same pinheader type (1x3) as the other outputs: is that ok or you want else?

3. F15 and F16 are to be taken from A4 and A5: these pins however have different locations depending on the version of the Pro-Mini, so I took liberty to use a wire from these pins to the board (marked A4 / A5): is that ok or you want else?

4. I included a 7805 1A regulator instead of a straigth 5V inpuit: ok?

5. Is the spacing of the pinheaders ok or too wide?

6. I still have to rearrange the top silkscreen to avoid vias interrupting text.

Looking forward to your comments,

Erik

/sites/model-railroad-hobbyist.com/files/users/Erik84750files/Geoff%20Bunza(1).zip

 

Reply 0
Geoff Bunza geoffb

@Erik re: Questions

Hi Erik,

Quote:

1. 2 versions are available: one on a 10x5cm PCB (uploaded) and one on a compact 6x5cm version: what do you prefer?

I always prefer smaller board sizes because the production cost is proportional to the board area, and I am normally trying to fit these into small places for concealment.

Quote:

2. I made F15 and F16 available on the same pinheader type (1x3) as the other outputs: is that ok or you want else?

This sounds like a good idea.

Quote:

3. F15 and F16 are to be taken from A4 and A5: these pins however have different locations depending on the version of the Pro-Mini, so I took liberty to use a wire from these pins to the board (marked A4 / A5): is that ok or you want else?

This sounds like a reasonable solution to the Pro Mini variations problem. This may be difficult to implement.

Quote:

4. I included a 7805 1A regulator instead of a straigth 5V inpuit: ok?

This is fine too. But... are you sure you want and can get a 200uF capacitor at at least 8 Volts in a SMD 1206 package (C2)  and a 100uF cap (c5) at a higher voltage in a SMD 1206 package?? The higher voltage needs to be whatever voltage you will feed the regulator plus 25% margin. For a typical 7805 regulator that is likely to be 8V + .25*8 = 10 Volts minimum.

Quote:

5. Is the spacing of the pinheaders ok or too wide?

They look fine.

It looks like you have some problems with the board layout:
1. Grounds are not connected to the F0-F16 pin triple pin headers
2. The "-" to the X1 connector is not connected to anything
3. It looks like you intend to populate the board with all the LEDs per function. If you do this and try to connect these to servos, you will likely find the servos will not operate correctly in all situations. Also remember that you have a LED on the Arduino board as well
4. If you can get a set of design rules from the PCB fabrication house you will use, you may be able to load these into Eagle to help you check for board layout errors. Run the Eagle error checks for the schematic (ERC) and Board (DRC) before you fab the board.
5. Ground is not connected to pin 5 on the 6N137.
6. It looks like there are many other ground lines not connected on the board layout.

These are major errors. You need to closely examine your board before fab. There may be more errors. I did not perform a comprehensive review. Also remember to check your parts availability and costs.

Have fun! 
Best regards,
Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
Erik A. Erik84750

@Geoff: PCB review

Hi Geoff,

many thanks for your professional review!

For the caps I use 1206 sized components, they are rated to 16V. But indeed for the input of the 7805 I will try and revert to a regular elco. As a consequence I may have to bring the pinheaders at closer spacings: I will see what can be done.

The LED's and their resistors are optionally installed, not required.

I will make two versions: the current one (which has the advantage of 2 mounting holes present) and the compact version.

For the A4 / A5 issue, please let me know if you have an alternative solution. I have a number of boards where I use this solution, so any different way of mounting will be worth looking at.

Concerning the ground (GND) issue: I use a polygon GND plane on the back of the PCB. When opening the file in Eagle you may have to apply the "Ratsnest" command which will show all ground connections including the "missing" GND (ground tracks). You may also close all layers except "Dimension" and "Unrouted": you will see no unconnected components are present.

I will rework the present board and upload both for your review.

When fabricated I will upload a picture of a finished (soldered) board, and send you one by mail. Parts are (at least for me here in Europe) readily available although for the SMD they may have to be purchased by the 100 (but at a cost of about €1 or €2 per 100).

Kindest greetings!

Erik

Reply 0
Geoff Bunza geoffb

@Erik

Hi Erik,

Quote:

For the A4 / A5 issue, please let me know if you have an alternative solution. I have a number of boards where I use this solution, so any different way of mounting will be worth looking at.

Given that there is no one way of accounting for the A4 / A5 layout on the Arduinos, I would try to assume each would need a small length of wire. I would probably try to put the attachment holes on the board outside of the Arduino outline near the edge of your board, or some place where soldering the two wires would be easy.

Re: Grounds -- very nicely done! This is the first time I've seen a modeler use this technique. Bravo!

Have fun! 
Best regards,
Geoff

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
Erik A. Erik84750

@Geoff: board/PCB update

Hi Geoff,

thank you for your kind comments.

Attached are two files: 1. the gerber files for this board and 2. the .sch, .brd and .lbr files for the updates per your comments

I used the cam processor, ERC and DRC settings for Elecrow, a Far East company that I use for several years; they produce good quality, at about USD 5 plus shipping for 5 boards of 100x100mm. Since my board measures 60x50 they can panelize to 10 decoder boards per order.

Following changes were applied:

1. board size reduced to 63x49mm

2. managed to include one M3 mounting hole

3. had to reduce spacing between headers to 150mil

4. All LED and their resistors are optional

5. Track size for power routes: 40mil

6. A4 is connected to F15, A5 is connected to F16. There is a small mix-up on this in the schematic but the board is ok. When male pinheaders are used on the Pro Mini and on the board then 2 pairs of Dupont female connectors on wires will do the job. Due to space constraints I had to change F15 and F16 to 2-pin headers.

7. A large elco (470uF or larger) can be fitted at the input of the 7805.

Unless you would like additional changes I will place an order for this board. Once received I will populate a few and send you one: can you please pm me your postal address?

Kind regards,

Erik

EDIT: I corrected the small mistake (see 7.), uploaded version v2a.; and oriented all LED's same direction.

/sites/model-railroad-hobbyist.com/files/users/Erik84750files/decoderSMA15_Bunza_v2a.zip

/sites/model-railroad-hobbyist.com/files/users/Erik84750files/decoderSMA15_Geoff_Bunza_v2a_schematics.zip

 

Reply 0
Reply