Wireless SSH connection with Raspberry PLC on first boot.
A step by step guide to connect your Raspberry PLC to wifi and use SSH on first boot up.
22 September, 2021 by
Wireless SSH connection with Raspberry PLC on first boot.
Boot & Work Corp. S.L., Amil Shrivastava


The Raspberry PLC that you ordered from industrial shields has finally been delivered to your doorstep. You are excited to work with it and explore the possibilities that this PLC offers. You realize that in order to program or work with it, you need a keyboard, a display monitor or an ethernet cable ; but all you have is your laptop and your home wifi. Read on!


This tutorial will explain how to connect your Raspberry PLC with your home wifi and enable the SSH protocol in the very first boot, so that all you have to do is prepare the SD card, insert it in the PLC and power it up to be able to control it via your laptop using SSH protocol. Follow the steps below:

Step 1: Prepare the SD card by installing the Raspberry os. You can download the Raspberry imager from their official site and install the Raspberry os lite.

Create the following two files in the boot drive of the SD card:

Step 2: Create an empty file named ssh with no extension. This file will enable the ssh protocol in the PLC. 

Step 3: Create a file named wpa_supplicant.conf and add the following lines to it. Make sure you edit the country_code; SSID and Password fields. This file will set up the wifi on boot up of the PLC. ( Do not change the spacing or indentation)

country=ES
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="SSID"
    psk="PASSWORD"
}

Note: If you are creating these files on windows, you will have to wrap the names in " " . This will ensure the integrity of the file's extension and if there is none, it will ensure that too. For eg. "ssh". Do it for both the files.


You can now insert the SD card in the PLC, but do not switch it on yet.

Step 4: We now need to find the IP address of the PLC. There are a few ways to go about this. One, you can try to connect to raspberry.local using the following command in the terminal or cmd depending on your OS:

ssh pi@raspberry.local 

if that does not work, the work around is to run the following command and look for all the devices currently in your local wireless network. This command shares the physical address and the IP address of all the devices in the network. 

arp -a

having noted the list, you can now turn on the PLC and wait for around 3 to 5 mins for the PLC to boot up completely. Once you are sure the boot up is complete, you can run the above mentioned command once again and check which ip address is new. This address will be of the PLC.

Step 5: With this information you can now connect to the PLC with the following command:

ssh pi@192.168.1.x  

And now you can configure your PLC however you like.


Other useful links:

How to build a Raspberry PLC image from a Raspberry Pi OS

How to access the Raspberry Pi industrial PLC

Wireless SSH connection with Raspberry PLC on first boot.
Boot & Work Corp. S.L., Amil Shrivastava
22 September, 2021
Share this post
Archive

Looking for your ideal PLC?

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 >>

Do you want more information?

Just fill the form!

Tell me more!