# Disconnected status with Modbus TCP + Arduino MEGA + Ethernet Shield W5100 through Ignition

**URL:** <https://forum.inductiveautomation.com/t/disconnected-status-with-modbus-tcp-arduino-mega-ethernet-shield-w5100-through-ignition/100185>\
**Category:** Ignition\
**Tags:** modbus\
**Created:** [December 24, 2024, 3:49am UTC](https://forum.inductiveautomation.com/t/disconnected-status-with-modbus-tcp-arduino-mega-ethernet-shield-w5100-through-ignition/100185 "2024-12-24T03:49:18Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bchax](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@Bchax](https://forum.inductiveautomation.com/u/Bchax)\
**Post date:** [December 24, 2024, 3:49am UTC](https://forum.inductiveautomation.com/t/disconnected-status-with-modbus-tcp-arduino-mega-ethernet-shield-w5100-through-ignition/100185/1 "2024-12-24T03:49:18Z")

</div>

Hi! First post here so I suppose I am a bit of a noob with Ignition. At least this is my first Modbus TCP communication with Ignition:

I want to send information of a flowmeter received through the digital input of my Arduino MEGA to Ignition through Modbus TCP protocol. I am using the ModbusIP.h library of Arduino, and I seem to successfully launch my Arduino as the server:

```python
#include <SPI.h>
#include <Ethernet.h>
#include <Modbus.h>
#include <ModbusIP.h>

// ModbusIP object
ModbusIP mb;

// Ethernet settings
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; 
byte ip[] = { 192, 168, 0, 177 };

// Flowmeter settings
const int flowPin = 2; // Digital pin connected to flowmeter
volatile unsigned int pulseCount = 0;
unsigned long lastTime = 0; // Last time flow rate was calculated
float flowRate = 0.0; // Flow rate in liters/min
float calibrationFactor = 477; // Pulses per liter

// Modbus register address
const int flowRateRegister = 0; // Modbus address for flow rate data

// Interrupt service routine to count pulses
void countPulses() {
  pulseCount++;
}

void setup() {
  // Start serial monitor
  Serial.begin(9600);
  while (!Serial) {
    ; // Wait for serial port to connect (only needed for some boards)
  }

  // Initialize Ethernet and Modbus
  Ethernet.begin(mac, ip);
  mb.config(mac, ip);
  mb.addHreg(flowRateRegister); // Add holding register for flow rate

  // Print IP and Port
  Serial.println(Ethernet.localIP());

  // Initialize flowmeter input
  pinMode(flowPin, INPUT_PULLUP); // Use internal pull-up resistor
  attachInterrupt(digitalPinToInterrupt(flowPin), countPulses, FALLING);

  // Initialize timing
  lastTime = millis();
}

void loop() {
  // Modbus handling
  mb.task();

  // Time calculation
  unsigned long currentTime = millis();
  unsigned long timeDiff = currentTime - lastTime;

  // Every second, calculate flow rate
  if (timeDiff >= 1000) {
    float frequency = pulseCount / (timeDiff / 1000.0); // Pulses per second
    flowRate = frequency / calibrationFactor; // Convert to liters/min
    pulseCount = 0; // Reset pulse count
    lastTime = currentTime;

    // Debug output
    Serial.println(flowRate, 2); // 2 decimal places

    // Update Modbus register
    mb.Hreg(flowRateRegister, (uint16_t)(flowRate * 100)); // Send scaled value
  }
}

```

I say successfully because once launched, the ping to the created IP address answers, and NetCat connects to the 502 port.

Nonetheless, when configuring a simple Modbus TCP device into my Ignition I get Disconnected status. The gateway is also located at the same subnet as the Modbus server I create (0). So I really do not see what could be happening here.

Noteworthy: I am using MacOS, hence I sadly do not have access to ModbusPoll and I cannot check if I am properly writing my registers yet. But I suppose that Ignition should connect anyway.

I tried to be as clear as possible, I am glad to further clarify my problem if needed.

---

<div class="post-metadata">

**Author:** ![bmusson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmusson/32/87530_2.png) [@bmusson](https://forum.inductiveautomation.com/u/bmusson)\
**Post date:** [December 24, 2024, 4:59am UTC](https://forum.inductiveautomation.com/t/disconnected-status-with-modbus-tcp-arduino-mega-ethernet-shield-w5100-through-ignition/100185/2 "2024-12-24T04:59:48Z")

</div>

What happens if you comment out this line?

```python
Ethernet.begin(mac, ip);

```

I think it’s unnecessary, `mb.config(mac, ip)` is sufficient to startup the interface.

If that’s doesn’t change anything, then it’s probably a networking issue. What do the gateway logs say?

---

<div class="post-metadata">

**Author:** ![Bchax](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@Bchax](https://forum.inductiveautomation.com/u/Bchax)\
**Post date:** [December 24, 2024, 2:02pm UTC](https://forum.inductiveautomation.com/t/disconnected-status-with-modbus-tcp-arduino-mega-ethernet-shield-w5100-through-ignition/100185/3 "2024-12-24T14:02:13Z")

</div>

Sorry that line of code was from another try. I removed it but the problem still remains. I leave some screenshots of the Logs, the nc to my IP, and the ping.

 ![ModbusDriver2 Logs](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/7/57a436512b5e94d5a7001399120ffdd97e9d560a.jpeg)

 ![NetCat](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/a/aaf701ca8cf02b4b3addd2ea7c8517351c514d3f.png)

 ![Ping](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/9/39e99d4aa74d8225de5a232094b9212789cac06f.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 24, 2024, 2:03pm UTC](https://forum.inductiveautomation.com/t/disconnected-status-with-modbus-tcp-arduino-mega-ethernet-shield-w5100-through-ignition/100185/4 "2024-12-24T14:03:46Z")

</div>

Expand this log entry (click "+") and copy/paste the stack trace here.

![image](https://us1.discourse-cdn.com/inductiveautomation/optimized/3X/6/c/6cb463c9741687029408b6246077bcf0370830f5_2_690x29.png)

---

<div class="post-metadata">

**Author:** ![Bchax](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@Bchax](https://forum.inductiveautomation.com/u/Bchax)\
**Post date:** [December 24, 2024, 2:08pm UTC](https://forum.inductiveautomation.com/t/disconnected-status-with-modbus-tcp-arduino-mega-ethernet-shield-w5100-through-ignition/100185/5 "2024-12-24T14:08:07Z")

</div>

Thank you for the fast reply Kevin, glad to have the OG of Modbus from all the forums. Here is the screenshot:

 ![Error during connect Log expanded](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/5/c5c9a9f38dc60c0db5114b70916ab1cc6d5e39af.jpeg)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 24, 2024, 2:08pm UTC](https://forum.inductiveautomation.com/t/disconnected-status-with-modbus-tcp-arduino-mega-ethernet-shield-w5100-through-ignition/100185/6 "2024-12-24T14:08:50Z")

</div>

That's weird.

What does your Modbus device configuration look like in Ignition?

---

<div class="post-metadata">

**Author:** ![Bchax](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@Bchax](https://forum.inductiveautomation.com/u/Bchax)\
**Post date:** [December 24, 2024, 2:14pm UTC](https://forum.inductiveautomation.com/t/disconnected-status-with-modbus-tcp-arduino-mega-ethernet-shield-w5100-through-ignition/100185/7 "2024-12-24T14:14:12Z")

</div>

It is quiet straightforward, I am using Maker though...

 ![OPC UA Devices](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/7/e7f4c0c872b6b9c029fd0ca1775be4c9bbd0975e.png)

 ![Screenshot 2024-12-24 at 11.12.57 AM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/9/c9c62834ab1dbbd34f57ac01ef334f582742745e.png)

 ![Screenshot 2024-12-24 at 11.13.26 AM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/a/cadada8111a5d525af1352e218cebc24c2be1ce2.png)

 ![Screenshot 2024-12-24 at 11.13.37 AM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/8/28170ac12bb2bda4bb5fa5aa8d76688fd9128128.png)

 ![Screenshot 2024-12-24 at 11.13.54 AM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/4/74f7882fc02987e008ff3ce4e23f610956977221.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 24, 2024, 2:16pm UTC](https://forum.inductiveautomation.com/t/disconnected-status-with-modbus-tcp-arduino-mega-ethernet-shield-w5100-through-ignition/100185/8 "2024-12-24T14:16:45Z")

</div>

Hmm, I have no idea. Maybe try setting "Local Address" to the IP address of whatever network adapter in your mac can reach the Modbus server.

This is the second time this week I've seen a "No route to host" error when connecting from somebody on a Mac. I don't know if there's some configuration or permissions or firewall problem with the latest update or what...

---

<div class="post-metadata">

**Author:** ![Bchax](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@Bchax](https://forum.inductiveautomation.com/u/Bchax)\
**Post date:** [December 24, 2024, 2:26pm UTC](https://forum.inductiveautomation.com/t/disconnected-status-with-modbus-tcp-arduino-mega-ethernet-shield-w5100-through-ignition/100185/9 "2024-12-24T14:26:16Z")

</div>

Yeah there is very limited control of these kind of things with Macbook. I will try with Windows whenever I have the opportunity.

Thank you for your attention, merry christmas and happy new year 👍🏼

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 24, 2024, 2:41pm UTC](https://forum.inductiveautomation.com/t/disconnected-status-with-modbus-tcp-arduino-mega-ethernet-shield-w5100-through-ignition/100185/10 "2024-12-24T14:41:54Z")

</div>

Pretty convinced this has something to do with Sequoia's Local Network Privacy and some missing entitlements on our side that would cause Ignition to show up here:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/6/269007c8cdc89848ca5b30baad31c80a7b1eae4b.jpeg)

tagging @jcoffman for after the holidays, he might know more.

---

<div class="post-metadata">

**Author:** ![jcoffman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jcoffman/32/6429_2.png) [@jcoffman](https://forum.inductiveautomation.com/u/jcoffman)\
**Post date:** [January 6, 2025, 5:25pm UTC](https://forum.inductiveautomation.com/t/disconnected-status-with-modbus-tcp-arduino-mega-ethernet-shield-w5100-through-ignition/100185/11 "2025-01-06T17:25:23Z")

</div>

To second Kevin, I have seen that Mac OS Sequoia has changed some permissions here, but this specific setting isn't user adjustable AFAICT at the moment. Im still looking into this a bit to see if there is a workaround or a way to add that entitlement, but my google foo is coming up short at the moment. Ill spend some more time looking into this

---

<div class="post-metadata">

**Author:** ![jcoffman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jcoffman/32/6429_2.png) [@jcoffman](https://forum.inductiveautomation.com/u/jcoffman)\
**Post date:** [January 10, 2025, 6:51pm UTC](https://forum.inductiveautomation.com/t/disconnected-status-with-modbus-tcp-arduino-mega-ethernet-shield-w5100-through-ignition/100185/12 "2025-01-10T18:51:04Z")

</div>

This is confirmed to be a new issue in Sequoia. In order to work around this there are a few options:

If using the binary installer don't install the gateway as a service

- If installing as a service is required, comment out the `ignition.sh` line for `RUN_AS_USER=`. This will install the service as the `root` user which does not require giving access to the Local Network permission.

The zip installer defaults to installing the service as root

This issue looks to only affect launchd services which are set to run as a user other than `root` at this point in time. I have already reached out to Apple about this and hopefully we get a better solution or a fix soon.

Hope that helps,  
Jonathan C

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 14, 2025, 6:24pm UTC](https://forum.inductiveautomation.com/t/disconnected-status-with-modbus-tcp-arduino-mega-ethernet-shield-w5100-through-ignition/100185/13 "2025-02-14T18:24:48Z")

</div>

NoRouteToHost NoRouteToHostException no route to host macOS Sequoia

^ This is a for future people searching for issues like this, and a prime example of why I rage when people post screenshots of errors/text instead of text. I had to find this post by remembering the word "entitlement" was used at some point.
