Results 1 to 15 of 15

Thread: Replacing a dead decoder -- the hard way.

  1. #1
    Join Date
    Apr 2008
    Location
    Ashburn, VA, USA
    Posts
    1,503
    Thanks
    311
    Thanked 2,833 Times in 816 Posts
    Mentioned
    54 Post(s)
    Tagged
    0 Thread(s)

    Default Replacing a dead decoder -- the hard way.

    I have an Atlas U23B that cooked its factory decoder well after the warranty period. No knock on Atlas here, I have plenty of engines and they have been rock solid. Things happen. I contacted them to see if they still had replacements, and the answer is no. I highly suspect someone else offers a drop in board for these as they were sold in a DC only variant, I presume with a light board.

    Anyhoo, it's been sitting on the shelf for quite a while. If you follow one of my other threads, I've recently cracked the code on how decode DCC in a PIC16 micro-processor, which means I've made 75% of mobile decoder. And while I know of many DIY accessory decoders, and one or two people who've made DIY decoders for HO or O, I am currently unaware of a hobbiest N scale decoder. (If you know of one, please let me know.)

    And so, in some spare time in the past few days I whipped up a circuit. Then I took out the old board, measured it carefully, and set to work. Turns out these are actually a bit difficult. The board is quite narrow in the middle compared to some other engines, and worse the motor contacts are under the board in such a way that they take up the whole width of the board. So all traces from front to back must be squeezed on the top side.

    But, with fine pitch low volume production and assembly now available to the hobbiest for a reasonable price it can be done!



    I'm not sure it's the prettiest, or best decoder ever designed, but I think it's darn close to something that would work. For the electronics nerds in the house:

    • The "power supply" is at the top, four diodes in a bridge, standard linear regulator to get 5v for the chips.
    • U3, which doesn't have a 3D model for the chip, is a DRV8876 motor driver IC which makes driving the motor a zillion times easier. It has fault protection, and can measure current draw (which I currently don't connect, no pun intended). I've also configured it with a BackEMF tap off the motor output. Around it are the support components. The only notable one is the C8 capacitor, which is the bulk cap for the voltage going to the motor. It's a 1206, and the only large component on the board.
    • U2 is a PIC16F15324 or PIC16F18324. The 18 chip is more powerful, and I know will do the job. I think the 15 chip will also do the job and save a few cents per board. They are pin compatible so the choice doesn't change the design any.
    • Both IC's are UQFN-16 4x4's. Capacitors and resistors are generally 0201. LED's are 0401.
    • Min trace is 0.2mm, power traces are 0.4mm.
    • The board is fully single sided. The existing decoder is double sided, and I could make good use of the back real-estate -- but all the cheap assembly services are for single sided boards only, so I crammed it all on the top.
    • The make "right angle" LED's...that is rather than the LED facing up on a surface mount chip it faces off to the side. The rendering doesn't show that, but I would probably spec bright white versions of those for this application.
    • There is an ICSP header cleverly spaced about the processor. While it's just pads, they are in the 2.54mm pin spacing such that regular pogo pins would work nicely. They have been placed so new code could be loaded on the decoder without removing it from the locomotive.


    I honestly have no idea if I'll try and have such a thing made. I was mostly curious how hard it would be to fit everything in, and the answer is not too hard! There's space out of the processor to control four more functions (F1, F2, F3, F4), but the way to drive them seems to be through a mosfet, and on this board with the narrow middle and no back traces I don't see how it could be done. It would probably be possible to drop two functions off the back end somewhere, but I don't know that such a thing would be useful.

    Really, all the rest of the mumbo jumbo on the decoder sheet is software. All the CV's, options, BackEMF, it would all be code in the PIC. And while I don't think any of it is that hard or complicated, my guess is it would take several hundred hours of coding and debugging to get a basic working prototype. I'm not sure I want to put in that sort of effort.

    I'm putting this out there as a conversation piece for the moment. I'll be curious to hear your comments!
    --
    Leo Bicknell

  2. The Following 13 Users Say Thank You to bicknell For This Useful Post:


  3. #2
    Join Date
    Sep 2019
    Location
    South Mississippi, USA
    Posts
    849
    Blog Entries
    1
    Thanks
    6,054
    Thanked 2,318 Times in 526 Posts
    Mentioned
    65 Post(s)
    Tagged
    0 Thread(s)

    Default

    I would like to see this become reality! This is beyond my knowledge of each part of a decoder. It looks like it will work better than the stock decoders that are installed. Only suggestion from me is, if possible make it universal for all atlas and compatible locomotives. Prime example is the Digitrax decoders are trimmed to fit the said locomotives. Where some other brands will fit the overall majority of the atlas and Intermountain locomotives. Because there’s some narrow hood decoders that are not available for certain models. Maybe make contact tabs either in a greater area so that it would fit in said locomotive I.E. expand the area around the contact strips.
    Cheers!
    Clayton

  4. The Following User Says Thank You to MoPac For This Useful Post:


  5. #3
    Join Date
    Jan 2012
    Posts
    1,765
    Thanks
    4,414
    Thanked 3,509 Times in 1,119 Posts
    Mentioned
    115 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by bicknell View Post
    Really, all the rest of the mumbo jumbo on the decoder sheet is software. All the CV's, options, BackEMF, it would all be code in the PIC. And while I don't think any of it is that hard or complicated, my guess is it would take several hundred hours of coding and debugging to get a basic working prototype. I'm not sure I want to put in that sort of effort.

    I'm putting this out there as a conversation piece for the moment. I'll be curious to hear your comments!
    I think you're pretty much spot on with both the "most of this is software" and the "several hundred hours" parts. And that's... well... the nice part about that is that software only needs to be done once and then can be re-used. The bad part is the "several hundred hours".

    Personally I'm in a similar spot, with an infra-red DCC decoder for Faller Car System cars in a special form factor. I do have code from others (under a free license) so I won't start from scratch, but still, if someone made those exactly how I want mine to be, even for $100 I wouldn't even think about starting.

    And I've had the PCBs and the truck has been moving for about a year now, but still just blinking all the lights, moving at one speed, no communication, no battery monitor, no BEMF (which will be absolutely necessary for that 3V micro motor). Too many projects, too little time and/or motivation.

    Your hardware looks good.

    Heiko

  6. The Following 2 Users Say Thank You to Heiko For This Useful Post:


  7. #4
    Join Date
    Apr 2008
    Location
    Ashburn, VA, USA
    Posts
    1,503
    Thanks
    311
    Thanked 2,833 Times in 816 Posts
    Mentioned
    54 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by MoPac View Post
    It looks like it will work better than the stock decoders that are installed. Only suggestion from me is, if possible make it universal for all atlas and compatible locomotives. Prime example is the Digitrax decoders are trimmed to fit the said locomotives.
    Well, I want to temper expectations on "work better", at least a little. The advantage to DIY/Open Designs/Open Source is that the community can build on each others work. People donating a few hours of their time can do miracles. Look at Linux or RPi, etc. But these things work better after years and only if there is sufficient community behind them.

    Digitrax, Lenz, TCS, they have all learned things we don't know. They have found components that work best. They have found designs that work best. They have fine tuned software bugs for years. It would take a while to get something like this even just up to par.

    But, it absolutely has the potential to be way better. A whole community fixing bugs, making new features, releasing software you could load on your locomotive.

    As for the form factor, I dunno. I have one board I tried to figure out. Part of the development cost for a decoder manufacture is buying one of every engine, measuring it, doing a new design, etc. This is another area where the community could help. Could we collect a database of decoder shapes, come up with a shape that fits a lot of engines, and make that? Absolutely. But again, a lot of work, and would need a lot of participants.
    --
    Leo Bicknell

  8. The Following 2 Users Say Thank You to bicknell For This Useful Post:


  9. #5
    Join Date
    Apr 2008
    Location
    Ashburn, VA, USA
    Posts
    1,503
    Thanks
    311
    Thanked 2,833 Times in 816 Posts
    Mentioned
    54 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by Heiko View Post
    I think you're pretty much spot on with both the "most of this is software" and the "several hundred hours" parts. And that's... well... the nice part about that is that software only needs to be done once and then can be re-used. The bad part is the "several hundred hours".
    The RPi software I made (https://github.com/bicknell/rpi-dcc-decoder) decodes all the messages coming out of my Digitrax command station. All it does is print them today, but it wouldn't be too bad to replace each print statement with code that actually did something. And I have working PIC16 code to get the bits off the wire for my other project. Not posted yet as I want to clean up and optimize a bit more, but totally working. It only uses about 25% of the PIC16 CPU for the model I have to grab the bits off the wire, so lots more CPU left over for tasks.

    But it's the motor control that concerns me. Turning functions on and off, even making them blink (say ditch lights), that's all relatively trivial code. The motor is part voodoo though. First there's basic control, but then there's momentum, BackEMF, etc. I suspect the motor control code would almost dwarf all the rest of the code. That's really the meat of the matter.

    The other thing is programming and read-back. I know how it works in theory, but I haven't even thought about looking at that side of things.

    My $0.02 is we need about 7-10 people willing to work on the software, test it, and so on. If that community could come together, I would think in 6-12 months a reasonably functional decoder could come together.
    --
    Leo Bicknell

  10. The Following 3 Users Say Thank You to bicknell For This Useful Post:


  11. #6
    Join Date
    Apr 2019
    Location
    SE Utah
    Posts
    549
    Thanks
    650
    Thanked 2,446 Times in 452 Posts
    Mentioned
    58 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by bicknell View Post
    My $0.02 is we need about 7-10 people willing to work on the software, test it, and so on. If that community could come together, I would think in 6-12 months a reasonably functional decoder could come together.
    DCC++EX started with just a couple guys (primarily Fred) and now they have a bunch working on it....

    https://discord.com/invite/PuPnNMp8Qf

    ... developing an open source DCC Command Station the rivals the commercial ones and that can be put together ....

    https://dcc-ex.com/

    ... for very little investment and works right now.

    You get things started and maybe a year from now you will have created something similar. If you aren't on their Discord channel now you might want to start posting there. Probably already a handful of guy/gals that would jump on your ideas and what you've done so far.

    Good luck and thanks for what you've done to this point.

    Sumner
    Modeling UP from late 40's to early 70's very loosely......

    Under$8.00 Servo turnout Control --- 3D Printed Model RR Objects -- MyHome Page
    http://1fatgmc.com/RailRoad/RR%20Mai...ge%20Menu.html

  12. The Following 4 Users Say Thank You to Sumner For This Useful Post:


  13. #7
    Join Date
    Apr 2008
    Location
    Ashburn, VA, USA
    Posts
    1,503
    Thanks
    311
    Thanked 2,833 Times in 816 Posts
    Mentioned
    54 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by Sumner View Post
    DCC++EX started with just a couple guys (primarily Fred) and now they have a bunch working on it....

    https://discord.com/invite/PuPnNMp8Qf
    That's clearly an interested community of folks. Maybe I'll see if I can pop in the Discord when I get some free time.
    --
    Leo Bicknell

  14. The Following 2 Users Say Thank You to bicknell For This Useful Post:


  15. #8
    Join Date
    Apr 2008
    Location
    Ashburn, VA, USA
    Posts
    1,503
    Thanks
    311
    Thanked 2,833 Times in 816 Posts
    Mentioned
    54 Post(s)
    Tagged
    0 Thread(s)

    Default

    I ran some numbers through one of the assembly services I use.

    5 boards, assembled: $46.36 + component cost

    This $9.27 a board, plus components.

    100 boards, assembled: $324.77 + component cost

    This is $3.24 per board, plus components.

    500 boards, assembled: $579.04 + component cost

    This is $1.16 per board, plus components.

    As for the components, using quantity 100 pricing off LCSC, I get $3.79 cents.

    THere's also shipping, some fee for wasted space when panelizing, etc. My guess is quantity 5 could be had for around $20 a board out the door each, at 100 it would be around $10 per board, and at quantity 500 it would be around $6 per board.
    --
    Leo Bicknell

  16. The Following 5 Users Say Thank You to bicknell For This Useful Post:


  17. #9
    Join Date
    Apr 2019
    Location
    SE Utah
    Posts
    549
    Thanks
    650
    Thanked 2,446 Times in 452 Posts
    Mentioned
    58 Post(s)
    Tagged
    0 Thread(s)

    Default

    How much are the components If one bought them for a single board? I'd think you probably could find 5 interested individuals and the quantity 5 price for 5 boards isn't too bad but probably another $8-$10 or so in shipping costs to you and on to them.

    Would putting the schematic up where individuals could breadboard it someway be an option. Even if it wouldn't fit into a loco to begin with individuals could start working on the code as that is going to be the long haul part. Also the components could then also be fine tuned and the board might be redesigned to work with the final components if they need to be changed.

    I'm not smart enough to be involved with the code work or the electronics end so maybe the above is way off base. If I was younger I'd probably be up for getting up to speed on at least part of the project as I've had a little experience programming but not of the type that would help here.

    Keep us posted, I'm sure I'm not the only one that will be interested in updates,

    Sumner
    Modeling UP from late 40's to early 70's very loosely......

    Under$8.00 Servo turnout Control --- 3D Printed Model RR Objects -- MyHome Page
    http://1fatgmc.com/RailRoad/RR%20Mai...ge%20Menu.html

  18. The Following 3 Users Say Thank You to Sumner For This Useful Post:


  19. #10
    Join Date
    Sep 2019
    Location
    South Mississippi, USA
    Posts
    849
    Blog Entries
    1
    Thanks
    6,054
    Thanked 2,318 Times in 526 Posts
    Mentioned
    65 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by bicknell View Post
    As for the form factor, I dunno. I have one board I tried to figure out. Part of the development cost for a decoder manufacture is buying one of every engine, measuring it, doing a new design, etc. This is another area where the community could help. Could we collect a database of decoder shapes, come up with a shape that fits a lot of engines, and make that? Absolutely. But again, a lot of work, and would need a lot of participants.
    I noticed with all of my narrow hood atlas locomotives. Regardless if they have different series of Digitrax decoders. The contacts were in the same location. As for as distance apart from the front contact to the rear, I don’t know. I never sat down and measured the distance between the two. My guess is that they are very similar in placement. Maybe all is needed is some clips to close the gap?
    Cheers!
    Clayton

  20. #11
    Join Date
    Apr 2008
    Location
    Ashburn, VA, USA
    Posts
    1,503
    Thanks
    311
    Thanked 2,833 Times in 816 Posts
    Mentioned
    54 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by MoPac View Post
    I noticed with all of my narrow hood atlas locomotives.....The contacts were in the same location.
    Manufacturing 101, higher volume == cheaper costs. You see this in the prices I reflected above. Just think if it was quantity 50,000 instead.

    In the 2000's manufacturers started to have to re-do their old DC-Only designs into DCC friendly ones so they could offer a DCC product. As they redesigned these units they realized two things: 1) If they can make the frames identical between two models they can do a higher volume of the same frame and 2) Even if the frame needs a different shape for some reason, if they can leave the board placement and contacts the same they can do a higher volume of the same decoder.

    The Digitrax offering for the U23 in this thread is a https://www.digitrax.com/products/mo...oders/dn163a0/. It fits a GP40-2, GP38, SD35, U23B, U25, B23-7, Trainmaster, Dash-8-40B and perhaps even others.

    Heck, even in the real world the same frame / car body is often under two different locomotives. GP7/GP9/GP18 are the same frame and basic body, differences in the prime mover, louvers and fans.

    This is a double-edged sword though for a hobby project like this one. Recently manufactures have started offering locomotives with a decoder standard. No DC only option, as they set them up to run on a DC power system as well. Makes 1 SKU for them, drives volume even higher. But that means most of the newer locomotives don't need third party boards. The boards that are needed are folks converting older units to DCC, prior to folks designing frames for DCC to be easy.
    --
    Leo Bicknell

  21. The Following 2 Users Say Thank You to bicknell For This Useful Post:


  22. #12
    Join Date
    Sep 2019
    Location
    South Mississippi, USA
    Posts
    849
    Blog Entries
    1
    Thanks
    6,054
    Thanked 2,318 Times in 526 Posts
    Mentioned
    65 Post(s)
    Tagged
    0 Thread(s)

    Default

    Exactly my point! Most of the atlas locomotives like the B23-7 run’s on one style decoder, as for the GP35’s, GP15-1’s are on an different board. To me they are identical. Maybe I could swap them out with the other style decoders and they will probably work. Granted you might have to add clip’s on the contact points. Maybe they made them different because of the advancements in the decoder world?
    Cheers!
    Clayton

  23. #13
    Join Date
    Apr 2008
    Location
    Ashburn, VA, USA
    Posts
    1,503
    Thanks
    311
    Thanked 2,833 Times in 816 Posts
    Mentioned
    54 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hard to say without much closer examination.

    What I can say is Digitrax seems to follow this pattern, using the GP15-1 board as an example:

    DN163A4

    D - Decoder
    N - N-scale
    1 - I think this is "amps" rounded down to the nearest whole number.
    6 - 6 Function Outputs
    3 - "Feature Set", higher numbers == more features. I think 3 means "FX3 features". Basically software rev loaded on it.
    A - Board shape "A".
    4 - Revision/Update 4

    But looking further at the specs, there is a significant difference. The A0 is 9.4996mm x 76.2381mm w/LEDs x 3.9878mm, while the A4 is 9.5mm x 98.3mm x 4.0mm. So the newer board is 22.1mm longer than the older board.

    If I had to guess without taking them all apart, the frame is the same for all of these units. But the plastic shell for the units that take the A4 board has been designed with more space inside. The additional space and likely newer components (new design) allowed them to rev the A4 board to fit in the new units. I would guess there's a good chance the A0 fits in all of them, but the lights may not be in the right place due to the difference shell designs. I'm just guessing though. Would be nice to see two side by side.

    The big limitation I'm facing is without ordering > 2000 part quantities the services don't want to do dual sided assembly. Almost all the commercial decoders use both sides of the board. This means I have a lot less space for components, and move to more "expensive" solutions. For instance I use a single driver IC for the motor driver -- but it's like $2 per chip, where as most commercial decoders use two half bridge chips that are probably a few cents each.
    --
    Leo Bicknell

  24. The Following 2 Users Say Thank You to bicknell For This Useful Post:


  25. #14
    Join Date
    Apr 2008
    Location
    Ashburn, VA, USA
    Posts
    1,503
    Thanks
    311
    Thanked 2,833 Times in 816 Posts
    Mentioned
    54 Post(s)
    Tagged
    0 Thread(s)

    Default

    I was sitting here and just glanced at the dead decoder sitting on my desk and I had a partial a-ha moment.

    The dead decoder uses through hole LED's (T1.5's I think, but not sure) mounted off the end of the board. This was very common for a while. If I measure end of LED to end of LED, I get 80mm. The board itself is 66mm. This particular board is a Lenz I believe. It's marked LEO63XF V1.

    Newer decoders use SMT LED's on the ends, typically mounted 90 degrees to their normal mounting so they face forward and backwards. The space that the through hole LED took up becomes additional board real estate that can be used.

    The board I designed uses the size of this board as I just measured it. But I used surface mount LED's. Most likely I could add about 10mm of board to both ends of my board and it would still fit just fine. In fact, I likely should do that to get the LED's in the right position. That might be part of what's going on in the different sizes.

    The manual for my decoder says it was only 0.5 amp rated. No wonder it exploded with my long trains! http://download.atlasrr.com/pdf/LE06...nual_Atlas.pdf It also says Atlas has replaced it with an NCE decoder, an AN12A0. It's a 1 amp decoder. It still uses through hole LEDs on both ends.
    --
    Leo Bicknell

  26. The Following 2 Users Say Thank You to bicknell For This Useful Post:


  27. #15
    Join Date
    Apr 2008
    Location
    Ashburn, VA, USA
    Posts
    1,503
    Thanks
    311
    Thanked 2,833 Times in 816 Posts
    Mentioned
    54 Post(s)
    Tagged
    0 Thread(s)

    Default

    I took the exact same circuit and tried to pack it into as small a form factor as possible. I started with the PIC16 and motor driver IC's directly under each other, and tried to pack in the other components as tight as possible.

    Now, I can tell you this is not my best work. I can already see where some moving stuff around might make this a little cleaner and smaller. But it's a good start.

    The result is a 10.55mm x 11.74 mm board. I'm sure a few MM could be shaved off that with some basic re-thinks. Also, this is with components at "standard" spacing. I suspect some of these little decoders are manufactured to the "tight" spacing tolerances. Also, I only use 0201 devices because I know I could get those assembled, I'm not sure anyone does 01005's in small quantity assembly. I don't know if anyone would make a board with tight spacing for a hobbiest.....



    The left is the "Top" with the PIC16 and power supply, the right is the "bottom" with the motor driver and contacts for the motor (middle), F0F/F0R (top) and rails (bottom).

    To compare, a DZ123 claims to be 9.144mm x 13.97mm on Digitrax's web site, so I'm very much in the ballpark. And my friend pointed me to a PCB supplier in China that does double sided assembly in small quantities that I think would make this....

    I'm not sure there's a point, but I guess I was mostly wondering how hard it was to get something as small as the "Big Boys" are doing right now. The answer I think is not very, the commercial decoder sizes could be duplicated on a hobby basis.
    --
    Leo Bicknell

  28. The Following 4 Users Say Thank You to bicknell For This Useful Post:


Similar Threads

  1. Replies: 9
    Last Post: 11th Oct 2019, 02:25 AM
  2. Replies: 0
    Last Post: 28th Feb 2013, 12:06 PM
  3. Replacing a SMD LED on Decoder?
    By Sleeper in forum DCC
    Replies: 27
    Last Post: 1st Apr 2012, 12:47 AM
  4. Hard to find stuff easy to find but still hard to get
    By kalbert in forum General Rail Discussion
    Replies: 3
    Last Post: 17th Mar 2012, 09:34 AM
  5. Replacing Shells
    By Bryan in forum Diesel
    Replies: 5
    Last Post: 25th Jul 2007, 03:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •