The purpose of this page is to write down step by step the actions to be taken to get a Raspberry Pi fully up and running to use immediateC in combination with openHAB.
As of October 1st, 2025, Trixie is the new Raspberry Pi OS. To get it, go th www.raspberypi.com and download the headless version. That is, Raspberry Pi OS Lite.
Once downloaded, flash the image onto an SD card.
Once this is done - and before you rush to put the SD card into the Raspberry Pi - do the following 2 things first:
Create an empty file ssh on the boot partition
Create a file userconf.txt which contains a user and an encrypted password
How to do this is nicely explained on the following page.
Once this is done, remove the SD card from the PC and put it into a Raspberry Pi.
If you connect a Putty session to the Raspberry Pi it will ask for the credentials:
user: pi
password: the password you gave while creating the encrypted password to be put in the file userconf.txt (see before).
Now the Raspberry Pi is ready to be used with the newest Raspberry Pi OS Trixie image.
Once you're logged in to the Raspberry Pi, it's time to set up basic things like SSH, I2C and so on using raspi-config.
On the command line, run sudo raspi-config: a setup menu will open. I've modified the following items:
System Options:
Hostname -> change to whatever you like
Interface Options:
SSH -> enable it
I2C -> enable it
Localisation Options:
Timezone -> Europe / Brussels
Advanced Options:
Expand Filesystem -> use complete SD card memory
All the rest I left untouched. Shoud the need arise to, for example, activate the serial port or SPI or 1-wire, you can always return back to the configuration window and do the necessary changes.
When you exit the configuration screen, you will be asked to reboot so that the changes can be put in effect. Do so.
Since I'm used to work with wsl on Windows, the first thing I will do is to create a private/public key pair so that I don't have to give the password anymore when connecting from wsl to Raspberry Pi.
Since I already have an ED25519 private/public key pair on my wsl environment, I only have to run the following command to copy the public key to the Raspberry Pi:
ssh-copy-id -i ~/.ssh/id_ed25519.pub pi@192.168.1.53
This will ask for the Raspberry Pi password but that should be the last time you have to give the password.
Once this is done, you should be able to log in onto the Raspberry Pi without the need for a password.
Run ssh pi@192.168.1.53 and see for yourself if the password is still needed. It should not be.
PS: if you don't have a private/public key yet in wsl, run the command ssh-keygen -t ed25519. It will create a private/public key into ~/.ssh for you.
If you connect from the wsl environment to a Raspberry Pi through ssh and there's no communication between the two for quite some time (so-called idle modus) it could be the connection is interrupted.
To avoid this, there's two ways to solve this:
On the wsl side
change or create the following file: ~/.ssh/config
add the following content to the file:
Host *
ServerAliveInterval 60
ServerAliveCountMax 5
close the file
On the Raspberry Pi side
open the file /etc/ssh/sshd_config
search for ClientAliveInterval: chances are it's commented out.
activate the line and change the number to 60, if needed
search for ClientAliveCountMax: chances are it's commented out too.
activate the line and change the number to 5, if needed.
once this is done, reload the SSH daemon: sudo systemctl restart ssh
Now there should be no disconnection anymore between the wsl and Raspberry Pi environments.
Some changes has to be made to the config.txt file of the Raspberry Pi to allow the usage of, for example, an I2C mux.
In the past, the file config.txt was located in the /root directory. Since bookworm it's been moved one level lower: /boot/firmware/config.txt.
Luckily, the mechanism hasn't changed.
Below is a list of changes:
To activate the sensing mechanism to detect if an I2C mux/chip is connected:
## Use I2c mux
dtoverlay=i2c-mux,pca9548,addr=0x70
To change the I2C speed to exactly 400 kHz (default: 100 kHz):
## Set I2c speed to exactly 400kHz
core_freq=250
dtparam=i2c_baudrate=400000
To define a pin to properly shut down the Raspberry Pi when the pin is low:
## Use GPIO pin to shut down RPi when pressing red button
dtoverlay=gpio-shutdown,gpio_pin=26,active_low=1,gpio_pull=gp
Summary:
# Added by GVC
## Set I2c speed to exactly 400kHz
core_freq=250
dtparam=i2c_baudrate=400000
## Use I2c mux
dtoverlay=i2c-mux,pca9548,addr=0x70
## Use GPIO pin to shut down RPi when pressing red button
dtoverlay=gpio-shutdown,gpio_pin=26,active_low=1,gpio_pull=gp
# End added by GVC
After reboot, those functions will be activated.
Following has to be done to ~/.bashrc before continuing:
Add ~/.bash_aliases, ~/.bash_paths and ~/.bash_exports files
vi ~/.bash_aliases
Add the following basic aliases (some are command line commands, others are Git commands):
alias lla='ls -als'
alias ltr='ls -ltr'
alias lt='ls -lt'
alias gs='git status'
alias gsu='git status -uno'
alias gd='git diff'
alias gb='git branch'
alias gdc='git diff --cached'
alias gac='git add . && git commit --amend'
alias gca='git commit --amend'
alias less='less -N'
alias gitk='gitk --all &'
alias gpp='git push && git pull'
alias gb='git branch'
alias ..='cd ..'
alias ...='cd ../..'
vi ~/.bash_paths
Add the following to the file to start with:
PATH=.:$PATH
vi ~/.bash_exports
Just create the file and add export stuff when needed.
Modify ~/.bashrc to use above files:
# Added by GVC
[ -f ~/.bash_aliases ] && . ~/.bash_aliases
[ -f ~/.bash_exports ] && . ~/.bash_exports
[ -f ~/.bash_paths ] && . ~/.bash_paths
LS_COLORS=$LS_COLORS:'di=0;92' ; export LS_COLORS
# End added by GVC
Modify ~/.bashrc to show command prompt in green:
Search for PS1
Copy the line so you have a backup; comment out the first line
Adapt the content to this:
PS1='${debian_chroot:+($debian_chroot)}\e[01;32m\]\u@\h\e[00m\]:\e[01;32m\]\w \$\e[00m\] '
To be able to use immediateC (see below) the following tooling has to be installed first:
sudo apt install vim
Apply necessary statements to ~/.vimrc (create first). See other Raspberry Pi's for an example ~/.vimrc file.
sudo apt install git
Needed to clone the immediateC repository from GitHub
sudo apt install flex
Needed to build immediateC
sudo apt install bison
Needed to build immediateC
sudo apt install plocate
This is a very handy tool to quickly locate files on the RFS.
This used to be called locate in the past.
After installing it for the first time, the locate DB has to be populated. This has to be done with the command sudo updatedb.
The very first time this can take some time. After that initial update, the command has to be repeated every now and then to update the DB. Especially if lots of changes have been done to the RFS.
Note 1: you will get a warning if you use locate and it's been a while the database has not been updated anymore.
Note 2: you can still use locate to search. locate is a soft link to plocate.
Install MQTT Perl module
sudo cpan Net::MQTT::Simple
Since this is the first CPAN module installed, a question will be asked for.
"Would you like to configure as much as possible automatically?": answer "yes"
Install Tk.pm Perl module
sudo apt install perl-tk
This will install the Tk Perl module, necessary for the GUI applications of immediateC.
Instead of the extreme lengthy procedure described in another section of immediateC, this is really "a walk in the park"! Thanks for the guy on SO for this hint.
A nice thing is also that this package is installing extra nice fonts which will make tools like iClive (see further) look much more nice on the screen:
pi@trixie2:~ $ sudo apt install perl-tk
Installing:
perl-tk
Installing dependencies:
fontconfig-config fonts-dejavu-core fonts-dejavu-mono libfontconfig1 libfreetype6 libxft2 libxrender1
Summary:
Upgrading: 0, Installing: 8, Removing: 0, Not Upgrading: 0
Download size: 4,468 kB
Space needed: 14.5 MB / 11.4 GB available
Install I2C tools
To be able to check the multi I2C buses for their correct working, you need i2cdetect to test. This is part of the i2c-tools package, so you have to install that package:
sudo apt install i2c-tools
Once this is done, you can do all basic I2C actions from the command line:
i2cdetect
i2cset
i2cget
i2cdump
i2ctransfer
i2c-stub-from-dump
See the documentation of i2c-tools (man pages).
Note: once immediateC is installed, you can run iCman to see a window specifically created to read man pages. Once the application is open, type i2cget in the man input box to see all the possibilities of i2cget.
Same can be done for all the other applications that are part of i2c-tools (see list above).
Make a directory mystuff and then clone immediateC from here: https://github.com/JohnWulff/immediatec
Use Git to clone: git clone https://github.com/JohnWulff/immediatec.git
Go into immediatec/src and run the following commands:
m -I: this makes some directories writeable for a regular user that are otherwise only read-only
./configure: will check if all is available to be able to compile all immediateC tools
Since we added all possible missing tooling in the previous step, this should all work fine.
m -a: this will start a - lengthy - build.
However, this build will fail when trying to compile iCpiPWM.
The reason for this is that the libraries related to pigpio and that are part of the immediateC repo - these are: libpigpio.a and libpigpiod_if.a - are not compliant anymore to work with Trixie.
To resolve this, I had to do the following:
Download, build and install the pigpio GitHub repository:
git clone https://github.com/joan2937/pigpio.git
cd pigpio
make
sudo make install
However, during installation something went wrong: the setup script setup.py requires distutils.core which is part of the distutils but the Python package distutils was not found.
Indeed, from a certain Python version onwards (3.11), distutils is not part of the distro anymore. The replacement is now setuptools.
To get setuptools installed, run the command sudo apt install python3-setuptools.
Then modify setup.py: replace from distutils.core import setup with from setuptools import setup
That should resolve the issue.