RocNetNode Raspbian Package

Introduction

To make the Raspi RocNetNode Plug&Play an installer package which contains all what is needed to configure and operate is provided.

Raspbian

The installer target is Raspbian and will not install on Debian.

The following error will occur when trying to install on Debian:

dpkg: error processing rocnetnode-5906-raspbian-armhf.deb (--install):
package architecture (armhf) does not match system (armel)

It is strongly encouraged to use Raspbian because it is optimized for the Rasberry Pi and has therefor better performance.

Package contents

Description File
RocNetNode binary /opt/rocnet/rocnetnode
Libraries /opt/rocnet/dcc232.so
/opt/rocnet/sprog.so
/opt/rocnet/rfid12.so
Default setup /opt/rocnet/rocnetnode.ini
Startup script /opt/rocnet/rocnetnode.sh
Update script /opt/rocnet/update.sh
Daemon script /etc/init.d/rocnetnoded
Configure the I2C modules postinst
Configure the RocNetNode as service at run level 2 and 3 postinst


Download & Install

With ssh or a direct connection:

wget http://rocrail.net/software/rocrail-snapshot/raspi/rocnetnode-xxxx-raspbian-armhf.deb
sudo dpkg -i rocnetnode-xxxx-raspbian-armhf.deb
sudo reboot
Default login: user=pi, password=raspberry

Note: The default keyboard layout is used which is English. (QWERTY)

Upgrade

Upgrades are, especially after the first roll out, sometimes necessary to fix bugs and to add extra functionality.
Its done in just a four steps:

sudo service rocnetnoded stop
wget http://rocrail.net/software/rocrail-snapshot/raspi/rocnetnode-xxxxx-raspbian-armhf.deb
sudo dpkg -i rocnetnode-xxxx-raspbian-armhf.deb
sudo service rocnetnoded start

The “xxxxx” must be replaced with the wanted revision number.

Shutdown

Workspace

At shutdown “Rocview & Server” a second question is asked to shutdown all RocNetNodes in case RocNet is one of the controllers in the Rocrail server.

Configuration Dialog

See: RocNetNode Configuration → Shutdown

Terminal

sudo service rocnetnoded stop

Power off

This is not the preferred way to shutdown RocNetNode because it does not report it to the Rocrail server and at worst case it could be loss of configuration settings.
But sometimes an unwanted power off happens and should normally not lead to any problem.

Setup from source

Skip this if the package did install successfully.

Build

git clone https://gitlab.com/rocrail/Rocrail
cd Rocrail
make fromtar
sudo make install
cd rocnetnode
sudo make install

Auto startup

sudo cp ~/Rocrail/rocnetnode/package/rocnetnoded /etc/init.d/rocnetnoded
sudo chmod 755 /etc/init.d/rocnetnoded
sudo chmod 755 /opt/rocnet/rocnetnode.sh
sudo update-rc.d rocnetnoded defaults

To re-install afterwards a modified rocnetnoded script it has to be removed first:

sudo update-rc.d rocnetnoded remove

Otherwise the command does do nothing than show warnings only.

Run levels

Event Levels
Start 2, 3
Stop 0, 1, 6


Manually start/stop

The RocNetNode can be manually started and stopped with the service command:

sudo service rocnetnoded stop


Modifications

Hosts

The last line in file /etc/hosts: (127.0.1.1 raspberrypi)

127.0.0.1	localhost
::1		localhost ip6-localhost ip6-loopback
fe00::0		ip6-localnet
ff00::0		ip6-mcastprefix
ff02::1		ip6-allnodes
ff02::2		ip6-allrouters

127.0.1.1	raspberrypi

must be deleted.
This is needed to retrieve the real IP address of this node.


I2C

See: I2C preparations

This can only be enabled with the sudo command.

Remove the modules from the /etc/modprobe.d/raspi-blacklist.conf by commenting them out (insert # at the beginning of the following lines):

# blacklist spi and i2c by default (many users don't need them)

#blacklist spi-bcm2708
#blacklist i2c-bcm2708

Add them in /etc/modules:

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.
snd-bcm2835
i2c-bcm2708
i2c-dev

Check the I2C bus

Get the I2C tools:

sudo apt-get install i2c-tools

Check bus 1 with 2 x GCA-Pi02:

pi@raspberrypi ~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: 20 21 22 23 -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --    


FAQ

  1. Can both the Rocrail server and the RocNetNode be installed on the same Raspberry Pi?
    • Yes.
  2. I2C stopped working after an Raspbian update


Links

Technical Details

The components used for basic I/O are the MCP23017 and the Adafruit 16 channel LED/Servo board. The Adafruit board is based on the PCA9685. Datasheets are readily available for both. There are many different I2C chips available but most are available only in surface mount.


Security

Security of the Rpi (Raspberry Pi) is a topic that is not well covered. Since the Rpi runs a standard version of Linux, security measures for Linux also apply to the Rpi. Some of the measures that should be taken are:

  1. Change the default password for 'pi'.
  2. Turn off unneeded services such as cups (print), etc.

There are other preventative measures that could or should be taken but is well outside the scope of this reminder.



Personal Tools