Digital I/O vs Analog I/O – The automation technology around us involves both digital I/O and analog I/O. They are commonly used for microcontroller and machine learning such as Programmable Logic Controller (PLC) and Distributed Control System (DCS). The PLC receives and processes input data and produces its output depending on the program line.
Both Digital and Analog I/O are fundamental for signal processing circuit and application. Both of them have their own characteristics, advantages, and disadvantages. Now we will learn about digital I/O and analog I/O, everything about their differences and also answer the frequently asked questions.
Both analog I/O and digital I/O are mainly used in the industrial sector, power industry, and of course robotic technology. A Programmable Logic Controller or PLC is the simple example of this I/O.
What is I/O – Input Output
We can’t start learning about digital I/O and analog I/O if we haven’t known about what is I/O. Maybe some of you have known that I/O stands for Input/Output. The input will determine how machines should act according to the program line inside its controller. The program will determine what output should be performed by the machine.
Input is the energy or information that enters a system while output is the energy or information that leaves a system. These input and output things are the method we can use to interact with the machine and vice versa. Input is usually related to switches, potentiometers, sensors, cameras, and many more. Output is usually related to electric motors, lighting devices, alarms, and many more.
Differences Analog I/O vs Digital I/O
We can differentiate between analog I/O and digital I/O by their sensors and signal processings. As an illustration we can use a water level control. This water level control will tell us whether the water inside the water tank is full or not. Of course, using digital I/O or analog I/O will give us different results. Keep in mind that digital data only has values “0” and “1”. Meanwhile, analog data can range between 0 and 1. We can read about it below.
Analog Input vs Digital Input Sensors
Illustrate that we want to make a water level control on your own. You can choose between an analog input or digital input. Analog input means you want to know its water level at the moment. Otherwise, digital input means you just need to know whether your water tank is full or not.
- Digital input sensor: A simple switch connected to a float can detect whether a water tank is full or not. The float is positioned at a certain point below the mouth of the water tank. When the water pushes the float, it will change the switch’s position from 0 to 1 or vice versa. We can set 0 as empty and set 1 as full or vice versa.
- Analog input sensor: A slider potentiometer connected to a float can give us the water level inside the water tank. The float will move the slider up and down according to water’s height. This slider potentiometer is connected to a voltage source and will produce output voltage at variable value between 0-100%. With this variable value, we can know the exact water level we have. We can achieve it by converting the data into an LCD display by a microcontroller. It is known as Analog to Digital Converter.
Later on, we can connect this further to the emergency lamp indicator, speaker, LCD, and even water pump motor. These examples are analog outputs we can easily install.
- Emergency lamp. When the water tank is full, it can turn on the red lamp. If the water tank is not full, it can turn on the green light.
- Speaker or siren. When the water tank is full, it can turn on the siren. If the water tank is not full, it can turn off the siren.
- Water pump motor. When the water tank is full, it can turn off the motor. If the water tank is not full, it can turn on the motor. We can also set the motor’s speed depending on the water level. It can either increase or decrease the motor’s speed.
- LCD. The LCD display can show the water tank’s status or even display variable values if we use analog input.
Analog I/O vs Digital I/O: Data Processing
After comparing between analog input and digital input, we will discuss analog and digital data processing time.
- Analog data is processed continuously. Every time the input changes, the output will also change. There is almost no delay between every change of the input. The delay depends on the electron’s movement speed which we already know that it is almost impossible to know about its exact time.
- Digital data is processed in discrete time delay. The delay depends on the time delay listed on the device’s datasheet. The time delay is also calculated from sampling frequency, depending on the crystal or clock component inside the device.
Looking back to the water level control, the application of slider potentiometer can be either analog or digital processing:
- Slider potentiometer with analog data processing: since analog processing is continuous, every change of water height detected by the float and potentiometer can be displayed with an LCD. The LCD can show between 0-100% of the water tank’s fullness.
- Slider potentiometer with digital data processing: since digital processing is in discrete time and produces binary data “0” and “1”, we can’t show the water’s height with 0-100%. We can divide the potentiometer value into 4 groups by dividing the voltage value into 0, 25%, 50%, 75%, and 100%. These percentage values are represented by binary numbers: 0, 1, 2, and 3. We can show these 4 percentage values using the LCD.
Why Digital I/O is Better
When it comes to advanced technology such as robotics, digital input, digital output, and digital processing is superior to analog. Why is that? Read it below:
- Since we have to program the robot, we need to use a computer. And as you have known, computers use digital data processing.
- Digital data has less electrical noise when transmitted.
- Digital data processing costs less than analog data processing and has a wide-variety of applications.
Aside from digital I/O superiority in advanced technologies, our world has a majority of analog I/O and will always be like that. There is a trick to reduce electrical noise by analog data, we need to convert it to digital data as soon as possible. This method can be achieved by Analog to Digital Converter (ADC).
Read also : power triangle and complex power
What is Digital Input
Digital input used digital data which are binary numbers “0” and “1”. These “0” and “1” are basically voltage values. The “0” represents zero volt or no voltage input. The “1” represents 5V to 220V or there is voltage input. To achieve this, we can use sensors, switches, or push-buttons to connect or disconnect the voltage source’s path. Since we only have “0” and “1”, it means they can only be used for “ON and “OFF”.
What is Digital Output
Like digital input, we only use binary data (0 and 1) to produce output. The simplest example of digital output is a light bulb. The output will turn on the light bulb or turn off the light bulb. Other examples can be found on contacts of a relay, solenoid valve, lamp, or other example which is able to operate on ON or OFF condition.
What is Analog Input
Unlike digital input, the analog input can receive continuous change depending on the electron’s speed (it’s almost instant). Of course, unlike the digital input which uses constant or fixed voltage as their data, analog input uses various voltages between 0-100% depending on the maximum voltage. Let’s say we have 10VDC input so the analog input can range between 0-10VDC or 0-100% of 10VDC.
For example, we can proportionally use this range with a potentiometer. We use 10VDC as input connected with a potentiometer. When the potentiometer reaches 50% resistance, it will produce 5VDC (50% from maximum VDC). If the resistance reaches 90%, the voltage will be 9VDC (90% from maximum VDC). Its scaling value is free for us to determine.
What is Analog Output
Just like analog input, the analog output also produces continuous results. If the input is changed, the output is also changed almost instantaneously. The implementation of analog output can be seen from the meters such as pressure meter, water level meter, etc.