Welcome to the forum   
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Share
Options
View
Go to last post in this topic Go to first unread post in this topic
Offline Mikael  
#1 Posted : 24 September 2004 00:00:47(UTC)
Mikael

Denmark   
Joined: 10/09/2004(UTC)
Posts: 959
Location: Copenhagen, Denmark
Hi.
If I want to make my own digital decoder (only for decoding the solenoid signals, not locomotives), where should I go for a good and technical description of the format used? Both electrically and protocol-wise.

My plan is to make a signal decoder, that receives red/green commands on its own address, but in addition to that, it should also monitor one or more switchtrack-addresses to determine by itself if green really means green, or rather green+yellow.

Thanks.
Offline perz  
#2 Posted : 24 September 2004 01:52:40(UTC)
perz

Sweden   
Joined: 12/01/2002(UTC)
Posts: 2,578
Location: Sweden
There is a link for the loco command format under the "Links & downloads" section. This link does not describe the turnout format, and the link is dead for the moment. An alternative source for the loco format description is http://home.arcor.de/dr.koenig/digital/motorola.htm.

The solenoid command format is a little bit different. The information I will describe here is from a book written by Rutger Friberg.

1. Voltage levels.
The commands are coded by alternating between positive and negative voltage. The approximate voltage level on the track is +/- 20 V.
(If you use the booster connection output from the 6021, "positive voltage" is +5V and "negative voltage" is 0 V (referenced to "brown") ).

2. Basic time unit.
The basic time unit for solenoid control commands is 12.5 us (some Control Units seem to use 13 us instead).

3. coding of bits.
One bit is coded in 8 time units, i.e. one bit is 100 us (or 104 us). A "0" is coded as 1 time unit of positive voltage followed by 7 time units of negative voltage. A "1" is coded as 7 time units of positive voltage followed by 1 unit of negative voltage.

4. Packet format
Each command consists of two identical packets of 18 bits each. The pause between the two packets, and between the packet pairs, is coded as negative voltage. I think the pause between the two packets is 762 us but I am not sure. (It is 1525 us for loco commands, and I think it is the half for solenoids). The pause between the two double packets is at least 500 us. A command should only be considered valid if both packets are received and are identical. Once a valid command is received, further identical packets to the same unit should be ignored.

5. Packet coding
Bit 0-7: Decoder address. The address coding is "trinary" (see the loco command reference). The same coding applies as for loco addresses 1-64.
Bit 8-9: 00
Bit 10-11: 11 vs 00 for red vs green for turnouts(I do not know which code that is "red" and which is "green").
Bit 12-15: Address within the decoder. This is coded as "double bits" i.e. bit 12-13 is either 00 or 11, and bit 14-15 is also either 00 or 11. This gives 4 possible alternatives.
Bit 16-17: 11 for activation, 00 for deactivation.

thanks 1 user liked this useful post by perz
Offline Mikael  
#3 Posted : 24 September 2004 11:00:07(UTC)
Mikael

Denmark   
Joined: 10/09/2004(UTC)
Posts: 959
Location: Copenhagen, Denmark
Thanks a lot. I don't fully understand it yet, but it looks like very useful information.
I will try to read it while having a scope hooked up to my IB tonight. Reading the hard facts, and experimenting with it at the same time, usually is quite effective. At least for me.
Offline nico van zon  
#4 Posted : 24 September 2004 11:29:25(UTC)
nico van zon


Joined: 25/07/2004(UTC)
Posts: 202
Location: ,
Mikael,
to get an idea of what you can expect when looking at your oscilloscope, you could have a look at this webpage: http://people.zeelandnet.../zondervan/digispan.html
It shows only the shape of the voltage, not how the message is composed.
Offline perz  
#5 Posted : 24 September 2004 16:56:17(UTC)
perz

Sweden   
Joined: 12/01/2002(UTC)
Posts: 2,578
Location: Sweden
Mikael,

If you find out any supplementary information or errors in my description, please post it. I have no hands-on experience with the solenoid format. (With the loco command format I have practical experience).
Offline Mikael  
#6 Posted : 24 September 2004 22:28:36(UTC)
Mikael

Denmark   
Joined: 10/09/2004(UTC)
Posts: 959
Location: Copenhagen, Denmark
Sure thing.
I will experiment with it tomorrow. I already think I have a plan for how to decode the packets with a microcontroller instead of the usual Motorola IC.
Offline Mikael  
#7 Posted : 25 September 2004 00:20:54(UTC)
Mikael

Denmark   
Joined: 10/09/2004(UTC)
Posts: 959
Location: Copenhagen, Denmark
Darn it. I can't consistently capture the frames I'm interested in on my scope, as there is some sort of idle comunication going on as well. Looks like I need to write the software for the decoder first, and then see if it can decode some solenoid frames for me.
But the few glimpses I did get, looked consistent with the various descriptions I've been reading around here.
Offline perz  
#8 Posted : 25 September 2004 00:33:20(UTC)
perz

Sweden   
Joined: 12/01/2002(UTC)
Posts: 2,578
Location: Sweden
Yes, there is different kinds of traffic going on all the time on the line. It is very difficult to trigger specificly on one kind of traffic. You would need something more than a standard oscilloscope to do that.
Offline Mikael  
#9 Posted : 25 September 2004 15:01:45(UTC)
Mikael

Denmark   
Joined: 10/09/2004(UTC)
Posts: 959
Location: Copenhagen, Denmark
Success.
I just wrote a quick program for an AVR microcontroller, and used that for reading and filtering out the solenoid packets. Your description above is accurate. I can add that bit 10-11 are 00 for red and 11 for green.

I haven't checked the delay between packets, as my program is just a simple hack without possibility to measure time.

Finally I can say that the Intellibox uses 13 us timebase, which by the way matches very well with a bitrate of 76.800 bps, which is a standard serial port rate. That makes it much easier to make a decoder with a standard serial port.
Offline Mikael  
#10 Posted : 26 September 2004 01:46:41(UTC)
Mikael

Denmark   
Joined: 10/09/2004(UTC)
Posts: 959
Location: Copenhagen, Denmark
Even more success.
I've wrote a proper decoding program, that can decode all solenoid addresses simultaneously, so I can now realize my original idea: The intelligent signal. One that you only send a stop or go signal to, and green or green/yellow is determined by the signal itself, based on one or more switchtracks ahead. Or the signal that refuses to go green if another signal (perhaps from a sidetrack) is already green.
Or one button to control several signals. Switchtrack positions then determine which signal is actually activated. The possibilities are endless.

But none of this would have been possible without your help. Thanks a million guys.
Offline john black  
#11 Posted : 27 September 2004 12:06:06(UTC)
john black

United States   
Joined: 22/04/2004(UTC)
Posts: 12,139
Location: New York, NY
Quote:
[size=1" face="Verdana" id="quote]quote:Originally posted by Mikael
<br /> ... just wrote a quick program for an AVR microcontroller, and used that for reading and filtering out the solenoid packets. Your description above is accurate. I can add that bit 10-11 are 00 for red and 11 for green.


Wow. Just find it great that some of us are able to dig deeply into M's crypto-coded secrets biggrinbiggrinbiggrin

John

I hope no one visits a poor Southener's layout in Brooklyn. Intruders beware of Gators.
AT&SF, D&RGW, T&P, SP, WP, UP, BN, NYC, ARR, epI-III - analog & digital Marklin Classics only.
CU#6021 FX-MOTOROLA DIGITAL SYSTEM. Fast as lightning and no trouble. What else ...
Outlaw Member of BIG JUHAN's OUTSIDER CLUB. With the most members, worldwide

Offline David Dewar  
#12 Posted : 27 September 2004 14:44:30(UTC)
David Dewar

Scotland   
Joined: 01/02/2004(UTC)
Posts: 7,461
Location: Scotland
John.... you any idea what these guys are talking about..all I can do is fit a decoder to a loco and press the buttonsbiggrin
I can add some extra lighting etc but thats about it. as to how it works I leave to Marklin.
David
Take care I like Marklin and will defend the worlds greatest model rail manufacturer.
Offline john black  
#13 Posted : 27 September 2004 15:04:01(UTC)
john black

United States   
Joined: 22/04/2004(UTC)
Posts: 12,139
Location: New York, NY
David - no idea, too [xx(] ... but I must say I admire 'em, really [:p]

I hope no one visits a poor Southener's layout in Brooklyn. Intruders beware of Gators.
AT&SF, D&RGW, T&P, SP, WP, UP, BN, NYC, ARR, epI-III - analog & digital Marklin Classics only.
CU#6021 FX-MOTOROLA DIGITAL SYSTEM. Fast as lightning and no trouble. What else ...
Outlaw Member of BIG JUHAN's OUTSIDER CLUB. With the most members, worldwide

Offline Mikael  
#14 Posted : 28 September 2004 01:06:58(UTC)
Mikael

Denmark   
Joined: 10/09/2004(UTC)
Posts: 959
Location: Copenhagen, Denmark
It really comes together for me now. Here is a small video of two signals. They are close on the video, but imagine them farther apart, and with a switchtrack somewhere between them. The two signals does not have any communication with each other. They only have two power lines from the tracks wherever they are placed.
The front signal reacts to the other signal and the (for now imaginary) switchtrack as well, just by listening for the commands to them.
http://www.ejberg.dk/external/marklinusers/signal2.mpg

I have ordered some parts to make a few of these signal modules for real. Until now it has been running on a development kit.
I am thinking of putting a brake module in it too. And perhaps some sort of feedback to make the signal go red by itself when a train has passed it.
thanks 1 user liked this useful post by Mikael
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

| Powered by YAF.NET | YAF.NET © 2003-2025, Yet Another Forum.NET
This page was generated in 0.533 seconds.