Tutorial: Industrial IO to IoT Cloud using REST API HTTP GET requests.
In this app note, we will be retrieving data from an industrial Advantech WISE-4012 (4 AI/2 DO module) with our nodeG5 (Debian 11 IMX8PLUS) industrial gateway. The IO module connects to our gateway using WIFI 802.11g 2.4GHz.
To support developers, we have integrated a “ready to roll” Python script that support HTTP GET requests to target devices, parse the JSON, XML or CSV data fields to save into the on-board data store for ingress to a Cloud back-end or further edge compute pre-processing. In this example, the IO data is sent to an easy to deploy IoT dashboard, Ubidots.
1. Setup the WISE-4012 mode and IP address
2. Generate some “field input”
3. Python script to poll the data into our gateway
4. Setup Ubidots
5. Send the data the ‘cloud’
STEP 1. Set up the WISE-4012 mode and IP address
Set the IO terminal’s SW1 in the back to OFF, so it’s in Access Point (AP) mode. Then connect to the WISE’s network in your “Available Networks”. Go to 192.168.1.1 and configure Wireless to allow it to connect to your home/office WIFI network when it reboots. Choose IP Mode as DHCP and hit “Submit”. Power off the WISE, set SW1 back to ON.
When you power it back on, you should be able to see the WISE on your home/office network. Connect to it’s assigned IP address, e.g. 192.168.1.125 from our FING network scanner.
STEP 2. Generate some “field input”
As a demo, we just attached a spare Fender Jazz bass 100K “pot” to simulate an analog input.
We can then check the real-time IO status in the WISE console ….
STEP 3. Test integrated developer Python script to poll the data into our gateway
We will configure our /amp/iot/httpget2DB.py script as following to match the requirements of the Advantech WISE target device.
From the returned JSON array , we will be able to parse out the required IO value that we are interested in. We have functions that supports XML and CSV responses. The data field is the inserted into on-board data store as ..
timestamp, field_name, data_value
.. for edge pre-processing (e.g. using statistical functions in our “IoT Data” module) or immediate sending to user’s IoT back-end with integrated clients for AWS IoT Core, Azure IoT Hub, Azure IoT Central, Ubidots or TLS secured MQTT client.
Example, sensor data monitoring (Ubidots) and also browser based public access graphical data widget.