Jump to content

Exact PWM signatures for 8-pin decoder


HMV

Recommended Posts

Hi everyone, hope you are all keeping well 😎

please bear with me as I am a beginner to DCC!

I was curious and want to fashion my own decoder for locos that cost less (like all my free collectors club ones) than an R8249 itself using an H-Bridge driver and an arduino board like the nano or promicro

I don't have a scope so I can't really deduce exactly what happens. By my understanding and from what I've read I'm guessing on a certain delay the controller sends a "packet" of data to the train with a PWM signal such as 1: adress, 2: direction and 3: speed and also a separate packet would be sent for the lighting and and functions, almost like a TCP packet on a network but just PWM. By my understanding the track is held a a certain voltage  and the packets are sent as voltage drops of a certain level and delay. If I haven't got it wildly wrong I would like to know what are the intervals and signals sent like in terms of their voltage drop and length of these drops. Is it the  delay alone that determines the value or is there a few pulses sent per variable. What is the delay between these variables within a packet. Using the wheel and track pickup pins on the 8 pin decoder (7 and 8 I think) I would read these packets every time they came and update values so the train could move and change direction. If the controller loco address didn't equal the target loco address the trains state wouldn't be updated. I would use a loop to have an old and new value for each variable of the packet, this way I could set up a system for acceleration and decceleration which I would simply predefine using the arduino map command for time vs pwm. If I have got it wrong which is very likely please say. I probably sound rather cocky as well but it is with the best intentions. I can't afford and don't want to pay twenty to thirty quid every time I decode a loco and I want to get a bit more experience with the arduino as well. I have only been using them for a couple of years for other projects. The way I see it is I could start with a basic functions decoder and move on to more advanced functions like light, sound and network control over one of my servers and a web interface with LabVIEW maybe. this would use other hardware of course.

If anyone has information on how the eight pin decoder receives this information or simply say no it isn't possible to tap into these data packets please say. It would be much appreciated, 

thanks everyone for your time, sorry if I wasted it.

Link to comment
Share on other sites

You are completely and totally 'off beam' with your understanding, there is no PWM sent to track in DCC command systems. DCC is Bi-polar, PWM is not and that's only at the basic voltage level without getting into packet structure, timing and error correction.

.

If you want to write your own DCC decoder software you will need to read and fully understand the NMRA S.9 Electrical DCC Standard. You can read S.9 online on the clickable link below. S.9 explains at 'bits and bytes' data packet level the communication between the DCC Controller and a DCC decoder.

.

https://www.nmra.org/index-nmra-standards-and-recommended-practices

.

 

TIP: As a newbie poster on the forum, just be aware that the 'Blue Button with the White Arrow' is not a 'Reply to this post' button. If you want to reply to any of the posts, scroll down and write your reply in the reply text box at the bottom of the page and click the Green 'Reply' button.

.

See also – further TIPs on how to get the best user experience from this forum.

https://www.hornby.com/uk-en/forum/tips-on-using-the-forum/

.

Link to comment
Share on other sites

Whilst you are waiting for a fuller answer have a look here which gives the basics of the DCC waveform...

https://www.hornby.com/uk-en/forum/hornby-decoder-track-voltage/?p=1

... which is not PWM as you think but comprised simply zeros and ones sent in sequence as a bi-polar square wave signal at a constant voltage. 

 

I suggest you peruse NMRA DCC section as linked to above by Chris and absorb the exact sequencing of 0/1s that are sent to determine address, speed, direction, functions, etc for both locos and stationary accessory decoders.

 

I am fascinated as to how you will pack an Arduino based control system into a small loco.

 

Edit - Chris types faster than me.

Link to comment
Share on other sites

Thanks guys.  I knew it wouldn't be quite as I imagined!! Really appreciate the help. The Arduino Nano is incredibly small and I have designed tiny tiny custom PCB add ons for other projects before, I then get them manufactured to suit with all their components soldered on. Sometimes things are at right angle etc and they fit mostly into where I shove 'em! Unfortunately I am unable to give you any pictures as my dear old GTX 570 has given up!

Thanks so much for the speedy replies and helping me understand. I obviously interpreted what I read very very wrong!! I'll take some time to really delve into the NMRA standards. I was also hoping to use my custom decoder alongside my existing 4-function decoders but we'll see about that

Link to comment
Share on other sites

There are published Arduino sketches for DCC Accessory Decoders where everything is downloadable and you don't have to write any software of your own if you don't want to. Search for "Rudysmodelrailway"

Link to comment
Share on other sites

You can make a DCC controller using an Arduino, several people have, I think there are places on the web that tell you how to do it. A guy I worked with had done it. The decoder side I assume is a lot more complicated purely in trying to get the pcb to fit. I don't know but I assume the decoder has some form of embedded micro to interprete the commands and drive the motor. If you are into PICs it could easily do the job, but then you have to get into smd placement technology to get them made. I keep meaning to look up the standard, last time I looked it seemed similar to MOST communications used in BMW cars for audio transmission between modules.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
  • Create New...