LocoLinx on Arduino Duemilanove with Loconet Shield on Proto Shield

Contents


The Arduino Duemilanove is a little bit outdated but has some advantages:

If you do not have one at hand you can try to get a clone from ebay.

Here I will also show you a simple LocoNet Shield build on a Arduino Proto Shield.

The Arduino and the Shield in an acryl glass housing
The Arduino and the Shield in an acryl glass housing

Install Arduino IDE

Download from https://www.arduino.cc/en/Main/Software and install.
I used Version 1.6.9 / Windows Installer.

Download LocoNet Library from MRRWA

Follow Instructions on http://mrrwa.org/download/ for download and import.

Install LbServer

Install on Windows

Download latested LbServer_0.NN_Win32_Setup.zip from https://sourceforge.net/projects/loconetovertcp/files/LbServer/, unzip and execute setup.exe.

Install on Linux

Download latested LbServer_0.NN_Source.zip from https://sourceforge.net/projects/loconetovertcp/files/LbServer/, unzip, build and execute make install. You can validate the installation by starting the help screen of LbServer with LbServer -h.

$ unzip LbServer_0.12_Source.zip
$ cd LbServer_0.12_Source/server/LbServer/
$ make
g++ -pipe -Wall -W -O2 -g -fexceptions ...
$ sudo make install
strip --strip-all Debug/LbServer -o Release/LbServer
cp Release/LbServer /usr/local/bin/
$ LbServer -h
LocoBuffer Server version 0.12.0.0, for protocol version 1, built Jul  7 2016,
released under GPL by Stefan Bormann.  Linux port by Ian Cunningham.
...
$

The Selfbuild Loconet Shield

A simple LocoNet Shield can be build by using a Proto Shield. I used the following schematic:

Schematic of Shield ([PDF Version](Loconet_Shield.sch.pdf))
Schematic of Shield (PDF Version)
The build shield already mounted
The build shield already mounted

Setup Hardware

Required:

Connect Arduino and Shield.

Connect the hardware handshake line CTS on the Arduino (X3 Pin 1) to Digital IO 9:

The connection of the hardware handshake line CTS
The connection of the hardware handshake line CTS

Connect the Arduino to your PC by USB.

Load Arduino with Sketch

  1. Start Arduino IDE
  2. Open Sketch:
    File >> Examples >> LocoNet >> LocoLinx
  3. Select Board
    Tools >> Board >> Duemilanove or Diecimila
  4. Connect Arduino to PC using USB-Cable
  5. Select Port
    Tools >> Port >> COM6
    (port number may vary)
  6. Upload Sketch
    Sketch >> Upload
  7. Wait until sketch has been compiled and uploaded

Test

Test on Windows

  1. Configure LbServer
    Start >> All Programs >> LocoNet over TCP >> LbServerConfig
Use 57600bps with flow control
Use 57600bps with flow control
  1. Start LbServer
    Start >> All Programs >> LocoNet over TCP >> LbServer

  2. Connect some Clients and see if Receive and Send is working:

The Output of LbServer
The Output of LbServer

Test on Linux

  1. Start LbServer from a terminal with required arguments.

  2. Connect some Clients

    $ LbServer /dev/ttyUSB0 1234 57600 true
    LocoBuffer Server version 0.12.0.0, for protocol version 1, built Jul  7 2016,
    released under GPL by Stefan Bormann.  Linux port by Ian Cunningham.
    
    Loconet device port opened on /dev/ttyUSB0 with 57600 baud and CTS flow control.
    TCP server started on port 1234.
    Output uses single characters for increased performance:
    R=received packet, .=nothing received but event was signaled :-(
    s=send request, S=sent successfully, e=send error
    C=client connected, D=client disconnected
    RRRRRRRRRRRRRRRCsRSRsRSsRSsRSsRSsRSsRSsRSsRSsRSRRRRRRRsRSRsRSsRSsRSDR
    

Newer Versions

As of April 2023 there are newer version available of the software used. As there is a bug in the old LocoNet version so please use:

Other Resources

Dirkjan Kaper has designed the FremoLNShield:
http://nh-finescale.nl/fremo/dcc/fremo-ln-shield/FremoLNShield.html
John Plocher has also designed a nice LocoNet Shield (check pin numbers):
https://www.spcoast.com/pages/LocoShield.html
Schematic of Shield as PDF file:
Loconet_Shield.sch.pdf