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.
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.
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 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.
A Python script was developed and used for system level test of the gateway.
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.
See below Advantech UNO-220 installation instructions:
1 - Mount UNO-220 hat to case
2 - Attach Raspberry Pi
3 - Attach case base
(note see instructions in Advantech UNO-220 datasheet)
1 - If machinechat JEDI One is not already installed on the Raspberry Pi see below:
- Download JEDI One from https://www.machinechat.io/jedione-raspberrypi
- Install on Pi, see Raspberry Pi - Installing JEDI One as a Service
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 uno220rtc uno220gpio uno220uart
- Reboot your Pi 4 and test IO.
pi@raspberrypi:~ $ sudo systemctl reboot
(note full instructions on Advantech UNO-220 Github page)
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.
#!/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 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
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.
- Advantech UNO-220 Datasheet
- Advantech UNO-220 Installation Video
- machinechat Writing plug-ins to send data to JEDI One
- Getting Started with machinechat’s JEDI One IoT Platform