Readings from MQTT Gateway

i got the following pub message from the sensors via the MQTT gateway:

{“00:13:A2:00:41:98:12:F9” {“transmission_count”:26,“battery_level”:3.29406,“type”:8,“node_id”:0,“rssi”:20,“rms_x”:6410.23,“rms_y”:6904.31,“rms_z”:5181.43,“max_x”:50782.72,“max_y”:49469.44,“max_z”:12554.24,“min_x”:-44410.88,“min_y”:-45721.6,“min_z”:-56401.93,“temperature”:33}}

The two vibration sensors are giving extremely high values eg, “rms_x”:346327". If the values are in mg, we are looking at 346 g. Does not look right.

Is the values in mg?


This is the conversion code for type 8 sensors:

dataObject["rms_x"] = (float)(signedInt(data, 9, 24)/100.00);
dataObject["rms_y"] = (float)(signedInt(data, 12, 24)/100.00);
dataObject["rms_z"] = (float)(signedInt(data, 15, 24)/100.00);
dataObject["max_x"] = (float)(signedInt(data, 18, 24)/100.00);
dataObject["max_y"] = (float)(signedInt(data, 21, 24)/100.00);
dataObject["max_z"] = (float)(signedInt(data, 24, 24)/100.00);
dataObject["min_x"] = (float)(signedInt(data, 27, 24)/100.00);
dataObject["min_y"] = (float)(signedInt(data, 30, 24)/100.00);
dataObject["min_z"] = (float)(signedInt(data, 33, 24)/100.00);
dataObject["temperature"] = (int16_t)(data[36]<<8)+data[37]; 

It looks like the bytes are converted to 24 bit and then divided by 100. Let me know if there are any issues with this.

Sorry I cannot understand. I am getting directly from the MQTT message string. Now can I obtain data from the message string.

do you have any USB modem or mega modem ?
if you do i will recommend testing the sensor with them and see what kind of results you are getting there.

Install the sensor and then hit reset. first few seconds it will calibrate itself and then send values.

I am sure the MQTT Gateway is giving wrong data. Can ncd publish a firmware release to fix this.

Does not make sense as customer to help ncd to debug their problem.

I have used node-red and I getting different values via node-red and the MQTT Gateway.

I do not want to use node-red to get the data from the sensors as there are extra hardware required to run node-red and ncd wireless USB modem. I am expecting the the ncd MQTT Gateway can do the same as a node-red and ncd wireless USB modem.

I cannot release a firmware update as I can see nothing wrong with the firmware. The conversion code appears to be correct. @Anil_Bhaskar can you confirm the gateway conversion code is correct? The only thing I could speculate is that the byte indexes of the packet were somehow shifted off but that does not appear to be the case since battery voltage, node ID, and transmission count appear to be correct.

I have compared the conversion code of the gateway against, Node-Red and the documentation. It is correct as far as I can tell.

the conversion code looks correct. Travis can you run a quick test using a vibration sensor.

Do we have a type 8 sensor here? All I have is a type 40.

This is the data obtained from node-red of the same sensor:

{“nodeId”:0,“battery”:3.2940600000000004,“counter”:1,“sensor_type”:8,“sensor_data”:{“rms_x”:26.69,“rms_y”:23.95,“rms_z”:11.19,“max_x”:196.9,“max_y”:191.05,“max_z”:31.47,“min_x”:-174.94,“min_y”:-180.8,“min_z”:-35.86,“temperature”:33},“sensor_name”:“Vibration”,“type”:“sensor_data”,“addr”:“00:13:a2:00:41:98:12:f9”,“received”: 1571846643673,“time”:“10/23/2019 04:04:33 PM”}

I just powered up a Type 8 Sensor, connected it to a MQTT Gateway and this is the message string I am seeing:


Personally I don’t know anything about Vibration readings so I do not know if these would be good readings or not. The sensor is on a desk with no vibration.

@TravisE_NCD_Technica looks like something is getting messed up in the gateway conversion… the values should be more like

{“nodeId”:0,“battery”:3.2940600000000004,“counter”:1,“sensor_type”:8,“sensor_data”:{“rms_x”:26.69,“rms_y”:23.95,“rms_z”:11.19,“max_x”:196.9,“max_y”:191.05,“max_z”:31.47,“min_x”:-174.94,“min_y”:-180.8,“min_z”:-35.86,“temperature”:33},“sensor_name”:“Vibration”,“type”:“sensor_data”,“addr”:“00:13:a2:00:41:98:12:f9”,“received”: 1571846643673,“time”:“10/23/2019 04:04:33 PM”}

when sensor is sitting on desk.

I have identified the problem and am now working to resolve it in a firmware update.

@cbmsingapore, we have an update script for updating the firmware on the gateway boards. This update however requires access to the USB connector on the gateway processor. You will need to pull the Processor module out of the Gateway and plug a USB Micro cable into it. Instructions for the update script are available here if you want to get a head start:

I will let you know as soon as the firmware is on our server and you can run the update script.

@cbmsingapore, The updates are live on our server. You can now run the update script to update your gateway module. This will reset all settings in the gateway so it will boot in config mode and you will need to re enter your MQTT Broker Host Settings as well as your wifi network settings. Let me know if you need anything else.

Thank you for the quick response.

I will try to install the firmware.

Now after the firmware update, the MQTT is sending correct data.

But now I faced a different problem. This happened twice already: The MQTT will stop sending after a few days. The LED light becomes blinking white.

The first time, I put the MQTT to setup mode and notice that the setting has been change to use static IP instead of DHCP. After changing the setting, the MQTT is sending again.

The second time, again the MQTT stop sending. I have look into the setting.

It is getting too troublesome to run the MQTT Gateway this way.

A flashing White LED indicates the gateway is attempting to connect to the network. Is it within close proximity of the WiFi Access Point? Maybe it does not have a good WiFi Connection strength.

Is the gateway switching from DHCP to Static IP by itself? I have not heard of this before and cannot find any way in the firmware this could be possible. Is it possible someone else is configuring the Gateway(fellow employee possibly)?