RevPi Flat S
Product Description
The RevPi Flat S is a robust, 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
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 RevPi Flat S variant: 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.
Virtual Devices
The Virtual Devices are delivered with the RevPi image as components in PiCtory included:
Variants
Item No.: | RAM | eMMC | Micro USB |
---|---|---|---|
RevPi Flat 100371 | 1 GB | 32 GB | No |
RevPi Flat S 100330 | 1 GB | 8 GB | Yes |
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 RevPi Flat S product variant).
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 :
-
Mount your RevPi on a DIN rail.
-
Connect all other devices such as sensors and actuators. The interfaces available to you for this can be found in the Components section.
-
As the last step connect the power supply.
Connecting the Power Supply
Danger to life due to electric shock
There is a risk of fatal electric shock when working on devices in the switch cabinet with 230 V mains voltage.
▷ Work in the switch cabinet may only be carried out by qualified electricians.
▷ Before carrying out any work in the switch cabinet, switch off the power supply properly.
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.
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.
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.
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 > Safe 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 - 10V for voltage measurement Current 0 - 20mA 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.
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.
RS485-1
An RJ11 socket is available for RS485-1.
Pin | Wiring |
---|---|
1 | – |
2 | GND |
3 | Negative |
4 | Positive |
5 | GRD |
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.
Termination
The interface has an integrated 120 ohm terminating resistor. This termination is switched off after booting. This is safest, as no communication is possible if several devices on the RS485 bus switch on their termination. Short cables allow for communication also without termination. For longer distances you should switch the termination on if your RevPi Flat is at the end of the bus line.
Switch the termination on and off as follows:
▷ Open the character device /dev/ttyAMA0
or /dev/ttyS0
with open()
.
▷ Read out the current RS485 configuration with the command:TIOCGRS485 ioctl()
▷ Set or delete the flag SER_RS485_TERMINATE_BUS in the struct serial_rs485
▷ Activate the changed RS485 configuration by a Command TIOCSRS485 ioctl(
▷ If necessary, send or receive the data with read()
or write()
.
▷ Close the character device by the command close()
You have to repeat these steps after each boot if you want to enable termination.
A C listing with these steps is prepared and can be compiled directly:
/*
* Copyright (c) 2020, KUNBUS GmbH
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the “Software”),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so.
*
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
```#include <errno.h>```
```#include <fcntl.h>```
```#include <stdio.h>```
```#include <string.h>```
```#include <unistd.h>```
```#include <linux/serial.h>```
```#include <sys/ioctl.h>```
```#define RCV_LEN 3```
int main(int argc, char **argv)
{
struct serial_rs485 rs485conf;
int fd, ret;
char buf[RCV_LEN];
```if (argc != 2) {```
```printf("Usage: %s <device>\n", argv[0]);```
```return 0;```
```}```
fd = open(argv[1], O_RDWR);
if (fd < 0) {
printf("Cannot open: %s\n", strerror(errno));
return errno;
}
```ret = ioctl(fd, TIOCGRS485, &rs485conf);```
```if (ret < 0) {```
```printf("Cannot get rs485 config: %s\n", strerror(errno));```
```return errno;```
```}```
rs485conf.flags ^= SER_RS485_TERMINATE_BUS;
```ret = ioctl(fd, TIOCSRS485, &rs485conf);```
```if (ret < 0) {```
```printf("Cannot set rs485 config: %s\n", strerror(errno));```
```return errno;```
```}```
```ret = write(fd, "abc", 3);```
```ret |= read(fd, buf, RCV_LEN);```
```if (ret < 0) {```
```printf("send or receive error: %s\n", strerror(errno));```
```return errno;```
```}```
ret = close(fd);
if (ret < 0) {
printf("Cannot close: %s\n", strerror(errno));
return errno;
}
}
By default, after booting, /dev/ttyAMA0
is used as the console terminal with the following configurations:
pi@RevPi0000:~ $ sudo stty -F /dev/ttyAMA0
speed 115200 baud; line = 0;
lnext = <undef>; min = 1; time = 0;
-brkint -icrnl ixoff -imaxbel iutf8
-icanon -iexten -echo
See also:
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.
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 , provided no other WLAN devices are used:
wlan0
Activate WLAN via RevPi status
▷ Start RevPi Status.
▷ Activate the Enable/Disable build-in WLAN option in the CONFIG tab.
Set 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 Optionsmenu.
▷ Select the WLAN Countryoption.
▷ Select the appropriate country from the country list and confirm with ENTER.
❯❯ The WLAN country code is active.
Set 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 commandsudo 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.