12 abril 2013


Category: — Manolo @ 20:53

Esta es la única página escrita en inglés, a fin de facilitar el intercambio de información – principalmente con el proyecto Rocrail. Si alguien necesita información en castellano, como siempre, que no dude en mandarme un correo.

This page is the only one written in english, in order to make easier the exchange of information – mainly with the Rocrail project. If someone needs information in Spanish, as usual, do not hesitate and contact me by e-mail


For the last version of the code, please visit the repository:





The raspberry and PIC (RPIC) is a very basic electronic circuit to have a multiprotocol central station running in the raspberry pi.


RPIC is basically code running on a Microchip microcontroller (currently a pic16f1825)

The main motivation to produce this firmware has been the failure in making DDX running on the rpi (http://forum.rocrail.net/viewtopic.php?t=4763). In the best scenario, the rpi was capable of use ddx through an usb adaptor, consuming a considerable amount of resources in the raspberry. You can see some of the posts to check the problems found whilest trying to get the rpi running with DDX

Thus, and inspired by the MDRRC Digital RailRoad Control by Robert Evers, I decided to develop my own ucontroller central station.

Yes, it is yet another solution for managing model trains. The main difference with other solutions is that rpic is born to be used jointly with rocrail and the raspberry pi. Of course, with the right HW adaptor, it could be used with other platforms, and with the right protocol, it could be also used by other pieces of SW… but for that purposes there are already many available solutions. The objective was to complement the raspberry pi with the minimum pieces of HW to get a full control center.

Currently RPIC works together the rocpi library created for rocrail. There are basically two modes of use: as an auxiliary command station, or as the main command station.

RPIC as auxiliary command stations

The rocpi library can be used as a secondary station to make use of the GPIO port of the raspberry pi. In this case, the ucontroller and max3232 of the schematic, can be removed.

In the current version, what the user will obtain is:

  • A led informing the daemon is up and running or not
  • A button to reset the daemon (short pulse) or turn off your raspberry pi (pressing the button for more than 4 seconds).
  • Three configurable buttons (WIP)

RPIC as main command stations

The current features included in the firmware are:

  • Support for MM1 and MM2 protocol
  • Support for NMRA (long and short addresses) – 14,28 and 128 steps
  • Support for NMRA accessories (no extended accessories so far)
  • Support for writing CV.

There are some other eastern eggs – as the capability to generate MFX messages). The development is not completed and coming features include:

  • Full support to reading and writing cvs, only on the main
  • Segregated programing track (PT), with the possibility to run both the trains and send commands to the PT.
  • MM accessories, MM1Fx and the special protocols MM3, MM4 and MM5 available in ddx (under demand)
  • Capturing of power consumption from ORD-2 and ORD-3 boosters (WIP, the schematic can be found already.. but the HW has not been tested yet… and there is not SW either)
  • At least complete the research on MFX.

2013-09-29 20.45.37

PCB and pic programming

In order to use RPIC a PCB prototype can be found in the HW repository of launchpad. It basically provides for four button:

1. Reser Rocrail Daemon /shut down raspberry pi

2. To be assigned -i.e. launch touchscreen keyboard

3. To be assigned – i.e. launch rocview

4. Reset PIC

The idea is to let the user configure the buttons in further version, improving the script to install both the daemon and the firmware at the pic. At this stage, programming can be done with an external programming, just moving the jumper to the programming mode, or directly from the raspberry through a script that program the ucontroler  using LVP. Further instructions can be found at the manual.