Author Topic: Building your own decoder.  (Read 2543 times)

0 Members and 2 Guests are viewing this topic.

bicknell

  • Crew
  • *
  • Posts: 238
  • Respect: +2
Building your own decoder.
« on: December 18, 2022, 11:49:53 AM »
+1
I have been working on and off on a project to build my own decoder -- hardware and software. While it is not complete, it is far enough along I have decided to share it with the world.

https://github.com/bicknell/DCC-Mobile-Decoder

If you are interested in electronics, writing software for micro-controllers, or just wanted to know how the innards of these things work please take a look. I am hoping to find a couple of other people who would like to help advance this project forward. The eventual goal is to make a mobile decoder that could go in a scale engine and work just like any commercial decoder -- except you have the source code!

wvgca

  • Crew
  • *
  • Posts: 320
  • Respect: +44
Re: Building your own decoder.
« Reply #1 on: December 18, 2022, 03:11:17 PM »
+1
i did some what similar a  few years ago, but i used the merg sample as a starting point.. obviously i had to update most of the components due to life cycle, but i used the pic code almost fully intact, i just added smokebox flicker for what i needed  ..
i found a guy overseas that was willing to do a run of ten, and they worked out well .. they also included external stay alive hookups .. [ Guests cannot view attachments ]

bicknell

  • Crew
  • *
  • Posts: 238
  • Respect: +2
Re: Building your own decoder.
« Reply #2 on: December 19, 2022, 04:40:22 PM »
0
Very cool!  I love to see other makers in this space.

I just committed support for Address, Direct, Register, and Paged programming in Service Mode.

I also added a resistor to the hardware design so that the board can do CV read back without having to have a real motor attached.

wvgca

  • Crew
  • *
  • Posts: 320
  • Respect: +44
Re: Building your own decoder.
« Reply #3 on: December 19, 2022, 09:11:03 PM »
0
you are better off just using a motor instead of a resistor  ... easier to forget a resistor ..

bicknell

  • Crew
  • *
  • Posts: 238
  • Respect: +2
Re: Building your own decoder.
« Reply #4 on: December 20, 2022, 09:24:55 AM »
0
One of the things I realized is that if there is going to be an "Open Source Decoder" community, people will be spending a lot more time writing code for decoders.  Now, obviously eventually that has to go into something in a real engine for final testing.  But much of the development does not need a real engine, motor, or track.

The "reference" hardware in my project is in fact a "decoder" that's designed to be connected to a 400/800 point bread board, and never a locomotive.  See https://github.com/bicknell/DCC-Mobile-Decoder/tree/main/hardware/reference/Breadboard-1

This makes development "on the bench" super easy.  It includes LEDs for the functions so for instance developing new blinking patterns doesn't require external parts.  It has an LED to indicate motor speed/direction, so no motor is required.  And thus the resistor I just added serves as the motor "load" for things like read back.

It does have external pins to the breadboard for any / all of those to be attached for testing.

The same code would then run on a real decoder, for instance I have a draft of an N scale wired decoder in the project at https://github.com/bicknell/DCC-Mobile-Decoder/tree/main/hardware/decoders/Wired-N-1A-6-1

C855B

  • Crew
  • *
  • Posts: 10863
  • Respect: +2416
Re: Building your own decoder.
« Reply #5 on: December 20, 2022, 09:29:25 AM »
0
The resistor for CV feedback in the absence of a load makes the decoder useful for non-motored applications such as tenders and cabooses.
...mike

http://www.gibboncozadandwestern.com

Note: Images linked in my postings are on an HTTP server, not HTTPS. Enable "mixed content" in your browser to view.

There are over 1000 images on this server. Not changing anytime soon.

peteski

  • Crew
  • *
  • Posts: 32937
  • Gender: Male
  • Honorary Resident Curmudgeon
  • Respect: +5336
    • Coming (not so) soon...
Re: Building your own decoder.
« Reply #6 on: December 20, 2022, 09:57:16 AM »
0
you are better off just using a motor instead of a resistor  ... easier to forget a resistor ..

Not sure what you mean by "forget a resistor".  Do you mean the small resistor would  overheat if current gets accidentally sent through it during regular operation?

I would imagine that if a load resistor is incorporated into a decoder for programming acknowledgement purpose, it will be controller by the firmware to be only used for that purpose and never during normal operation.  As I see it, hardware-wise it would just be an extra function output with the load (resistor) hardwired internally.

I agree with Mike that this feature would be handy, especially for function-only decoders.  I do something similar (add 2 resistors and a cap) to function-only decoders to enable CV readback on the programming track. My load circuit is connected to one of the function outputs, and it still allows that function to still be used for its intended purpose.
. . . 42 . . .

wvgca

  • Crew
  • *
  • Posts: 320
  • Respect: +44
Re: Building your own decoder.
« Reply #7 on: December 20, 2022, 11:41:36 AM »
0
 i meant that a small resistor would be easy to forget once you were doing the pcb pattern, pretty easy to mistakenly leave on ,,,,

peteski

  • Crew
  • *
  • Posts: 32937
  • Gender: Male
  • Honorary Resident Curmudgeon
  • Respect: +5336
    • Coming (not so) soon...
Re: Building your own decoder.
« Reply #8 on: December 20, 2022, 12:08:49 PM »
0
i meant that a small resistor would be easy to forget once you were doing the pcb pattern, pretty easy to mistakenly leave on ,,,,

I guess I still don't understand. The way I understand, it is *SUPPOSED* to be left on, or permanently installed.
. . . 42 . . .

wvgca

  • Crew
  • *
  • Posts: 320
  • Respect: +44
Re: Building your own decoder.
« Reply #9 on: December 20, 2022, 12:31:54 PM »
0
nope, not permanent ... it CAN be left on if the decoder is stationary, but should be off [and not permanently mounted] if the decoder is mobile ..
when was the last time you saw mobile decoder with a motor resistor PERMANENTLY mounted ??  i never have .. mind you no experience with european designed decoders though ..
the need for a motor load can be gotten around in the pic code, sometimes it's only used for programming feedback anyways .. the pic code determines if it's necessary to have in there ..
and it's real easy to add the load circuitry if needed for stationary usage
« Last Edit: December 20, 2022, 12:34:30 PM by wvgca »

peteski

  • Crew
  • *
  • Posts: 32937
  • Gender: Male
  • Honorary Resident Curmudgeon
  • Respect: +5336
    • Coming (not so) soon...
Re: Building your own decoder.
« Reply #10 on: December 20, 2022, 02:10:13 PM »
0
Well, I was agreeing with Mike that it would be a good to have such resistor circuit on a function-only decoder. You know, the ones which go into dummy locos or cabeese to be able to control their lights without a motor present?  Those need to be programmed from time to time (while installed in a mobile rolling stock).
« Last Edit: December 20, 2022, 02:11:44 PM by peteski »
. . . 42 . . .

bicknell

  • Crew
  • *
  • Posts: 238
  • Respect: +2
Re: Building your own decoder.
« Reply #11 on: December 20, 2022, 02:14:35 PM »
0
I'll attempt to clarify a bit more here.  I would not put such a resistor on any mobile or accessory decoder.  There are other ways to solve the problem in those applications.  Basically anything similar to what can be bought off the shelf today shouldn't have one.

It's a solution to a specific problem of https://github.com/bicknell/DCC-Mobile-Decoder/tree/main/hardware/reference/Breadboard-1, which is not designed to ever be used on a real layout in any way.  It's designed to help people write the software (see https://github.com/bicknell/DCC-Mobile-Decoder/tree/main/software/reference/Breadboard-1.X), test, debug, etc on a bench top.  On the bench it's likely many users would never have a motor connected because they are working on something like light patterns, but to do that they need it to respond to programming so it needs a load. 

The way I added it there is a two pin jumper to put it in or not in the circuit.

peteski

  • Crew
  • *
  • Posts: 32937
  • Gender: Male
  • Honorary Resident Curmudgeon
  • Respect: +5336
    • Coming (not so) soon...
Re: Building your own decoder.
« Reply #12 on: December 20, 2022, 02:18:59 PM »
0
I see, so is for a development use only.

Still something similar would be nice to have on function only decoders (designed as I described earlier).  I permanent dedicated (internal) function output would be tied to a resistor which would be used to generate the current high enough  for acknowledging a programming packet.
. . . 42 . . .

wvgca

  • Crew
  • *
  • Posts: 320
  • Respect: +44
Re: Building your own decoder.
« Reply #13 on: December 20, 2022, 02:32:01 PM »
0
Well, I was agreeing with Mike that it would be a good to have such resistor circuit on a function-only decoder. You know, the ones which go into dummy locos or cabeese to be able to control their lights without a motor present?  Those need to be programmed from time to time (while installed in a mobile rolling stock).

true, how ever [as far as i know] none of the commercial offerings [ for a mobile decoder] have such a resistor on board ... in the case of stationary decoders, they -might- have such a resistor, but it's normally installed external to the main pcb ..i guess that i would give users the choice if they wanted stationary or mobile decoders ..
just my two cents worth, for what it's worth, lol

bicknell

  • Crew
  • *
  • Posts: 238
  • Respect: +2
Re: Building your own decoder.
« Reply #14 on: December 20, 2022, 06:55:34 PM »
0
Are accessory decoders programmed on a programming track normally?  I don’t have a lot of experience with them, but that seems weird. Im not sure how most are programmed though.