Wireless SSH connection with Raspberry Pi PLC on first boot

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

Introduction

The Raspberry Pi based 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 Pi PLC controller 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.

Steps


Step 1: Prepare the SD card by installing the Raspberry os. You can download the Raspberry Pi automation 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 extension and if there is none, it will ensure that too. For eg. "ssh". Do it for both the files.

File name - Wireless SSH connection with Raspberry PLC on first boot.

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

Step 4: Now you 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 [email protected] 

If that does not work, the workaround 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 [email protected]  

And now you can configure your PLC however you like.

Other useful links

How to build a industrial Raspberry Pi PLC image from a Raspberry Pi OS.     Read >> 

How to access the Raspberry Pi industrial PLC.    Read >> 

​Search in our Blog

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

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