Arduino Modbus Read Register and store in a mySql database

I am working on project where I read out modbus registers from an energy meter via Ethernet. My hardware is an Arduino Mega2560 with an Ethernet Shield 2.
The inserted libraries are: ArduinoModbus Version 1.0.3, MySql_Connection Version 1.2.0.
I can read successfully the modbus register. After reading I will connect the database. This is not possible. I seems the Modbus communication is blocking all other netowork communications. I have tried to store the data without mySql via a PHP-Scritpt, unfortunately with the same effect.
In the attachment you will find my whole code.

Has somebody experience with this stuff?
Thanks for any tipps and hints in advence.

Best regards
Martin

Read_PAC2200_Modbus_Mega_Eth_001_support.ino (12.5 KB)

@ Martin,
I am looking for something as you did. Is it possible to send me how everything is connected through Ethernet?
Are both machines in the same location?
Thanks

Hello
The Energy Counter and the Arduino Mega2560 are in the same Subnet. The databse is hosted by an provider.
Regards

Can you use the PHP page manually from a browser? Is it http or https?

Is MySQL configured to permit external access? It defaults to localhost only.

Hello
Yes I can use PHP from bowser. http is working. If I bypass the modbus part in the sketch php and mySql works. MySQL is conficured for external access. I use othe tables in the same database with the same Library and it works. Just if I use the "ModbusTCPClient modbusTCPClient(client)" it seems other connections are blocked.

@martin
For learning purposes, would you mind to post a schematic showing how everything is connected?
Thank you

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