akYtec Lesson 6: Mastering 4-20mA Sensors and Linear Scaling

In industrial automation, reading a sensor is only half the battle. The real challenge is converting a raw electrical signal into a value that humans—and machines—can actually use. This lesson covers the industry-standard 4-20mA current loop and how to scale it within akYtec Logic Program (ALP).

1. Why 4-20mA? (The B2B Standard)

While hobbyist projects often use 0-5V, industrial systems prefer 4-20mA for two reasons:

  1. Noise Immunity: Current signals aren’t affected by voltage drops over long cables.
  2. Fault Detection: A 0mA reading signals a broken wire, whereas a 4mA reading signals a live “zero” value.

2. Physical Wiring: 2-Wire Pressure Sensor

Most industrial sensors use a “Loop Powered” 2-wire configuration.

  • Sensor (+) Red: Connect to +24V DC.
  • Sensor (-) Black: Connect to the AI1 (Analog Input) terminal on your akYtec device.
  • Device Ground: Ensure your akYtec controller and 24V supply share a common ground (GND).

3. ALP Configuration

Before programming, you must tell the hardware to expect current rather than voltage.

  1. In ALP, go to the Device Configuration tab.
  2. Select your Analog Input (e.g., AI1).
  3. Set Sensor Type to 4-20mA.
  4. Set Lower/Upper limits to 0 and 1.0 (or 0-4000 depending on your specific hardware model’s resolution).

4. The Linear Scaling Logic (LIN_INT)

To turn the 0.0 - 1.0 raw signal into a meaningful value (like 0.0 - 10.0 Bar), we use the LIN_INT block.

Block Setup:

  • X1 (Raw Min): 0.0
  • X2 (Raw Max): 1.0
  • Y1 (Unit Min): 0.0
  • Y2 (Unit Max): 10.0 (The maximum range of your sensor)

ALP Screenshot Description:
Imagine a square block titled LIN_INT. On the left, a floating-point variable named AI_Raw enters the X input. On the right, the output leads to a display variable named Pressure_Bar.


5. Adding “Broken Wire” Detection

To maintain B2B safety standards, we must detect if the sensor fails.

  1. Add a Compare block.
  2. Set it to check if AI_Raw is less than 0.02 (roughly 3.9mA).
  3. Link the output to a Red LED or a Modbus Alarm Coil.

🚀 LogicHobbyist Pro Tip: Scaling Precision

When scaling in ALP, always use Floating Point (REAL) variables. Using Integers will round your values, causing you to lose the decimal precision needed for accurate pressure or temperature monitoring.

⚠&#xfe0f Industrial Safety: The “Live Zero”

Always program a fault routine for when the signal drops below 3.8mA. In industrial logic, a 0mA reading doesn’t mean “zero pressure”—it means a broken wire. Use a Compare block to trigger an alarm if the input is < 0.05.

🔧

LogicHobbyist Automation Lab

Industrial PLCs · Modbus · EtherCAT · Beckhoff · Sensors · HMIs

We publish in‑depth technical comparisons, real‑world configuration guides, and performance reviews. Our content helps engineers and procurement teams select the right automation components. No consulting, no service offers – just reliable technical data.

Leave a Comment