All About PLC Analog Input and Output Signals and Programming

Do you know how to scale an analog input or wire an analog output?
Analog signals can be difficult to work with in PLC programming. Wiring an analog input or output and using it in your program can both be tricky. Most example PLC programs use digital signals, as do most examples in my Structured Text Tutorial.
Many of you have asked how to use analog signals in PLC programming, so I wrote this article to explain them. Analog signals are common in PLC programs and in a SCADA system. We will cover how to connect a 4-20mA analog transmitter to your PLC and how to use that signal once it reaches your PLC program. We will also examine how to scale an analog signal in Function Block Diagram.
The topics covered are:
We will start with the basics of analog signals and how a PLC handles them.
Analog Signals in the PLC
Start with the numbers. My article about combinatorial logic explains that a PLC uses boolean values. It can work only with 0 and 1.
Digital signals are relatively easy to work with because each is either 0 or 1. Analog signals work differently. As Wikipedia explains, analog signals are continuous signals that can change over time.
Consider a 0-10 volt analog signal. It can take any voltage from 0 to 10 volts, including every level between those limits. There are no gaps between the available levels. Because it is continuous, there is a voltage level at every instant, even as that level changes with time. The diagram below shows how it can take any value between 0 and 10 volts.
How does a PLC handle this range of values? Suppose a 5 volt analog signal enters the PLC. A boolean value cannot describe it, since boolean values are limited to 0 and 1.
We use binary numbers.
Representing Analog Signals with Binary Numbers
A PLC works with just two values, 0 and 1. That does stop us from working with analog signals. The PLC actually uses binary numbers because, like a microcontroller, it consists of advanced electrical circuits built from transistors. A transistor can be on or off, with these states corresponding to 0 and 1.
For digital signals, these two possible states are enough to describe the input. Analog signals need more values than those two states can provide. To see how analog inputs work in a PLC, we need to understand how binary numbers describe those values.
PLCs and other computers use the binary numbering system. It has only two numbers, while our 10-base system has 10, from 0 to 9. Binary gives us another way to write numbers. Read this tutorial on binary numbers, if binary numbers are new to you.
Bits and Bytes
A single binary digit is a bit, which holds either 0 or 1 in the same way as a digital input. Combining bits produces numbers with multiple digits and lets us describe more values.
In many PLC’s, a word holds an analog signal. A binary word consists of 8 zeros in a row, or two bytes (4 zeros), as shown here:
00000000 00000000
A binary number with 16 digits can describe values from 0 to 65.535. In PLC’s, however, the first bit is used for signing the number, making it positive or negative.
Using 1 bit for the sign leaves 15 bits for the analog value. This gives the binary number a range from -32.768 to 32.767.
A/D Converter
The A/D converter converts the continuous analog signal into digital signals. The PLC uses those digital bits to process the incoming information.
Before examining the A/D converter, identify the type of analog signal you are using. We will cover three types used in PLC programming:
- Voltage
- Current
- Resistance
The signal type tells us which range to use.
A common analog signal type is 4-20mA.
Knowing the signal type tells us that this example has a range of 16mA. A PLC often stores an analog value in a 16-bit double word because the A/D converter produces a digital value 16 bits long.
Analog input cards are available with different resolutions, determined by the number of bits their A/D converters use. More bits allow more numbers to describe the analog signal.
Resolution of Analog Signals
Resolution is the number of bits available to store an analog value. It is similar to a TV picture, which has a fixed number of pixels. Analog to digital conversion has a comparable limit.
The term resolution describes both of these limits. With a television, we use it to describe the number of pixels that form the picture. For an analog value stored as a number, it describes the detail we can retain from the signal.
Resolution affects how we use analog signals in PLC programming. At the analog input card, the signal becomes a value between 0 and 32.767. Dividing the analog value into 32.767 gives us the resolution.
An increase of 1 in the stored value corresponds to an increase of x mA in the analog signal.
Before calculating the mA, we need to account for the over- and under range used by most PLC’s for analog signals. Let’s examine those ranges.
Analog Signal Range
The details now depend on the vendor. We will use Siemens as our example, though the principle applies to most PLC vendors.
Analog signals can be sensitive. A signal intended to stay within 4-20mA can sometimes peak above or drop below that range. We want to see these peaks and drops in the PLC when they occur. They do not always mean something is wrong, but they can indicate a problem. Our program therefore needs a way to detect signal levels outside the intended range. Over- and under range let our PLC program detect them.
The normal, or rated, range is 4-20mA. Siemens extends it with extra mA above and below these limits. The over range has two categories:
- Overshoot range (overrange)
- Overflow
The under range also has two:
- Undershoot range (underrange)
- Underflow
This extends the 4-20 mA range to 1.185 – 22.96 mA. Other analog signal types work the same way; the 0-10V range, for example, extends to 0 – 11.852 V.
The table below shows these analog signal ranges:
| PLC Value | Measuring Range | |||
|---|---|---|---|---|
| Dec | Hex | 0-10 V | 4-20 mA | |
| 32767 | 7FFF | 11.852 V | 22.96 mA | Overflow |
| 32512 | 7F00 | |||
| 32511 | 7EFF | 11.759 V | 22.81 mA | Overshoot Range |
| 27649 | 6C01 | |||
| 27648 | 6C00 | 10 V | 20 mA | Rated Range |
| 20736 | 5100 | 7.5 V | 16 mA | |
| 1 | 0001 | 361.7 μV | 4 mA + 578.7 nA | |
| 0 | 0000 | 0 V | 4 mA | |
| -1 | FFFF | No Negative Values | Undershoot Range | |
| -4864 | ED00 | 1.185 mA | ||
| -4865 | ECFF | Underflow | ||
| -32769 | 8000 | |||
Accounting for over- and underflow lets us calculate the signal’s actual resolution. Before using the 22.96-1.185 mA or 11.852 V ranges, look at this number:
27.648
The table shows that this number marks the end of the rated range. For a 0-10 V signal, we therefore calculate resolution as follows:
10 V / 27658 = 361.7 μV
For the 4-20 mA signal, the calculation is:
16 mA / 27648 = 578.7 nA
These two numbers give the smallest steps the PLC can describe with a digital value. They are small and precise enough for most uses. Higher resolution also means more expensive PLC analog input and output modules.
Analog Inputs
We can now apply the theory to a PLC’s analog inputs.
Sensors, transmitters or a combination of both can provide analog inputs. For example, one of the thermocouple types can connect to a transmitter, which connects to a PLC analog input. Sensors and transmitters convert many different measurements into electrical signals. Analog sensors can measure the following, for example:
- Level
- Flow
- Distance
- Viscosity
- Temperature
Many other measurements are possible. In each case, the sensor or transmitter converts a physical value into an analog signal that the PLC can use as an input.
For example, a temperature transmitter with a 4-20 mA output connects to a temperature sensor. We might calibrate the transmitter for 0-100 degrees. At 0 degrees, its output would be 4 mA, rising to 20 mA at 100 degrees.
We often need a transmitter because the sensor alone cannot produce an analog signal, or cannot produce one that suits a PLC analog input. You can buy analog input modules that accept a sensor directly, such as modules with connections for a temperature sensor. In most installations, though, the module has a voltage or current input, and we connect a transmitter to provide that signal.
Calibration tells us how to interpret the transmitter’s output. We need to know how much of the physical value each mA or volt stands for before we can use that electrical signal as a measurement.
Wiring of Analog Inputs
Before wiring analog inputs, identify your signals and read the manual. Each signal type needs its own wiring method. Understand the signal’s characteristics and follow its setup instructions carefully.
This tutorial covers the wiring of the two basic analog input signal types:
- Voltage
- Current
I separate these two types partly because they are the most common signals. Their wiring differs as well, since voltage and current signals work differently. Each type therefore needs its own connection method at the analog input module. Take care: wiring mistakes can destroy the module.
Both kinds of analog signal share one property.
That property is resistance.
Resistance divides voltage or limits current. We even use a resistor to measure current, as we will see later. First, we will examine voltage signals.
Voltage Analog Input Wiring
Voltage is common for analog signals and is fairly easy to wire, often requiring only two wires. Even so, wire it carefully. An incorrect connection can produce a faulty signal or damage the analog input module.
Analog voltage inputs generally have two terminals:
- AGND: The ground or reference for analog inputs
- AIN: Analog input
Voltage is a measurement between two points. Measuring 10 volt at one point requires another point as a reference. For example, a 9 volt battery provides 9 volt between its positive and negative sides.
AGND, or analog ground, provides that reference. The PLC measures the voltage between AGND and AIN to determine the analog input voltage. This also explains what AIN does.
Connect the positive (+) side of the analog voltage source to AIN and the negative (-) side to AGND. These are the two main signal wires.
Connecting only those two wires leaves the signal vulnerable. Electromagnetic compatibility (EMC) can easily affect it.
The diagram below shows the solution: shield the wires and ground the shield. Look carefully at which ground the shield connects to. It is NOT the same ground as AGND, even though both are called grounds.
As this explanation shows, not all grounds are the same. AGND is the reference for the analog signal (0 volt), while the shield connects to earth ground. Magnetic fields induce current in wires, creating noise. Using a shield means that the magnetic fields induce this current in the shield instead of in the wires carrying our analog signal. That current needs somewhere to go. We connect the shield to earth ground to lead it away from the signal wiring.
Voltage Drop in Wires
The wiring itself can affect a voltage signal. Every electrical conductor has resistance, creating a voltage drop. As a result, the analog input voltage might differ from the transmitter voltage. This becomes a problem with long wiring runs or wires that are too small.
Current Analog Input Wiring
You can also use current for an analog signal. Current signals can take more care to wire, but they are generally more stable. One type has a useful feature that probably makes it the most common analog signal.
Analog current signals are usually measured in milliamperes (mA), with a typical range between 0 and 20 mA. Lower currents would be hard to measure, and higher currents would soon become dangerous. Here is how we use current as an analog signal.
Current needs a closed loop to flow.
The first current transmitter type uses the same wiring as a voltage transmitter, but it works differently. Current flows as electrons move from one pole to another, so measuring current always requires a closed loop.
Shunt Resistor
The PLC itself cannot measure current directly, so the analog input module converts the signal into something it can measure. Inside the module, a resistor sits between the positive terminal (AI) and the negative terminal (AGND). It completes the loop and converts the current signal into a voltage signal.
This is a shunt resistor with a known resistance. Some Siemens analog input modules use 250 Ohm, for example. Ohm’s Law then lets us calculate the voltage signal from the analog current signal.
Voltage (V) = Resistance (R) x Current (I)
With the resistance known to be 250 Ohm, we can also calculate the current in milliamperes from the voltage we measure.
We can now examine current analog input wiring, which generally falls into three types:
The terms 2, 3 and 4 wires describe the transmitters or transducers. Current transmitters use different wiring arrangements and numbers of wires according to how the signal receives power. The number of wires therefore tells us about the power supply for the signal. In some arrangements the transmitter supplies the circuit. In others, we must provide an external supply to make the circuit work.
2-wire Analog Input
The simplest connection for a 2-wire transmitter is loop power: the PLC supplies the current loop. This takes only 2 wires. To provide that current, we use another terminal on the analog input module:
- A+: Analog input supply
One wire runs from A+ through the transmitter, with another returning to AIN. A+ supplies power, the transmitter controls the current and AIN receives the analog current signal.
An external power supply can also power a 2-wire transmitter. Connect the supply’s 0 V to AGND, and take 24 V through the transmitter back to AIN. This uses 3 wires in practice, but it is still a 2-wire analog input connection because the transmitter itself has only two wires.
A 2-wire current loop shares one loop for power and signal. Because the same loop supplies power and carries the signal, the transmitter must use less than 4 mA for this arrangement to work. That limit can be a disadvantage when choosing the transmitter or sensor. Sensors and transmitters that need more current can use the 3- and 4-wire loops described next.
3-wire Analog Input
In a 3 wire current loop, only the ground is shared by the power supply and signal. It connects to AGND and the supply (-). The transmitter has 2 positive (+) wires, one connected to the supply (+) and the other to AIN.
A 3-wire transmitter shares the ground but has 2 loops, one for the signal and another for power. This lets the sensor or transmitter consume as much current as it needs without disturbing the analog signal.
4-wire Analog Input
The commonly used 4-wire transmitter separates power and signal. Of its 4 wires, 2 carry the supply and 2 carry the signal. The 4-wire transmitter requires an external power supply.
Complete separation of power and signal is the main advantage of a 4-wire transmitter. Full isolation or optical isolation can prevent disturbances in the supply from affecting the signal.
Read the Manuals
Identify your transmitter or sensor, read its manual and choose the connection method. Read the analog input module’s manual as well as the transmitter or sensor manual. Vendors do not always use the same terminal names on their modules. Their instructions for grounding and protecting the signal from noise can differ too, so check the guidance for your equipment.
Follow the manufacturer’s wiring instructions carefully to keep the PLC operating smoothly and avoid wiring mistakes.
Analog Input Scaling
You will often need to scale an analog input signal in the PLC program. Scaling converts the raw input value into an engineering value: a number describing the physical measurement, such as flow (m3/s), weight (kg) or temperature (degrees).
You can scale the value with simple math. Some IDE’s, including Siemens Step 7 and Tia Portal, also provide a dedicated scaling function block. We will use both methods.
Scaling with Math
The analog signal becomes a raw number in the PLC, such as a value between 0 and 27648 on the Siemens platform. Its physical measurement might be 0 to 300 degrees. The raw number alone does not tell us that physical measurement. Converting it to the engineering value lets us work with the measurement itself in the PLC program. It also lets us display the value on an HMI in terms an operator can use.
We need to convert the 0-27648 range into 0-300.
We can express the relationship mathematically:
Raw Value / 27648 = Engineering Value / 300
Isolating the engineering value gives us an equation to use directly in the PLC program. It scales the analog input into the engineering value:
Engineering Value = (Raw Value / 27648) * 300
Structured text makes this easy: one line of code scales the analog input. Here is the process in CODESYS:
Some systems provide function blocks as an alternative to scaling with math.
Scaling with the SCALE Function Block
Siemens provides a built-in scaling block called SCALE. It has 5 inputs and 3 outputs; here we will use 3 of those inputs and 1 output.
HI_LIM and LOW_LIM define the engineering value limits. To scale a signal to 0-300 degrees, for example, set LOW_LIM to 0 and HI_LIM to 300. Connect the raw analog input value to IN.
The block sends the scaled result to its OUT output.
The function block performs the same math we used earlier, so both methods do the same scaling calculation. Some people prefer to use the equation directly, while others prefer the function block.
Analog Outputs
Analog outputs resemble analog inputs, though their wiring and use in the PLC program differ. Like analog inputs, outputs have two types:
- Voltage
- Current
The principle stays the same: the analog signal uses either voltage or current.
We will begin with analog output wiring.
Wiring of Analog Outputs
Every analog output connects to a load, so consider that load when wiring either type. It might be a flow controller valve, a frequency converter or an analog input on another PLC.
The connected device determines which analog signal type to use. A valve controlled by a 4-20 mA signal needs a 4-20 mA analog output.
Voltage Analog Output Wiring
A voltage analog output is the simplest to wire, needing only 2 wires for the positive and negative sides of the voltage source. Here, that source is the analog voltage output. The diagram shows a basic 2-wire connection:
Some voltage outputs need more than 2 wires. Certain Siemens modules have two extra terminals at the analog outputs to compensate for line impedance, or line resistance. Impedance is the opposition that a circuit presents to changes in current or voltage. Because this is a voltage signal, resistance creates a voltage drop.
When the analog voltage signal changes, the resistance becomes even greater. The two extra wires compensate so that the voltage at the destination matches the voltage at the analog output.
You must also account for load impedance when connecting analog voltage outputs. The load needs a minimum impedance, typically between 500 and 1k Ohm, to avoid short-circuiting the output. Always read the manuals for both the analog output module and the connected load.
Current Analog Output Wiring
Most PLC analog outputs work much like a 3-wire transmitter. Although we have used only 2 wires so far, the PLC often supplies power internally. That power supply forms the third wire for the signal.
With current outputs, you usually only need to wire the signal current loop. You must also wire the supply loop, but that is often part of powering the module itself so the PLC can detect it.
Load impedance is one difference between voltage and current outputs. Voltage outputs need a minimum load impedance, while current outputs have a maximum. Here we are dealing with current flow. Impedance (resistance) limits that flow. If the load impedance is too high, the loop cannot drive the amount of current required for the signal. This is why we need to check the maximum rather than the minimum for a current output.
For a typical PLC analog current output, the maximum load impedance is 300-500 Ohm.
Analog Output Scaling / Unscaling
The same principles used for scaling also apply to unscaling, which you will often need. Unscaling converts an engineering value into a value the module can use to produce an output.
Suppose a 0-10 V analog output controls a motor’s speed. To run the motor at 50% speed, we need a 5 V output signal. We must know which value to send to the D/A converter to produce it, which means knowing the range.
The Siemens PLC’s used earlier in this article have a range of 0-27648.
We can calculate 50% of that range: 13824.
An operator typically enters the engineering value, here a percentage (%), as the HMI setpoint instead of 13824. We therefore need to convert that engineering value into a number within the analog output range.
You can unscale with math or with function blocks. Math helps explain the process, using the same relationship as scaling:
Raw Value / 27648 = Engineering Value / 100
Isolate Raw Value to get an expression that converts an engineering value to a raw value. One line of structured text implements it:
RawValue := (EngineeringValue / 100) * 27648;
Some vendors provide function blocks for unscaling as well. Siemens has UNSCALE, which reverses the SCALE block’s operation. It converts a value in a specified range to a value from 0-27648. HI_LIM and LOW_LIM define the engineering value limits.



















Thank you for the time and effort you put in to helping other people understand the way analogues work. This was an eye opener for me and I only have to take this knowledge and practice to make it perfect. Thanks once again…..
Hey Quinton! I’m glad you enjoyed the article. Please let me know if there’s anything else you would like to read about here on PLC Academy 🙂
Thanks so much.
Please like to know how to add analog input card to an existing devicenet 1794-ADN adapter.
I have no problem adding to ethernet bus but I am new to devicenet.Thanks.
I so glad and appreciate ur effort it is very way Conway knowledge to the other person I think this is great opportunity for student how want to lean about plc again I thanks
This article has been beneficial at least for me. Thank you very much. Regarding if there is other things to talk about, if you could write about interrupts in PLC, that will help. Coming from C programming background myself , the interrupt concept in PLC took some time to understand…
This Article is so Useful thank you
Thank you very much for this. much appreciated
Hello i have a flow meter with three wires red(+), green,black(-), how can i connect with plc module
there are two wires are coming out from module 24v+ and 24v- .but how can i connect return signal wire (green).
Very use ful thank you
Very easy to have knowledge of Analog Input and Analog Output. Please clear my point, If i don’t have Controller Can i give direct input signal to control valve without using PLC in between. What is main difference between analog input signal and analog output signal?
Thank you for this great article.
very well written article. Really enjoyed!
Brilliant article. Opened up my knowledge on analog signals.
Great article, it’s very useful, I’m having a trouble wiring an analog output with an analog input, both siemens in a S7-300 PLC. I always have the same read value even if the output signal is changed. Can you give me an advice of how to wire them?
This is just pure beauty. Thank you very much. I have had a little struggle with analog i/o modules wiring. This is so clear and easily comprehensible. Thanks again.
I thank you very much for this eye opening article about analog i/o
Fantastic information laid out brilliantly. Thank you for your time to write this article.
Thank you for your efforts. Every part of this writing makes sense, since you’ve written it in steps and easy language.
Thank you Arsalaan! I’m happy that you like my article 🙂
thanx
good article
thanks a lot for this useful information
Very helpful.
Thank you.
Thank you for your efforts. Every part of this writing makes sense, since you’ve written it in steps and easy language.
People usually shows analog a very difficult subject but you make it very easy for us. LONG LIVE……………………………
Thank you Shams! I’m very happy that you like my article. Long live you 🙂
Nice presentation,thanks
Thanks Michael!
Tq for sharing.. This blog is a best teacher i have.. I get 1 semester input on my HND just by reading this
Thanks! I’m very happy that you learned so much!
Thanks for sharing this useful article. It is really helpful.
Really nice and clear tutorial, Thanks a lot.
Could you make examples for real application ?
Really Very useful and provide with clear solution for my career.
Thanks for taking your time out to write this, it helped a lot
This was concise and exactly what was needed – thank you. It would be nice if the PLC manufacturer provided the front-end electronic schematic (simplified of course) for analog inputs so that the designer knows how to interface the sensors.
Thanks for this article sir …!! Very usefuly
Thank you for sharing this content with us. Great explanation!
Please, keep with this articles.
Very useful article sir….
Hi,
Thanks for this article. Only one thing, A word is 16 bits, or not?
Because you write it’s 8 zeros(bits), but then you write 16 bits!
“In many PLC’s an analog signal is represented by a word. A word in binary is 8 zeros’ in a row or two bytes (4 zero’s). Just like this:
00000000 00000000 “
Thank you verymuch
Good presentation, great article. Thank you very much…
Thanks heaps. just fyi there is a typo on the Analog Signal Range 10 V / 27658 = 361.7 μV. Should be 10 V / 27648 = 361.7 μV.
I’m an operator and I found this very informative. Although the engineers hate when I edify myself.
Hi Peter, these tutorials are great. However, I’m unable to write the ladder logic diagram for writing my DELTA-14SS2 PLC’s data register value (which I successfully got from another Analog to Digital module) into Digital to Analog module. I’m using the FROM and TO functions but the program isn’t just working. I’m using WPLSoft to write the Ladder Logic. Please help me.