Wednesday, October 22, 2025

Raspberry Pi5 as a desktop computer

For an index to all my stories click this text.

Last saturday (18 october 2025) was a memorable day.
I switched over permanent to my new computer !!

Up untill a few days ago my desktop system was an AMD Ryzen 5 1400 with Quad Core, a total of 8Gb memory and a 1 Terrabyte harddisk. At the time when I bought it (2018) this system cost about 800 Euro's not counting the mouse, keyboard and monitor.
The machine was getting terribly old and slow and that was mainly due to Windows. So I switched over to Linux (Kubuntu) about 2 year ago and that speeded things up enormously.

But lately The system had memory (ram) problems and hanged regularly. Terribly annoying when you try to do things. So while still working with this system in the mean time I was installing and experimenting with what would be my new computer. And like said a few days ago I switched over permanently.

I am typing this on my new computer. It is fast and works flawless.

My new system is ...............

A Raspberry Pi5 with 8Gb memory and a 1 Terrabyte SSD harddisk.

Yes, indeed a Raspberry Pi, is now my new main computer. And I am impressed.

I experimented a lot with the Pi5 before making the actual switch.


I first started with a 3D printed case. Inside was the Pi5 with a 128Gb SD card.

But soon I realized that while this was already faster as my desktop machine there were some things I did not like.

My first concern was that I thought that the mini HDMI connection was too fragile for everyday use.
Second I wanted a real harddisk in stead of the SD card.
And I was not particularly fond of the cable spaghetti.

And then the software.........

I started out with Raspberry OS Bookworm.
And although the OS is great, it's Debian after all, the graphical shell (Pixel) is terrible. After all the years I work with Raspberry I can not get used to it.
So I removed the Desktop and installed KDE Plasma in stead.
That is the same desktop I was used to on my desktop machine when I installed Kubuntu on it.
And that works flawless and looks super !!!

If you want to install KDE Plasma on bookworm you can follow this tutorial:
https://lucstechblog.blogspot.com/2025/10/raspberry-os-bookworm-with-kde-desktop.html

And about a week Later Raspberry introduced their new OS called Trixie. Fortunately is was easy to install KDE Plasma also on this new OS. I wrote how to do that in this story:
https://lucstechblog.blogspot.com/2025/10/raspberry-trixie-with-kde-plasma.html

After installing all my necessary software on the Pi5 I made a backup of my desktop PC's home directory in which are all my datafiles, photo's video's and stories. I made a backup on an external harddisk.

For safety, you should anyhow make a backup each week !!!

Now that everything was softwarewise to my liking, remained the casing problem.

Raspberry Pi cases

You can, of course, print your own case like I did. But I wanted something more.

A great option is SunFounders Pironman 5 case. I like the tower look and the transparant side with RGB fans. But it lacks USB ports on the front.
So if you regularly need to plug in USB sticks or USB harddisks you need to do that at the back of the case. Or you need to use an USB extension cord from the back to a more reachable place.

This is annoying but it's really a pita when you want to program your ESP's and Raspberry Pi Pico's. Then you really need an easy reachable USB connection.

This makes the Pironman 5 not suitable for me.

Raspberry Pi 500+

I must say this looked very tempting.
But I still have to see one in the wild, before I buy one.
As a writer one of the most important parts of a computer is the keyboard. I do not like the chiclet keys of the Pi 500. Those of the Pi 500+ should be considerably better. But then it misses the numeric keypad and cursor keys.

I do like the 16GB Ram.
But then it has "only" 256GB storage which is too low by my standards. (I write books remember)
And yes you can remove the SSD and put a larger one in. But that would bring the cost up.

Argon One V5 M.2 case

I opted for the Argon One V5 M.2 case. This one had all the features wanted.


At the front:
- 2 USB 2 ports
- 1 Audio out port (for headphone etc)
- An on-off switch
- A power indicator led
- Access to the Raspberry's SD-card port



At the back:
- The USB-C power port
- 2 Full HDMI ports
- The ethernet (network) port
- 2 USB3 ports
- 2 USB2 ports

Inside:
- A fan which speed is regulated by a script
- A PCI board with an SSD slot
- An audio card connected to the front audio port
- An extension board that transforms the micro HDMI ports
  into full HDMI ports and adds 2 USB ports (the front connections)

Assembly.

The case comes as several loose parts. And I thought it was going to be hell to assemble it.
But in fact it took me about half an hour to finish the full assembly.

First step is to push the extension board (for audio, extra USB ports and full HDMI ports) into the raspberry ports.
Then glue the supplied thermal strips to the Raspberry chip's. And then screw the board in the base plate.

Next connect some power leads and a ribbon lead for the PCI board. Push the SSD in and glue some thermal strip on.
Close the case and you are done.

Piece of cake.

Argon software

To use all features of the Argon One V5 case you need to install a small script.

Again there is nothing to it. Just open the Konsole (terminal window) and copy some commands. That is it.
From that moment on your 2 front USB ports are operational.


And you get a dashboard on which you can see how much free ram there is, how much free disk space and your processors temperature and loads.

And here is my desk !!


In the front you see the Argon One V5.
At the back it is attached to a powered USB hub that connects to my keyboard and mouse. The USB hub also connects to my external harddisks that you can see on the right side.
They vary in size from 500Gb to 1 Terrabyte.
Connecting to a powered USB hub connects multiple apparatus to a single USB port. So I still have 3 USB ports available at the back.

The yellow box in the back is a Raspberry Pi3 which acts as a printer server. Through this server everyone in my home can use my Epson Ecotank printer which keeps printing costs very low.

And in the back there is a network switch that ties it all together.

Pricing.

Well let me add it all up.

- Raspberry Pi5 with 8GB € 86,50
- Power supply 27W       € 12,69
- Argon One V5 M.2 case  € 54,44
- Patriot 960GB SSD      € 70,17

This all adds up to a total of 223.80 Euro

This is presuming that you already have a computer monitor (or tv) with HDMI, a mouse and a keyboard. The necessary cables and a spare SD card to install the OS on before you switch over to the SSD as your main storage.

A full working desktop computer with 8GB and a 1Tb harddisk is what I would call cheap.

And just a sidenote.

In a previous story where I showed how to install the KDE desktop on your Raspberry PI I mentioned that booting the PI took a bit longer: 43 seconds.

But that is when booting from an SD card. Booting from the SSD is blazing fast. Just a few seconds.

The Future ??

For now this machine works as a charm for me. Loads of memory and storage, and it runs all the software I need.

I can not predict that the Pi5 will last 8 years like my AMD Ryzen machine did. But then it also did not cost as much.

And without a doubt Raspberry will bring out a Pi6 in a few years. And it will be faster with more memory etc etc. And maybe I switch over at that time.

But for now I am very happy with my new workhorse.

That's it for now.
Back to work for me
have fun and till next time

Luc Volders










 

Friday, October 17, 2025

Using a VPN with Kubuntu

For an index to all my stories click this text.

This story explains how to install a VPN on Kubuntu
This does not work on a Raspberry Pi. For the Pi there is a different solution which will be addressed in an upcoming story. 

What is a VPN

For those that have no idea what a VPN is and why you could use one I'll give a brief explanation.

First the name. VPN stands for Virtual Private Network.

Normally when you visit a website with your browser you have a direct connection to that website.

A VPN is a bridge in between. So you send the request for the website to the server of the VPN provider. The connection between your browser and the VPN server is encrypted and their server is a secure server. The VPN then contacts the website, gets the information and sends it encrypted back to you.
That way you do not have direct contact with the website you want to look at. This keeps you safe in countries where free speech is at stake. But it also makes it impossible for the website you are visiting to track you down. Even your Internet Provider can not see what sites you are visiting.

Another advantage is that you can access sites that are geo-restricted. This means that the website you are contacting even does not know in which country you are.
For a long time this was popular by people in Europe that wanted to watch certain US TV-shows. Without a VPN the US media server saw that you were in Europe and prohibited viewing. If you contacted these media through a VPN server they could not see that you were not in the US.

A VPN is secure for both UDP and TCP communication. Therefore you can also mask your IOT communication this way.

But it's not only safe for anonymously browsing. For Internet banking and mailing a VPN is also an extra safety step.



Free or paid VPN's

There are free and paid VPN services.
The restriction of a free VPN service is that you have less VPN servers to chose from, the service might not always be available and it may be slower.

I have been using the free VPN services from Proton for a while and they were always available and I did not notice any significant speed limitations. I do see that the amount of free VPN servers is indeed more limited as with their paid service, but for my testing purposes that did not bother me.

Proton have a no-log policy. That means that they do not keep a log of your activities. That is an extra safety measure that makes sure that no one can see what sites or services you have been using.

Even the Dutch consumer organisation "Consumentenbond" stated that the free Proton VPN service had little restrictions.
https://www.consumentenbond.nl/veilig-internetten/veiliger-internetten-met-een-vpn



Proton

Proton is a company that was founded by crowdsourcing and their main shareholder is the non-profit Proton Foundation. Their first priority ia privacy for internet users. One of the members of the organisation is Tim Berners Lee who is the inventor of the internet. Many of the people that work at Proton originate from CERN the European Organisation for Nuclear reasearch. Which is also the place where the internet was born.

This all sounds trustfull which is a must for a privacy first oriented company and VPN service.

Next to the VPN service they also supply a safe email service, a cloud based storage (drive), bitcoin wallet etc. etc. etc. Indeed all kinds of products where privacy is of the utmost concern.



Install Proton VPN

To use a VPN you'll need to install a small software package. This package intercepts all your network communication and sends it to the VPN server.

Installing the VPN software in Kubuntu is easy. Just visit the Proton website and follow the steps by pressing the button "Get Proton VPN"

https://protonvpn.com/

Fill in your email address and make up a password. Then download the software.



Using the Proton VPN


After downloading and installing Proton VPN you will find the software in the internet section of the Application Launcher.


The first time using Proton VPN you need to log in with your freshly created email address and password.


The software mentions that you are disconnected, meaning that you are not connected to a VPN server. You can choose the option "Quick Connect" at the top of the window in which case Proton chooses a radom server for you.
You can also click on one of the Cobbect buttons next to a mentioned country in the list. That way Proton VPN choses a connection to a free server in that country.


Clicking on the down arrow next to the country of your choosing presents a list of VPN servers in that country.
As you can see there are 2 free to use servers in Romania. There are 13 more servers in Romania but they are for paying members.

Next to the server you can see a percentage. In this example both servers show 87%. That means that the server still has some room for making new connections. If the percentage is at 100% the server is at his maximum capacity and it will not allow you to connect.


After choosing the server of your liking you can see that the connection is established.

That is all.

You can now open your browser and visit any website you want without anybody being able to trace your internet tracks. 



Does it work.

We here is a quick and simple test to see if the VPN works.

Start with disconnecting the VPN server in the Proton VPN software by simply pressing the Disconnect button.
Then open your internet browser and visit the following site:

https://www.whatsmyip.org/


The website shows your normal IP address.

Now activate the Proton VPN server and choose any server anywhere in the world to your liking. Then again visit https://www.whatsmyip.org/


And look at that: a totally different IP address.



Extra safety

Those of you who have used a TOR browser know that a TOR browser connects to a TOR server, that connects to another TOR server and that again connects to yet another TOR server. And that last server connects to the website you wanted to have a look at.

This way you can not easily be traced.

For extra safety you can use your TOR browser with the VPN.

Just make sure to start the VPN connection first and then start your TOR browser. That way your TOR browser connects to a TOR server through your VPN connection which gives you an encrypted communication line upon an encrypted line. So a double encrypted and untraceable connection.

So if you, for example, want to see a tv show or series that is only available for US citizens within the US connect to a VPN server in the US. And if you connect through a TOR browser make sure the last server in the range is also a US TOR server.

Just be aware that a TOR browser slows your connection to the end station down. 

Safe surfing
till next time
have fun


Luc Volders 

Friday, October 10, 2025

Raspberry Trixie with KDE Plasma

For an index to all my stories click this text

In the previous story I showed how to install the KDE desktop on a Raspberry Pi with the Raspberry OS Bookworm. Why ?? Well because the KDE desktop is beautiful while the Raspberry OS desktop is childish.As this story leans heavily on that previous story I urge you to read that first. Here is the link: http://lucstechblog.blogspot.com/2025/10/raspberry-os-bookworm-with-kde-desktop.html

And just when I was writing that story Raspberry introduced Trixie. The new OS based on Debian 13.
So I upgraded my setup (always recommended) and started experimenting to check if I could install the KDE desktop, called Plasma, on Trixie.

The official Raspberry site writes:
Something you will notice, however, is that we’ve made some changes of our own in the Trixie release. The most obvious is that we have updated the theme for the desktop — we have a completely new set of icons, a new font, new desktop backgrounds, and some other small tweaks to refresh the appearance of the system. This should be apparent as soon as you launch it.

Well actually the new theme looks indeed a bit better. But installing new software, and changing settings and a lot of other things still look dreadful. I wonder why they did not take the chance to upgrade tp KDE Plasma together with the new OS.

How to try this safely


A reader send me a mail telling that he was reluctant to do this as he was afraid to break things in his software. I told him not to worry.

You can try this safely before definitely stepping over.
Just use a fresh SD card. Install the Raspberry OS on that and follow the described steps. That will not harm your original setup and you can experiment as much as you like

But do yourself a favour and give it a try. You will not be disappointed.

Backup your data

First thing to do is to backup your valuable data. Good practice is to do that at least every week. I use an external harddisk for that and copy my complete home directory to that.

Installing KDE Plasma

Well actually most of the steps are equal to installing KDE Plasma on the previous OS: Bookworm.

So I refer to that story which you can find here:
https://lucstechblog.blogspot.com/2025/10/raspberry-os-bookworm-with-kde-desktop.html

The differences in the steps.

Step 7 in the story says:

And there we are.
The screen opens with your user name and you need to login with your password.

Well with Trixie that is not the way it works.
After rebooting the Raspberry GUI appears again.

Another difference is that when updrading Bookworm there is a dropdown menu on the top left side of the screen.
With Trixie this menu is at the left bottom side of the screen.

Just continue.

That is what you need to do. Just continue all the steps and when you reached the last step you will have achieved what you want: the KDE Plasma desktop on the Raspberry Pi !!!


The picture shows the Raspberry Config screen on the KDE Plasma desktop.

Keeping both: Raspberry Theme AND KDE Plasma

Actually it is possible to keep the Raspberry theme and KDE at the same time.
If you want this just omit the steps 10-11-12 from the previous story.

When the login screen appears you can then use the menu on the left-bottom side of the opening screen.

Be aware that it does not really look as a menu. There is just a text saying KDE Plasma on X11 (or Wayland). But that text is clickable and when you do the rest of the options are shown. Just click on the one you want and log in.

The only point with keeping all GUI's is that it will take up space on your root directory. And on a small SD card, like 32Gb, that might limit the amount of additional software you can install.

But when you have installed KDE Plasma and tried it you will see there is no reason to go back.

That's all for now
have fun


Luc Volders

Monday, October 6, 2025

Raspberry OS (Bookworm) with KDE Desktop !!!

For an index to all my stories click this text

This story tells how to get the KDE desktop running on a Raspberry Pi with the Raspberry OS. Why ?? Well because the KDE desktop is beautiful while the Raspberry OS desktop looks childish.

UPDATE:
This story tells how to install the KDE desktop on Raspberry Pi Bookworm. Just when I was writing this Raspberry brought out a new version of their OS: Trixie
At this moment I am testing whether this works with Trixie too. So come back if you want to use the KDE desktop with Trixie
.

For those who have worked only in the Raspberry OS desktop I'll show you some screenshots from the KDE desktop and that will make it easier to decide if you want to switch.

The KDE desktop.

The screenshots below are actually made from my Raspberry Pi5 running Raspberry OS with the KDE desktop.


The Raspberry OS has a drop down menu at the top right of your screen. KDE has also a menu from which to choose the program you want to run. It looks far better as the Raspberry's.


This is the window from which you can choose to install or remove new software packages. On the left side there is a menu from which you can choose a category. And clicking on a category opens a screen with loads of programs. Clicking on one of the programs not only presents a good description and the possibility to install the program or remove it if it already is installed. You will also get the possibility to read some users reviews.


At the bottom of the screen there are icons that represent programs and actions that are direct available and do not have to be chosen from the menu. This is of course fully customizable.
The second icon (the one with the 4 squares) is the one I miss most from other distributions like the Raspberry OS or even Ubuntu.

The 4 squares (you can add more) represent 4 virtual screens. By clicking on one of them your current screen closes and another screen opens. This allows you to have multiple programs open at the same time (like Thonny and a browser and your file browser). The difference is that you can place each program on its own screen so they do not clutter.


This is the Raspberry's configuration screen.


And this is the way KDE offers you to alter your configuration settings. Just look at all the possibilities at the left side of the window.


Some background

I love the Raspberry Pi. I have several of them that each performs a specific task. There is one for example installed as a printer server so anybody in my home can use my office printer from their location. The others are my Domoticz system, two Pi Zero's each as an internet radio, an MQTT server, a Dweet server, A Pi3 running Octoprint for my 3D printer, and a Pi as a media system connected to my TV.

Not all of them are active at the same time. Octopi only when I am going to print, the internet radio's when they are needed. But some of them (Domoticz and the printer server) are running 24 hour a day and most have been doing this for years.

So you can say I am a fan.

My main PC is an old beast from 2018 on which I switched from Windows to Kubuntu about a year and a half ago. The main reason was that my PC was getting slooowwwww. So I tried Kubuntu and it made my computer about 3 times as fast as when running Windows. The most gain is achived at starting up and shutting down. But often Windows was doing so many tasks at the same time in the background that it made the computer unworkable. and I never had these issues with Kubuntu.

However the beast is getting old an I am getting memory errors. So more and more the computer freezes just when I am doing something important..... Time for a new beast.

Raspberry Pi 5 as my new desktop beast.

As soon ad I laid my hands on the new Raspberry Pi 5 (my model has 8Gb) I was blown away at it's speed. It is way faster than my Kubuntu desktop machine and runs all the software I need like Office for writing my books, Arduino IDE, Thonny, The Gimp, Cura, VNC madia player etc. etc. etc.

There is just that one thing.
I don't like the Raspberry Desktop User Interface. It does the job flawless but just looks ridiculous childish.

I could switch to Ubuntu which is robust. But Ubuntu's user interface is not intuitive. I also don't like the way of choosing the program I want to run. And it lacks the Raspberry specific software.

So what I wouild like is the Rapberry OS with the looks of Kubuntu. And guess what: you can have that setup.

KDE

Kubuntu is a version of Ubuntu that has a different User interface. It is called KDE and the looks come from Plasma.

So in Ubuntu you can replace the User Interface (GUI) with KDE and that is just what KDE did with Kubuntu.
But then I saw that you could install KDE on all kinds of different Linux Distributions. To mention a few: Suse, Ubuntu, Fedora, Gentoo, Arch Linux

Most of these Linux distributions are Debian based. Hey, but so is the Raspberry OS !!

So I dug deeper and I found it.

There are several Raspberry Pi users who have replaced the Raspberry OS desktop with the KDE desktop.
How to install the KDE desktop is not documented very well And it took me several tries to get it working. I found descriptions that did not work. Maybe that was because they were written for older versions of Raspberry OS (Raspbian).

So here is the step by step guide to install the KDE Desktop on your Raspberry PI.

KDE on Raspberry OS.

The first step is to install the Raspberry OS on your SD card.


Use the Raspberry pi Imager to install the Raspberry OS as described on the raspberrypi.com website: 
https://www.raspberrypi.com/documentation/computers/getting-started.html

Install the full 64bit version. I advise not to install the OS Lite version.
If you install the full version you will get all Raspberry specific software.

Boot the Raspberry and open the console.

STEP 1

sudo apt update && sudo apt full-upgrade -y

The first thing to do is to make sure your system is fully up to date.

STEP 2

sudo apt install kde-full -y

Then use this command to install the full KDE desktop with all major packages.
This might take a few minutes.

STEP 3

sudo reboot

Now reboot your system

The Raspberry will reboot but reboots the Raspberry OS with it's own Desktop. We now have to activate the KDE desktop.

STEP 4

sudo apt install kde-plasma-desktop sddm -y

This installs the KDE login manager (sddm)

STEP 5

sudo dpkg-reconfigure sddm

And this command makes a dialog appear in which you can choose which display manager should boot. Choose sddm and press ok.

STEP 6

sudo raspi-config

We will use this to make sure the OS will start with the Desktop interface and not with the console. So choose Desktop/ Console and make sure to choose Desktop.

STEP 7

sudo reboot

And there we are.
The screen opens with your user name and you need to login with your password.

Just like in any Linux version you can add users later on if you have multiple people working at this computer. So this menu will expand when you have added users.


On the top right side of the screen there is a drop-down menu. Clicking that menu offers you the choice to boot to different versions. Choose for the Plasma (X11) session. On KDE X11 is more stable as Wayland.

The system will boot now.

Booting KDE takes a bit longer as booting the Rasberry desktop. 

But it is so much better looking !! And boooting is just done once every time you power up the Pi.

Remove the Raspberry desktop.

The last thing to do is to remove the Pixel/LXDE desktop so the Pi will boot into the KDE with Plasma desktop.

Open the console and give the following command:

STEP 8

sudo apt install kde-plasma-desktop sddm -y

Yes, I know we just did this. But we want to be on the safe side.

STEP 9

sudo dpkg-reconfigure sddm

We did this in previous steps but do it again for safety. Choose for sddm and press ok.

STEP 10

sudo apt purge lxde* lightdm* openbox* -y

Pixel is based on LXDE, LightDM and openbox This command removes them., and frees some of your storage space.

STEP 11

sudo apt purge raspberrypi-ui-mods -y

And this removes the rest of the Raspberry Pi desktop. 

STEP 12

sudo apt autoremove --purge -y
sudo apt clean


And with these command s we clean up all unused packages, which frees even more storage.

STEP 13

sudo reboot.

Reboot the Raspberry Pi and it will boot straight into the KDE desktop.

And this is what my desktop looks like (at the moment of this writing) with a clock widget and a custom background.


Side notes

My Raspberry boots from an SD card.
Please note that booting KDE is a bit slower as booting Raspberry OS.
From powering up and filling in my password to the opening of the KDE Desktop took 43 seconds. And be aware that this includes typing in my password.


Concluding.

This setup is way faster than my Kubuntu desktop machine.
It looks every way that the humble Raspberry Pi5 with Raspberry OS and the KDE Desktop is going to be my new main computer.
There are however still some things to do. I want a different casing as my 3D printed case, and I want an SSD disk for storage. That's a future project.

Till next time
have fun


Luc Volders

Friday, September 26, 2025

Pico audio 7: Build a Zwitscherbox

For an index to all my stories, click this text

My girlfriend got a birthday present from a friend. Nothing to write about you would think. But it was a Zwitscherbox. Never heard of it ??? Neither did I. Read on.



A Zwitscherbox is a simple concept. It is a box with some kind of a microcontroller inside (no I did not take it apart), a speaker and a PIR. Every time you pass by, the PIR detects movement, and the box plays the sound of birds singing.

Simple, but effective and fun. And most of the time it brings a smile to your face. So a real fun present.

I looked it up on the internet and was amazed at the price. It was a rather expensive gift at 50 to 60 Euro (USD).

That got me thinking. How difficult would it be to build one myself. Well actually it is dead simple.

Playing audio with a microcontroller.

There are several ways to play audio with a microcontroller. You can add an MP3 player like I did it this story: http://lucstechblog.blogspot.com/2019/10/web-controlled-mp3-player.html

Another method is to use the Raspberry Pi Pico as an audio player. I have written a few stories on using a Raspberry Pi Pico as an audio player. You just need a few cheap components. It can be build in 15 minutes or so. And like stated before, the audio quality is very good. I chose this option for this project.

Raspberry Pi Pico audio player.

To build an audio player with the Raspberry Pi pico you will need a few simple components. You will need a few resistors, some capacitors and (for larger audio files) an SD card with an adapter. If you can solder, you can use the SD adapter that is included with most micro-sd cards. If you can not solder you can use an SD-card adapter for microcontrollers.

I wrote several stories on this subject and it would be wise to read these first before continuing this story.

The audio file has to be in WAV format and you can use Audacity to convert an MP3 file to a 8K wave file. The following link takes you to my story on how to achieve this:
https://lucstechblog.blogspot.com/2024/10/audacity-pico-audio-part-1.html

The Raspberry Pi Pico audio player hardware can be found here:
https://lucstechblog.blogspot.com/2024/10/audio-on-pico-part-2-hardware.html

The Raspberry Pi Pico software (Micropython) can be found here:
https://lucstechblog.blogspot.com/2024/10/pico-audio-part-3.html

Attaching an SD card:
https://lucstechblog.blogspot.com/2025/01/pico-sdcard-part-1-hardware.html

Software for Pico and SD card:
https://lucstechblog.blogspot.com/2025/01/pico-sd-card-part-2-software.html

For this project we need to add a PIR.
You can read the basics on how a PIR works here: https://lucstechblog.blogspot.com/2017/01/pir-basics-movement-detection.html

Alternatively you could use a radar module like this one:
http://lucstechblog.blogspot.com/2018/08/motion-detection-with-rcwl-0516-radar.html

They both work the same way so rummage through your stock and use what you have got.

The breadboard setup.

Basically it is the setup from the Pico audio player. You can use that for testing. When everything works as planned just remove the buttons and the Oled screen. If you want to use that setup just look at this story: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx




I just added one thing to this setup and that is a PIR.
The VCC of the PIR MUST be connected to the VBUS connection of the Pico as it needs 5 Volt.
The PIR is further connected to GP21 and to GND.
If you are not building this on top of the Pico Audio Player you can attach the PIR to any GPIO you like. Just make sure you adjust the program to use the selected pin.

And that's all for the hardware side.

The audio file.

For replicating the Zwitscherbox I needed an audiofile of a bird singing. There are many sites on the internet that offer royalty free sounds. I found a nice audio file that plays a blackbird singing. It runs for about 2 minutes. Ideal for this project. You can download it here:

https://quicksounds.com/sound/4769/blackbird-in-town-3

Next step is to import the file into (free software) Audacity and convert it to an 8K wav file. In a previous story in this series I described how to do that. You can find that story here: 
https://lucstechblog.blogspot.com/2024/10/audacity-pico-audio-part-1.html

When the audio file was converted I stored it on the SD card that is attached to the Pico in the directory music with the name "Blackbird.wav"

Zwitscherbox software

Basically this is the same program that was used for the Talking Dice. The program is written in MicroPython.

import os as uos
import time
from machine import SPI, Pin
import sdcard
from wavePlayer import wavePlayer

spi = SPI(1,sck=Pin(14), mosi=Pin(15), miso=Pin(12))
cs = Pin(13)
sd = sdcard.SDCard(spi, cs)

pir=machine.Pin(21, machine.Pin.IN)

uos.mount(sd, '/sd')

player = wavePlayer()

print(uos.listdir('/sd/Music'))
time.sleep(10)

try:
    while True:
      print(pir.value())   
      if (pir.value() == 1):
        player.play('/sd/Music/Blackbird.wav')
        time.sleep(5)
      time.sleep(0.3)
except KeyboardInterrupt:
    player.stop()
    print("wave player terminated")


For testing purposes I build a keyboard interrupt into the program. Pressing CTRL-C on the keyboard, while the Pico is connected to Thonny, stops the program and shuts the audio player down.

Like said before and as can be seen in the schematics: the PIR is connected to GPIO 21 on the Raspberry Pi Pico.

Almost everything is identical to the previous audio programs except for this part:

      if (pir.value() == 1):
        player.play('/sd/Music/Blackbird.wav')
        time.sleep(5)
      time.sleep(0.3)

First the program tests if the PIR signal is high. If that is the case then someone is passing by. The player then plays the blackbird sound witch is stored on the attached SD card in the directory Music. The program then waits 5 seconds so the PIR can settle down and then runs again.

Concluding.

The Raspberry Pi Pico with MicroPython is a golden combination that is easy to program and enormous versatile.
The Zwitscherbox clone is an easy build and great fun. It makes a fantastic present for a fraction of the price of the original.

Next step is to design and build a nice casing.........

Till next time
Have fun


Luc Volders



Friday, September 12, 2025

Javascript Speech Synthesises

For an index to all my stories click this text.

I like Javascript. I really do. The language is easy to learn, versatile and extensive. You just make a simple (or complicated) webpage, put some Javascript code in it and it runs on your PC, Raspberry, phone or tablet. Interfacing with the ESP8266, ESP32, your home automation system or a myriad of other devices and services is generally not difficult to achieve.

And there is speech synthesises.......

Have your computer speak to you.

The Javascript commands for having your computer/phone/tablet speak to you are really easy.

var msg = new SpeechSynthesisUtterance();

This starts a new Speechsynthesis instance and we call it msg.

msg.text = "this is my text"

Obviously the text that the message will speak = "this is my text"

speechSynthesis.speak(msg);

And this speaks out the message.

That is really all there is to it.

Now let us look to the next html code with a Javascript example.

<!DOCTYPE html>
<html lang="en-US">
<body>

<h2>Javascript Speech</h2>

<script>

var msg = new SpeechSynthesisUtterance();
msg.text = 'I have put the lamp on';

speechSynthesis.speak(msg);

</script>
</body>
</html>

Copy this code in your favorite text editor (I use notepad) and save it as speech01.html Make sure not to save it as a txt file. So use "Save as" for that. Save the file in a directory of your choice.



As you can see the file was saved as speech01 and seen as a Firefox HTML document. If your default browser is Chrome you should see the file as a Chrome HTML file.

Double-click the file and your browser will open and the words 'I have put the lamp on' will be spoken. Naturally you will have to make sure that your speakers are on and the volume is up. The text shows where this is going.......

Neat huh ???

For the next step I urge you to change your default browser to Chrome or Edge as these browsers have more posibillities for speech synthesises as Firefox has. You can always left-click on the html file and choose open with Chrome or Edge provided these are installed on your computer. You might try with other browsers (I haven't) to see if that works.

Changing the language and voice

Now we know how simple it is to have the computer speak to us we might want to change some parameters. Again: this works in Chrome and Edge but not in Firefox.

var msg = new SpeechSynthesisUtterance();
var voices = window.speechSynthesis.getVoices();
msg.voice = voices[0];
msg.volume = 1; // From 0 to 1
msg.rate = 1; // From 0.1 to 1
msg.pitch = 1; // From 0 to 2
msg.lang = "en";

These are the parameters you can change.

msg.voice = voices[0];

You can most of the time choose between 0 and 1. This will change the voice sometimes from female to male or between different male/female voices. Choose what sounds best to you.

msg.volume = 1;

Set this to 0 and speechsynthesises is set off. Set this to any value between 0 and 1 (like 0.2) and you can have the voice whisper without having to change the volume settings on your computer.

msg.rate = 1;

This will set the speech rate. from 0.1 which is veeerrrrrryyyyyy ssssssslllllloooooowwwwwww to 1 which is the normal speech rate.

msg.pitch = 1;

This will set the pitch of the voice. 0 is very low and 2 is high. 1 Is the standard value.

msg.lang = "en";

And finally this allows us to choose the language in which the text will be spoken.

msg.text = 'I have put the lamp on';

This one we have seen behore in the first (small) program. And this is where to put the text that has to be spoken.  So if you change msg.lang into another language you need to alter the text in msg.text in the text for that language.

If you want to change the text in Dutch (hey that's my native language) you would need to set the following parameters:

msg.lang = 'nl'
msg.text = 'Ik heb de lamp aangezet'


Another example

Here is another example that would speak out a fake temperature setting. In this example all parameters are available so you can change them to your liking.

<!DOCTYPE html>
<html lang="en-US">
<body>

<h2>Javascript Speech</h2>

<script>

var msg = new SpeechSynthesisUtterance();
var voices = window.speechSynthesis.getVoices();
msg.voice = voices[1];
msg.volume = 1; // From 0 to 1
msg.rate = 1; // From 0.1 to 1
msg.pitch = 1; // From 0 to 2
msg.lang = "en";

msg.text = 'The temperature is' + 18 + 'degrees';

speechSynthesis.speak(msg);

</script>
</body>
</html>

Just copy this into your editor and save it as speech02.html Go to the directory where you saved it and double-click on it and the webpage will open and speak the text. Alter some settings in the editor, save it again and reload the page.

What languages are available ???


Javascript uses the BCP 47 Language Codes and here is the complete list of languages that are available:

ar-SA Arabic Saudi Arabia
cs-CZ Czech Czech Republic
da-DK Danish Denmark
de-DE German Germany
el-GR Modern Greek Greece
en-AU English Australia
en-GB English United Kingdom
en-IE English Ireland
en-US English United States
en-ZA English South Africa
es-ES Spanish Spain
es-MX Spanish Mexico
fi-FI Finnish Finland
fr-CA French Canada
fr-FR French France
he-IL Hebrew Israel
hi-IN Hindi India
hu-HU Hungarian Hungary
id-ID Indonesian Indonesia
it-IT Italian Italy
ja-JP Japanese Japan
ko-KR Korean Republic of Korea
nl-BE Dutch Belgium
nl-NL Dutch Netherlands
no-NO Norwegian Norway
pl-PL Polish Poland
pt-BR Portuguese Brazil
pt-PT Portuguese Portugal
ro-RO Romanian Romania
ru-RU Russian Russian Federation
sk-SK Slovak Slovakia
sv-SE Swedish Sweden
th-TH Thai Thailand
tr-TR Turkish Turkey
zh-CN Chinese China
zh-HK Chinese Hong Kong
zh-TW Chinese Taiwan


So if you are Belgian or Dutch and like the soft touch of the Belgian voices set:

msg.lang = "nl-BE";
msg.text = 'Ik heb de lamp aangezet';


Fun to play with.

Remember the Javascript pages made to control an ESP8266 and get information from that ESP ??? Next time we are going to incorporate the speech synthesises into that page so you will have an audible feedback on the commands you have send to the ESP and sensor readings from that ESP.

For now you have something funny and usefull to play with.

Till next time
have fun

Luc Volders


Friday, September 5, 2025

Autostarting a program with Raspberry Bookworm OS

For an index to all my stories click this text

October 2018 I wrote a story on how to build an internet radio with the Raspberry Pi Zero. You can find that story here: https://lucstechblog.blogspot.com/2018/10/raspberry-pi-internet-radio-part-3.html

As you might know (as a faithfull follower of this weblog) I am building a second version for using in my living room. The old one is still working in my mancave, and stays there.

The old one uses the, at that time, current Raspberry OS. And of course I am now going to use the latest version. And that posed a small problem.

The previous version (which still works flawlessly) modified the LXDE-pi file in a way that made the internet radio program start automatically when the Pi Zero booted. And that does not work anymore.

For those that are interested I'll show you how to make a Python program autostart with Raspberry Pi's Bookworm OS.

Modify .bashrc

There are several ways to make a program, any program, autostart but this is one of the easiest.

Open the console and type:

sudo nano /home/pi/.bashrc

This opens the .bashrc file in the Nano editor. Please not the . at the beginning of the .bashrc filename. This makes the file normally hidden.

This is a fairly large file. Scroll down to the end of the file, and at put down the next two lines:

echo Running at boot
python /home/pi/radio.py


Then press CTRL-O to save the file and CTRL-X to quit the Nano editor.

You can alter python /home/pi/radio.py in any program you want to start when the Pi boots.

Reset the Pi with:

Sudo reboot now

And the Pi will reboot and automatically runs your program.

That's all for now

Till next time
Have fun

Luc Volders

Friday, August 22, 2025

Dweet.cc with MicroPyton

For an index to all my stories click this text

After my story about Dweet.cc and Freeboard I got some mails from readers of that wanted to know how to send data to Dweet.cc and retrieve data from Dweet.cc with MicroPython.

Well here we go.

Sending a dweet to Dweet.cc


The API call I used to send a temperature value to Dweet.cc with the thingname lucstechblog is as follows:

https://dweet.cc/dweet/for/lucstechblog?temperature=25

To use that API call in a MicroPython program you can use the following code: 

import network
import urequests

# Router credentials
ssid = "YOUR_ROUTER_NAME"
pw = "PASSWORD"
print("Connecting to wifi...")

# wifi connection
wifi = network.WLAN(network.STA_IF) # station mode
wifi.active(True)
wifi.connect(ssid, pw)

# wait for connection
while not wifi.isconnected():
    pass

# wifi connected
print("Connected. IP: ",str(wifi.ifconfig()[0], "\n"))

# Replace 'lucstechblog' with your actual thing name
# Replace valuename with the name of the value you are sending
# Replace value with the actual value
thingname = 'lucstechblog'
valuename = 'temperature'
value = 25
value = str(value)

url = 'https://dweet.cc/dweet/for/'
url = url + thingname
url = url + "?"
url = url + valuename
url = url + "="
url = url + value

response = urequests.get(url)
print(response.text)
response.close()



That is it.

Put this code in Thonny and press the "run" button. And you will get the next response in the shell:



Of course your IP address will be different.
The response clearly states that the command had succeeded.

I will break the most important part of the code down here for you.

thingname = 'lucstechblog'
valuename = 'temperature'
value = 25
value = str(value)

These are the variables that need to be send to Dweet.cc

I used lucstechblog for the thing name but please use your own thing name. You can choose any name you want but best practice is to make it relevant.
Please be aware that we are sending a public dweet. So anybody in the world that sends a dweet with the same thing name will alter your value.

Then there is a valuename. I used temperature but use something significant like "kitchen-temperature" or "mancave-temperature". For a single dewwt this looks irrelevant but wait till you build a complete home automation system with this.

And then there is the value itself.
If the value is a number (integer or floating point) like in this example you need to convert it into a string like this example shows.

url = 'https://dweet.cc/dweet/for/'
url = url + thingname
url = url + "?"
url = url + valuename
url = url + "="
url = url + value

This is the code that combines all variables into the api call. Just make sure to incorporate the "?" after the thingname and the "=" after the valuename.

I split the code up like this so you can easily put this in your own program and replace the variable names into your own names.

Retrieving a value from Dweet.cc

The code for retrieving a value from the Dweet.cc server is:

https://dweet.cc/get/latest/dweet/for/my-thing-name

In this example it would be:

https://dweet.cc/get/latest/dweet/for/lucstechblog

Let's translate this in a MicroPython program.

import network
import urequests
import ujson

# Router credentials
ssid = "YOUR_ROUTER_NAME"
pw = "PASSWORD"
print("Connecting to wifi...")

# wifi connection
wifi = network.WLAN(network.STA_IF) # station mode
wifi.active(True)
wifi.connect(ssid, pw)

# wait for connection
while not wifi.isconnected():
    pass

# wifi connected
print("Connected. IP: ",str(wifi.ifconfig()[0], "\n"))

# Replace 'my-thing-name' with your actual thing name
thing_name = 'lucstechblog'

url = 'https://dweet.cc/get/latest/dweet/for/'
url = url + thing_name

response = urequests.get(url)
print(response.text)
response.close()

And here is the important part for this program:

url = 'https://dweet.cc/get/latest/dweet/for/'
url = url + thing_name

I splitted the api call in two parts. The first part is the general part and the second part adds your thingname. That is the variable you just created.

And this would gain the following response:




So this proves that it worked.

Decoding the JSON response.

So now we know that this works. However the response is JSON code. And unfortunately that is not direct usable in our program.

Suppose you want to display the temperature on an oled screen, or build a physical thermometer pointer with a servo, or use a bunch of neopixels to display the value like an old-school thermometer.
The JSON code would certainly not be suitable as a value we can work with. We have to decode it.

Here is the complete program that rertrieves the dweet and extracts the value.

import time
import network
import urequests
import ujson

# Router credentials
ssid = "Ziggo2903181"
pw = "ptzbB2ohKbgs7agp"
print("Connecting to wifi...")

# wifi connection
wifi = network.WLAN(network.STA_IF) # station mode
wifi.active(True)
wifi.connect(ssid, pw)

# wait for connection
while not wifi.isconnected():
    pass

# wifi connected
print("Connected. IP: ",str(wifi.ifconfig()[0], "\n"))

# Replace 'my-thing-name' with your actual thing name
thing_name = 'lucstechblog'

#url = 'http://192.168.178.62:8000/get/latest/dweet/for/Kit-pow'
#url = 'http://dweet.me:3333/get/latest/yoink/from/Man-temp'

url = 'https://dweet.cc/get/latest/dweet/for/'
url = url + thing_name

response = urequests.get(url)
print(response.text)

print ("============================================")
# Parse the JSON string
data = ujson.loads(response.text)

# Extract the temperature value
tempvalue = data["with"][0]["content"]["temperature"]

# Display the result
print("Temperature is:", tempvalue)

The important parts are these:

data = ujson.loads(response.text)

We create a variable that decodes the JSON response in its individual parts

tempvalue = data["with"][0]["content"]["temperature"]

There we extract the temperature value and put it into the tempvalue variable.

print("Temperature is:", tempvalue)


And this is where we print the actual value in the shell.

If your JSON code looks different you can use a JSON decoder of which there are several on the internet.

Now the value is stored into the tempvalue variable we can use it for our project.

Decoding JSON structures is a bit puzzling.


Click here to buy my book on the Raspberry Pi Pico W

But then you could buy my book on MicroPython with the Raspberry Pi Pico W that explains it in detail and shows how to get help from a JSON decoder.


Till next time
Have fun

Luc Volders