My Raspberry Pi Setup
Refreshing pi and ECDSA key changed
This is a very common scenario, and simple to fix just enter the command e.g.
# ssh-keygen -R <host>
ssh-keygen -R 192.168.1.8
Enable VNC
From ssh command line access on PC
Enter the command sudo raspi-config.
Use the arrow keys to select Interfacing Options and press Enter.
Use the arrow keys to select VNC and press Enter.
You will be prompted to enable VNC Server.
Display Options for VNC
Set to 1024x768 or 1280 x 720 or 1280x1024 or 1600x1200
``
NB for Bookworm on PiZero
The Pi Zero 2W has 512M of memory and the default swap space to do a memory update may be insufficient.
From a Terminal window, enter the command swapon. The answer gives the file name, size, and usage of the swap file. The default swap file size is 100M and that probably is not sufficient with 512M memory.
Enter sudo nano /etc/dphys-swapfile and change CONF_SWAPSIZE=100 to 1024. Reboot and then before doing anything enter the command "swapon" in a terminal window to see the swap space usage.
Using MQTT
The Eclipse Paho MQTT Python library provides a client client class to enable applications to connect to the MQTT Eclipse Mosquitto broker to publish messages and to subscribe to topics and receive published messages.
Add/Remove search for mosquitto and install MQTT compatible message broker for Mosquitto. The client library will be added automatically.
Unless the configuration File is modified MQTT only runs on same computer as localhost.
Starting with the release of Mosquitto version 2.0.0, the default configuration will only bind to localhost. To enable remote access so that we can communicate with other IoT devices, we need to edit/create a configuration file.
1) Run the following command to open the mosquitto.conf file.
sudo nano /etc/mosquitto/mosquitto.conf
2) Move to the end of the file using the arrow keys and paste the following two lines:
listener 1883
allow_anonymous true
Mosquitto configuration file to allow remote connections and anonymous users
3) Then, press CTRL-X to exit and save the file. Press Y and Enter.
4) Restart Mosquitto for the changes to take effect.
sudo systemctl restart mosquitto
When configuring MQTT server in Node Red, in the MQTT broker node set the Protocol to MQTT V5.
Node-RED Installation
(v3.x no longer supports Nodejs 12 )
then add --node18 to bash script
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --node18
For a specific version of Node Red add for eg --nodered-version="3.0.1"
Bluepy
Assumes standard raspberry pi installation with headless setup.
Install Bluepy from https://github.com/IanHarvey/bluepy .
To install the current released version, on most Debian-based systems:
$ sudo pip3 install bluepy
To enable Bluepy without sudo
$ sudo setcap cap_net_raw+e <PATH>/bluepy-helper
$ sudo setcap cap_net_admin+eip <PATH>/bluepy-helper
Where <PATH> is the place where bluepy-helper is installed; it's easiest to just search for this,
e.g.
$ find /usr/local/lib -name bluepy-helper
Using 433 Utils
Raspian may already have WiringPi installed. Check by entering
gpio -v if bash: gpio: command not found then need to install WiringPi.
then install WiringPi. Unfortunately it has been deprecated and sudo apt-get install wiringpi no longer works. The GPIO Zero library is now the default installed on Debian!
Follow setup instructions in link below.
433Utils is made by GitHub user wolfeidau code allows reading and sending commands over 433MHz. The fork by jstevenperry works whereas the original didn’t!
The following instructions are based on Steven Perry’s Home Automation Series (video) (wordpress)
Installation:
To install run following commands
$ mkdir HA
$ cd ~/HA
$ git clone --recursive https://github.com/jstevenperry/433Utils no longer available but could copy from PC backup seems to have a few differences from the original then follow instructions below
$ cd 433Utils/RPi_utils
$ make
**Moved 433Utils folder to HA folder (my folder for Home Automation projects)
**If recovering 433Utils in HA folder from a backup held on PC, need to
$ cd HA/433Utils/RPi_utils
$ make