Challenge - 5 Problems
Analog Input Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediateCalculate scaled value from 4-20mA input
Given a raw analog input value of 3276 from a 12-bit ADC (0-4095) representing a 4-20mA signal, what is the scaled process value in engineering units if 4mA = 0 and 20mA = 100 units?
PLC Programming
raw_value = 3276 scaled_value = ((raw_value / 4095) - 0.2) * (100 / 0.8) print(round(scaled_value, 2))
Attempts:
2 left
💡 Hint
Remember to convert raw ADC counts to current ratio, then scale from 4-20mA range to 0-100 units.
✗ Incorrect
The ADC value 3276 corresponds to a ratio of 3276/4095 = 0.8. Since 4mA corresponds to 0.2 ratio (4/20), subtract 0.2 to get 0.6, then divide by 0.8 (20mA-4mA range) to get 0.75 normalized value. Multiply by 100 units gives 75.0.
💻 Command Output
intermediateConvert 0-10V analog input to engineering units
A 0-10V analog input is read by a 12-bit ADC (0-4095). If the process range is 0 to 200 units, what is the engineering value for an ADC reading of 2048?
PLC Programming
adc_reading = 2048 engineering_value = (adc_reading / 4095) * 200 print(round(engineering_value, 2))
Attempts:
2 left
💡 Hint
Calculate the voltage ratio from ADC reading and multiply by max units.
✗ Incorrect
2048/4095 is approximately 0.5, so half of 200 units is 100.0 units.
🔧 Debug
advancedIdentify error in 4-20mA scaling formula
What error will occur when running this code snippet for scaling a 4-20mA input?
raw_adc = 3000
scaled = raw_adc / 4095 - 0.2 * 125
print(round(scaled, 2))
PLC Programming
raw_adc = 3000 scaled = raw_adc / 4095 - 0.2 * 125 print(round(scaled, 2))
Attempts:
2 left
💡 Hint
Check the parentheses and operator order in the scaling formula.
✗ Incorrect
The formula uses 125 as scaling factor, which is correct for 4-20mA to 0-100 units (100/0.8=125). However, the code lacks parentheses around (raw_adc / 4095 - 0.2) causing wrong order of operations: it computes raw_adc / 4095 - (0.2 * 125) instead of ((raw_adc / 4095) - 0.2) * 125.
🚀 Application
advancedWrite a script to normalize 0-10V input with offset
You have a 0-10V analog input read by a 12-bit ADC (0-4095). The sensor has a 0.5V offset that must be removed before scaling to 0-100 units. Which script correctly calculates the scaled value for an ADC reading stored in variable adc_val?
Attempts:
2 left
💡 Hint
Subtract the offset voltage before scaling the remaining voltage range.
✗ Incorrect
The sensor offset 0.5V must be subtracted from the measured voltage. The effective range is 10V - 0.5V = 9.5V. So scale the adjusted voltage to 0-100 units by multiplying by 100/9.5.
🧠 Conceptual
expertWhy is 4mA used as the lower limit in analog current loops?
In 4-20mA analog current loops, why is 4mA chosen as the minimum signal instead of 0mA?
Attempts:
2 left
💡 Hint
Think about how the system detects if the signal wiring is broken.
✗ Incorrect
Using 4mA as the minimum allows the system to detect if the current drops below 4mA, which usually means a wiring fault or broken loop, since 0mA means no current flow and likely a problem.
