Product Description #

The RevPi Flat S is a non-modular 24 V industrial PC for IIoT and automation projects based on the Raspberry Pi Compute Module 4S. Due to its flat design, the RevPi Flat S is suitable for installation in sub-distribution cabinets in accordance with DIN EN 18012.

Components #

Note

RevPi Flat and RevPi Flat S have the same structure.

revpi-flat-s-aufbau
Position Component Application

1

6 × status LED

LEDs

2

Button

Freely configurable push-button

3

2 × locking clip

Mounting the Device on a DIN Rail

4

Micro USB

Only for model RevPi Flat S:
Saving and Reinstalling the Image

5

4 × RJ45 Ethernet

Ethernet Interfaces (RJ45),
Establishing a Network Connection

6

2× USB A

USB Interfaces

7

Digital output (relay contact)

Digital output (relay contact)

8

POWER
(2-pin plug)

Connecting the Power Supply

9

Analog input /
Analog output
(5-pin plug)

Analog Inputs and Outputs

10

RS485-0
(3-pin plug)

Serial Devices (RS485)

11

RS485-1
(RJ14 connection)

Serial Devices (RS485)

12

RP-SMA socket

WLAN and BT

13

Ventilation Slots

Mounting the Device on a DIN Rail

Compatible RevPi Images for RevPi Flat S:
  • RevPi Bookworm Image

  • RevPi Bullseye Image

See: RevPi Images.

Variants #

RevPi Flat S #

Item No.: RAM eMMC Micro USB

100330

1 GB

8 GB

Yes

RevPi Flat #

Item No.: RAM eMMC Micro USB

100371

1 GB

32 GB

No

For available variants see Revolution Pi Shop.

The RevPi Flat was designed as a tamper-proof device. Therefore, it is not intended that you can flash the image of the device (in contrast to the product model RevPi Flat S).

Virtual Devices #

The Virtual Devices are delivered with the RevPi image as components in PiCtory included:

Scope of Delivery #

The scope of delivery includes

  • RevPi Flat S or Rev Pi Flat (non-modular base module)

  • 2-pin plug POWER

  • 5-pin plug ANALOG

  • 3-pin plug RS-485-0

  • 2-pin plug for relay contact

  • Supplement

Mounting and Connecting #

The RevPi was developed for use in a control cabinet. Observe the specifications for the Intended Use and all Safety Instructions.

Carry out the installation and connection in the following order:

  1. Mount your RevPi on a DIN rail.

  2. Connect all other devices such as sensors and actuators. The interfaces available to you for this can be found in the Components section.

  3. As the last step connect the power supply.

Connecting the Power Supply #

Warning
Danger to life due to electrical shock

There is a risk of fatal electrical shock when working on devices in the switch cabinet with 230 V mains voltage.

▷ Operations in the switch cabinet may only be carried out by qualified electricians.

▷ Before carrying out any operations in the switch cabinet, switch off the power supply properly.

Important
Damage to the device due to impermissible power supply

▷ Observe the maximum voltage supply of 28.8 V DC.

▷ Only use the supplied plug and a suitable power supply unit.

▷ Ensure correct polarity when connecting.

▷ Ensure a stable power supply.

Important
Damage to the device due to installation under voltage supply

While the RevPi device is connected to a power source, no other devices may be connected or disconnected, as this may cause damage to the devices.

▷ Do not connect the power supply until all other devices are connected correctly.

▷ Switch off the power supply before disconnecting a device from the system.

Important
Damage to the device software due to disconnection from the power supply

If the device is disconnected from the power supply during operation, the file system of the eMMC memory may be destroyed. The device can then no longer be booted.

▷ Shut down the device properly before disconnecting it from the power supply.

Important
Damage to the device due to different grounding

▷ Refer all connections to the same system ground.

▷ Connect external voltage inputs or outputs with different grounding externally.

This power supply requires cabling via the POWER plug.

You will also need:

✓ A power supply unit (min. 20 W, e.g. DIN rail switching power supply, article no. 200003)

✓ Wiring, cross section 0.35…​2.5 mm

✓ Stripping and crimping pliers

✓ If you use stranded wire, apply suitable wire end sleeves

✓ A small slotted screwdriver

▷ First disconnect connected devices from their respective power supply.

▷ Connect a power supply between 10.7 …​ 27.8 V to the pin marked 24 V on the POWER plug.

▷ Connect the 0 V supply to the pin marked GND.

Access to the Device #

The RevPi is accessed in two steps:

Install all available Updates as soon as the RevPi is connected to the Internet so that the system is always up to date with security-relevant features.

See also:

Configuration #

Basic Configuration #

From the RevPi Bookworm Image (10/2024) onwards, the basic configuration of the RevPi devices is carried out via the Cockpit web application.

Until the RevPi Bullseye Image (04/2024), the basic configuration of the RevPi devices is carried out via the RevPi Status web application.

Configuring the Base Module in PiCtory #

▷ Start PiCtory.

▷ Select the RevPi base module from the Device Catalog and drag and drop it onto the empty slot with position number 0.

❯ The configurable values appear in the Value Editor.

▷ Save the configuration as the start configuration with File > Save as Start-Config.

❯❯ The start configuration is called up directly after each boot process.Start PiCtorySystem Configuration with PiCtory

Value Function

INP AIn

Input values of the analog inputs

INP AIn_Status

Status of the analog inputs

INP_AOut_Status

Status of the analog outputs

INP Core_Temperature

CPU Temperature

INP Core_Frequency

CPU Frequency

INP Top_Button

Input value of the push-button

OUT RevPiLED

Status byte for LEDs

OUT AOut

Output value for analog output

OUT DOut

Output value for digital output

MEM AInMode

Mode for the analog input:
Voltage 0 …​ 10 V for voltage measurement
Current 0 …​ 20 mA for current measurement

Serial Devices (RS485) #

The RevPi has two RS485 interfaces. This allows you to use serial protocols such as Modbus and to integrate devices such as smart meters or solar inverters into your the Revolution Pi system.

The interfaces are labeled with RS485-0 and RS485-1 . Both interfaces are isolated galvanically from each other and from the RevPi.

Under Linux, the interfaces can be addressed with:

  • ttyAMA0( RS485-0)

  • ttyS0( RS485-1)

RS485-0

RS485-0 is connected to a 3-pole terminal. The data lines are marked with P (positive) and N (negative). For other devices, these lines are often referred to as D+ and D- or A and B.

revpi-flat-rs485-pinout

Only the lines N and P are required for the actual data transmission. We recommend a twisted pair for longer line lengths or larger baud rates.

revpi-flat-rs485-0-pinout

RS485-1

An RJ11 socket is available for RS485-1.

revpi-flat-rs485-1-pinout
Pin Wiring

1

 — 

2

GND

3

Negative

4

Positive

5

GND

6

 — 

Reference Potential

Should a reference potential be necessary, you can use the GND electrical circuit ground of the respective RS485 bus for this purpose. Since the two RS485 systems have complete galvanic isolation from each other and from the rest of the RevPi Flat circuitry, these GND connections are also isolated galvanically from each other and from the RevPi Flat GND connection.

Shielding

Cables having a length over 30 meters and cables leaving the building should be shielded. To further improve the EMC properties of the shield, you can connect the shield to the equipotential bonding rail of the distribution box if necessary. Such a connection can easily be made with a contact force spring.

Bit Rates

Linux addresses the interfaces via the character devices /dev/ttyAMA0 and /dev/ttyS0. You can configure bit rates from 50 to 3,000,000 for /dev/ttyAMA0 and from 1,200 to 4,000,000 for /dev/ttyS0. However, occasional reception errors may occur at more than 230,400 bits. The reason is that the UART of the Raspberry Pi, to which the interface is connected, has only a 16 byte FIFO and does not support DMA. The higher the bit rate, the more often the FIFO is not read out fast enough and received data is lost. For example, there are 1 - 2 errors per 50 MByte received at 460,800 bits and there are about 10 errors at 921,600 bits. If your RevPi Flat mainly sends data and only rarely receives it, you can also use higher bit rates. Otherwise we recommend to not set more than 230,400 baud.

Activating Termination Resistor

✓ The integrated 120 Ω terminating resistor of the RS485 interface is switched off after a restart.

▷ Check out the Git repository of the command line tool rs485_config from GitLab with the command:

git clone git@gitlab.com:revolutionpi/rs485_config.git

▷ Build the tool with the command:

cd rs485_config; make

▷ Activate the resistor with the command:

./rs485_config <SERDEV> --set-bus-term

Replace <SERDEV> with the name of the interface, e.g. /dev/ttyRS485.

▷ Check whether the resistor has been activated and display the settings of the RS485 interface with the command:

./rs485_config <SERDEV>

❯❯ If the resistor is activated, Bus termination: Yes is output.

Ethernet Interfaces (RJ45) #

The RevPi has two 10/100 Ethernet interfaces with one or three RJ45 sockets for two or four independent MAC addresses. With active autonegotiation, they support half and full duplex.

A transmission rate of 100 Mbit/s is available for each interface. All Ethernet interfaces are connected to the internal USB hub. As USB interfaces and Ethernet interfaces share a USB bandwidth, the transfer rate may be reduced if additional USB devices are connected.

revpi-flat-usb-schema

LAN 0

The MAC address for LAN 0 is printed on the front of the housing. Under Linux, the interface can be addressed with eth0.

LAN 1 (switch) or LAN 1 …​ LAN 3

Up to three additional devices can be connected to a network via the three RJ45 sockets for LAN1. They are connected to the internal USB hub via a 1:3 switch. The MAC address for LAN 1 is printed on the front of the housing. Under Linux, the interface can be addressed with eth1.

The three connections for LAN 1 can be assigned to independent MAC addresses via DSA. The storage location for the MAC addresses is /boot/config.txt.

If no addresses are entered in this file or after a new image has been installed, the factory MAC addresses are used.

WLAN and BT #

Prerequisites

✓ RevPi base module with WLAN interface

✓ DHCP-capable WLAN router

✓ Optional: external RP-SMA WLAN antenna

The WLAN interface operates at 2.4 and 5 GHz and complies with the IEEE802.11a/b/g/n/ac specification.

Under Linux, you can address the WLAN interface with wlan0, provided no other WLAN devices are used.

Activating WLAN via RevPi status

▷ Start RevPi Status.

▷ Activate the Enable/Disable build-in WLAN option in the CONFIG tab.

Setting up WLAN country code via raspi-config

The regulations and frequency ranges for WLAN networks are different for each country. Configure the WLAN country code so that the RevPi does not transmit in prohibited areas or cause interference.

▷ Log in to the RevPi via a terminal.

▷ Open raspi-config with the command:

sudo raspi-config

▷ Use the arrow keys to navigate to the Localization Options menu.

▷ Select the WLAN Countryoption.

▷ Select the appropriate country from the country list and confirm with ENTER.

❯❯ The WLAN country code is active.

Setting up WLAN connection via NetworkManager

The WLAN connection is set up via the NetworkManager nmtui. The NetworkManager is a terminal-based user interface for managing network connections under Linux.

▷ Log in to the RevPi via a terminal.

▷ Start nmtui with the command

sudo nmtui

❯❯ The nmtui user interface appears.

Use the arrow and ENTER buttons to navigate within nmtui.

▷ Select Edit a connection.

▷ Select the appropriate Wi-Fi network.

▷ Enter the WLAN password under Password and configure any other WLAN settings.

▷ Save the settings with OK and return to the home screen with Back.

▷ Select Activate a connection.

▷ Select the Wi-Fi network and activate the connection with the ENTER button.

❯ The status message Connecting …​ appears.

❯ The WLAN connection is established.

Setting up BT Interface

BT interface Standard 5.0 is also available via the same SMA socket as for the WLAN interface.

▷ Log in to the RevPi via a terminal.

▷ Activate the HCI interface with the command:

sudo systemctl enable hciuart

▷ Start the hciuart service with the command:

sudo systemctl start hciuart

▷ Start the BT daemon with:

sudo systemctl start bluetooth

See also:

USB Interfaces #

The RevPi has two USB-A Interfaces. This allows USB 2.0 client devices such as USB hard disks, surf sticks, keyboards or mice to be connected.

the power consumption of the connected devices must not exceed 2.5 W (500 mA @ 5 V) per port. In the event of an overload, the power is switched off at the corresponding USB interface.

The USB interfaces share a USB hub on the RevPi with the two Ethernet interfaces and a Bluetooth interface. This can influence the maximum bandwidth.

The USB interface is suitable for a maximum of 64 DAM-based USB devices.

You can display the USB devices connected to the USB subsystem with the following:

pi@RevPi0000:~ $ lsusb -t
/:    Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
|__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M`
|__ Port 4: Dev 4, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M`
|__ Port 5: Dev 5, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 12M

LEDs #

LED PWR

The PWR (Power) LED indicates the device status.

Signal Function

Green

Power supply is connected.

Red

There is a communication fault between connected modules.

LED A1 — A5

LEDs A1 to A5 are customizable.

The LEDs can be used for user-specific requirements such as indicating a network connection, indicating that a memory limit has been exceeded, monitoring a process and indicating faults.

The LEDs can be switched in the command line application piTest with the variable RevPiLED.

The RevPiLED output has a defined byte length and therefore has a certain number of bits that are read from right to left. Certain bit positions are each assigned to an LED. The LED is switched by setting the respective bits to 0 or 1.

LED Assigned bit position

A1

0 and 1

A2

2 and 3

A3

4 and 5

A4

6 and 7

A5

8 and 9

An LED signal is set in the command line with the command piTest -w RevPiLED,x where x corresponds to the decimal value calculated from the respective bit pattern.

LED Signal Bit pattern Decimal value

A1 … A5

off

0000 0000 0000

0

A1

green

0000 0000 0001

1

red

0000 0000 0010

2

orange

0000 0000 0011

3

A2

green

0000 0000 0100

4

red

0000 0000 1000

8

orange

0000 0000 1100

12

A3

green

0000 0001 0000

16

red

0000 0010 0000

32

orange

0000 0011 0000

48

A4

green

0000 0100 0000

64

red

0000 1000 0000

128

orange

0000 1100 0000

192

A5

green

0001 0000 0000

256

red

0010 0000 0000

512

orange

0011 0000 0000

768

To switch several LEDs simultaneously, the respective decimal values have to be added up.

Example: If LED A1 shall flash red and LED A2 green at the same time, the command is piTest -w RevPiLED,6 (bit pattern: 0000 0110 = decimal values 2+4).

Note

If a signal is to be added to an existing LED circuit, the value for all required signals must be recalculated and rewritten.

Digital output (relay contact) #

You can use the digital output to switch external devices on and off, for example. It is designed as a potential-free relay contact. Control is therefore effected via a mechanical connection of the pins.

revpi-flat digital output relay

The relay contact may be loaded with a maximum of 30 V DC or 24 V AC and 2 A.

A suppressor diode is connected in parallel to the relay contact to reduce the switching sparks that occur when switching inductive loads. This reduces wear. An external freewheeling diode or similar is not required.

Controlling with piTest

You can switch the relay via piTest with the -w option:

▷ Activate the relay with the command

piTest -w DOut,1

▷ Deactivate the relay with the command

piTest -W DOut,0

Direct Control

You can use the gpio program for direct control of the relay via operating system functions. First you must switch the corresponding GPIO - pin — in this case pin 28 — as the output. Then you can set the output with 1 for switch on and 0 for switch off. The example below shows the corresponding sequence of commands:

▷ Set the pin as the output with the command

gpio mode 28 out

▷ Switch the output on with the command

gpio write 28 1

▷ Switch the output off with the command

gpio write 28 0

Analog Inputs and Outputs #

The RevPi has one analog input and one analog output on the 5-pin ANALOG connector.

Analog input

The analog input can be used to measure either voltage or current.

  • U IN: Voltage measurement 0 …​ 10 V DC

  • I IN: Current measurement 0…​ 20 mA DC

Current and voltage input must not be connected at the same time, otherwise the measurement result will be distorted.

The current is converted into a proportional voltage via an internal 240 ohm resistor.

The MCP3550-50 analog-to-digital converter (ADC) used for this purpose offers a high usable resolution of 21 bits, but at 85 milliseconds per measurement, it requires a comparatively long time.

There are two ways to access the interfaces: either by reading and writing the Linux sysfs or by using our RevPi configuration tool PiCtory and the software tool piTest, which allows you to access the process image of the system. In the following we describe both methods separately for input and output.

Reading out Values with Linux sysfs

Read out voltage 0 …​ 10 V:

▷ Enter the following command to obtain the input value of the ADC:

cat /sys/bus/iio/devices/*/in_voltage0*

▷ Convert the raw value read out to in_voltage0-voltage1_raw with the formula ($raw * 12500) >> 20) + 12500 to obtain the voltage in mV.

Read out current 0 …​ 20 mA:

✓ The current should be on the port I IN: are available.

▷ Divide the read out voltage (see above) by a resistance of 240 ohms to obtain the current in mA.

Reading out Values with piTest

You can configure the current/voltage mode for the RevPi Flat in PiCtory with the variables AInMode :

  • AInMode Voltage 0-10V (standard)

  • AInMode Current 0- -20mA

▷ Simply read out the current or voltage value by entering

piTest -r AIn

Analog output

You can connect actuators such as frequency converters to the analog output. It can output a voltage between 0 and 10 V.

The DAC121S101 digital-to-analog converter (DAC) used for this purpose has a resolution of 12 bits.

Entering Values with Linux sysfs

▷ Enter the following command to enter the value in the DAC:

echo 2047 | sudo tee /sys/bus/iio/devices/*/out_voltage0_raw

▷ Enter a value between 0 and 4095 into the DAC out_voltage0_raw to output a voltage between 0 and 10 V.

Entering Values with piTest

▷ Enter the analog value in mV in the variable AOut e.g. 5000 mV for the analog output:

piTest -w AOut,5000
More information on implementation

On the software side, the DAC121S101 and MCP3550-50 are treated like IIO modules whose interface is implemented in sysf as /sys/bus/iio/devices/.

After the converters are successfully registered, the following kernel log usually appears.

pi@RevPi0000:~ $ dmesg | grep "spi.*consumer
[ 4.461004] mcp320x spi0.1: Linked as a consumer to regulator.1
[ 5.747592] ad5446 spi0.0: Linked as a consumer to regulator.2

Two subfolders are added to the folder sysfs for the converters as /sys/bus/iio/devices/iio:deviceX. You can use X to distinguish between the converters here. The order depends on the registration of the devices and therefore has no fixed assignment. The assignment becomes apparent, however, when you look at the contents of the folders. The folder with the files out_voltage is the output module and therefore the DAC module. The folder with the files in_voltage is the input module and therefore the ADC module.

In the method with piTest, piControl retains these values permanently in the process image and you can read and write the values with piTest.

See also:

Trusted Platform Module (TPM) #

The RevPi is equipped with the Trusted Platform Module Infineon OPTIGA™ TPM SLB 9670. It fulfills the requirements of TPM 2.0.

Under Linux you can address the module with /dev/tpm0.

Watchdog #

The RevPi has two independent watchdogs. The first is part of the BCM2837 SoC, which is also used on the Raspberry Pi 3. The second is the Maxim MAX6370 external watchdog module.

BCM2837

The BCM2837 watchdog is the preferred watchdog because it behaves like other watchdogs under Linux. You can access it either via the device file /dev/watchdog0 or as a default watchdog via the device file /dev/watchdog.

MAX6370

The MAX6370 can be accessed via the device file /dev/watchdog1.

To activate it, GPIO4 must be set high once. It can no longer be deactivated via this GPIO, however. For activation via the command line, you can use the gpiod tool:

gpioset -m time -u 1000 pinctrl-bcm2835 4=1
gpiod package

The command gpioset is part of the gpiod package. If this is not installed, you can install it yourself with:

sudo apt install gpiod

If you want to operate the GPIO from your application, the libgpiod is right for you. This also provides a Python interface.

You will need the following packages:

  • libgpiod‑dev

  • libgpiod2

  • python3‑libgpiod

The timeout of the MAX6370 is fixed at 60 seconds and cannot be changed.

Once activated, the Watchdogs MAX6370 can only be deactivated by disconnecting the power supply. A restart does not deactivate the watchdog. This means that a restart must not take longer than 60 seconds when the watchdog is active, otherwise the hardware will be reset.

Watchdog under Linux

There are several ways to use a watchdog under Linux. The RevPi image and Raspbian rely on systemd. This is therefore also the preferred method of using the watchdog. systemd can be used to trigger a hardware watchdog. Applications that are to be monitored by the watchdog are then monitored by systemd. This has the advantage that several applications can be monitored. Consequently, the entire system does not necessarily have to be restarted, but instead only the individual application.

See also:

Freely configurable push-button #

The RevPi has a freely configurable button. The input value of the button can be evaluated via GPIO13 and then used for certain actions, e.g. for a controlled shutdown of the RevPi.

In the PiCtory Value Editor, the input value of the push-button is entered under Top_Button displayed.

It can be retrieved by software in the same way as a keyboard entry. The KEY_UNKNOWN key code is used (corresponds to value 240).