DEV Community

zhuyue
zhuyue

Posted on

Add RS485 interface to interact with 3rd party sensor & acuator by MODBUS protocol

The software design of ESP8266-based programmable controller as well as testing is nearly completed, including:
Controller software,
The built-in web page,
PC tool developed by delphi to download web pages and firmware,
IOT gateway developed by PHP,
Remote web pages in cloud,
Still need to complete the WX integration, cloud platform management system, third-party APP integration and other functions;
Simultaneously start to update the hardware.

Considering that MODBUS protocol sensors or actuators via RS485 is also a commonly used function, also data acquisition via RS45 may be required,
If the controller doesn't supprort RS485, it will be a pity.

Good news is an empty area exists next the output relay;

Therefore, I added the RS485 communication circuit, in order to avoid surge voltage/current into the communication port to damage the RS485 communication chip, further surges into ESP8266 and damage it, I added two unipolar TVS at the port, And two current-limiting resistor are connected in series, also current-limiting resistors are connected between the communication chip and the module, to provent the surge.

In order to be compatible with the 3.3V operating voltage of the ESP8266, the RS485 communication chip is selected the 3.3V operating voltage model.

ESP8266 may be not realtime enough to meet the requirements of the MODBUS protocol 3.5 character as a Modbus slave, but as a MODBUS master, it should be no realtime problem.
A few years ago, the design of the circuit has a very cumbersome work, that is, the schematic package and PCB package design, with the electronic component online store, such work has been greatly simplified, the online EDA can provide a schematic package and PCB package, can be imported into the office EDA for direct use.

The concerning is that for the high voltage surge, even after the TVS clamp, may still be far more than 3.3V, such high voltage into the RS485 communication chip may lead to the chip port and power supply voltage is raised, resulting in damage to the module, need to do a detailed test subsequently;

Image description

Image description

Image description

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay