All Projects → budulinek → arduino-modbus-rtu-tcp-gateway

budulinek / arduino-modbus-rtu-tcp-gateway

Licence: GPL-3.0 license
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.

Programming Languages

C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to arduino-modbus-rtu-tcp-gateway

solaredge modbus
SolarEdge Modbus data collection library
Stars: ✭ 49 (-12.5%)
Mutual labels:  modbus-tcp, modbus-rtu
ModbusMechanic
Cross platform GUI MODBUS TCP/RTU simulator & gateway. Interprets data types including ascii float and int.
Stars: ✭ 63 (+12.5%)
Mutual labels:  modbus-tcp, modbus-rtu
modbus-esp8266
Most complete Modbus library for Arduino. A library that allows your Arduino board to communicate via Modbus protocol, acting as a master, slave or both. Supports network transport (Modbus TCP) and Serial line/RS-485 (Modbus RTU). Supports Modbus TCP Security for ESP8266/ESP32.
Stars: ✭ 332 (+492.86%)
Mutual labels:  modbus-tcp, modbus-rtu
huawei solar
Home Assistant integration for Huawei Solar inverters via Modbus
Stars: ✭ 126 (+125%)
Mutual labels:  modbus-tcp, modbus-rtu
go-modbus
modbus write in pure go, support rtu,ascii,tcp master library,also support tcp slave.(WIP new implement<old: https://github.com/thinkgos/gomodbus >)
Stars: ✭ 124 (+121.43%)
Mutual labels:  modbus-tcp, modbus-rtu
EasyModbusTCP.Java
EasyModbusTCP library for Java implementation
Stars: ✭ 76 (+35.71%)
Mutual labels:  modbus-tcp, modbus-rtu
Esp32modbustcp
Modbus client for ESP32
Stars: ✭ 51 (-8.93%)
Mutual labels:  modbus-tcp
Pyscada
PyScada is a open source scada system that uses the Django framework as backend
Stars: ✭ 233 (+316.07%)
Mutual labels:  modbus-tcp
Clientserverproject
一个C-S模版,该模版由三部分的程序组成,一个服务端运行的程序,一个客户端运行的程序,还有一个公共的组件,实现了基础的账户管理功能,版本控制,软件升级,公告管理,消息群发,共享文件上传下载,批量文件传送功能。具体的操作方法见演示就行。本项目的一个目标是:提供一个基础的中小型系统的C-S框架,客户端有三种模式,无缝集成访问,winform版本,wpf版本,asp.net mvc版本,方便企业进行中小型系统的二次开发和个人学习。同时网络组件方便的支持读写三菱和西门子PLC的数据,详细见Readme
Stars: ✭ 873 (+1458.93%)
Mutual labels:  modbus-tcp
Modbus
Modbus RTU and TCP support for C#
Stars: ✭ 23 (-58.93%)
Mutual labels:  modbus-tcp
modbus port esp32
lib freemodbus porting for esp32
Stars: ✭ 22 (-60.71%)
Mutual labels:  modbus-rtu
J2mod
Enhanced Modbus library implemented in the Java programming language
Stars: ✭ 155 (+176.79%)
Mutual labels:  modbus-tcp
Pymodbus
A full modbus protocol written in python
Stars: ✭ 1,225 (+2087.5%)
Mutual labels:  modbus-tcp
Mbusd
Open-source Modbus TCP to Modbus RTU (RS-232/485) gateway.
Stars: ✭ 233 (+316.07%)
Mutual labels:  modbus-tcp
Modbridge
Bridge between modbus and MQTT
Stars: ✭ 20 (-64.29%)
Mutual labels:  modbus-tcp
Gomodbus
A Modbus client in Go
Stars: ✭ 11 (-80.36%)
Mutual labels:  modbus-tcp
Jlibmodbus
JLibModbus is an implementation of the Modbus protocol v1.1b in java language.
Stars: ✭ 149 (+166.07%)
Mutual labels:  modbus-tcp
Androidmodbusrtu
No description or website provided.
Stars: ✭ 22 (-60.71%)
Mutual labels:  modbus-rtu
Genmon
Generac Generator Monitoring using a Raspberry Pi and WiFi
Stars: ✭ 143 (+155.36%)
Mutual labels:  modbus-tcp
Modbustool
A modbus master and slave test tool with import and export functionality, supports TCP, UDP and RTU.
Stars: ✭ 187 (+233.93%)
Mutual labels:  modbus-tcp

arduino-modbus-rtu-tcp-gateway

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.

What is it good for?

Allows you to connect your Modbus RTU slaves (such as sensors, energy meters, HVAC devices) to Modbus TCP/UDP masters (such as monitoring systems, home automation systems). You do not need commercial Modbus gateways. Arduino (with an ethernet shield and a cheap MAX485 module) can do the job!

Change settings of your Arduino-based Modbus RTU to Modbus TCP/UDP gateway via web interface (settings are automatically stored in EEPROM).

Screenshots of the web interface:

01

02

03

04

05

What are the technical specifications?

  • slaves are connected via RS485 interface
  • master(s) are connected via ethernet interface
  • up to 247 Modbus RTU slaves
  • up to 8 TCP/UDP sockets for Modbus TCP/UDP masters and for the web interface
  • RS485 interface protocols:
    • Modbus RTU
  • Ethernet interface protocols:
    • Modbus TCP
    • Modbus UDP
    • Modbus RTU over TCP
    • Modbus RTU over UDP
  • supports broadcast (slave address 0x00) and error codes
  • supports all Modbus function codes
  • settings can be changed via web interface, stored in EEPROM
  • diagnostics and Modbus RTU scan via web interface
  • optimized queue for Modbus requests
    • prioritization of requests to responding slaves
    • queue will accept only one requests to non-responding slaves

How can I build it myself?

Get the hardware (cheap clones from China are sufficient) and connect together:

  • Arduino Nano, Uno or Mega (and possibly other). On Mega you have to configure Serial in ADVANCED SETTINGS in the sketch.
  • W5100, W5200 or W5500 based Ethernet shield (for Nano, I recommend W5500 Ethernet Shield from RobotDyn)
  • TTL to RS485 module:
    • with hardware automatic flow control (recommended)
      Arduino <-> Module
      Tx1 <-> Tx
      Rx0 <-> Rx
    • with flow controlled by pin (such as MAX485 module)
      Arduino <-> MAX485
      Tx1 <-> DI
      Rx0 <-> RO
      Pin 6 <-> DE,RE

Here is my setup: Terminal shield + Arduino Nano + W5500 eth shield (RobotDyn) + TTL to RS485 module (HW automatic flow control) 01

Download this repository (all *.ino files) and open arduino-modbus-rtu-tcp-gateway.ino in Arduino IDE. Download all required libraries (both are available in "library manager"). If you want, you can check the default factory settings (can be later changed via web interface) and advanced settings (can only be changed in sketch). Compile and upload your program to Arduino. Connect your Arduino to ethernet, connect your Modbus RTU slaves to MAX485 module. Use your web browser to access the web interface on default IP http://192.168.1.254 Enjoy :-)

Where can I learn more about Modbus protocols?

https://en.wikipedia.org/wiki/Modbus

https://modbus.org/specs.php

http://www.simplymodbus.ca/FAQ.htm

Can I use just the web interface for my own project?

Feel free to use this sketch as a template for a web interface within your own project. Look into the main file (arduino-modbus-rtu-tcp-gateway.ino) for how settings are stored in and loaded from EEPROM during boot. Ethernet interface and Webserver is started via function in 01-interfaces.ino. All other functions related to the web server (reading from clients, sending pages to clients) can be found in separate files (04-webserver.ino , 05-pages.ino ). Feel free to adjust them.

The key to success is:

Big thanks to the authors of these libraries and tutorials!

Limitations

Portability

The code was tested on Arduino Nano, Uno and Mega, ethernet chips W5100 and W5500. It may work on other platforms, but:

Ethernet socket

The default Ethernet.h library determines MAX_SOCK_NUM by microcontroller RAM (not by Ethernet chip type). So if you use W5500 (which has 8 sockets available) on Arduino Nano, only 4 sockets will be used. If you want to force the library to use 8 sockets, redefine MAX_SOCK_NUM in advanced settings in the sketch.

Memory

Not everything could fit into the limited flash memory of Arduino Nano / Uno. If you have a microcontroller with more memory (such as Mega), you can enable extra features in the main sketch by uncommenting:

  • #define ENABLE_DHCP will allow you to set "Auto IP" via DHCP in the IP settings web interface. Leased IP is automatically renewed.

06

  • #define ENABLE_EXTRA_DIAG shows extra info on "Current status" page: per socket diagnostics, run time counter, ethernet data counter.

01x

Version history

For version history see:

https://github.com/budulinek/arduino-modbus-rtu-tcp-gateway/blob/master/arduino-modbus-rtu-tcp-gateway/arduino-modbus-rtu-tcp-gateway.ino#L27

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].