Browse our Blog. You will find multiple applications, solutions, code examples. Navigate using the tag cloud or search using specific criteria

Basics about analog outputs of an industrial PLC


On this post, we are going to explain how to do the basics in order to work with analog outputs of Industrial Shields' programmable logic controllers. Reading this post, you will be able to understand how to connect and configure the analog outputs of your industrial Arduino Controller.

Previous reading

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


In order to work with analog outputs you will need any of our industrial controllers for industrial automation:

Configuring the switches

Most of the analog outputs are always connected to the internal Arduino, but in 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 o an M-Duino 21+. If we put the switch to the right position (ON) in the lower one, the output Q0.0 will be activated and we will be able to work this as digital. If the switch is in the left position (OFF) we will activate the output as analog. Keep in mind each switch has two different configurations: you must select the right (ON) or the left (OFF) option. 

Odoo - Sample 1 for three columns

Q0.0 enabled - A0.0 disabled


Odoo - Sample 3 for three columns

Q0.0 disabled - A0.0 enabled

Input types

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

  • 0V - 10V analog output

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

Odoo - Sample 3 for three columns

Analog output Serigraphy


The following image shows how to connect an analog output to the PLC:

Odoo - Sample 3 for three columns

0Vdc -10Vdc Analog output


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


This function puts the value of the analog output "A0.0" to 255 (meaning 10V):



You can see a write analog GPIO in the following paragraph:

// Analog write example
// This example writes the A0_0 and shows via serial the value

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

// Loop function
void loop()
    Serial.println("Value: 0");    
    analogWrite(A0_0, 0);    
    Serial.println("Value: 100");    
    Serial.println("Value: 255");

Basics: Analog outputs in Arduino PLC

Do you want more information?

Just fill the form!

Tell me more!