9 abril 2013

RPIC, raspberry pi, rocrail and rocpi!!!

Category: Electrónica,Raspberry pi,Rocrail — Manolo @ 20:54
For the last version, visit always: http://tren.enmicasa.net/rpicd

 

In the last weeks I have been working on a new approach to use the raspberry pi and rocrail: RPIC.

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

rpic

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.

Thus, and inspired by the MDRRC Digital RailRoad Control by Robert Evers (http://vhaenchen.homepage.t-online.de/mdrrc/mdrrc.html), 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.

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).

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.
  • At least complete the research on MFX

As usual I am releasing all the code and updating the manual:

  • rpic firmware (and also the compiled file)
  • rocpi source code. Just extract the content in your rocrail source code folder and compile. I will be requesting to the rocrail community to accept this contribution and include it in the usual distribution packet
  • rocrail-4981-wheezy-armhf. A compiled version of rocrail with the rocpi library.
  • rocrail_save. An example of the rocrail.ini file and the daemon scripts
  • Setting up rocpi_v1.5. The updated version of the “book”

Next weekend I will try to prepare a specific page in the web-site to gather all the information related to the raspberry pi and rpic. And of course a good PCB coming soon.

IMG_0050p