OpenSprinkler Forums Hardware Questions OpenSprinkler Data logging via MQTT Reply To: Data logging via MQTT

#42933

Ray
Keymaster

I think ENC28J60 generally works fine, as long as you don’t have too many packets to send. The more packets, the higher likelihood of one or two packets getting lost on the way. The main problem with the open-source ENC library is that it’s not a complete implementation of TCP/IP — it doesn’t guarantee delivery of packets. So when necessary you have to manually send duplicate packets, which is a crude way to fix the problem.

I didn’t modify the driver of ENC28J60 to make it more reliable. Instead, I assumed it’s not totally reliable and added higher-level features to handle issues when they happen. For example, when it detects it can’t connect to the router over several tries, it re-initializes the Ethernet controller.

A more modern library for ENC is UIPEthernet, which I think is much more reliable. I’ve planned to replace the current library with UIPEthernet, but that’s likely to exceed the RAM limit on the older OS hardware 2.0 to 2.2 — only the current OS 2.3 (including both AC and DC) will be able to work with this new library. For backward compatibility reasons, I haven’t made the switch, but it will happen at some point.

My suggestion is to directly modify the firmware to support MQTT. However, if this turns out to be too hard, using serial is a good alternative, and probably involves less changes to the firmware code.