Industrial Arduino based PLC programmed with LabVIEW

May 8, 2020 by
Industrial Arduino based PLC programmed with LabVIEW
Boot & Work Corp. S.L., DAVID SEGOVIA LOPEZ

Introduction

In this post you are going to learn how to work with our industrial PLCs and the computer application LabVIEW.


Previous readings

We recommend you to read the following posts from our blog before reading this one.


Requirements

In order to work with the PC application LabVIEW, you will need the following things:

  • Some electronic components such as wires, leds, resistors, potentiometers, etc.

Hardware & Software

Configuration of the switches for the digital example: 

Most of the inputs and the outputs are 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 of the two possible configurations at the same time. For example, in this case, we are watching the configuration of an M-Duino 42+ Ethernet industrial controller. If we put the switch to the right position (ON), the digital outputs Q0.5, Q0.6 and Q0.7 will be activated, but if the switch is in the left position (OFF) we will activate the analog outputs A0.5, A0.6 and A0.7.

In this case, all of the switches have to be in the ON position.

Q0.5, Q0.6 & Q0.7 enabled - A0.5, A0.6 & A0.7 disabled


The connection between an Arduino board and LabVIEW:

First of all, you are going to look for the sketch called LIFA_Base following the steps in the first screenshot: Este equipo -- Disco local(C:) (or the letter that your local disc has) -- Archivos de programa (x86) -- National Instruments -- LabVIEW 2019 (or the version that you downloaded) -- vi.lib -- LabVIEW Interface for Arduino -- Firmware -- LIFA_Base. Once you found it click on it and an Arduino IDE window is going to pop up on your computer.

After that, go to this window and click Tools -- Board (Your PLC family) + Model (Your PLC) + Port and select your PLC Arduino family, your specific model and the serial port where it is located and transfer the code to your Industrial Shields PLC with the arrow on the top left of the screen (second icon).

 


Build the following electrical circuit:

  • The Leds

  • The connections can be done in any of the digital outputs of the PLC. The equivalence of the Arduino board pins with your PLC for industrial automation is in our webpage, selecting your family and model and going into the file named User Guide in the Pinout section.

  • The resistors should be 220 Ohm.

  • There has to be a cable that connects two pins in the controller Arduino; the one called 5Vdc with the QVdc of the pins you are going to use.

  • A power supply (12-24 Vdc) is needed to power up your programmable logic controller (PLC) apart of the USB connection from it to your computer.



It can have any color. (The long leg of the leds is the positive part, which has to be connected to its resistor and the other one has to be connected to the ground pin (GND) of the PLC controller).


The next step is going to be finding some LabVIEW examples to work with them. Go to Este equipo -- Disco local(C:) (or the letter that your local disc has) -- Archivos de programa (x86) -- National Instruments -- LabVIEW 2019 (or the version that you downloaded) -- Examples -- MakerHub -- LINX. Click on LINX - Blink (Simple). It is a digital output test.


A window will pop up. Go to window -- Tile Left and Right and you will have the sketch of this project on your screen.

To connect your board go to Tools -- MakerHub -- LINX -- LINX Firmware Wizard. Again, a window will pop up in your computer screen and you will have to select your Arduino board type (Mega2560) and click Next. Select your USB Port also in the next window and click Next again. Keep clicking Next until the program is uploaded in your Arduino board and then click Finish.

Click on the green button and the program is going to start running. Click again on the green button and the led of the port that you selected is going to light up. This means that the connection between LabVIEW and your board and between your board and LabVIEW are working.

If the led does not light up, it means that the connection is not working, so check all of your connections, disconnect the board from your computer and upload the LIFA_base and the LINX - Blink (Simple) again until it works.



Once it is connected, click the green button as many times as you want and the led of the Digital Output Channel is going to light up and turn back off. Change the number of the channel to try all of your leds.


The next test is going to be an analog input test. The electrical circuit will be the following one:

  • Put a potentiometer in your protoboard (better if it is from 0 to 5 analog Voltage).

  • The connections will be done as in the picture. (Middle leg to the analog input A0, positive leg to the 5V power pin and negative leg to the ground, GND.




The next step is going to be the same as before. Go to Este equipo -- Disco local(C:) (or the letter that your local disc has) -- Archivos de programa (x86) -- National Instruments -- LabVIEW 2019 (or the version that you downloaded) -- Examples -- MakerHub -- LINX. Click on LINX - Analog Read 1 Channel.

Upload all the sketches as done before and turn your potentiometer from left to right. You are going to see that the Analog Value of the voltage changes.


If you want, you can try any sketch of the Examples folder.


Following readings

We recommend you read the following post from our blog, in order to continue using the interface LabVIEW with our PLCs.

​Search in our Blog

Industrial Arduino based PLC programmed with LabVIEW
Boot & Work Corp. S.L., DAVID SEGOVIA LOPEZ May 8, 2020

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.


Industrial PLC comparison >>>