Introduction

 

In line with our partnership with Dell, our Systems Engineering team in Singapore received an opportunity to test out a Dell Edge Gateway unit for a short period. The Dell Edge Gateway is like a mini PC that is designed for Industrial-use to aggregate, secure and relay data from diverse sensors and equipment. It able to accept many communication protocols such as BACNet, Modbus, and CANbus, to modern wireless mesh networks like Zigbee, 6LoWPAN, and ZWave.

 

For this testing, we decided to install the full PI system and connect it to temperature sensors to perform simple direct data collection examples.
In this post, we will show what we have done on the Dell Gateway and go through 2 examples:

1) how to connect and collect data from an industrial thermometer transmitter via RS232 port

2) how to collect data from Temperature-Humidity sensor via Raspberry Pi through PI Web API

 

Setup

 

Sensors: Comet Thermometer (T0310) with RS232 output and Temperature-Humidity sensor (DHT22) (with jumper cables, breadboard and 10k Ohm resistor )

Development Board (for example 2): Raspberry pi3 Model B

Gateway Device: Dell Edge Gateway Model 5000. OS - Windows 10 IoT Industry. Processor - Intel Atom E3827 1.75 GHz 2 Cores. Memory - 8 GB

PI System component installed: PI Data Archive 2016, PI AF 2016 (including SQL Server 2012 R2 Express), PI ProcessBook, PI Coresight and PI DataLink (including MS Excel 2013)

Data Collection Method: PI Interface for Modbus Serial PLC (Example 1) and PI Web API 2016 (Example 2)

 

In this post, we will assume that all of the PI System components have been installed successfully on the Dell Gateway beforehand. Dell Gateway unit is running in Workgroup and does not have internet access (although it's possible).

 

Example 1

Comet Temperature sensor (T0310) comes with RS232 Serial output port which can be connected to Dell Gateway via a Serial Port COM1 directly.

PI system on Dell Gateway can easily collects the sensor’s real-time reading (Degree Fahrenheit) into a PI tag via PI Modbus Serial interface.

 

Depending on how familiar you are with PI Modbus interface/tag, the interface configuration was straight forward with all default setting.

As for PI Tag Configuration, you need to follow the manual. Some of important tag attributes are:

Tagname
Point SourcePoint Type
Location 1
Location 2Location 3Location 4Location 5Instrument Tag
T0310_Comet_TemperatureMODBUSSFloat3211104149COM1

 

Once we started the interface, the data then started flowing to the PI server.

We built a display on PI Processbook and imported it to PI Coresight.

 

 

Example 2

Plug Temperature-Humidity sensor (DHT22) onto the breadboard and connect jumper cables as per diagram below.

  • Connect Pin 1 of the sensor to 3.3V GPIO
  • Connect Pin 2 of the sensor to GPIO4
  • Connect Pin 4 of the sensor to Ground
  • Connect an Ethernet cable between the Dell Gateway and Raspberry pi Ethernet port

Image result for dht22 raspberry pi ref: DHT22, gpio

Once everything is ready. On the PI Server side, we created 2 PI tags to collect the sensor’s readings (Temperature and Humidity). These 2 tags can have 'float32' type and use 'PS = L'. Other tag's configuration can be kept as default. 

The data will be reading off from Raspberry pi into PI tags via PI Web API.

 

Make sure to set the AuthenticationMethods parameter on PI Web API 's 'System Configuration' in AF Configuration Database to 'Anonymous'. 

Then, note down the WebID of two new PI Tags that were created. You should have 2 sets of webID; one for Temperature tag and one for Humidity tag.

 

Code

 

We used Python scripts. We need 2 scripts below:

1) DHT22.py available online via github

2) dev.py - Write sensor's data to PI every 5 seconds. Make sure to modify 'base_url' and insert WebIDs for 'temperature' and 'humidity'.

Note: 'webapi.cert' is a self-signed certificate stored at the same location as the scripts. More information on Certificate Generation is available here.

 

import requests
import os
import time
import pigpio
import DHT22


base_url = 'https://gateway5000/piwebapi'
os.environ['REQUESTS_CA_BUNDLE']='webapi.cert'
temperature='P0KXR0VK08VUemBzWNbx97QQZgUAAAR0FURVdBWTUwMDBcREhUMjIgVEVNUEVSQVRVUkU'
humidity='P0KXR0VK08VUemBzWNbx97QQZwUAAAR0FURVdBWTUwMDBcREhUMjIgSFVNSURJVFk'
def post_pi_value(value,webid):  
    data = {'Value': value}  
    headers = {'Content-Type': 'application/json'}  
    response = requests.post(base_url + '/streams/'\
                             + webid + '/value', json=data,\
                             headers=headers)  
    return response
def get_pi_value(webid):  
    response = requests.get(base_url + '/streams/'\
                             + webid + '/value')  
    return response
pi=pigpio.pi()
s=DHT22.sensor(pi,4)
i=1000
while True:
    s.trigger()
    post_pi_value(s.temperature(),temperature)
    post_pi_value(s.humidity(),humidity)
    r = get_pi_value(temperature)
    #print r.text
    i=i+1
    time.sleep(5)

Credit: Eugene Lee

 

You can setup to run above python script on startup.

Or start/stop on demand using bash scripts below.

and

These two files can be placed at the same location as the Python scripts. When you want to start/stop reading the sensor's data, then you can execute command from the terminal application (command-line) as shown below.

 

Conclusion

 

In this post, we made use of Dell Gateway's capability to directly connect to data sources via Serial and Ethernet ports. We selected simple sensors that are easy to connect to and come at low cost. We have successfully delivered data to PI Server, which resided on the same machine. Since Dell Gateway can accept many other communication protocols, this means the data collection from many other IoT devices are possible. In my opinion, Dell Gateway can be a very good interface node for the PI system, where all sensors can be connected and gathered to one location. However, it is not suitable for hosting our full version of PI system. This is because it has physical limitation such as 2 processors and only 8 GB RAM. The performance will surely be limited if we have large number of tags or utilized AF/AF Analyses heavily. In the future, with higher specification, it maybe possible.

 

If you have any questions, please post them here and if you have an experience in using Dell Gateway, please share with us.