How to set up Wi-Fi on your first industrial Raspi

Nice to meet you. I am a non-engineer, but I am also a Raspberry Pi information site (raspida.com). raspida.com My name is Raspida, and I am visiting the website of
PiLink Co., Ltd.
I have been given the opportunity to borrow the PL-R4.

Having touched the Raspberry Pi for about 10 years, I wondered what was different about the Raspberry Pi for industrial use.

We will be touching an industrial Raspi for a while and introducing it to you in the usual Raspida style.
We hope this information will be helpful to those who have introduced this system or are considering it in the future.
Please stay with us until the end.

ComputeModule for industrial applications

As many of you know, most of the Raspis used for industrial applications use “ComputeModule” (hereafter RPI CM) instead of the usual Raspi.
Since the type and number of interfaces to be connected depends on the application, they are generally connected to a carrier board.

Because the RPI CM is so small, the enclosure case it is housed in is also one of the smallest.

Even though it is for industrial use, the OS level is not much different from the usual Raspi that everyone has in their hands.
If the premise is to run the Raspberry Pi OS, as in the PL-R4, it can be handled in the same way as for hobby use.

The programs and applications we use on a daily basis work in the same way.

The photo image used in the article is intentionally opened to show the inside, but the product version is properly housed in a case.

PL-R4 BASIC RJ Plus IP20 (standard specification)

Wi-Fi Settings

After renting the room, I immediately started by setting up the Wi-Fi.

The environment is Raspberry Pi CM4 and the OS is Raspberry Pi OS bullseye 64bit.
The CM4 in the PL-R4 will be the model equipped with eMMC and Wi-Fi.

$ lsb_release -a

Distributor ID:    Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:    11
Codename:    bullseye

$ getconf LONG_BIT
64

At the time of writing, Raspberry Pi 5 and OS version bookworm are the latest models.
Starting with bookworm, the network settings default to NetworkManager instead of dhcpcd.

In this case, the OS version used in RPI CM4 is bullseye (Legacy).
Therefore, the network is the way to set it up with dhcpcd.

The setup procedure is the same for a regular Raspberry Pi 4. Please refer to this page for hobby use.

Preconfiguration

We are proceeding with the Raspberry Pi with Japanese display and input enabled.
The Wi-Fi function will not be enabled unless the country name (JP) is set. Remember to set it.

Setup from desktop screen (GUI)

You can configure the settings from the “Raspberry Pi Settings” in the main menu.

The format is to select settings from each of the four buttons on the Localization tab.

As a minimum, as long as the locale is set, it is OK. I displayed and set all of them for confirmation.
When the system prompts for a reboot and starts up, the changes have been made.

Do it by command (CUI)

With commands, you can perform the operations you have done in the GUI with just three lines of execution.

sudo raspi-config nonint do_change_locale ja_JP.UTF-8
sudo raspi-config nonint do_change_timezone Asia/Tokyo
sudo raspi-config nonint do_wifi_country JP

This will also be reflected if the system is restarted.

Configure Wi-Fi connection settings on the desktop screen (GUI)

In this example, the Wi-Fi connection was set up after the wired LAN cable connection first.

What makes it different from the usual Raspberry Pi 4 is that it has an external antenna.
With the Wi-Fi in the RPI CM4, the signal is attenuated by the amount of storage in the metal case.

In order to have it communicate with this external antenna, configure /boot/config.txt to enable it.

sudo nano /boot/config.txt

Enable the parameters in the Pi4 section that are commented out.

[pi4]
# Switch to external antenna. ant1:internal ant2:external noant:Disable both antennas
dtparam=ant2

ant2 represents the external antenna.
If the RPI CM4 case is compatible, the external antenna can be pulled out from the main board with a cable.

What’s with the appearance, it doesn’t feel like a Raspi.
An external antenna is reliably projected.

Settings are available from the top bar icon

Left-click the network icon in the upper right corner of the desktop screen, and you will see a list of SSID names.
When the Wi-Fi connection is established, the icon changes to a fan-shaped icon.

By clicking on the name of the SSID you wish to connect to, you will be prompted to enter your password.
If the connection can be established, a check mark will be placed on the connection.

Now you can easily connect to Wi-Fi with a mouse operation.

static IP addressing

In this product PL-R4, the IP address of the pre-installed Raspberry Pi OS is set.
The wired LAN cable connected to the connection port labeled E0 represents eth0 and is set to 192.168.0.10. E1 is 192.168.1.1.

IP :192.168.0.10
Mask:255.255.255.0
GW:192.168.0.1

If you would like to have the IP address determined by the DHCP server instead of automatically, right-click on the network icon and go to Wireless & Wired Network Settings to change it.

After Wi-Fi connection, it is indicated by a fan-shaped signal icon, and before connection by the ↑↓ icon.

Select an interface name from the pull-down menu in the upper right corner.
If you are connecting with a wired LAN cable, it is eth0.

Uncheck Automatically configure empty options since you want to specify it manually.
You will then be able to fill in the text boxes that were grayed out.

Just enter the IP address you want to specify and the IP address of the router.

It can be set in eth0 and wlan0 respectively.

The same can be done for wlan0 by unchecking Automatically configure empty options and changing to any IP address.

Change the interface item to SSID, and you can also configure settings for each SSID name you wish to connect to. Normally, only wlan0 is required.

Wi-Fi connection setup with commands (CUI)

The next step is how to set up the system without a monitor screen.
command in the terminal.

It can be done while looking at the monitor screen or connected to VNC.

There are two main files required to set up a Wi-Fi connection with dhcpcd.

Each is located under /etc.

/etc/wpa_supplicant/wpa_supplicant.conf
/etc/dhcpcd.conf

Wi-Fi connection information is set in wpa_supplicant.conf

Edit wpa_supplicant.conf from the terminal. Take a look at the contents once.

The cat command displays the contents of a file in the terminal.

sudo cat /etc/wpa_supplicant/wpa_supplicant.conf

Edit with a text editor (e.g. nano).

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

The minimum description that will be required is as follows

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

network={
        ssid="SSID名"
        psk="平文のパスワード"
}

Specify the encryption method depending on the network environment.
If you set it up in the GUI, it should be filled in automatically.

WPA2-PSK (AES)

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

network={
        ssid="SSID名"
        psk="平文のパスワード"
        key_mgmt=WPA-PSK
}

For WPA3-SAE

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

network={
        ssid="Wi-FiのアクセスポイントSSID名"
        sae_password="平文のパスワード"
        key_mgmt=SAE
        ieee80211w=2
}

key_mgmt=WPA-PSKpart depends on the encryption method.
Match the encryption method to the Wi-Fi router you are using.

WPA in WPA-PSK stands for Wi-Fi Protected Access and PSK for Pre-Shared Key. In Japanese, it is Pre-Shared Key.
There are several WPAs, including WPA, WPA2, and WPA3.

Depending on the router, WPA2-PSK (AES)/WPA-PSK (AES) and AES are the same encryption strength. AES stands for Advanced Encryption Standard.

In general so far, most routers of the size used at home will follow WPA2-Personal, with WPA2-PSK (AES) encryption.
In this case, the passphrase should be between 8 and 63 characters. (or 64 hexadecimal digits).

Some modern routers offer WPA3-Personal, which uses a mechanism called SAE instead of WPA3 or PSK, which is stronger security than WPA2-PSK.

For enterprises, there are enterprise modes such as WPA2/WPA3-EAP, which seems complicated.
Either way, the router must be supported and configured by the router.

Password Encryption

Let the password for the Wi-Fi connection be encrypted for added security.
The command to run is wpa_passphrase.

wpa_passphrase 接続するSSID 平文のパスワード

The encrypted password will appear in the terminal when executed as shown below.
This can be written in the conf file mentioned earlier.

network={
    ssid="SSID名"
    #psk="平文のパスワード"
    psk=f932c09ef574eda8c239a07b46661ac8f9a17ef13beb8b2d9429d27be89119f2
}

The encrypted password will be 64 hexadecimal digits and will not be enclosed in double-cotation marks.
Remove any plain-text password lines that are commented out.

static IP addressing

To fix the IP address with the command, you can configure it by writing in dhcpdc.conf.
If you do not have the same description, please add it to the bottom line.

sudo nano /etc/dhcpcd.conf

Wired cable connection (eth0)

interface eth0
static routers=192.168.0.1
static ip_address=192.168.0.10/24
static domain_name_servers=
static domain_search=

Wi-Fi connection (wlan0)

interface wlan0
static ip_address=192.168.0.12/24
static routers=192.168.0.1
static domain_name_servers=
static domain_search=

Related Commands

For your convenience, we have listed the network-related commands used in the Raspberry Pi OS.
It is not necessary to use all of them. It is recommended that you check them as you go along, as it will give you peace of mind.

Command 1 to check Wi-Fi status

wpa_cli -i wlan0 status

Command 2 to check Wi-Fi status

ifconfig wlan0

Commands to rebuild Wi-Fi settings

wpa_cli -i wlan0 reconfigure

Encrypt Wi-Fi passwords

wpa_passphrase 接続するSSID 平文のパスワード

Confirmation of IP address

ip a

Check IP and MAC addresses of devices from other PCs

arp -a

Touching PL-R4 First Industrial Raspi

Thank you for reading to the end.

Industrial Raspis are seldom touched, even by Raspberry Pi enthusiasts.
It was also the first time I used an RPI CM4 with eMMC.

When the PL-R4 is sold by PiLink Corporation, the Raspberry Pi OS is written to the eMMC by default when the equipment is shipped.

Since eMMC is rewritable, it can be written from a separate OS image file.
The product supports Raspberry Pi (Legacy), regular Raspberry Pi OS (32/64-bit) and Ubuntu OS.

There is already a lot of information on Raspberry Pi. I am continuing to disseminate it as well.
I will stay with hobby use, but even if I use it for industrial applications, I feel more comfortable with a device that I know and am known for.

It looks like a completely different Raspberry Pi on the outside, but inside it is nothing different from the usual Raspberry Pi 4.
On the contrary, I am amazed at the various extensions on the carrier board.

If you want to use a Raspberry Pi in the field, a robust case and connection interface are essential.
Since the OS is inevitably driven over a long period of time, we would like the OS to be more durable than microSD card activation.

As one might imagine, the PL-R4 also gave the impression of being a well-thought-out industrial Raspi.