Posted on Leave a comment

How to connect 4 – 20mA Industrial Sensors with ESP32 PLC: A Comprehensive Guide

How to connect 4 - 20mA Industrial Sensors with ESP32 PLC: A Comprehensive Guide

Connecting 4-20mA industrial sensors to an ESP32 PLC involves several steps, including understanding the sensor, configuring the ESP32, and handling the analog signal conversion. Here’s a comprehensive guide to help you:

Connect 4 - 20mA Industrial Sensors with ESP32 PLC

Connecting 4-20mA industrial sensors with an ESP32 PLC offers several advantages in industrial applications:

Compatibility: 4-20mA sensors are widely used in industrial settings due to their resilience against electrical interference and ability to transmit data over long distances without significant loss. ESP32 PLCs with analog input capabilities can easily interface with these sensors, enabling seamless integration into existing industrial systems.

Data Acquisition: ESP32 microcontrollers have analog-to-digital converters (ADCs) that can accurately read analog signals. By connecting 4-20mA sensors to the ESP32, you can efficiently capture and process sensor data, allowing for real-time monitoring and control of industrial processes.

Cost-effectiveness: ESP32 microcontrollers offer a cost-effective solution for acquiring sensor data. They provide flexibility, programmability, and connectivity options, making them suitable for various industrial automation and monitoring tasks at a relatively low cost compared to specialized PLCs.

Scalability and Customization: The ESP32 platform offers flexibility for customization and scalability. It allows developers to create tailored solutions by writing custom code to interpret sensor data, implement control algorithms, and interface with other devices or networks, meeting specific industrial requirements.

Internet Connectivity: ESP32 boards feature built-in Wi-Fi and Bluetooth capabilities, enabling connectivity to local networks or the internet. This connectivity facilitates remote monitoring, data logging, and control, offering enhanced accessibility and convenience in managing industrial processes.

Compact Size and Efficiency: ESP32 devices come in compact sizes, offering space-saving advantages in industrial environments. Despite their small form factor, they boast sufficient processing power and energy efficiency, suitable for continuous operation in industrial applications.

Understanding 4-20mA Industrial Sensors

Know Your Sensor: Identify the type of sensor you’re dealing with (temperature, pressure, etc.), its specifications, and the range of values it can output (typically 4-20mA).

Power Supply: 4-20mA sensors often require a power supply. They might operate on loop power, where the same two wires used for transmitting the signal also supply power to the sensor.

ESP32 PLC Setup

ESP32 Board Selection: Choose an ESP32 board suitable for PLC applications.

Analog Input: ESP32 boards usually have built-in ADCs (Analog to Digital Converters) that can read analog signals. Determine the number of analog input pins available and their specifications.

Signal Conditioning and Conversion

Current-to-Voltage Conversion: 4-20mA signals need to be converted to a voltage signal that the ADC can read. This involves using a resistor (known as a shunt resistor) to convert the current to a measurable voltage. Ohm’s law (V = IR) can be applied, where V is the voltage across the resistor, I is the current, and R is the resistor value.

The INA196 measures the voltage drop across this shunt resistor. The voltage across the shunt resistor (Vshunt) can be calculated using Ohm’s Law:

Vshunt = Isensor × Rshunt

Vshunt  is the voltage across the shunt resistor.

Isensor is the current through the sensor.

Rshunt is the resistance of the shunt resistor.

Once you have the voltage across the shunt resistor, you can use the gain equation for the INA196 to calculate the output voltage:

Vout =(Vshunt ×G

Vout is the output voltage of the INA196.

G is the gain of the INA196.


Assuming a 4mA current sensor connected to the INA196, the sensor is likely producing a 4mA current through a shunt resistor, and 

Isensor = 4mA 

Rshunt = 10

Vshunt = Isensor × Rshunt

Vshunt = 4mA 10

Vshunt =  40mV

G(INA196) = 20 V/V

Vout =(Vshunt ×G

Vout =(40mV ×20 V/V

Vout = 0.8 V


Resistor Selection: Choose a suitable shunt resistor value to convert the 4-20mA range to a voltage range that doesn’t exceed the ESP32 ADC’s maximum input voltage.

Circuit Connection

Connect the Sensor: Wire the sensor to the power supply and the shunt resistor. Ensure proper grounding and follow the sensor’s datasheet for correct wiring.

Connect to ESP32: Connect the output of the shunt resistor (voltage signal) to the ESP32’s analog input pin. Pay attention to the voltage range and make sure it falls within the ADC’s specifications.

ESP32 Programming

Analog Input Reading: Write code to read the analog voltage from the connected pin using the ADC library provided for the ESP32.

Voltage-to-Value Conversion: Convert the read voltage value to the actual sensor value using appropriate scaling formulas. Map the voltage range you’ve measured to the corresponding 4-20mA current range.

Testing and Calibration

Calibration: Test the setup with known values to calibrate and verify the accuracy of your sensor readings. Adjust scaling factors if needed.

Monitor Readings: Develop a monitoring system or interface (web-based, serial monitor, etc.) to display and log the sensor readings from the ESP32.


Noise and Interference: 4-20mA signals are robust against noise, but ensure proper shielding and grounding to minimize interference.

Power Supply Stability: Ensure a stable power supply for both the sensor and the ESP32 to avoid fluctuations affecting sensor readings.

Safety Measures: Comply with safety standards and take necessary precautions, especially when dealing with industrial sensors and electrical components.


By following these steps and considering these aspects, you should be able to successfully interface 4-20mA industrial sensors with an ESP32-based PLC for accurate readings and monitoring in your industrial setup.

In summary, the process of linking 4-20mA industrial sensors to an ESP32 PLC is multifaceted. It involves comprehending the sensor’s operational requirements, configuring the ESP32 platform, and implementing signal conversion mechanisms. By utilizing a resistor to transform the sensor’s current output into a compatible voltage for the ESP32’s input, establishing secure and accurate connections, and developing code to interpret sensor data, a systematic approach ensures functionality. Rigorous testing, calibration with known benchmarks, and prioritizing safety measures contribute to the development of a robust and dependable system for collecting precise data from industrial sensors via an ESP32 PLC interface.

Posted on

Understanding Expansion Modules for PLCs for Industrial Innovative Automation

Understanding Expansion Modules for PLCs for Industrial Innovative Automation

Explore the world of Expansion Modules for PLCs (Programmable Logic Controllers) and their pivotal role in enhancing industrial automation. Learn about various expansion types, including I/O, communication, specialized functions, analog I/O, power supply modules, and NORVI’s advanced expansion lineup.

What is an Expansion Modules for PLCs?

Expansion Modules for PLCs (Programmable Logic Controller) are additional hardware components that can be connected to a base or main PLC unit to expand its capabilities and functionality. These modules allow the PLC system to accommodate more input/output (I/O) points, various communication protocols, additional memory, or specialized functionalities based on specific requirements.

Here are some common types of Expansion Modules for PLCs:

  • I/O Expansion Modules: These modules increase the number of input or output points of the PLC. They can be digital or analog and allow the connection of more sensors, actuators, or other devices to the PLC system.
  • Communication Modules: These enable the PLC to communicate with other devices or systems using different communication protocols such as Ethernet/IP, Modbus, Profibus, DeviceNet, etc. They facilitate data exchange between the PLC and external devices like HMIs (Human Machine Interfaces), SCADA (Supervisory Control and Data Acquisition) systems, or other PLCs.
  • Specialized Function Modules: Some PLCs offer specialized expansion modules designed for specific functions like high-speed counting, motion control, temperature control, PID (Proportional-Integral-Derivative) loops, etc. These modules enhance the PLC’s capability to handle particular tasks efficiently.
  • Analog I/O Modules: These modules handle analog signals (voltage or current) and are used for applications that require precise control or monitoring of variables such as temperature, pressure, flow rate, etc.
  • Power Supply Modules: Sometimes, additional power supply modules are used to provide more power to the PLC system or to isolate specific sections of the PLC for safety or operational purposes.

Expansion modules allow users to customize the PLC system based on the specific needs of their applications without having to replace the entire PLC unit. They provide flexibility, scalability, and the ability to adapt to changing requirements in industrial automation and control systems.

NORVI Expansion Module

Expansion Modules for PLCs

NORVI prides itself on its core ethos of seamless connectivity and unmatched expandability, setting the benchmark in the realm of industrial automation. Leveraging the Expansion port of NORVI Controllers heralds a pivotal moment in unlocking the full potential of these robust systems. They offer various types of Expansion Modules for PLCs.

The comprehensive lineup of expansion modules seamlessly interfaces with NORVI IoT controllers through versatile I2C and UART connections. This integration empowers users to augment the NORVI Controller’s functionalities without necessitating extensive customizations. NORVI’s commitment to delivering cutting-edge technology manifests in its unwavering reliability tailored explicitly for the exacting demands of industrial applications, solidifying its standing as a premier IoT hardware manufacturer on a global scale.

Among the array of expansion modules, NORVI offers a spectrum of choices including NB-IoT, LoRa, and sophisticated analog modules. These expansions not only broaden the horizons of connectivity but also enrich the capabilities of the NORVI Controller, fostering a dynamic ecosystem adaptable to the diverse needs of industrial automation.

These are the expansion ports:

  • TXD0
  • IO33
  • RXD0
  • Not Connected
  • IO32
  • IO0 BOOT
  • IO17 SCL
  • Not Connected
  • IO16 SDA
  • Ground

Does NORVI have Communication Expansions?

EX-LR4XX and EX-NB95X, the cutting-edge communication expansion modules designed to elevate the capabilities of NORVI controllers to unprecedented levels.

The EX-LR4XX module revolutionizes communication with its LoRa technology. Featuring the state-of-the-art RYLR896 transceiver, this module boasts ultra-long-range spread spectrum communication coupled with exceptional interference immunity. Notably certified by the NCC and FCC, it ensures reliability and compliance. Equipped with the Semtech SX1276 Engine, a high-efficiency Power Amplifier, and a remarkable 127 dB Dynamic Range RSSI, it establishes unparalleled reliability while minimizing current consumption. This versatile module offers both built-in and external antenna options, providing flexibility in installation and enhancing signal transmission. Choose between the REYAX RYLR896 operating at 868/915 MHz frequencies or the REYAX RYLR406 spanning 426/433/470 MHz frequencies for optimal performance.

On the other hand, the EX-NB95X module represents the pinnacle of NB-IoT communication. Leveraging the BC95-G, it offers an ultra-low-power communication interface tailored specifically for NORVI controllers. This module’s compatibility with global bands makes it a versatile solution applicable worldwide, delivering superlative sensitivity and performance. Seamlessly interfacing with NORVI controllers through an I2C interface, ensures effortless integration while maintaining extremely low power consumption. Furthermore, its incorporation of Embedded Internet Services Protocols and Quectel Enhanced AT Commands facilitates efficient and reliable communication. The module supports both built-in and external antenna options, providing users with flexibility in deployment and ensuring optimal connectivity in diverse settings.

Whether opting for the groundbreaking LoRa capabilities of the EX-LR4XX or the futuristic NB-IoT advancements of the EX-NB95X, NORVI’s expansion modules guarantee unmatched connectivity, reliability, and adaptability, setting new standards in industrial communication.

Does NORVI have Analog Inputs Expansions?

Certainly, NORVI extends its range of expansion modules with the NORVI-EX-ANV01 and NORVI-EX-ANI01, unleashing unparalleled analog input capabilities that redefine precision in industrial data acquisition.

The NORVI-EX-ANV01 stands out with its provision of four 0-10V analog inputs. Leveraging the cutting-edge ADS1115 I2C ADC, this module epitomizes accuracy in reading analog channels. What sets it apart is the inclusion of an analog attenuation network, a sophisticated feature that seamlessly converts the 0-10V input range to levels acceptable for the ADS1115. This precision-engineered module ensures precise, reliable readings across the spectrum of analog inputs, facilitating seamless integration into diverse industrial applications.

Meanwhile, the NORVI-EX-ANI01 delivers exceptional versatility with its four 4-20mA analog inputs. Employing the ADS1115 I2C ADC for analog channel readings, this module mirrors the precision and accuracy of its counterpart. Similar to the NORVI-EX-ANV01, it also integrates an analog attenuation network adept at converting 0-10V signals to acceptable levels for the ADS1115. This innovation ensures a seamless transition from varying analog signals to precise digital readings, enabling industries to monitor and control processes with unmatched accuracy and reliability.

Both modules, whether the NORVI-EX-ANV01 with its 0-10V analog inputs or the NORVI-EX-ANI01 with its 4-20mA analog inputs exemplify NORVI’s commitment to providing cutting-edge solutions for industrial data acquisition. These expansion modules not only offer unparalleled accuracy but also ensure seamless compatibility and integration with NORVI controllers, empowering industries with the precision they require for critical operations.

Does NORVI have Digital Inputs Expansions?

Absolutely, NORVI introduces a range of expansion modules – NORVI-EX-I4, NORVI-EX-I8, and NORVI-EX-I16, designed to enhance digital input capabilities, catering to a spectrum of industrial automation needs with remarkable versatility and precision.

The NORVI-EX-I4 offers a sophisticated solution with its provision of four sink/source digital inputs. Leveraging the state-of-the-art MCP23008 I2C I/O Expander provider, this module ensures seamless and precise reading of digital inputs. Furthermore, the digital inputs come equipped with internal pull-up resistors, bolstering reliability and accuracy in signal acquisition. This module serves as a reliable cornerstone for diverse industrial setups, providing seamless integration and superior performance.

Moving up the ladder, the NORVI-EX-I8 raises the bar by delivering eight sink/source digital inputs, maintaining the same precision and reliability as its predecessors. Employing the MCP23008 I2C I/O Expander provider, this module is engineered to read digital inputs with unparalleled accuracy. With internal pull-up resistors ensuring signal stability, this module proves to be an ideal solution for industries requiring a higher number of digital input channels, ensuring seamless integration and robust performance.

Meanwhile, the NORVI-EX-I16 sets a new standard by offering an extensive array of sixteen sink/source digital inputs. Leveraging the MCP23016 I2C I/O Expander provider, this module significantly expands the capacity for digital inputs without compromising on accuracy or reliability. Just like its counterparts, this module ensures precise reading of digital inputs with internally pulled-up resistors, making it a robust choice for large-scale industrial applications demanding higher channel capacity and steadfast performance.

Whether opting for the NORVI-EX-I4, NORVI-EX-I8, or NORVI-EX-I16, these expansion modules epitomize NORVI’s commitment to providing advanced digital input solutions, ensuring seamless integration and precise, reliable performance in various industrial environments.

Does NORVI have Transistor Output Expansions?

NORVI proudly presents the NORVI-EX-Q4, NORVI-EX-Q8, and NORVI-EX-Q16 expansion modules, representing a leap forward in providing comprehensive open collector output solutions tailored for diverse industrial applications, ensuring precision, reliability, and seamless integration.

Starting with the NORVI-EX-Q4, this module delivers four open collector outputs, offering a robust solution for controlling external devices. Employing the MCP23008 I2C I/O Expander provider for precise transistor output writing, this module ensures precise control over various connected devices. Capable of handling voltages up to 36V DC, these outputs provide the flexibility and reliability required in industrial settings, ensuring seamless integration and efficient performance.

Moving forward, the NORVI-EX-Q8 expands its capabilities with eight open collector outputs, maintaining the same precision and reliability as its predecessor. Utilizing the MCP23008 I2C I/O Expander provider, this module empowers users to exert precise control over a greater number of external devices. Supporting voltages up to 36V DC, these outputs cater to diverse industrial needs, ensuring optimal control and reliability across varied applications.

Moreover, the NORVI-EX-Q16 elevates the standard by offering an impressive sixteen open collector outputs. Employing the MCP23017 I2C I/O Expander provider, this module significantly expands the capacity for open collector outputs while maintaining precision and reliability. Capable of handling voltages up to 36V DC, these outputs provide unmatched flexibility and control over a myriad of external devices in large-scale industrial setups, ensuring seamless integration and steadfast performance.

Whether opting for the NORVI-EX-Q4, NORVI-EX-Q8, or NORVI-EX-Q16, these expansion modules exemplify NORVI’s commitment to delivering advanced open collector output solutions. Ensuring seamless integration, precision control, and steadfast performance, these modules cater to diverse industrial requirements, setting new benchmarks for reliability and versatility in industrial automation.

Does NORVI have Relay Output Expansions?

Introducing the NORVI-EX-R8 and NORVI-EX-R16, these expansion modules redefine control and operation with relay outputs, embodying precision, reliability, and adaptability in industrial automation.

The NORVI-EX-R8 leads the way with its provision of eight relay outputs, establishing itself as a cornerstone for seamless relay control. Employing the MCP23008 I2C I/O Expander provider, this module ensures precise operation of relay outputs. With relay outputs configured as normally open, this module provides a versatile solution for controlling various external devices. This meticulously designed module guarantees reliability and accuracy in relay control, catering to diverse industrial needs with efficiency and precision.

Meanwhile, the NORVI-EX-R16 elevates the standard by offering an expansive array of sixteen relay outputs, enhancing the scope and control capabilities for industrial applications. Leveraging the MCP23016 I2C I/O Expander provider, this module extends the capacity for relay outputs without compromising on precision or reliability. Configured similarly with relay outputs as normally open, this module sets a new benchmark for seamless relay operation, catering to larger-scale industrial setups with efficiency and unwavering accuracy.

Whether opting for the NORVI-EX-R8 or the NORVI-EX-R16, these expansion modules epitomize NORVI’s commitment to delivering advanced relay output solutions. With meticulous design, precision control, and seamless integration, these modules provide unparalleled reliability and control over external devices in diverse industrial settings, setting new standards for efficiency and adaptability in industrial automation.



The evolution of industrial automation is fueled by the adaptability and scalability offered by Expansion Modules for PLCs (Programmable Logic Controllers). These crucial hardware components enable a PLC system to transcend its inherent limitations, catering to the ever-changing demands of industrial environments.

From I/O expansion modules that broaden connectivity to communication modules facilitating seamless data exchange, specialized function modules enhancing specific task handling, analog I/O modules ensuring precision control, and power supply modules for enhanced operational safety – these expansion units collectively form the backbone of a versatile and adaptable PLC system.

The innovation doesn’t stop there. Manufacturers like NORVI have pushed the boundaries of expansion technology, offering a comprehensive suite of expansion modules designed to meet the unique demands of industrial automation. Whether it’s NORVI’s communication expansions like LoRa or NB-IoT, analog input expansions delivering unmatched accuracy, or the prowess of digital input, transistor output, relay output expansions providing precise control, these modules redefine industry standards, promising reliability, adaptability, and efficiency.

The integration of Expansion Modules for PLCs marks a paradigm shift, empowering industries to tailor their automation setups according to specific requirements without the need for full system replacement. As technology advances, the scope and capabilities of these modules continue to expand, ushering in an era of unparalleled customization and innovation in industrial automation. Harnessing the potential of expansion modules is not merely an option; it’s a strategic imperative for industries aiming to stay at the forefront of modern automation.

Visit our product page now to buy ESP32-based Expansion Modules:

Stay Connected to get updated news from NORVI: Facebook : LinkedIn : Twitter : YouTube