Ruggedized IoT Platform with Raspberry Pi 4 / Advantech UNO-220 / machinechat JEDI One

Description

This project sets up a Raspberry Pi 4 with machinechat’s JEDI One IoT data management software and Advantech’s UNO-220 I/O hat and industrial-grade chassis. The result is a ruggedized, fanless, highly capable, general purpose IoT platform featuring WiFi, ethernet, GPIO, battery backed RTC and RS-232/485 interfaces. The UNO-220 case also provides access to the Raspberry Pi 4 standard HDMI, USB, ethernet, audio and power connections. The aluminum enclosure also features a cutout (covered by plastic) on the side facing the Pi 4 antenna to allow for WiFi access.

image

Hardware

  • RASPBERRY PI 4B/4GB
    Raspberry PI 4 Model B with 4GB SDRAM

  • Advantech UNO-220 Pi 4 I/O Hat and Enclosure
    The UNO-220 I/O hat adds a RTC with battery backup and terminal block with 4 GPIOs and RS-232/485 interface. The industrial-grade UNO-220 case is aluminum and features a heatsink channel that mechanically and thermally interfaces directly to the Raspberry Pi’s Broadcom processor to channel heat to the fins on top of the case.

Software

  • Advantech UNO-220
    The UNO-220 includes a system-image OS equipped micro SD card integrated with drivers for the RTC, GPIO and RS-232/485 interface. Alternatively, Advantech provides drivers on github that can be installed on an existing Pi 4 micro SD card.

  • JEDI One
    JEDI One is a ready-to-use IoT data management software solution. Capabilities include: collect data from sensors, devices and machines; build intuitive real-time and historical data and system view dashboards; create rules to monitor and respond to data conditions automatically; receive alert notifications by email and SMS.

  • Python
    A Python script was developed and used for system level test of the gateway.

Implementation

The IoT platform is based on a Raspberry Pi 4 running machinechat’s JEDI One software. Advantech’s UNO-220 I/O hat is attached to the Pi 4 and the combined assembly housed inside the industrial-grade enclosure. The I/O hat adds a Real Time Clock (RTC), external I/O connections GPIO[0-3] and an external RS-232/485 port.

Setting up the Hardware

See below Advantech UNO-220 installation instructions:

1 - Mount UNO-220 hat to case
image

2 - Attach Raspberry Pi
image

3 - Attach case base
image

(note see instructions in Advantech UNO-220 datasheet)

Installing the Software

1 - If machinechat JEDI One is not already installed on the Raspberry Pi see below:

2 - Install Advantech UNO-220 driver on Raspberry Pi:

Log in to Pi 4 and follow the steps below:

  • make sources.list editable
pi@raspberrypi:~ $ chmod 777 /etc/apt/sources.list
  • Append the following in /etc/apt/sources.list on your Pi 4.
deb [trusted=yes] https://advantechralph.github.io/uno-220/dpkg/ /
  • Run apt-get update
pi@raspberrypi:~ $ sudo apt-get update
  • Install uno220 packages.
pi@raspberrypi:~ $ sudo apt-get install uno220config uno220gpio uno220uart
  • Download uno220rtc_0.1-5_armhf.deb
pi@raspberrypi:~ $ wget https://github.com/Advantech-IIoT/UNO-220-POE-/raw/docs/dpkg/uno220rtc_0.1-5_armhf.deb
pi@raspberrypi:~ $ sudo dpkg -i uno220rtc_0.1-5_armhf.deb 
  • Reboot your Pi 4 and test IO.
pi@raspberrypi:~ $ sudo systemctl reboot

(note full instructions on Advantech UNO-220 Github page)

IoT Gateway System Test

A small demo application running on the JEDI One was used to test the IoT platform. A python script was set up in a JEDI One custom plug-in to measure the Raspberry Pi CPU temperature and read port0 on the UNO-220 hat and send to the JEDI One. The resulting data was be displayed on the JEDI One dashboard.

Python code:

rpi_uno220.py

#!/usr/bin/python3
import os
import time

def temp_of_rpi():
    cpu_temp = os.popen("vcgencmd measure_temp").readline()
    return (cpu_temp.replace("temp=",""))

# read uno-220 gpio p[0]
def read_p0_uno220():
    uno_port = os.popen("uno220gpio --pin=0").readline()
    return (uno_port.replace("pin 0 value:",""))

devID = "RPiCPUtemp"

cpu_ftemp = float(temp_of_rpi()[0:-3])

port0 = float(read_p0_uno220())

# send rpi cpu temp to JEDI One
print("metric:id=%s,n=Temperature,vd=%0.1f,u=C" % (devID, cpu_ftemp))

# send rpi cpu port0 to JEDI One
print("metric:id=%s,n=port0,vd=%0.1f,u=x" % (devID, port0))

Save python file “rpi_uno220.py” to Raspberry Pi 4 pi directory, log in to Pi 4 and follow the command line steps below:

  • Make python file executable
pi@raspberrypi:~ $ sudo chmod +x rpi_uno220.py
  • Copy to JEDI One plugins subdirectory
pi@raspberrypi:~ $ sudo cp ./rpi_uno220.py jedi/plugins

Add and configure JEDI One custom data collector plug-in:

Set up dashboards and display on JEDI One

Conclusion

The combination of Advantech’s UNO-220 I/O hat and case, machinechat’s JEDI One IoT data management software and a Raspberry Pi 4 results in a highly capable, ruggedized, flexible, IoT platform that can be deployed in multiple use case scenarios.

References

13 posts were split to a new topic: Broken uno220rtc debian package Advantech UNO-220