In 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.
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:
How to program our industrial PLC with Arduino IDE: Install Industrial Shields's boards in the Arduino ID.
Most of the analog outputs 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 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.
Q0.0 enabled - A0.0 disabled
Q0.0 disabled - A0.0 enabled
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:
Analog output Serigraphy
The following image shows how to connect an analog output to the PLC:
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// Set the speed of the serial port
// This example writes the A0_0 and shows via serial the value
// Setup function
pinMode(A0_0,OUTPUT); // Only required in ESP32 based PLCs
// Loop function