Serial (UART) over Ethernet on Argon/Photon2

I'm looking to test out Serial UART communication over Ethernet instead of USB. I have both NCD's Ethernet Overlay and the Particle Ethernet Featherwing.

I've reviewed relevant posts on this forum and found the following:

  • NCD Hardware and Software examples support the local communication I'm looking for but break during compiling due to 'ambiguous EthernetClass' on the Gen3 Particle Devices
  • The Particle Featherwing and DeviceOS built in support for ethernet compile fine, but the only firmware examples deal with connecting and communicating with the Particle cloud, not local UART-over-Ethernet communications

If the Particle hardware/firmware solution supports this type of communication, a little bit of guidance would be much appreciated.

@rkast4321, the Particle Featherwing does no support Serial UART over Ethernet without an extra user-supplied library.

Which example from NCD did you try (I could not find anything)? It likely requires modification since the Ethernet-type class is already implemented in DeviceOS, which supports both TCP and UPD communications.

This is the library I was looking at from NCD:

The Ethernet-type class already being implemented seemed to be exactly the issue.

@rkast4321, you can configure either Ethernet adapters to work with the Argon/Photon 2:

You can then use the built-in TCP and UDP functions built in DeviceOS:

I did not notice any examples of Serial(UART) over Ethernet in the NCP files. Did I miss something?

2 Likes

Reviewing the NCP files, I agree it doesn't look like there is any example of UART, I must have been looking at something else. I think I could get away with TCP/UDP for the short term.

In the past I've connected a 2-3 Particle Devices via USB and to a hub computer and passed messages back and forth via serial. But I'm currently proof-of-concepting a system where there would be more Particle Devices and a longer distance from the hub computer, so USB seemed less practical. My thought is ethernet cabling and an large ethernet switch might be a more robust solution.

So if you have any insight on going from the examples you sent to UART or on my project as a whole, let me know. Otherwise, those examples will definitely get me further down the road on this project.

@rkast4321, you may want to consider MQTT to send/subscribe to messages locally. You would need a local MQTT server which could run on a Pi.

You could also do TCP messaging over ethernet. Or, on an entirely different medium, you could use UART over RS485 over shielded twisted pair to connect your devices over long wires.

2 Likes

I appreciate the suggestions, I'll start digging into those as well.

Hi Ryan,

depending on the messages you need to pass back and forth and the distance among the devices and the hub, you could contemplate using BLE:

There is the examples section that illustrates some scenarios.
There's even an UART example:

Using BLE, the HUB may be another particle device.
Implementing your project over BLE may be more difficult than MQTT, depending on the requirements.
Best

1 Like

I've used the BLE capability on the Particle Devices a fair amount, but generally it was a 1-to-1 connection. Do you think BLE could handle upwards of 30-40 devices all connecting to one hub?

I believe the max is 5 devices connected to a BLE central at the same time.
Now, if the devices do not need to remain connected, and can report to the BLE central every now and then, then it may work. The devices will connect to the central one after the other, or so.

Also, if the devices need to report data and do not receive any messages, then they may be advertising the data out, and the central with a scan can read the info needed. There would be no limit there (ok, maybe you'd be pushing some limits on buffers for the scan...)

1 Like

Huh, hadn't thought to approach it that way, definitely an interesting strategy to keep in the toolbox. That being said, I started looking at MQTT on @peekay123's recommendation and it seems to fit the bill for what I need pretty well. I appreciate all the help and insights on this, the Particle community continues to crush it.

2 Likes

Hey, is there an example of TCP over Ethernet?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.