top of page

Connecting a Vehicle ECU Simulator to an IoT backend platform with the nodeG5 edge IIoT Gateway
 
Cloud monitoring vehicle CAN Bus ISO15765-4 data

ECU-Simulator_CAN_0320x0240.jpg
Screen Shot 2023-08-14 at 4.01_edited.png
  • In this tutorial, we will set up a OZEN Elektronik OE91C1610 CAN BUS ECU simulator that is compatible with IS015765-4 (part of OBD2) to interface with the nodeG5 gateway’s CAN bus interface and connect to AWS IoT. To also see our tutorial for CAN Bus J1939 (heavy vehicles) Click here.

  • Our nodeG5 gateway runs a NXP iMX8Plus SoC with built-in CAN port functionality. The CAN bus is driven by an industrial proven high speed CAN transceiver that provides a robust & reliable interface with high noise immunity.

  • We will also look at connecting the nodeG5 IOT Gateway to a designated Cloud Service. Supported clients are AWS IoT Core, Azure IoT Hub and Ubidots.

  • Users have the option of backhaul via either cellular (4G), WiFi or wired Ethernet, depending on version

HARDWARE WIRING

Hardware Wiring

Screen Shot 2023-11-13 at 10.34.11 am.png

OZEN Elektronik OE91C1610 (J1962 female OBD)

nodeG5 Gateway

The above diagram shows the signal connection from the OZEN board to the CAN Port E of the nodeG5 using a shielded twisted pair cable. 

SCHNEIDER METER CONFIGURATION

Ozen ECU simulator Configuration

Use the DIP switch on the board to select CAN frame ID 11-bit type. 

For the CAN BUS baud rate, select 250 kbps. 

DIP Switch CAN config.png

The baud rate set on the nodeG5 gateway CAN BUS must be same.

CONNECT METER TO GATEWAY

Connect the ECU Simulator to Gateway

Our gateway uses a configuration file (\user\iotasset.json) to map the required Parameter IDs (PIDs) to be read during each polling cycle. This flexibility allows wide compatibility with different CAN Bus devices from different manufacturers.

To write this iotasset.json file we will be referencing the PIDs table from the product user manual (see sample below):

ECM Table.png

And here is a sample of the iotasset.json.
 
In the top example, we are configuring to read ECT (Engine Coolant Temperature) PID.

  • “7DF” is the functional address of ECU which based on ISO-15765-4 11-bit protocol.

  • “7E8” is the response message ID used to filter the response message from the query.

  • “0105” is the CAN request ECM mode 01 & PID 05.

  • Response data is located at offset +3 from first byte and length of 1 byte. 

  • Name data field name, as “EngineCoolantTemp".

  • The gateway is able to apply a customer multiplier (x1 in this case) and offset (-40 in this case) to match the requirements of their cloud service.

{

    "CANBUS":[

        {

            "Key":"OBD2EngineCoolantTemp",

            "IOTMODE":"1",

            "CANBUSTYPE":"OBD2",

            "CANPORT":"canE",

            "CANIDREQUEST":"7DF",

            "CANIDRECEIVE":"7E8",

            "CANMODEPID":"0105",

            "BYTESTART":"4",

            "BYTECOUNT":"1",

            "DATATYPE":"UINT8",

            "SCALEMUL":"1",

            "SCALEADD":"-40"

        },

        {

            "Key":"OBD2EngineRPM",

            "IOTMODE":"1",

            "CANBUSTYPE":"OBD2",

            "CANPORT":"canE",

            "CANIDREQUEST":"7DF",

            "CANIDRECEIVE":"7E8",

            "CANMODEPID":"010C",

            "BYTESTART":"4",

            "BYTECOUNT":"2",

            "DATATYPE":"UINT16HL",

            "SCALEMUL":"0.25",

            "SCALEADD":"0"

        },

        {

            "Key":"OBD2VehicleSpeed",

            "IOTMODE":"1",

            "CANBUSTYPE":"OBD2",

            "CANPORT":"canE",

            "CANIDREQUEST":"7DF",

            "CANIDRECEIVE":"7E8",

            "CANMODEPID":"010D",

            "BYTESTART":"4",

            "BYTECOUNT":"1",

            "DATATYPE":"UINT8"

        }

    ]

}

Once you have configured your device configuration file, we can update to your nodeG5 gateway securely over the air. The gateway HTTPS connected web console must be accessible, if you do not have an Internet connection, you can follow the alternative steps here). 

Log into the nodeG5 (the default address is 192.168.1.1) and enter in the user name and password. Go to the <Management> tab in the web configuration menu. Enable the SSH option (see below) and click the 'UPDATE' button to save your settings. Then reboot the gateway.

Screen Shot 2023-11-08 at 11.06.36 pm.png

Then log in again, go to the <IOT Hardware> menu to set the CAN bus mode to "Query mode" and register the polling configuration as required by the user. Click 'UPDATE' to save your settings. 

(Note that all other interfaces like Modbus and Zigbee can also run concurrently).

EnableCANBus.png

Next, click “Upload iotasset.json” button and in the new window, use the 'CHOOSE FILE' tab to select the above prepared file from your local folder to to send over to nodeG5After the upload is successful you will need to close the page and log in again for security purpose. The user can also confirm the status of iotasset.json file upload by clicking on Diagnostics::Check File.

We will now also configure the gateway's CAN BUS baud rate. Go to the <Port Settings> tab and enter the following settings below. Once you are done click the 'UPDATE' button to save your settings.

CANBaudRate.png

After these settings are updated, REBOOT the gateway. The user can then check the CAN BUS vehicle data collected (Diagnostics::JSON Data) or delete for testing.

CONNECTING TO A CLOUD STACK

Connect to AWS IoT Cloud Service

Now that the connectivity between the ECU Simulator and the nodeG5 gateway has been set, we will then look at getting the data onto a designated cloud service. We support an open customer software and 3rd party API (e.g. REST API for HTTP, HTTPS and MQTT) integration to connect to a chosen cloud data or dashboard service (or to use for on board data processing).

 Direct deployment on Azure, AWS IoT or Ubidots can also be done as these IoT clients have been integrated on the gateway. For this project, we are going to showcase using AWS IoT
(note that an AWS
account is required to continue this tutorial).

1. Create a new AWS IoT Thing

First log into your AWS IoT Management Console and create a Thing:

AWS IoT > Manage > Thing > Create

Next go to:

Secure > Certificates

Then download the 'Certificate' & 'Private Key File'.

Ensure the Certificate is "Active", otherwise activate it under ACTIONS in 

Things > Your Certificate > Security

AWS Certificate Download.png
2. Update your IIoT Gateway
Create a new local folder and name it "AWS". 

Save the downloaded certificate files into this folder and rename them as the following:

"certificate.pem.crt"

"private.pem.key"
 

Next zip the folder (ensure that you zip the entire folder and not just the files inside).

Then log into your nodeG5 web console and go to the <Management> tab.

Patch the zipped folder to the gateway using the UPDATE FIRMWARE button.

3. Create a Security Policy for your Thing

In your AWS IoT Management Console go to:

Secure > Policies > Create

Create AWS Policy.png
At <Things>, select your new Thing then click on

Security > Certificates > Policies

Under <Actions>, choose to Attach a Policy:

Attach AWS Policy.png
4. Configure your nodeG5 IoT Gateway to send data to your AWS Account

Now, you are ready to configure your gateway to send AWS IoT endpoint to feed data to your AWS applications. In the web configuration menu, go to the <IoT Client> tab and configure your AWS client settings according as per your AWS end point and Thing settings. Then REBOOT your gateway.

uber5_CAN_web_settings.png
Next go back to go your AWS IoT console and subscribe to the Topic to "Test" that data is being received.

ODB2_AWS_IoT.png
Congratulations! You have succesfully sent your Modbus or CAN bus data to your AWS IoT endpoint and ready to, for example, push the data to a S3 bucket using a Rule in 'Act > Rules'.

The nodeG5 AWS IoT client side is built using AWS IoT Device SDK for Python and users are free to install, modify our device client codes for enhanced edge capabilities or other required functionalities.

See our guides below for connecting to other supported IoT platforms includes Azure IoT and Ubidots. Here is a sample dashboard from Ubidots. 

 
CANonAWS.png

Guides to connect other Cloud Platforms

Connecting to Microsoft Azure IoT Hub

Connect to Ubidots IOT Platform

Have a question for us?
bottom of page