Aprende las funciones básicas sobre las entradas analógicas de un PLC industrial
14 noviembre, 2019 por
Aprende las funciones básicas sobre las entradas analógicas de un PLC industrial
Alejandro Jabalquinto


En este post, te explicamos cómo hacer lo básico para trabajar con las entradas analógicas de los controladores lógicos programables de Industrial Shields. Al leer este post, entenderás cómo conectar y configurar las entradas analógicas de tu
industrial Arduino PLC controller.

Previous reading

We recommend you to read the following blogs in order to understand the program of this blog. We have used the following blog posts to do this example:

  • How to program our industrial PLC with Arduino IDE: Installing Industrial Shields's boards in the Arduino IDE

Read >>>


In order to work with analog inputs, you will need any of our industrial controllers for industrial automation.

Industrial Shields controllers: 

Configuring the switches

Most of the analog inputs are always connected to the internal Arduino, but in a few cases, the user can choose between a special peripheral configuration or a GPIO by changing the position of the Dip Switches.

Each switch can select only one configuration. For example, in this case, we are watching the GPIOs configuration of an M-Duino 57R+. If we put the switch to the right position (ON) in the upper one, the input I2.1 will be activated and we will be able to work with this as input. If the switch is in the left position (OFF) we will activate the SCL line which will be used for I2C communication. Keep in mind that each switch has two different configurations: you must select the right (ON) or the left (OFF) option.

Entrada I2.1 habilitada - SCL deshabilitado

I2.1 input enabled - SCL disabled


Entrada I2.1 input deshabilitada - SCL habilitado

I2.1 input disabled- SCL enabled

Input types

In all of the Industrial Shields Arduino based PLCs, analog inputs can work at:

  • 0V - 10V analog input

Analog inputs have a special draw in the case of the PLC:

Entrada analógica 0V - 10Vdc

0V - 10Vdc Analog input



All the analog inputs are not optoisolated (they use the same GNDs as the PLC). The following image shows how to connect an analog input to the PLC:


0V - 10Vdc Analog input



In order to program the analog GPIOs, we must keep in mind that we can read the values with the following command:


This function returns a value between 0 and 1023 depending on the applied voltage level to the input (0V it is equal to 0, and 10V is equal to 1023).

GPIO is the name of the input. Imagine we want to know the state of the "I0.12" input, then, we must write this line: 


We must know that we do not need to configure the analog inputs as analog. Industrial Shields' libraries do all the work for us.


You can see a read analog GPIO example in the following paragraph:

// Analog read example
// This example reads the I0_12 and shows via serial the value

// Setup function
void setup()
    // Set the speed of the serial port

// Loop function
void loop()
    int value = analogRead(I0_12);

Basics: Analog inputs in Arduino PLC

Aprende las funciones básicas sobre las entradas analógicas de un PLC industrial
Alejandro Jabalquinto
14 noviembre, 2019

¿Buscas tu controlador lógico programable ideal?

Echa un vistazo a esta comparativa de producto de varios controladores industriales basados en Arduino.

Comparamos entradas, salidas, comunicaciones y otras especificaciones con las de los equipos de otras marcas destacadas.

Comparación PLC industrial>>>

¿Quieres más información?

¡Rellena el formulario!

¡Cuéntame más!