FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
321 views 3 comments
by anonymous
Hello

My task -> using TRB142 to send data from sensor with serial interface to Azure IoTHub using MQTT. TRB142 Configuration part for MQTT and  Azure is clear for me. But how to configure serial interface?
by anonymous
Hi, did you ever get this going?
by anonymous
Not tested. I realized this functionality on not Teltonika router (MTX)

1 Answer

0 votes
by anonymous

Hello,

TRB142 do not have a feature which would allow it to send serial data over MQTT. This would require additional development.

But you could try making a custom scripts which for example would log serial data to file, and then another script would take that info and with the help of mosquitto package you could try and send that data over MQTT.

Here are some ideas how those scripts could potentially look like:

- Logging serial data:

#!/bin/ash
microcom /dev/rs232 > /tmp/serialtomqtt.txt

- Sending data over MQTT:

#!/bin/ash
while true
do
if [ -s /tmp/serialtomqtt.txt ]
then
mosquitto_pub -h 192.168.1.244 -p 8800 -m "$(cat /tmp/serialtomqtt.txt)" -t testas
echo -n "" > /tmp/serialtomqtt.txt
else
mosquitto_pub -h 192.168.1.244 -p 8800 -t testas -m Nothning_Received
fi
sleep 10
done

You might need to install mosquitto package via opkg.

Please, keep in mind this is only a theory and we are not sure if this solution will work, so please test with "pinch of salt".

Best regards,

by anonymous

Hello,

I'm back again with same question: maybe you have some development for sending serial data over MQTT?