RS232 to UDP Message

My application is capturing outbound RS232 messages from an industrial machine, and sending through to a Losant workflow for processing.

I am struggling to send data to an edge device using UDP.

I have an industrial LTE router, which has an RS232 to UDP feature.

I have set a Pi3B+ running the edge agent, and I believe I’ve opened up the UDP port following various forum posts and docker documentation.

I have proven my USB-Serial adapter works with the router, so the only variables left are:

  1. Router Configuration
  2. Docker Settings
  3. Workflow Settings

1 -

2 -

3 -

I have tried connecting to 0.0.0.0 instead of 192.168.1.8 (Pi Address), however this also doesn’t work.

Do you have any ideas of what I might be able to try next?

Thanks in advance!

Hey @Chris_West,

Welcome to the Losant Forums. We’re very excited you’re here!

Would you be able to share with me the contents of the toml file you’re using for your Edge Agent configuration? I just want to confirm that you have enabled the UDP Server on the Edge. You can read more about it in our Supported Edge Protocols Documentation.

Could you share, also, the command you are using the spin up the docker container with the Edge Agent in it?

Thank you so much,
Heath

Hi @Heath, thanks for your quick reply.

Based on the fact that I’m not using any specific toml file, I think you’re on to something!

I did try using a toml command from the documentation, but I now see this wouldn’t work without creating the file with vim.

Here is my run command currently:

sudo docker run -d --restart always --name docs-agent --publish 8080:8080/udp
-e ‘DEVICE_ID=XXX’
-e ‘ACCESS_KEY=XXX’
-e ‘ACCESS_SECRET=XXX’
-v /var/lib/losant-edge-agent/data:/data
losant/edge-agent

So I’ve created, and edited the file in vim with:

sudo vim /var/lib/losant-edge-agent/config.toml

" [udp]
" # Address for UDP server - CLI: --udp-address, EnvVar: UDP_ADDRESS
" address = ‘192.168.1.9’

Note ip has now changed. I redeployed ubuntu.

I then spin up using:

sudo docker run -d --restart always --name docs-agent
-e ‘DEVICE_ID=XXX’
-e ‘ACCESS_KEY=YYY’
-e ‘ACCESS_SECRET=ZZZ’
-v /var/lib/losant-edge-agent/data:/data
-v /var/lib/losant-edge-agent/config.toml:/etc/losant/losant-edge-agent-config.toml
-p 2395:2395/udp
losant/edge-agent

Note, I have tried a different port in case 8080 was an issue.

The device connects OK, however still no UDP messages passed through.

I have used this command:
echo “This is my data” > /dev/udp/192.168.1.9/2395
I do get a UDP message into my edge workflow debug log.

Suspect my modem is not outputting the UDP message.
Or my edge device is not letting it in.

I have downloaded wireshark to see if I can debug this, but I’m not that familiar with it.

Hey @Chris_West,

Thanks for all that information, it’s a huge help!

I spoke with some of our folks here who are familiar with UDP about what you’re experiencing. Once you have the container running, you can run the command (on your RPi), nc -u localhost 2395 testing UDP message on 2395 and see if your workflow picks that up as well.

You can also run this command from a different unix-based machine on the same network with nc -u <ip-address-of-pi> 2395 .... This would confirm that the RPi (and the Edge Agent) are receiving UDP messages, and the issue may lie within your Modem or Edge Device.

I am going to do some testing with a container on my machine in the meantime. I’ll be sure to update you with anything I find as well.

Thank you,
Heath