User Tools

Site Tools


rocnet:article-en

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

rocnet:article-en [2018/11/12 08:56] (current)
Line 1: Line 1:
 +| //This is an article of RocNet for the MERG Journal planned for Vol 48-4, the Christmas Edition.// (Britisch English please...) |
 +
 +
 + \\
 +{{:​rocrail-logo-35.png}}
 +
 + \\
 +====== Model Railway Automation with Raspberry Pi. ======
 +The popular and inexpensive Raspberry Pi((“Raspberry Pi" is a trademark of the Raspberry Pi Foundation.)) tiny PC offers some interesting I/O like I2C and GPIO. Because the I2C bus is a common and standard one, the idea to use it for Model Railway automation was born in 2013.\\
 +Together with Peter Giling, who lives in the Netherlands,​ we have developed a range of modules for use with Model Railways.\\
 +And I am Rob Versluis, living in Germany, the founder and main developer of the Rocrail Project: __**http://​www.rocrail.net**__\\
 +
 +===== History =====
 +In September 2011, before the Raspberry Pi was released, one forum member mentioned that the Raspberry Pi might make for a Rocrail server that would fit under the layout. ​ Little did anyone realize just how popular, powerful, and flexible the Raspberry Pi would be.  In May of 2013 experimentation was done using a variety of communication methods. ​ In May of 2003 the first mention of Rocnet as a way communication between the PC and a Raspberry Pi occurred. ​ In August of 2013 the first version of a Rocnet client on the Raspberry was created. ​ It was a simple port expansion device. ​   Simple, robust, and easy to implement, it was a near perfect solution....and inexpensive too.  Next came the servo/LED controller, then the other modules. ​ \\
 +
 +Various forum members also tried a variety of TCP/IP protocols like SRCP (1). \\ 
 +While SRCP is certainly one possibility,​ it lacks plug-and-play capabilities as it is TCP/IP socket (2) based. ​  ​Rocnet,​ which is Multicast based, is plug-and-play.\\  ​
 +
 +While this was occurring, various other experiments were conducted by Peter and others.\\
 +A variety of I2C (3) peripheral devices were tried for various functions.\\
 +Some were successful, some less so.  One fact became increasingly clear as a result of these experiments. The Raspberry Pi (and its I2C bus) is a stable, robust and very capable platform.\\
 +The very best of these prototypes resulted in modules available from GCA (= Giling Computer Applications). ​ \\
 +In retrospect the Linux based Raspberry have proven to be more than just a simple controller for model railways.\\
 +Coupled with Rocrail/​Rocnet it becomes what some call a Super-Controller. \\ 
 +\\
 +**(1) SCRP = Simple Railraod Command Protocol**\\
 +\\
 +(2) **TCP/IP socket communications** requires that the IP address of the remote node be known before communications can start.\\
 +To resolve this issue, IP-Multicast is used so that remote node communications can occur without prior knowledge of the destination IP address.\\
 +This also means that the Raspberry'​s IP address can change without impact. ​  (IP address changes are common when DHCP is used to assign IP addresses.)\\
 +\\
 +(3)  **I2C = IIC = Inter Integrated Circuit**.\\
 +This hardware based communication protocoll , originated by Philips, is a 2 wire communication system between chips on the ame board.\\
 +Later improvements and speed-up, together with availability of bus transcievers and buffers like used in the RocNet modules, made it possible to extend the communication lines to more than 10 meter. ​
 + \\
 +
 +===== Setup =====
 +The whole system is kind of like '​Plug&​Play'​ but it needs an Ethernet Local Area Network in which IP-Multicast is not blocked by a firewall.\\
 +An Internet gateway is only necessary for updating the Rocnetnode software.\\
 +
 +====Small or Large====
 +
 +The following diagram shows a small and a large setup example:\\
 +|  {{:​rocnet:​rocnet-setup.png?​600}} ​ |  ORD-3 = 3 Amp booster ​ \\  SPROG = DCC generator ​ \\  RFID12 = RFID sensor like MERG  RFID Mk2 Reader ​ \\  RocNetNode = Raspberry Pi  \\  PI01 = GCA_PI01 RocNet interface board  \\  PI02 =  GCA_PI02 32-Ports RocNet I/O module ​ \\    |
 +The DHCP-Switch ( a small box used to interconnect TC/IP devices) is responsible for assigning IP addresses to the RasPi'​s and Rocrail.\\
 +The large setup example is especially interesting for modular layout like my own '​Plan-F':​ __**http://​wiki.rocrail.net/​doku.php?​id=plan-f:​plan-f-en**__.\\
 +
 +
 + \\
 +
 +===== Software =====
 +The Rocrail project has developed a protocol based on IP-Multicast Ethernet communication which was chosen for this RasPi solution.\\
 +The Rocnetnode is the software part running on the RasPi and will manage I/O, Servos and throttles. All hardware modules are I2C based and do not need any firmware; Rocnetnode handles it all.\\
 +The Rocnet Protocol is Open Source and is documented on the Rocrail Wiki pages: __**http://​wiki.rocrail.net/​doku.php?​id=rocnet:​rocnet-prot-en**__
 +
 + \\
 +
 +=====Hardware=====
 +This diagram shows the many and flexible possibilities of the Raspberry Pi solution in combination with Rocrail and Rocnetnode:​\\
 +{{:​rocnet:​gca-pi.png}}
 +
 + \\
 +==== Available modules ====
 +^  Interface ​ ^  32-I/​O ​ ^  16-Servo ​ ^  Throttle ​ ^  G-Decoder ​ ^  Power Supply ​ ^ Transformer Sensor ​ ^
 +| [[:​gca1-pi01-en|{{:​gca:​gca-pi01_pict03.jpg?​0x90}}]] | [[:​gca_pi02-en|{{:​gca:​gca_pi02_pict03.jpg?​0x90}}]] | [[:​gca-pi03-en|{{:​gca:​gca_pi03_pict01.jpg?​0x90}}]] | [[:​gca-pi04-en|{{:​gca:​pict5613.jpg?​0x90}}]] | {{:​gca:​gca_pi05_pict2.jpg?​0x90}} | {{:​gca:​gca_pi06_pict_02.jpg?​0x90}} | {{ :​gca:​gca_pi07_pict03.jpg?​0x90 }} |
 +|  [[:​gca1-pi01-en|GCA-Pi01]] ​ |  [[:​gca_pi02-en|GCA-Pi02]] ​ |  [[:​gca-pi03-en|GCA-Pi03]] ​ |  [[:​gca-pi04-en|GCA-Pi04]] ​ |  [[:​gca-pi05-en|GCA-Pi05]] ​ |  [[:​gca-pi06-en|GCA-Pi06]] ​ |  [[:​gca-pi07-en|GCA-Pi07]] ​ |
 + \\
 +
 +**There are seven hardware modules available:​**
 +| Pi01 | The main module which connects directly on the RasPi GPIO header. |
 +| Pi02 | 32 port I/O module which is compatible with all GCA interface modules: __**http://​wiki.rocrail.net/​doku.php?​id=english#​interfaces**__. |
 +| Pi03 | 16 port PWM module for controlling servos. It's an adapter for the Adafruit PCA9685 PWM controller. \\  Also usable for dimming LEDs (4095 steps) |
 +| Pi04 | A hand-held throttle with 28 functions. |
 +| Pi05 | Large scale decoder which can report RFID tags scanned between the tracks. (This is still work in progress.) |
 +| Pi06 | 3A power supply and I2C hub together |
 +| Pi07 | Zero loss occupancy detection which can handle low and high current for large scale locos. | \\
 + \\
 +All modules have I2C line drivers to make long cables possible.\\
 +You can choose between RJ45(CAT) and RJ12(LocoNet) connector types.\\
 +I personally prefer RJ12 because this type is easy to assemble yourself with very flexible cable, and it cannot be accidentally swapped with the RJ45 Ethernet cables.\\
 +
 + \\
 + 
 +
 +===Pi01 Raspberry Pi connection===
 +The Pi01 connects on the RasPi GPIO header and serves also as a power supply when connected to the Pi06.\\
 +{{:​gca:​gca-pi01_pict03.jpg?​300}}\\
 +The board offers two LEDs and one button. The green LED starts to blink if Rocnetnode has been started.\\
 +The red LED is used for identification when requested by Rocrail, which is very useful in the case of a large setup.\\
 +A short push on the button will identify this Rocnetnode to Rocrail and  will popup the configuration utility with this node selected.\\
 +A long push of several seconds duration will shutdown this RasPi as indicated by fast blinking of the green LED.\\
 +
 +It is not necessary to shutdown the RasPi because the configuration is saved on the SD-Card. But for those who will get a bad conscience when pulling the power supply plug of a Raspberry Pi, the shutdown(all) option is available in some variations.\\ ​
 +
 + \\
 +
 +===Pi02===
 +{{:​gca:​gca_pi02_pict03.jpg?​300}} \\
 +The Pi02 is a module with 32 programable I/O for a wide range of applications like:
 +  * LEDs (Signals)
 +  * Pushbuttons
 +  * Frog polarisation
 +  * Coil switches
 +  * Servos
 +  * and so on...
 +
 +==Interfaces==
 +The list of compatible interfaces for the Pi02 is long and is documented here: __**http://​wiki.rocrail.net/​doku.php?​id=english#​interfaces**__.\\
 +
 +A small overview of possible interfaces:
 +  * Occupancy detection based on current: **GCA93**
 +  * Hall sensors and reed contacts (Magnets): **GCA173**
 +  * Fiddle Yard / Turntable / Traverse controller: **GCA145**
 +  * Coil drivers up to 10A: **GCA76**, **GCA77**
 +  * Relay board for frog polarisation:​ **GCA107**
 +  * Servo drivers: **GCA136**
 +
 +LEDs or other low power consuming parts can be connected directly with the needed resistor.\\
 +Also push buttons can be connected directly to be able to create a CTC.\\ ​
 + \\
 +
 +===Pi03 PWM Controller===
 +The Pi03 uses the Adafruit PCA9685 PWM controller as piggyback because the footprint of the chip is for our techniques too small.\\
 +{{:​gca:​gca_pi03_pict01.jpg?​300}}\\
 +An alternative would have been to let the chip be mounted directly on the professional board but this investment would not fit in our hobby budget.\\ ​
 +But also as piggyback solution this board is just great for servos and general PWM. (Day and Night lighting.)\\
 +
 +
 + \\
 +
 +===Pi04 Throttle===
 +This throttle, also called '​Rocmouse',​ is Command Station independent and has the look and feel of a FREMO Fredi.\\
 +{{:​gca:​pict5613.jpg?​300}}\\
 +The commandos are scanned by Rocnetnode running on the RasPi and are forwarded to Rocrail.\\
 +Rocrail will dispatch the received commands to the configured Command Station in its own native protocol like Xpressnet for example.\\ ​
 +It can be hot plugged in any free I2C connector.\\
 +=== Features ===
 +  * Rotary knob for speed; 50 steps which are recalculated to meet the real loco speed steps.
 +  * Direction switch with V=0 position.
 +  * 28 functions divided in groups of 4. The group number is represented as binary number by the LEDs above the buttons.
 +  * Lights.
 +  * Flashing Scan/Run LED.
 +  * Up to 8 connected on one RocNetNode.
 +
 + \\
 +
 +===Pi06 Power Supply===
 +The Pi06 serves as power supply for all modules and the RasPi.\\
 +{{:​gca:​gca_pi06_pict_02.jpg?​300}}\\
 +It also is a concentrator for the I2C bus.\\
 +It has only four connectors but all modules can be daisy chained in sequence.\\
 +
 +The project was started using common 5V USB power supplies but that solution has been dropped because of the bad quality of those units and never delivered the promised 5V.\\
 +The Pi06 made the project more accepted by avoiding many unwanted 5V adapters.\\
 +
 + \\
 +
 +===Pi07 Zero loss current detection===
 +The original idea came from Richard Andrews (Texas).\\
 +{{:​gca:​gca_pi07_pict03.jpg?​0x300}}\\
 +Peter and I did not take it very serious at start but Richards experiments came to a good useable result.\\
 +After prototyping by Peter we added this to the Pi line of hardware.\\
 +
 +
 + \\
 +
 +=====Modular Example=====
 +I already migrated two modules. Module 2 is shown in the picture below with all its hardware:\\
 +{{:​plan-f:​plan-f-mod2-rocnet.jpg?​800}}
 +  * Software Command Station: RocNetNode + DCC232 + ORD3/4 -> __**http://​wiki.rocrail.net/​doku.php?​id=dcc232-en**__
 +  * Only one 16V AC 70VA transformer is needed for the whole '​Plan-F'​ setup. ​
 +  * The small Ethernet Switch is a low budget one for less the €10 which can be daisy chained from one layout module to the other.
 +
 +
 + \\
 +
 +=====Configuration=====
 +For configuring the Rocnetnode options, I/O and Servos there is a very advanced utility in Rocrail in which every detail can be viewed and set.\\
 +{{:​rocnet:​rocnetnode-index-en.png?​350}}{{:​rocnet:​rocnetnode-portsetup-en.png?​350}}{{:​rocnet:​rocnetnode-channelsetup-en.png?​350}}\\
 +
 +====Configuration Tabs====
 +^ Tab name ^ Configuration ^
 +| **Index** | A list of automatically registered Rocnetnodes. |
 +| **RocNet** | A tree view of all nodes with the basic settings. |
 +| **Options** | Defines which hardware is connected; Even the SPROG can be included. |
 +| **Pi02 Port Setup** | I/O configuration. |
 +| **Pi03 Channel Setup** | Servo and/or PWM configuration. |
 +| **Macro** | Especially for signal system with more then 4 aspects. |
 +| **Update** | On the fly update the Rocnetnode software. |
 +See for detailed information:​ __**http://​wiki.rocrail.net/​doku.php?​id=rocnet:​rocnetnode-setup-en**__.\\
 +
 +
 + \\
 +
 +===== Boards and Kits =====
 +Professional boards and kits can be ordered at the Web site of Peter Giling : __**http://​www.phgiling.net/​**__.\\
 +Also a pre-configured SD-Card or Micro Sd-Card with installed Raspbian and Rocnetnode is available in combination with an order.\\
 +
 + \\
 +
 +===== Support =====
 +The support of Rocrail and all related Hardware is covered by a very good Forum with many good Moderators.\\
 +The Forum Internet address is: __**http://​forum.rocrail.net**__\\
 +
 + \\
 +
 +===== The Future =====
 +Because the Raspberry Pi OS is Open Source, the Rocrail/​Rocnet system is easily added to or modified.\\
 +A sound client is one idea by using the audio output of the RasPi.
 +
 +
 + \\
 +===== Abbreviations =====
 +^ Abbreviation ^ Meaning ^ Internet link ^
 +| I/O | Input/​Output | http://​en.wikipedia.org/​wiki/​I/​O |
 +| I2C | Serial computer bus invented by Philips. | http://​en.wikipedia.org/​wiki/​I%C2%B2C |
 +| GPIO | General Purpose I/O | http://​en.wikipedia.org/​wiki/​GPIO |
 +| TCP/IP | Internet protocol suite | http://​en.wikipedia.org/​wiki/​Tcp/​ip |
 +| SRCP | Simple Railroad Command Protocol | http://​srcpd.sourceforge.net/​ |
 +| GCA | Giling Computer Applications | http://​www.phgiling.net/​ |
 +| DHCP | Dynamic Host Configuration Protocol | http://​en.wikipedia.org/​wiki/​Dhcp |
 +| IP address | Internet Protocol address | http://​en.wikipedia.org/​wiki/​Ip_address |
 +| IP Multicasting | Sending Internet Protocol (IP) datagrams to a group of interested receivers | http://​en.wikipedia.org/​wiki/​IP_multicast |
 +| RasPi | Short form of "​Raspberry Pi" | http://​www.raspberrypi.org/​ |
 +| PWM | Pulse-width modulation | http://​en.wikipedia.org/​wiki/​Pulse-width_modulation |
 +| SD-Card | Secure Digital (SD) is a non-volatile memory card format for use in portable devices. | http://​en.wikipedia.org/​wiki/​SD-card |
 +| CTC | Centralized traffic control | http://​en.wikipedia.org/​wiki/​Centralized_traffic_control |
 +| FREMO | Freundeskreises Europäischer Modellbahner – FREMO e. V. | http://​www.fremo-net.eu/​3.html?&​L=6 |
 +| Ethernet Switch | Network Switch(Hub) | http://​en.wikipedia.org/​wiki/​Ethernet_switch |
 +
  
rocnet/article-en.txt · Last modified: 2018/11/12 08:56 (external edit)