Raspberry Pi Logo.svg


Roc-Pi Hardware

There are 3 different I/O buses on the Rpi (Raspberry Pi). They are I2C-0, I2C-1 and SPI. I have designated each bus by function per the chart below.

I2C #0

Lighting Control

I2C #1

Servo (turnout) Control


Block Detection

The hardware required is very easy to build. All of the port expanders and Serve/LED controllers are connected to the Raspberry's I2C buses. The I2C bus is a simple moderate speed serial bus that allows for many devices to be attached to the Rpi (Raspberry Pi) It is simplicity itself to connect to. There are only 4 wires needed. +3volts, ground,. SDA (Serial Data) and SCL (Serial Clock). Assuming that you are using a model B Rpi, the pinouts for each bus are below.

I2C bus #0 (secondary) P5 Pinout (needs header)

Raspberry I2C Bus #1 (Primary Bus) Pinout

Rpi SPI (and I2C #1) Pinout

Servo and LED Controller

The easiest way to get a servo controller is to purchase an Adafruit controller. Priced at $15 this allows 16 servos to be controlled. That is less than a $1 per servo.

Adafruit 16 port Servo/LED Controller ($15)

LED High Current Driver

LED High Current Interface Diagram

I made 16 channel high current interface boards. It was not hard to build using hobby boards

16 channel High Current LED Driver Board (~$15)

Hobby PC Board (front) ($0.30 ea)

Hobby PC Board (back) ($0.30 ea.)


I use the Sainsmart Signal relay boards. While the specs say that it can be driven with 2.5 volts, I have found that the 1k resistor has to be changed to 680 ohms and the 10k resistor removed..

Sainsmart DPDT 8 Relay Board ($20)

Port Expander – 16 ports (~$2)

Rocrail is copyright Rocrail.net.

Raspberry Pi is a trademark of the Raspberry Pi Foundation