The Lanbahn protocol is actually very simple (maybe too simple …).

Everyone (smartphone, tablet, decoder, …) is communicating via UDP Multicasts to everyone in the network (just like the tradional model railroad “Bus” systems). ASCII transmission is choosen because ease of debugging (and because your model railroad only needs a very small bandwidth compared to your 3 kids viewing 4K videostreams…).

The standard “channel” concept is also retained, so each accessory decoder and each locomotive are having a unique “address” (from 1 to 10000(?)).

The commands (Rev. 2.1):
SET <addr> <data>  and  READ <addr>
    set address 911 to state 1 by sending the message: “S 911 1″. 
    Trigger reading of channel 911 with “R 911″ – and the decoder
    with address 911 will respond with it’s current state 
    “S 911 1″.

FB <addr> <data> (FEEDBACK) 
    messages from the accessory decoders were introduced after the 
    experience of a noisy environment at the Warley Show (where 1 
    out of 500 commands did not reach the accessory) – “FB 911 1″ 
    meaning: command understood and having set decoder 911 to 1.
LOCO <addr> <speed> <direction> <f0> ... <fn>
    set speed, direction and functions of a locomotive. Locos have
    a separate command to allow an address space overlap between
    accessory decoders and locomotives to allow use of loco-numbers 
    (like "7411") as addresses.

RLOCO <addr>
    read current loco state from the central station (like SPROG) or
    from the locomotive decoder directly (if 2-way communication), i.e.
    a "FL .." response is triggered
FL <addr> <speed> <functions> (= FEEBACK from Loco)

LOCK <addr>
    is the same a set (“L 911 1″ = set channel 911 to 1 and lock 
    the decoder), except that it locks the decoder state afterwards
    (i.e. decoder will not respond to a new "SET” until it is 
    unlocked again or a new "Start of Day" message is received).

UNLOCK <addr>
    is unlocking a decoder (“U 987″ = unlock channel 987)
    "SOD" means: all decoders back to start position (i.e. red
    for signals, closed for turnouts)
A = Announce
    regularly decoder capabilities can be announce, exact format
    still unclear, maybe something like
    "A arduino1 710T:711T:712T:740S:741S" 
    (= an arduino with hostname "arduino1" can control 3 turnouts
    (T) at addresses 710, 711, 712 and two signals with address 
    740 and 741)

RT <n> (= Routing)
    commands starting with “R” are used in routing, to announce 
    that a route was set or cleared.

A note on security:

There is no extra security built into the system, it is assumed that you are owning and securing the access to the WLAN (or even better have your own “model railroad WLAN” in your layout room with a nice little 20€ accesspoint). But use a password and WPA2 – anyone who has access to your WLAN can send UDP commands to your loco!

Leave a Reply