Giter Club home page Giter Club logo

budulinek / arduino-modbus-rtu-tcp-gateway Goto Github PK

View Code? Open in Web Editor NEW
164.0 164.0 48.0 4.35 MB

Arduino-based Modbus RTU to Modbus TCP/UDP gateway with web interface. Allows you to connect Modbus RTU slaves (such as sensors, energy meters, HVAC devices) to Modbus TCP/UDP masters (such as home automation systems). You can adjust settings through web interface.

License: GNU General Public License v3.0

C++ 93.89% C 6.11%
arduino arduino-eeprom arduino-webserver home-assistant loxone modbus-rtu modbus-tcp modbus-udp

arduino-modbus-rtu-tcp-gateway's People

Contributors

budulinek avatar f-reiling avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino-modbus-rtu-tcp-gateway's Issues

the last version doesn't work well

Hello,
the last version v3.0 doesn't work well.
The connection freezes after a few minutes and I have to reset the Arduiono.
Troubleshooting from last issue didn't help
I'm back to version v2.3

Best regards
Michael

exceeds available space in board in arduino nano

Dear Budulinek
I'm failed to build this project with arduino nano and its W5500 ethernet shield (RobotDyn). When I try to verify the program there is a message saying exceeds available space in board.
But I thing you sucsess with the same hardware. Please let me know if I did wrong.

Thanks

Arduino OPTA port

Hello!
I'm interested in porting this project to the Arduino OPTA(STM32H747XI)
Are there any suggestions in regards to replacing the Atmega based code of this project, for STM32?

Thanks!

turn off retries

Hello budulinek, excellent work.
I want to turn off retries in the RTU, the minimum value for the Web page is Retry Attempts = 1.
I can set localConfig.serialRetry=0 and with this turn off the retries

The connection to the Modbus master is broken after a few hours

Hardware:
Arduino Mega 2560, W5500 lite, 1 RTU Slave 0x01
Modbus Mode : Modbus TCP/UDP

Modbus Master TCP/502, query interval 120s ,timeout 5s

The connection to the web interface TCP/80 also breaks off.
After pressing the reset button, the connection is re-established

error message 'CreateTrulyRandomSeed' was not declared in this scope

Hi, i'm new with Arduino and also with Git, so i hope this is the right way to ask a question.

I copy your code into Arduino Software (Version 1.8.16 Linux)
What made i wrong?
When i try to upload the code i get this errors:

Arduino: 1.8.16 (Linux), Board: "Arduino Nano, ATmega328P"

/home/toni/test1.ino:122:0: warning: "UDP_TX_PACKET_MAX_SIZE" redefined
#define UDP_TX_PACKET_MAX_SIZE modbusSize

In file included from /home/toni/test1.ino:40:0:
/home/toni/libraries/Ethernet/src/Ethernet.h:150:0: note: this is the location of the previous definition
#define UDP_TX_PACKET_MAX_SIZE 24

/home/toni/test1.ino: In function 'void setup()':
test1:220:3: error: 'CreateTrulyRandomSeed' was not declared in this scope
CreateTrulyRandomSeed();
^~~~~~~~~~~~~~~~~~~~~
test1:230:5: error: 'generateMac' was not declared in this scope
generateMac();
^~~~~~~~~~~
test1:235:3: error: 'startSerial' was not declared in this scope
startSerial();
^~~~~~~~~~~
/home/toni/test1.ino:235:3: note: suggested alternative: 'Serial'
startSerial();
^~~~~~~~~~~
Serial
test1:236:3: error: 'startEthernet' was not declared in this scope
startEthernet();
^~~~~~~~~~~~~
/home/toni/test1.ino:236:3: note: suggested alternative: 'Ethernet'
startEthernet();
^~~~~~~~~~~~~
Ethernet
/home/toni/test1.ino: In function 'void loop()':
test1:244:3: error: 'recvUdp' was not declared in this scope
recvUdp();
^~~~~~~
test1:245:3: error: 'recvTcp' was not declared in this scope
recvTcp();
^~~~~~~
test1:246:3: error: 'processRequests' was not declared in this scope
processRequests();
^~~~~~~~~~~~~~~
test1:249:3: error: 'sendSerial' was not declared in this scope
sendSerial();
^~~~~~~~~~
/home/toni/test1.ino:249:3: note: suggested alternative: 'Serial'
sendSerial();
^~~~~~~~~~
Serial
test1:250:3: error: 'recvSerial' was not declared in this scope
recvSerial();
^~~~~~~~~~
/home/toni/test1.ino:250:3: note: suggested alternative: 'Serial'
recvSerial();
^~~~~~~~~~
Serial
test1:253:3: error: 'recvWeb' was not declared in this scope
recvWeb();
^~~~~~~
test1:254:3: error: 'maintainCounters' was not declared in this scope
maintainCounters(); // maintain counters and synchronize their reset to zero when they overflow
^~~~~~~~~~~~~~~~
/home/toni/test1.ino:254:3: note: suggested alternative: 'scanCounter'
maintainCounters(); // maintain counters and synchronize their reset to zero when they overflow
^~~~~~~~~~~~~~~~
scanCounter
exit status 1
'CreateTrulyRandomSeed' was not declared in this scope

adapt project for stm32

I would like to know if it is possible to adapt this project for the stm32f103 "bluepill" or similar

Run this Gateway on a ESP8266

I am new on github and dont know how to ask a questions like this way. Is this the right way?
This project is exactly what i was looking for. However, I would like to run it on an ESP8266. Is it possible without a lot of changes, or does it take a lot of effort to run it on the esp?
certainly the following line must be inserted:
#include <ESP8266WiFi.h>
and removed this:
#include <utility/w5100.h>

timeout error

I have managed to make the project work on an arduino mega 2560, but the master simulator throws me timeout error in alternate reads, one ok and another reading timeout error and so on. that could be happening?

great job

Modbus rtuovertcp ModbusTcpClient: Connection unexpectedly closed x seconds into read of 2 bytes without response from unit before it closed connection

I'm using HomeAssistant Modbus plugin (mode rtuovertcp) to get data from a serial modbus device (power meter SDM630)
In between I have this arduino modbus rtu tcp gateway, build with a Arduino Uno and a W5500 shield.

It is working, I get the values from the power meter, but HA is reporting regularly that the item is Unavailable.
In the logfile of HA, I find the error mentioned in the title.
I opened a ticket in HA, but they are redirecting me to a problem in the gateway.
home-assistant/core#57426

They propose to debug the thing in the gateway. If I understand correctly, the diagnostic define cannot be uncommented in a Arduino Uno?
I've done tests in HA with a configuration to get only one input register with a scan interval of 20 seconds, thinking that getting all needed registers is too much for the gateway. But still the same error.

What do you think?
How to proceed to debug this?
Is the Arduino not quick enough to do this and should I switch to a nano or a mega?

Compiling Error

Hi budulinek,

great work. So I have an issue that I cannot solve. Maybe there is a library missing, but which? Error Code from Arduino IDE is attached. Thank you very much.

Nico
error.txt

Modbus with ENC28J60

good afternoon.
I would like to ask if you have used an Arduino card with an ENC28J60 network card for modbus?
This network card, according to the information on the WEB, is used with the UIPEthernet or EtherCard library.
Do you know her
It has had some problems, since during programming, there are some instructions, or objects that are not 100% compatible or transparent.

Ethernet was not declared

Dear sir, I changed from working with ESP8266 and ENC28J60 to Arduino UNO with W5500, and I get the following error: "Ethernet was not declared ..". That error is indicated in Ethernet.begin, in Ethernet.etc ...
I am reviewing the original program and the Ethernet.h library is perfectly included in it, so I understand that there is no error in it.
Could you please tell me where I should check to fix this error?

Esp32 version

Hi
I am trying to make this work on esp32. There are some fork version for esp32 but no one works, at least for esp32 dev board.
Would it be so complicated to adapt this to esp8266/esp32?
I think the memory limits on Arduino borads will be overcome.
The main problem seems to be in ArduinoRS485.h with SERIAL_PORT_HARDWARE variable definition.
Thanks!

warning compilation

Warning compiler for mega2560:

arduino-modbus-rtu-tcp-gateway\04-webserver.ino:288:20: warning: invalid conversion from 'byte {aka unsigned char}' to 'action_type' [-fpermissive]
action = (byte)atoi(strtok_r(NULL, "=", &sav2));

Trouble porting to STM32 Arduino

I am having some trouble getting this to work on STM32, have you tried this? I am using W5500 and get odd results when using the library functions such as W5100.readSnPORT(dataAvailable) this function.

If I assign it to a variable like this
uint8_t SnPORT = W5100.readSnPORT(dataAvailable); and then compare
if (SnPORT == 80) it works, but

if (W5100.readSnPORT(dataAvailable) == 80) gives incorrect results.

I think it might be a timing issue, but I cannot get it to work! I have tried a basic webserver with the hardware configuration and it works without issue. The only changes from your latest version is that I remove the generateuniqueID and hard code a mac address for testing.

"Unknown board"

Hello, I have a problem with the code does not recognize the board. The model I have is the "atmega328p Xplained mini".

Error is:
287 #error "Unknown board"

Can anyone tellme, how fix it?

My configuration is:
Board: atmega328p Xplained mini (the hardware is same to serie NANO)
Ethernet: ENC28J60 (NANO Ethernet Shield v1.0 "Deek-Robot")
Modbus: MAX485

best Regards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.