|
EagleAutodesk
|
|
|
Autodesk Fusion 360Autodesk
|
|
|
arduino IDEArduino
|
|
|
Simply Modbus Slavesimplymodbus
|
|
|
Simply Modbus Mastersimplymodbus
|
Industrial RS485 IoT Gateway
Welcome to my ESP32 based Industrial RS485 Gateway project. This project will be exciting if you have never heard of any Industrial Gateways.
If you are wondering that what this gateway thing is all about, then stay around we will explore that soon.
What is an Industrial Gateway?
In lamen term an Industrial Gateway has mainly these objectives to be fulfilled.
- It should sustain the Industrial Environment.
- The device should be able to communicate with other Industrial devices such as VFD, Energy meters, Multifunction meters, inverters, etc.
- And most important it should talk to the internet.
That's all you need now I think it should be clear that this device act as a gateway between the internet and other industrial devices.
For communicating with different Industrial devices there are different industrial protocols such as Profibus, CAN, Profinet, AI bus, inter bus, and a lot more.
But in this project, we will be using a famous protocol named Modbus and it works on the RS485 serial bus.
We have one RS485 Port on our device therefore we can use Modbus RTU, Modbus ASCII, and with WiFi and ethernet, we can use Modbus TCP IP.
To know more about Modbus you can check out Simply Modbus they have covered everything.
Key Features:
- It supports industrial voltage levels up to 6 - 35Vdc.
- Onboard Wi-Fi and Ethernet for Internet Connectivity.
- Ethernet 100Mb interface.
- ESP32-WROOM-32D WiFi/BLE module. (Dual-core capabilities).
- USB connector for easy Programming ESP32 using Arduino IDE.
- Half-duplex RS485 Communication port.
- Onboard EEPROM IC for storing data.
- Automatic data flow control for RS485.
- Two Programmable LED indications. (I used them as Tx and Rx LEDs)
- Selectable RS485 transceiver voltage level. (5v & 3.3v)
- Industrial Enclosure with DIN mounting and compact size of PCB.
What can be done with this project?
Industrial Energy Meter Monitoring
Most of the Industrial Energy utility meters have RS485 communication available. Therefore we can read data from energy meters such as overall industry unit consumption, power factor, frequency, total active or reactive power consumed, and more.
After reading the data with the device we can send it to the cloud using MQTT or any other protocol easily. And you can display it in many open source app such as the MQTT dashboards, Blynk, or you can use Adafruit IO or you can build your own dashboard.
Monitoring and controlling Solar Inverter
Nowadays all solar inverters come with RS485 capabilities and a few of the inverters also provide functionalities such as ON-OFF operation over RS485.
Our RS485 gateway will directly connect with such inverter and will communicate with the inverter and we can easily get the live status of the inverter such as PV voltage, all MPPT voltage level, unit generated, current output per phase, and different Errors also. Additionally, if your inverter support controlling, you can turn ON or OFF your inverter remotely with this small gateway.
Live Industrial Temperature and Humidity values
In many industrial areas, they install Temperature and Humidity sensors for controlling the overall temperature of the area to a set value. Such sensors also have RS485 communication and we can get live data of that sensor in the palm of our hand with this gateway.
We can also program it with alert values such as temperature rise above 65°C then send an alert via email, SMS, or in App, etc.
Monitoring Pneumatic Pressure and Flow Rate
Pneumatic systems are widely used in Industries to create controlled mechanical motion or force. And pneumatic systems operate with air and there are mainly two parameters in consideration flow rate and pressure for calculation of air consumption or air loss calculation.
Above is the pneumatic pressure and flow indicator and has an RS485 port. We can now easily calculate and monitor very precisely with the RS485 gateway.
Monitoring MFM (multi-function meter)
Multi-function meters are used as sub-meters in industrial panels. MFM is used in parts like they install such meters for each section/machine part of their industries. So that they can observe particular machine consumption, efficiency, and more. Here is a live feed of an MFM meter to a mobile device by using an IoT RS485 gateway.
These meters give perfect insights into the overall operation of the industry. As they can measure all important electrical parameters such as 3-phase voltage & current, active & reactive power, power factor, frequency, Kwh, and etc.
I have seen industries that have more than 120+ such small meters. Here is a glimpse of an industrial electrical panel room full of multi-function meters, and they have 5 such big panel rooms.
Hence installing RS485 gateways in such cases are most reliable as they are small, cost-effective, accurate, and provides lots of useful information about an electrical network in industries.
If you want to monitor or control such RS485 devices then you will need a Modbus register map data of a slave that you want to monitor or control. Most probably this will be given in the App note of the slave device for the RS485 communication port.
As a starting point for multifunction meters, you can check out the Aggsoft website they have a list of many different MFM from different companies with their Modbus register table ready for you.
Apart from this, I have also controlled a VFD (AC drive) over RS485 with this gateway.
As we see the possibilities with such small devices are limitless in industrial use cases.
Exploring PCB components
DC-DC Buck Converter
As industrial standard voltage level here in India is 12Vdc and 24Vdc as most of the automation devices such as HMI, PLC, etc work on this voltage level.
Therefore our device needs to be operated perfectly at such voltage level to fulfill the industry requirement.
In order to do it efficiently and in a cost-effective way I have chosen to add a DC-DC buck converter onboard as a primary voltage conversion.
I have used a converter name XL1509 in the project.
XL1509 comes in mainly 3 different varients
- 3.3v output voltage (XL1509-3.3)
- 5v output voltage (XL1509-5)
- adjustable output voltage (XL1509-ADJ)
The converter can provide 2A of constant current output that we do not need.
And it operates at 150KHz switching frequency.
In my case, I am converting the high voltage DC supply to 5v as a primary conversion. Therefore I am using the XL1509-5 variant for this.
And it needs very few external components such as
- Input and output bulk filter capacitors (Electrolite caps 470uF - 330uF)
- one Inductor (47uH - 68uH)
- one Schottky diode (SS34)
That's all you need for a converter and for achieving proper results out of it minor tweaking with inductor and capacitor values is needed.
The PCB layout plays a critical role in such converters such as feedback path to the converter IC should be short and away from high-frequency switching, proper heat dissipation should be kept in mind, and more.
Secondary Voltage Conversion
We still need a 3.3v level to run our ESP32. Therefore I have used a famous LDO that ESP32 development board has AMS1117-3.3.
It also comes in different output voltage and current variants. I have used 3.3v and 1A output variants in this project.
USB Interface
To minimize the overall BOM price I chose CH340 as a USB to TTL converter as CP2102 price is a little high and I have sufficient space for CH340.
Mainly two types of CH340 IC are famous CH340G and CH340C both have the same footprint and functionality. The only difference is that CH340C does not need an external crystal oscillator.
And I have added ESP32 auto-reset circuit so that it is super simple to program the device using an Arduino IDE.
And for a robust connection, I have chosen USB type B as it is big and has a stable fit when compared with micro USB or other types when compared with price.
Ethernet Interface
For ethernet capabilities, I used a LAN8710A chip also known as Single-Chip Ethernet Physical Layer Transceiver (PHY).
This IC follows 10/100BASE-T standard and as per the datasheet it can go up to 100mbps data speed (have not tested it at max speed as I do not need it if someone has used it at max speed leave a comment down below)
Also, this IC has a build-in Two status LED outputs for the Ethernet connector.
Using it in
- Auto-negotiation enable mode
- RMII configuration
- SMI address: 0x00
And for the Ethernet connector, I am using an Hanrun HR911105A connector with magnetics.
RS485 Interface
RS485 interface uses differential voltage for error-free communication. Therefore we need to use the RS485 transceiver IC that will convert normal TTL signals to RS485 differential voltage signals.
Shortlisted two famous transceiver IC
- MAX485 (works at 5v input supply)
- MAX3485 (works at 3.3V input supply)
Initially, I used MAX485 without worrying that ESP32 GPIO is at 3.3v logic level and luckily it worked like charm, and non of the ESP32 get damage and they are all still working fine.
But after a while, I discovered MAX3485 that supports a 3.3v input supply and now I do not need to worry anymore. (And now I have an SMD jumper JP2 for selecting input voltage given to this RS485 transceiver)
Also, I have used a simple transistor logic for Automatic Data Flow Control for the RS485 transceiver. If you need to control the flow with software you need to remove components R4, R5, and T2. Now short the JP1 jumper and Flow control Pin will connect to GPIO2 of ESP32.
RS485 is used for long-range wired communication and I personally have tested error-free communication up to 1Km with a baud rate of 9600.
I have used standard twisted and shielded pair of RS485 communication wires from the Belden company (3105A )
We can read/write up to 32 slave devices using this RS485 transceiver IC. All slave needs to be connected in a daisy chain for proper communication and all slave should have unique slave IC for avoiding clash in communication between master and slave.
If communication distance is small then termination resistor Rt is needed of 120ohm and for long-distance, it can be omitted.
RS485 Bus Protection
For protecting the RS485 bus I have used a small SM712 Series 600W Asymmetrical TVS Diode Array. SM712 is specially designed to protect RS-485 applications with asymmetrical working voltages (-7V to 12V) from damage due to electrostatic discharge (ESD), electrical fast transients (EFT), and lightning-induced surges.
As per the datasheet, it provides the following protections-
- ESD, IEC 61000-4-2, ±30kV contact, ±30kV air
- EFT, IEC 61000-4-4, 50A (5/50ns)
- Lightning, IEC 61000- 4-5 2nd edition, 19A (tP=8/20μs)
If more lightning protection is needed then SG6 and SG7 SMD Gas discharge tubes from LittelFuse can be used.
Onboard Storage
In case there is no internet availability for a while and the monitoring data is important then we have onboard EEPROM storage for that.
I have used AT24C512 EEPROM IC from Microchip which provides us an additional 65536 bytes of storage memory.
Electrical Enclosure
For Industrial use, the enclosure should also meet the industrial requirements like
- It should have DIN rail mount capabilities.
- High temperature sustaining capability. (-40 °C ... 80 °C)
- Proper IP ratings. (IP20)
- Proper ventilation
Therefore after a lot of searches, I found a perfect enclosure that I was looking for the project.
The enclosure that I used in this project is from Phoenix Contact. They have a huge selection of industrial-grade enclosures.
For the base, I am using 2200474 and for Top, I am using 2201770.
Here is the 3D animation of the overall project with the electrical enclosure.
Want to play with a 3D model then try out this.
Future Scope
There are few things that I would like to include in this project in the future.
- Add Isolated Power Over Ethernet functionality (POE).
- Add an Isolated DC-DC buck converter for more protection of the device. (But it is not needed if we are using a proper SMPS).
- Add additional RS485 port. As one bus only supports up to 32 devices.
- The current version has a 120ohms termination resistor in the RS485 port. Would like to add one switch or jumper to turn ON and OFF the termination when required.
- Add a few high voltage DC IO pins.
- Add one onboard relay which can be programmed to turn ON heavy load such as AC alarm in fault conditions.
Configuring Wi-fi Credentials
I have used ESP touch (SmartConfig) for easily configuring the WiFi credentials in ESP32.
once It is configured I store them in ESP32 non-volatile memory so no need for reconfiguration.
For doing so I have a step-by-step guide on using SmartConfig in ESP32 check it out.
Also, you can check out my website TechTOnions.com for more such projects
Gallery
Have few more pics to show and now I am out of words so adding them here have fun.
Industrial RS485 IoT Gateway
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
- Comments(15)
- Likes(44)
- Engineer Nov 24,2024
- Heribert Tockner Sep 26,2024
- Muralidharan k Sep 23,2024
- pcbndre Aug 16,2024
- Engineer Jun 20,2024
- Engineer May 25,2024
- Jörgen Rosvall Apr 03,2024
- Engineer Feb 18,2024
- Engineer Jan 15,2024
- Engineer Jan 12,2024
- Engineer Nov 23,2023
- Mark Shane Hayden (Outlaw) Nov 11,2023
- Engineer Oct 13,2023
- Engineer Oct 11,2023
- Engineer Oct 09,2023
- doobledee Aug 07,2023
- Jaco Roselt Apr 12,2023
- DRV Apr 07,2023
- ayhani Mar 13,2023
- venkatesh pampana Feb 06,2023
- Guilherme Jan 14,2023
- Engineer Nov 30,2022
- Zaharia Constantin Nov 12,2022
- supun kumara Nov 12,2022
- Engineer Oct 18,2022
- Engineer Aug 15,2022
- habbo_vc96 Aug 06,2022
- Matt Swain Jul 31,2022
- Engineer Jul 24,2022
- Engineer May 07,2022
- Engineer Apr 11,2022
- Engineer Apr 06,2022
- Ömer KANOĞLU Feb 19,2022
- Engineer Jan 18,2022
- Dharmik Patel Dec 06,2021
- mzelenkin Nov 13,2021
- Engineer Nov 08,2021
- Engineer Oct 31,2021
- Engineer Sep 22,2021
- Engineer Aug 28,2021
- Engineer Aug 24,2021
- Aadi Aug 24,2021
- Tirth Aug 24,2021
- Rajat Aug 24,2021
- 15 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
-
2design
-
3usability
-
4creativity
-
5content
-
8design
-
8usability
-
9creativity
-
6content
-
9design
-
8usability
-
9creativity
-
9content
-
10design
-
10usability
-
10creativity
-
10content
-
1design
-
2usability
-
3creativity
-
6content
-
10design
-
10usability
-
10creativity
-
10content
-
10design
-
10usability
-
10creativity
-
10content
-
10design
-
10usability
-
10creativity
-
10content
-
10design
-
10usability
-
10creativity
-
10content
-
10design
-
10usability
-
10creativity
-
10content
-
10design
-
10usability
-
10creativity
-
10content
-
10design
-
10usability
-
10creativity
-
10content
-
10design
-
10usability
-
10creativity
-
10content
-
10design
-
10usability
-
10creativity
-
10content
-
10design
-
10usability
-
10creativity
-
10content
More by Dharmik Patel
-
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
113 0 0 -
DIY Laser Power Meter with Arduino
163 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
156 0 2 -
-
A DIY Soldering Station Perfect for Learning (Floppy Soldering Station 3.0)
564 0 3