Introduction
Raspberry Pi is used worldwide by all types of users, and everyone has its own preferences at the time to work with this little computer. Choosing the Operative System that fits you the best is one of the most important things, but it can be very tricky when installing one.
In this post you will learn how to install and configure your favourite OS on Raspberry Pi, and also install the Industrial Shields packages in order to work with the Raspberry PLC at its full potential.
Requirements
Screen to connect the Raspberry PLC
Micro SD card
Installing the image in the micro SD card
The first thing to do is to install the desired Operative System into the micro SD card. To do so, it is necessary to install the Raspberry Pi Imager app, which can be downloaded from here.
After installing Raspberry Pi Imager, open the application and choose the desired OS to install in the left button. The recommended one is the Raspberry Pi OS (32-bit), but any other can be chosen.
Next, plug the micro SD card in the PC using a micro SD card adaptor and select the card in the middle button of the Raspberry Pi Imager. Finally, click the right button to erase all contents in the micro SD card and install the OS.
Installing the packages
After the installation finishes, it is time to plug the micro SD card in the Raspberry PLC in the micro SD socket. After that, connect the PLC to a screen using one of the micro USB ports and then to the power supply, in that order. Never plug-in the micro SD card in the Raspberry or disconnect it while the PLC is connected to the power supply or the micro SD card could be permanently damaged. In addition, connect a mouse and a keyboard to any of the 4 USB ports to properly work with the Raspberry PLC.
After the connections are done, the Raspberry PLC should start and display in the screen the OS initial configurations, where you must configure the parameters such as the username, password, time zone, language and WiFi connection.
By now, you should have complete control of the Raspberry PLC, so the installation of the OS has gone flawless and you are ready to start working on your projects! We recommend installing the Industrial Shields packages to work better with the Raspberry PLC and use it at its full potential.
To do so, visit this URL and download the install.sh script. It can be easily one by executing the following command in the terminal:
$ wget https://apps.industrialshields.com/main/rpi/rpiplc_v4/install.sh
The command will download the install.sh script into the current directory. To execute the script, type:
$ chmod u+x install.sh
$ sudo ./install.sh
With these two commands, we allow the user to execute the script and then we execute it with superuser permissions. This script installs some of the needed packages to work with Raspberry PLC as well as the services for the UPS system.
Final checks
To make sure the install.sh script has run correctly, there are a couple things to check.
1. Two more services have been added
The first one is the rpishutdown.service. It enables UPS system, to avoid unexpected power supply loss and allow the Raspberry to shutdown correctly.
The second one is the hw-config.service. This service is essential while working with the Raspberry IOs.
This services can be checked with:
$ systemctl status rpishutdown.service
$ systemctl status hw-config.service
2. Ethernet's IP
With the command
$ ip address
you can check the IP address for every interface in the Raspberry Pi. After install.sh, Ethernet IP addresses should be:
eth0: 10.10.10.20/24
eth1: 10.10.11.20/24
3. Install python3 Industrial Shields package
To install the python3 Industrial Shields package, you will need to do something very similar the the Node-RED package installation:
$ git clone -b v2.X.X https://github.com/Industrial-Shields/rpiplc-lib
$ cd rpiplc-lib
$ make
$ sudo make install
Note: Check the github page to know the numbers to replace v2.X.X.
4. Node-RED installation
After installing the python3 package, you can now install the Industrial Shields Node-RED package by typing
$ node-red-start
and going to http://localhost:1880/, you should find the dashboard package installed. To install the Industrial Shields Node-RED package, you will need to follow this instructions:
1. Execute the following commands:
$ git clone -b v2.X.X https://github.com/Industrial-Shields/rpiplc-python3-lib
$ cd rpiplc-python3-lib
$ sudo python3 setup.py install
Note: Check the github page to know the numbers to replace v2.X.X.
2. After the installation, go to the Node-RED environment and install the Industrial Shields package. Go to Menu -> Manage Palette -> Install, and search node-red-contrib-rpiplc-node. You can also install the Node-RED package from the terminal by:
$ cd ~/.node-red
$ npm install node-red-contrib-rpiplc-node
If you cannot find the .node-red folder inside the $HOME directory, then it must be located inside /root.
Installating an Operative System in the Raspberry PLC