Skip to main content

Connect a Syrus 4G to Ubidots over MQTT

Learn how to setup the Syrus 4G and send data to the Ubidots cloud over MQTT.

Written by Sergio M

The Syrus IoT Telematics Gateway (Syrus 4G) offers next-generation fleet productivity and asset management solution, developed by Digital Communications Technologies (DCT), a premier worldwide provider of wireless physical infrastructure devices for mobile asset management with actionable intelligence fully managed through APIs.


​

Requirements

1. Syrus 4G IoT Telematics Gateway Configuration

NOTE: Please make sure you have the latest version of Apex OS
​
​Step 1: Prepare your System:

Go to Management Tool (http://192.168.9.2 if you’re over USB cable), select System and confirm that you’re up to date.
​

Now go to Applications Manager and Check for updates and make sure you have the latest version of SyrusJS application installed:

Step 2: Create an instance:

In application manager pull down the menu of SyrusJS, this will show you all versions installed of the application, select the latest one and Create a New Instance:

Name your instance and select Create Instance button:

Now you have your instance created:

Step 3: Create your configuration files
​
You should create two files on any notepad application (notepad++, sublime, vscode, etc), you can name it as you want but the extension must be: syrus.conf
​

The first one contains the destination data, protocol, output format, MQTT URI, username, and topics, here is an example:

### DESTINATIONS

define destination ubidots json mqtt://industrial.api.ubidots.com:1883
protocol="mqtt"username="[YOUR_TOKEN]"subscribe="/v1.6/devices/syrus4g"
publish="/v1.6/devices/[YOUR_DEVICE_LABEL]"

Replace [YOUR_TOKEN] for you Ubidots Account Token and [YOUR_DEVICE_LABEL] with the label you want the device to have in Ubidots, keep in mind that you can only user lower case letters.

NOTE: For More information please refer to this article: https://syrus.pegasusgateway.com/syrdocs/syrus4/syruslang/#destinations

The second file contains all the events that will be sent to the Ubidots over MQTT, here is an example, this will send Ignition On/Off events and track points every minute:

####### ###### ####### ###### ###########
############ START MQTT EVENT ###########

define variable constant_1 1
define fieldset ubidots

fields="ident":$modem.imei,position.context.lat:$gnss.latitude,position.context.lng:$gnss.longitude,position.value:$variables.constant_1,"position.direction":$gnss.heading,"position.hdop":$gnss.hdop,"position.pdop":$gnss.pdop,"position.vdop":$gnss.vdop,"position.speed":$gnss.mph,"position.altitude":$gnss.altitude,"event.enum":code,"can.engine.rpm":$ecu.rpm,"can.throttle.pedal.level":$ecu.accel_pedal_position,"can.engine.temperature":$ecu.coolant_temp,"can.fuel.consumed":$ecu.fuel_total,"can.intake.map":$ecu.intake_manif_pressure,"can.vehicle.speed":$ecu.fe6c_7-8,"can.fuel.temperature":$ecu.fuel_temp,"can.engine.load":$ecu.engine_load,"can.engine.torque":$ecu.actual_engine_torque,"can.catalyst.outlet.temp":$ecu.aftmt_catalyst_outlet_gas_temp,"can.fuel.rate":$ecu.fuel_rate,"can.engine.hours":$ecu.hours_total,"can.ambient.temp":$ecu.ambient_air_temp,"can.oil.pressure":$ecu.oil_pressure

define group ubidots
set destinations group=ubidots ubidots

define tracking_resolution ubidots_tracking 5m 25deg 1000mts

define signal ignitionON min_duration=5s $io.ign == true
define signal ignitionOFF min_duration=5s $io.ign == false

define event ignitionONmqtt group=ubidots fieldset=ubidots ack=seq label=ignonmqtt code=102 trigger=ignitionON
define event ignitionOFFmqtt group=ubidots fieldset=ubidots ack=seq label=ignoffmqtt code=103 trigger=ignitionOFF

# Define tracking event, a single tracking resolution signal that can be controlled by different actions

define event trackingOffMqtt group=ubidots fieldset=ubidots ack=seq label=prdtst code=100 trigger=@tracking_resolution.ubidots_tracking.signal,ignitionOFF,and
define event trackingOnMqtt group=ubidots fieldset=ubidots ack=seq label=trckpnt code=101 trigger=@tracking_resolution.ubidots_tracking.time,ignitionON,and
define event trackingHeadingMqtt group=ubidots fieldset=ubidots ack=seq label=heading code=140 trigger=@tracking_resolution.ubidots_tracking.heading,ignitionON,and
define event trackingDistanceMqtt group=ubidots fieldset=ubidots ack=seq label=distance code=141 trigger=@tracking_resolution.ubidots_tracking.distance,ignitionON,and

############ END MQTT EVENT ###########
####### ###### ####### ###### #######

define event trackingOnMqtt group=mqtt fieldset=mqtt ack=seq label=trckpnt code=101 trigger=@tracking_resolution.mqtt_tracking.time,ignitionON,and
define event trackingHeadingMqtt group=mqtt fieldset=mqtt ack=seq label=heading code=140 trigger=@tracking_resolution.mqtt_tracking.heading,ignitionON,and
define event trackingDistanceMqtt group=mqtt fieldset=mqtt ack=seq label=distance code=141 trigger=@tracking_resolution.mqtt_tracking.distance,ignitionON,and

############ END MQTT EVENT ###########
####### ###### ####### ###### #######

NOTE: If you need more information about how to configure more events please refer to SyrusLang documentation: https://syrus.pegasusgateway.com/syrdocs/syrus4/syruslang

Step 4: Upload your configuration files

Select your created instance:

Go to Data Folder Tab:

Select Upload File:

Search in your local disk the previous configurations files created, and upload it one by one:

Go to the Configuration tab, pull down Configuration and Destination File, select your previously updated items, and click the Save button:

Step 5: Start your instance

Finally, go back to the Information tab and click the Start button:

Step 6: Check your data in Ubidots Device

The reported variables should be automatically created according to the fieldset configuration:

Now you can design your own dashboards with Syrus 4G data:

Other users also found helpful:

Did this answer your question?