Building your own decoder.

Leo Bicknell Dec 18, 2022

  1. Leo Bicknell

    Leo Bicknell TrainBoard Member

    569
    30
    27
    I've updated CALCULATIONS and README.
     
  2. wvgca

    wvgca TrainBoard Member

    499
    305
    21
    actually i wasn't trying to source an alternative DIP, i was taking a quick look for a SMD
     
  3. Erik84750

    Erik84750 TrainBoard Member

    355
    144
    12
    My take is that commercial developers just copy from one another.

    Using separate SMD parts makes for easier replacement. Which is nice in the debugging status. And since price is a big issue it is mostly not worth to them to replace SOT's with an IC in the final testing phase because that would require another round of testing/debugging....

    But purely on an electronics hardware llevel integrated chips offer only advantages imo:
    1. cheaper
    2. more features
    3. smaller
    4. widely used elsewhere
    5. ........

    Personally I would opt fot the IC route.
     
    Moose2013, BigJake and Leo Bicknell like this.
  4. Leo Bicknell

    Leo Bicknell TrainBoard Member

    569
    30
    27
    I gave it a whirl. https://github.com/bicknell/DCC-Mobile-Decoder/tree/drv8870-refactor/hardware/reference/Breadboard-1 is a branch using a TI DRV8870 chip, which there are also knockoffs available of in China.

    It greatly reduces the part count, taking 17 components and replacing them with 4. Even if those 17 are only 1-2 cents each, that's still 30+ cents of components, and I can get the driver chip for around 40 cents. So it's not a big cost difference, but it saves a ton of board space and complexity.
     
    Moose2013 likes this.
  5. Erik84750

    Erik84750 TrainBoard Member

    355
    144
    12
    The DRV8870 is available on AliExpress for about €12 all-in for 10pcs.

    I do not dispute your price, just saying what the cost would be for an average person looking for its cheapest supply on AliExpress, shipping and taxes incl..

    An exact same chip (pinout, specs,..) is the Toshiba TB67H450FNG. This driver is available on AliEpress for €6.5 all-in, 10pcs.
     

    Attached Files:

  6. Leo Bicknell

    Leo Bicknell TrainBoard Member

    569
    30
    27
    FWIW, the way I quote prices is in quantity 100 from the Chinese companies I use to get PCB's made. Basically the "what would a small run cost" pricing for fully assembled boards in a turnkey arrangement.

    Small quantity (e.g. 5) is often wildly high or low for seemly random reasons. On the other side I don't think there would ever be runs big enough to need 3,000 or 10,000 unit reels. The Chinese board vendors are not always the cheapest either, there are often cheaper alternatives, but what they quote seems to be _relatively_ stable supply. That is if I order now, I can order the same thing again 6 months from now. When going to a place like AliExpress you might get one knock off today, and a totally different one next week. I think a lot of these companies sell their partial reels on places like AliExpress when they feel they aren't selling through normal channels.

    Anyway, you're not wrong. Those are good prices. If someone wanted to hand-solder a couple of boards that's the way to go. And yeah, the DRV8870 seems to be "well copied", plenty of people making the same pinout. It's also available in a very small package, at least from TI, making it suitable for N/Z.
     
  7. Leo Bicknell

    Leo Bicknell TrainBoard Member

    569
    30
    27
    I have a possible reason to not use the motor driver IC. I'm going to cut and paste some thoughts below I posted in another forum.

    The point about analog mode is fair. Right now I'm running the micro at 5v, so I need about 6v in anyway. However, there's (conceptually) no reason the micro couldn't run at 3.3, or even down around 1.7v. And down the road when implementing analog mode that could be important.

    Now, that said, I see two ways to implement analog mode. Way #1, the micro reads the track voltage (so some sort of resistor divider into an analog input pin) and scales the PWM motor control output based on the voltage. While not to difficult in hardware and software, I kinda suspect this would produce poor real-world results. There's a not of noise on the track making good voltage readings hard, what voltage level is 100% throttle, etc.

    Way #2, detect the polarity of the incoming DC signal (to select direction) and then just set the H-Bridge to 100% in that direction (e.g. turn on both MOSFETS). Track voltage would flow directly through to the motor more or less as if the decoder wasn't even there. The two rails, via a voltage divider again, could be fed directly into two micro pins. One will be high, one will be low to determine the direction. The micro still needs to boot to be able to read those pins and set the direction, so it won't do anything until the minimum booting voltage. This would argue for running the micro at the lowest possible voltage. For the current part I'm using that would be 1.8v. Running it at 1.8v I probably couldn't use the DRV8870, I would have to use discrete MOSFETS, and ideally try and find N-channels that turn on with a gate voltage of 1.8v. This may be one reason manufactuers shy away from motor driver IC's.
     
  8. FlightRisk

    FlightRisk TrainBoard Member

    548
    237
    14
    I have a word document I could clean up a bit and maybe publish as a PDF that has a collection of every DIY decoder project I could find. I was wondering if I should archive some of the things in case the websites shut down at some point. I could publish that in the files section of our website. There are only so many ways to make a decoder circuit, but there are a lot of ideas for the firmware.
     
    Leo Bicknell likes this.

Share This Page