This page provides setup information for the Andino X1 base board. For documentation on a specific Andino X1 configuration and setup documentation for extensions, refer to the product-specific setup documentation.

Important: It is now possible (and recommended) to set up all Andino boards using our Andinopy setup script. This will automatically configure hardware settings, download necessary overlays and optionally also installs the Andinopy library / TCP stack and Node-Red. You will not need to follow this baseboard setup documentation when using the setup script.

  1. Release the ttyAMA0 from getty and asign it to GIO14, GPIO15 (used for the Modem)
  2. Add a driver for the SPI UART (RS232 and RS485)
  3. Add a driver for the CAN Bus
  4. Add a driver for the Temperatur Sensor

The recommended way to enable SPI is downloading the pre-compiled overlay from GitHub. To do so, we first need to download the overlay from GitHub to our home directory:

cd ~/

Now, copy the downloaded file to /boot/overlays/:

sudo cp sc16is752-spi0-ce1.dtbo /boot/overlays/

If you would rather like to compile the overlay yourself, the sources can be found on our GitHub too. First, download the sources, as well as the make-file into your home directory

cd ~/

Make the make-file executable and run it. This will compile the source code and move the compiled file to /boot/overlays.

chmod +x ./
sudo ./makedts.s

After having installed the overlay, stop getty on serial0. Edit /boot/cmdline.txt:

sudo nano /boot/cmdline.txt 

Here, remove all intries starting with console=… (see example below, all bold entries have to be removed).

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 .....

Save and quit the file. Afterwards, some changes in the /boot/config.txt have to be made:

sudo nano /boot/config.txt

Jump to the end of the file and add the following lines:

# -----------------------
# Andino IO from here
# -----------------------

# SPI on

# I2C on

# sudo apt-get install -y i2c-tools
# i2cdetect -y 1

# CAN on SPI 0.0
# sudo apt-get install can-utils
# sudo ip link set can0 up type can bitrate 125000
# sudo ifconfig
# cansend can0 456#43414e2054657374
# candump can0

# 1. UART
# /dev/ttyAMA0 = Modem

# 2. SPI-UART on SPI 0.1
# /dev/ttySC0 = RS485
# /dev/ttySC1 = RS232

# DS1820 Temp sensor
# cat   /sys/bus/w1/devices/28-00000a990ab5/w1_slave

Save and quit, then reboot the Pi.

sudo reboot now

Finally, edit the file /etc/modules and check if the line


is present. If not, add it to the end of the file. Then save and quit.

The UART SPI driver should now be fully configured and the two devices /dev/ttySC0 and /dev/ttySC1 should be visible.

The digital inputs are connected to the GPIO:

The Inputs are calculated for 24 Volt Input. Normaly a signal of 24 Volt is applied to Pin 2 and the Ground to Pin 1. (active Mode)

By closing the JumperX the Inputs can be driven in passive Mode or Dry Contact. This means a Switch / Relaycontact can be conneted between Pin 3 and Pin 2.

Andino IO - digital input schematics

Andino IO - digital input configuration

The Relay are controlled by the GPIO:

The Relays can drive 230V and up to 5 ampere. There a no Fuses at the relay contacts!!

The Power Fail Input can be used to inform the Raspberry about a Mains Power loss. This can be done by a Switch- / Relay-Contact. Just bridge Pin1 and Pin2 to signal Power good/fail.

Andino IO - Power Fail Input

This feature can be used together with the Andino UPS

sudo echo "18" > /sys/class/gpio/export
sudo echo "in" > /sys/class/gpio/gpio18/direction
cat /sys/class/gpio/gpio18/value

The RS232 and RS485 based on the SPI Uart from NXP SC16IS752.

Important: For RS232, make sure that the ground pin (GND) has the same potential as the minus pin of the power input! Furthermore, the RS232 bus is not galvanically insulated!

After prepare the Debian for the use of the SPI Uart (see Prepare Debian) the /dev/ttySC1 is the RS232 Channel. The Signals on the RS232 Port are +-12 Volt.

You can exit minicom with CTRL-A then X

sudo apt-get install minicom
sudo nano minicom –setup
# press Serial Port Setup

| A -    Serial Device      : /dev/ttySC1                               |
| B - Lockfile Location     : /var/lock                                 |
| C -   Callin Program      :                                           |
| D -  Callout Program      :                                           |
| E -    Bps/Par/Bits       : 38400 8N1                                 |
| F - Hardware Flow Control : No                                        |
| G - Software Flow Control : No                                        |
|                                                                       |
|    Change which setting?                                              |
        | Screen and keyboard      |
        | Save setup as dfl        |
        | Save setup as..          |
        | Exit                     |
        | Exit from Minicom        |

sudo apt-get install python-serial

after that you can send data:

import serial
import time

ser = serial.Serial(
               baudrate = 9600,

for i in range(2):
        ser.write(str(i)+ b"Hello 232\n")
        s = ser.readline()
        print( s.rstrip() )

After prepare the Debian for the use of the SPI Uart (see Prepare Debian) the /dev/ttySC0 is the RS485 Channel. It can be used as full duplex RS422 or as two wire RS485. In RS485 Mode the transmitter can be switched on either by the RTS signal or automaticaly.

RS485 Jumper

Send in manual mode

for i in range(2):
        # Transmitter on
        ser.write(str(i)+ b"Hello 485\r\n")
        s = ser.readline()
        print( s.rstrip() )
        # Transmitter off

Send in RS485 Auto mode

for i in range(2):
        ser.write(str(i)+ b"Hello 485\r\n")
        s = ser.readline()
        print( s.rstrip() )

The CAN Bus based on the Microchip MCP2515 and the Tranceiver MCP2551. It is supported by the Raspberry Pi.

sudo apt-get install can-utils
sudo ip link set can0 up type can bitrate 125000
sudo ifconfig can0
cansend can0 456#43414e2054657374
# or
candump can0

The Device has a Build in temperatur Sensor DS1820. The Sensor is wired to GPIO 22.

ls /sys/bus/w1/devices/
cat   /sys/bus/w1/devices/28-00000a990ab5/w1_slave
6a 01 4b 46 7f ff 06 10 5f : crc=5f YES
6a 01 4b 46 7f ff 06 10 5f t=22625

This is 22.6225 Degrees Celsius

The Modem is connected to the internal UART of the Raspberry Pi.


This Port has to configured to GPIO14 and GPIO15 (see Prepare Debian)

Modem Connector

You can find some example python scripts in this folder of our GitHub repository. You can test the modem with a simple python script:

# -*- encoding: utf-8 -*-
import time
import serial

def send(data):
   p = serial.Serial("/dev/ttyAMA0" , 57600 )
   print rdata

send("sys reset")


send("mac get deveui")

And then, in a new terminal, you can get the eui from the device:

$ python
sys reset
RN2483 1.0.4 Oct 12 2017 14:59:25
mac get deveui

The OLED Display is connected via the I2C Bus with the address 68. This can be seen when checking the i2c devices:

apt-get install -y i2c-tools
i2cdetect -y 1

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

0x3C is the OLED-Display 0x68 is the RTC

To print custom text on the display through external programs (e.g. Node-Red), you need to install Andinopy TCP. To do so, follow this installation instruction.

Execute this

sudo -s
chmod +x /etc/rc.local 
apt-get purge -y fake-hwclock 
apt-get remove fake-hwclock -y 
dpkg --purge fake-hwclock 
rm -f /etc/adjtime. 
cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime
ln -s /home/pi/bin/ /etc/cron.hourly/ntp2hwclock
sudo reboot now

hwclock -w
hwclock -r

This Python script sets the NTP Time to the HWClock as long a NTP connection can established. Place this script at /home/pi/bin/ (for example, see above)

# Location of logfile
if [ ! -f $LOGFILE ]; then
  touch $LOGFILE
# Set the maximum allowed difference in seconds between Hw-Clock and Sys-Clock
msgNoConnection="No connection to time-server"
msgConnection="Connection to time-server"
# Check for NTP connection
if ( ntpq -p | grep -q "^*"  ); then
        echo $msgConnection >> $LOGFILE
        echo "---------------------------------"  >> $LOGFILE
        secHwClock=$(sudo hwclock --debug | grep "^Hw clock time" | awk '{print $(NF-3)}')
        echo "HwClock: $secHwClock sec" >> $LOGFILE
        secSysClock=$(date +"%s")
        echo "SysClock: $secSysClock sec" >> $LOGFILE
        echo "---------------------------------" >> $LOGFILE
        # Compute absolute value
        if ( echo $secDiff | grep -q "-" ); then
            secDiff=$(echo $secDiff | cut -d "-" -f 2)
        echo "Difference: $secDiff sec" >> $LOGFILE
        msgDiff="HwClock difference: $secDiff sec"
        if [ "$secDiff" -gt "$maxDiffSec" ] ; then
                echo "---------------------------------" >> $LOGFILE
                echo "The difference between Hw- and Sys-Clock is more than $maxDiffSec sec." >> $LOGFILE
                echo "Hw-Clock will be updated" >> $LOGFILE
                # Update hwclock from system clock
                sudo hwclock -w
                msgDiff="$msgDiff --> HW-Clock updated." >> $LOGFILE
        if !(awk '/./{line=$0} END{print line}' $LOGFILE | grep -q "$msgConnection") || [ "$secDiff" -gt "$maxDiffSec" ]; then
                echo $(date)": "$msgConnection". "$msgDiff >> $LOGFILE
        # No NTP connection
        echo $msgNoConnection
        if !(awk '/./{line=$0} END{print line}' $LOGFILE | grep -q "$msgNoConnection"); then
                echo $(date)": $msgNoConnection" >> $LOGFILE

GPIO Mapping of the Andino IO

To enable WAN communication, please refer to the following setup tutorials:

Modbus RTU can be used via RS485. Modbus TCP is also supported on the Raspberry Pi via Pymodbus. To install PyModbus, you need to have python, pip and pyserial installed as a prerequisite.

sudo apt install python python-pip
sudo pip install pyserial
sudo pip install pymodbus

For further information on how to use PyModbus, please refer to the official PyModbus documentation.

Andino IO - Raspberry Pi on DIN Rail - Front view Andino IO - Raspberry Pi on DIN Rail - PCB Overview Andino IO - Raspberry Pi on DIN Rail - Block Diagram