Bird
Raised Fist0
PLC Programmingscripting~30 mins

Analog input configuration (4-20mA, 0-10V) in PLC Programming - Mini Project: Build & Apply

Choose your learning style10 modes available
Analog input configuration (4-20mA, 0-10V)
📖 Scenario: You are setting up a PLC to read analog sensor values. The sensors output signals in two common ranges: 4-20mA current and 0-10V voltage. You need to convert these raw input values into meaningful engineering units.
🎯 Goal: Build a simple PLC program that converts raw analog input values from 4-20mA and 0-10V sensors into scaled engineering units using linear scaling formulas.
📋 What You'll Learn
Create variables to hold raw input values for current and voltage signals
Create configuration variables for minimum and maximum raw input values
Write code to scale the raw inputs to engineering units using linear formulas
Print or display the scaled engineering values
💡 Why This Matters
🌍 Real World
This project simulates how PLCs read and convert analog sensor signals from industrial devices like flow meters, pressure sensors, or temperature transmitters.
💼 Career
Understanding analog input scaling is essential for automation engineers and technicians who configure PLCs to monitor and control industrial processes accurately.
Progress0 / 4 steps
1
Create raw input variables
Create two variables called raw_current and raw_voltage to hold the raw analog input values. Set raw_current to 3277 and raw_voltage to 2048.
PLC Programming
Hint

Think of raw_current and raw_voltage as the numbers read from the PLC's analog input registers.

2
Add configuration variables for scaling
Add four variables: current_min set to 3277, current_max set to 16383, voltage_min set to 0, and voltage_max set to 4095. These represent the raw input ranges for 4-20mA and 0-10V signals.
PLC Programming
Hint

These values correspond to the raw ADC counts for the sensor signal ranges.

3
Calculate scaled engineering values
Write code to calculate scaled_current and scaled_voltage by scaling the raw inputs to engineering units. Use the formulas:
scaled_current = 4 + (raw_current - current_min) * (20 - 4) / (current_max - current_min)
scaled_voltage = 0 + (raw_voltage - voltage_min) * (10 - 0) / (voltage_max - voltage_min)
PLC Programming
Hint

Use simple math to convert raw counts to real-world units like mA and volts.

4
Display the scaled values
Write two print statements to display the values of scaled_current and scaled_voltage with labels: "Scaled Current (mA):" and "Scaled Voltage (V):".
PLC Programming
Hint

Use print statements to show the final converted values clearly.

Practice

(1/5)
1. What is the typical current range used for analog input signals in industrial PLCs?
easy
A. 0-5V
B. 10-30mA
C. 4-20mA
D. 0-24V

Solution

  1. Step 1: Understand common analog signal standards

    Industrial sensors commonly use 4-20mA current loops for analog signals because they are less affected by electrical noise.
  2. Step 2: Compare options with standard ranges

    Among the options, only 4-20mA is the standard current range for analog inputs in PLCs.
  3. Final Answer:

    4-20mA -> Option C
  4. Quick Check:

    Standard analog current signal = 4-20mA [OK]
Hint: Remember: 4-20mA is the classic industrial current signal [OK]
Common Mistakes:
  • Confusing voltage and current ranges
  • Choosing 0-5V as standard current signal
  • Thinking 10-30mA is common
2. Which of the following is the correct way to configure a 0-10V analog input in a PLC program?
easy
A. Set input range to 0-24V and scale raw value accordingly
B. Set input range to 4-20mA and scale raw value accordingly
C. Set input range to 0-5V and scale raw value accordingly
D. Set input range to 0-10V and scale raw value accordingly

Solution

  1. Step 1: Identify the signal type

    For a 0-10V sensor, the PLC input must be configured to accept voltage signals from 0 to 10 volts.
  2. Step 2: Apply correct scaling

    The raw input value must be scaled based on the 0-10V range to convert it into meaningful units.
  3. Final Answer:

    Set input range to 0-10V and scale raw value accordingly -> Option D
  4. Quick Check:

    0-10V input needs 0-10V range setting [OK]
Hint: Match sensor type with input range setting [OK]
Common Mistakes:
  • Using 4-20mA range for voltage input
  • Choosing 0-5V range for 0-10V sensor
  • Ignoring scaling after setting range
3. Given a 4-20mA input scaled to 0-100 units, what is the scaled value if the raw input is 12mA?
medium
A. 50
B. 60
C. 40
D. 70

Solution

  1. Step 1: Understand scaling formula for 4-20mA

    The formula to scale current (I) to units is: scaled = ((I - 4) / (20 - 4)) * 100
  2. Step 2: Calculate scaled value for 12mA

    scaled = ((12 - 4) / 16) * 100 = (8 / 16) * 100 = 0.5 * 100 = 50
  3. Step 3: Re-check calculation

    Wait, 12mA is halfway between 4 and 20, so scaled value should be 50.
  4. Final Answer:

    50 -> Option A
  5. Quick Check:

    Halfway current = 50 units [OK]
Hint: Use linear scaling: subtract 4mA, divide by 16mA range [OK]
Common Mistakes:
  • Using 20mA as denominator instead of (20-4)
  • Not subtracting 4mA offset
  • Mixing up units and raw values
4. A PLC analog input configured for 0-10V is reading 5V, but the scaled value shows 100 units instead of 50. What is the most likely cause?
medium
A. Input range is incorrectly set to 0-5V
B. Sensor is faulty and outputs wrong voltage
C. Scaling formula uses 4-20mA range instead of 0-10V
D. PLC input channel is damaged

Solution

  1. Step 1: Analyze the symptom

    5V input should scale to 50 units if range is 0-10V, but shows 100 units, meaning scaling is doubled.
  2. Step 2: Identify configuration error

    If input range is set to 0-5V, 5V is max input, so scaled value is max (100 units), causing the error.
  3. Final Answer:

    Input range is incorrectly set to 0-5V -> Option A
  4. Quick Check:

    Wrong input range causes wrong scaling [OK]
Hint: Check input range matches sensor output voltage [OK]
Common Mistakes:
  • Assuming sensor fault without checking config
  • Confusing 4-20mA scaling with voltage scaling
  • Ignoring input channel hardware issues
5. You have a sensor outputting 4-20mA representing 0-200°C. How do you configure the PLC to correctly scale the input to temperature?
hard
A. Set input range to 0-10V and scale using formula: Temp = (V / 10) * 200
B. Set input range to 4-20mA and scale using formula: Temp = ((I - 4) / 16) * 200
C. Set input range to 4-20mA and scale using formula: Temp = (I / 20) * 200
D. Set input range to 0-20mA and scale using formula: Temp = (I / 20) * 200

Solution

  1. Step 1: Identify sensor output and temperature range

    The sensor outputs 4-20mA representing 0-200°C, so 4mA = 0°C and 20mA = 200°C.
  2. Step 2: Apply correct scaling formula

    Subtract 4mA offset, divide by 16mA span, then multiply by 200°C: Temp = ((I - 4) / 16) * 200.
  3. Step 3: Verify other choices

    The other choices use wrong input ranges or omit offset, causing incorrect scaling.
  4. Final Answer:

    Set input range to 4-20mA and scale using formula: Temp = ((I - 4) / 16) * 200 -> Option B
  5. Quick Check:

    Correct scaling subtracts 4mA offset and scales to 200°C [OK]
Hint: Always subtract 4mA offset before scaling [OK]
Common Mistakes:
  • Not subtracting 4mA offset in formula
  • Using voltage scaling for current input
  • Assuming 0-20mA range instead of 4-20mA
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard