Bird
Raised Fist0
PLC Programmingscripting~10 mins

Analog input configuration (4-20mA, 0-10V) in PLC Programming - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - Analog input configuration (4-20mA, 0-10V)
Start
↓
Select Input Type
↓
Read Current Signal
↓
Convert Current to Value
↓
Scale Value
↓
Output Scaled Value
↓
Read Voltage Signal
↓
Convert Voltage to Value
↓
Scale Value
↓
Output Scaled Value
↓
End
The flow starts by selecting the input type (4-20mA or 0-10V), then reads the signal, converts it to a usable value, scales it, and outputs the scaled value.
Execution Sample
PLC Programming
IF input_type = '4-20mA' THEN
  raw_value := ReadCurrent()
  scaled_value := (raw_value - 4) * 100 / 16
ELSE
  raw_value := ReadVoltage()
  scaled_value := raw_value * 100 / 10
END_IF
Output(scaled_value)
This code reads either a 4-20mA current or 0-10V voltage input, converts it to a scaled value from 0 to 100, and outputs the result.
Execution Table
Stepinput_typeraw_valueConditionscaled_valueAction
1'4-20mA'5input_type = '4-20mA' is True6.25Read current 5mA, scale to 6.25
2'4-20mA'20input_type = '4-20mA' is True100Read current 20mA, scale to 100
3'0-10V'0input_type = '4-20mA' is False0Read voltage 0V, scale to 0
4'0-10V'10input_type = '4-20mA' is False100Read voltage 10V, scale to 100
5'0-10V'5input_type = '4-20mA' is False50Read voltage 5V, scale to 50
6'4-20mA'4input_type = '4-20mA' is True0Read current 4mA, scale to 0
7'4-20mA'12input_type = '4-20mA' is True50Read current 12mA, scale to 50
8'0-10V'7.5input_type = '4-20mA' is False75Read voltage 7.5V, scale to 75
9N/AN/AEnd of input samplesN/AStop processing
💡 No more input samples to process, execution ends.
Variable Tracker
VariableStartAfter 1After 2After 3After 4After 5After 6After 7After 8Final
input_typeN/A'4-20mA''4-20mA''0-10V''0-10V''0-10V''4-20mA''4-20mA''0-10V'N/A
raw_valueN/A52001054127.5N/A
scaled_valueN/A6.2510001005005075N/A
Key Moments - 3 Insights
Why do we subtract 4 from the raw current value in the 4-20mA input?
Because 4mA represents the zero point of the measurement range, subtracting 4mA normalizes the signal to start from zero, as shown in execution_table rows 1 and 6.
Why is the scaling factor different for 4-20mA and 0-10V inputs?
4-20mA spans 16mA (20-4), so we scale by dividing by 16, while 0-10V spans 10V, so we scale by dividing by 10, as seen in the scaling calculations in the execution_table.
What happens if the input_type is neither '4-20mA' nor '0-10V'?
The code only handles these two types; if input_type is different, no scaling occurs and output may be invalid. This is why input_type must be correctly set before running, as implied by the flow in concept_flow.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table row 2. What is the scaled_value when raw current is 20mA?
A80
B100
C120
D16
💡 Hint
Check the calculation in row 2 where scaled_value = (20 - 4) * 100 / 16
At which step does the input_type switch from '4-20mA' to '0-10V' in the execution_table?
AStep 1
BStep 5
CStep 3
DStep 6
💡 Hint
Look at the input_type column in execution_table rows to find where it changes
If raw_value for 4-20mA input is 12mA, what scaled_value will the code produce?
A50
B75
C12
D100
💡 Hint
Refer to execution_table row 7 where raw_value is 12 and scaled_value is calculated
Concept Snapshot
Analog input config reads signals from sensors.
4-20mA means current from 4 to 20 milliamps.
0-10V means voltage from 0 to 10 volts.
Scale inputs to 0-100 or desired range.
Subtract 4mA for current to normalize zero.
Multiply/divide to scale to output range.
Full Transcript
This lesson shows how to configure analog inputs for PLCs using 4-20mA current or 0-10V voltage signals. The process starts by selecting the input type. For 4-20mA, the raw current is read, then 4mA is subtracted to normalize the zero point. The result is scaled by dividing by 16 (the span from 4 to 20) and multiplying by 100 to get a percentage. For 0-10V, the voltage is read and scaled by dividing by 10 (the span) and multiplying by 100 to get a percentage. The scaled value is then output for use in the program. The execution table traces sample inputs and shows how values change step-by-step. Key moments clarify why subtraction and scaling differ between input types. The quiz tests understanding of scaling and flow. This visual approach helps beginners see how analog signals become usable data in automation.

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