tech explorers, welcome!

Category: Raspberry Pi

Case + OLED display for Raspberry Pi with status panel

I was tempted to just switch cases from my Raspberry Pi 4 to the Raspberry Pi 5, but look at it…

  • 16×2 LCD display from an Arduino Starter Kit
  • C++ program with the WiringPi library
  • DIY case

I was really proud of it at the time and it was good learning back in 2020, but surely I could do better. Surely I could do a cool status panel!!

Components

  • Raspberry Pi (probably compatible with any of them)
  • OLED display (RGB 1.5 inch size is ideal)
  • PCB prototype board
  • Jumper cables
  • Soldering iron
(courtesy of epiCRealism model in ComfyUI)
  • Casing (3D printed or handcrafted)

Software config

I'll configure the Raspberry to interact with this display using python, with the Adafruit Circuitpython library for the SSD1351 display controller:
https://learn.adafruit.com/adafruit-1-5-color-oled-breakout-board/python-wiring-and-setup#setup-3042417

It's as simple as installing Circuitpython with the following command:

sudo pip3 install --upgrade click setuptools adafruit-python-shell build adafruit-circuitpython-rgb-display

If you find issues with your python version not finding a compatible circuit python version, include --break-system-packages at the end. (It wont break anything today, but don't get used to it...)

sudo pip3 install --upgrade click setuptools adafruit-python-shell build adafruit-circuitpython-rgb-display --break-system-packages

Wiring

Now wire your display according to the manufacturer guidance. Mine is this one from BuyDisplay:

https://www.buydisplay.com/full-color-1-5-inch-arduino-raspberry-pi-oled-display-module-128x128

OLED DisplayRaspberry Pi (pin #)
GNDGND (20)
VCC3V3 (17)
SCLSPI0 SCLK (23)
SDASPI0 MOSI (19)
RESGPIO25 (22)
DCGPIO 24 (18)
CSSPI0 CE0 (24)

Use a site like pinout.xyz to find a suitable wiring configuration.

You're ready to do some tests before making your final move to the PCB.

Script config

You can try Adafruit's demo script. Just make sure that you choose the right display and update any changes to the ping assignment (use IO numbers/names rather than physical pin numbers):

# Configuration for CS and DC pins (adjust to your wiring):
cs_pin = digitalio.DigitalInOut(board.CE0)
dc_pin = digitalio.DigitalInOut(board.D24)
reset_pin = digitalio.DigitalInOut(board.D25)

# Setup SPI bus using hardware SPI:
spi = board.SPI()

disp = ssd1351.SSD1351(spi, rotation=270,                         # 1.5" SSD1351
    cs=cs_pin,
    dc=dc_pin,
    rst=reset_pin,
    baudrate=BAUDRATE
)

Assembly

Here are the STL 3D files for this case design:

Now let's put it all together:

  1. Screw the frame to the display
  2. Solder the 7 pins of the display to 7 jumper cables across the PCB
  3. Wire all connections to the Raspberry Pi
  4. Screw the top and bottom pieces together
  5. Place the display on the support

Final result

I've shared the script you see on the images via github:

https://github.com/TheRoam/RaspberryPi-SSD1351-OLED

It currently displays:

  • Time and date
  • System stats (OS, disk usage and CPU temperature)
  • Local weather from World Meteorological Organization (updated hourly)

And this is how it ends up looking. Much better right?

As always, enjoy your tinkering, and let me know any comments or issues on Twitter!

🐦 @RoamingWorkshop

Move your Raspberry Pi into a new SD card.

There are plenty of lenghty explanations around the web on how to clone a Linux OS onto a new device, but I came through this great tool on my Pi which reduces it to a few minutes and no typing at all.

It is a built-in “SD Card Copier” which you can use to regularly backup your OS, or upgrade your file system to a larger SD card, which is my case.

1. Setup.

As mentioned, I want to move my Raspbian OS to a larger and faster SD card. Both cards need to be accessible on your Pi, so I got it set up like this:

  • Raspberry Pi 4B with Raspbian 10 Buster
  • 32Gb SD card on Pi's SD card slot.
  • 128Gb fast SD card on USB adapter via Pi's USB
  • For a backup, you can plug in a USB stick and transfer the backup onto it.

We will be using the "SD Card Copier" or "piclone", which should be built-in but you can install it on Raspbian via:

sudo apt-get update

sudo apt-get install piclone

[Not tested!] Piclone should work for other Linux distributions, if you're skillful enough to build all the required dependencies. In that case, you can access the github repository and follow the instructions there:

https://github.com/raspberrypi-ui/piclone

2. Transfer your OS via piclone.

Open the "SD Card Copier" either by finding the app launcher or via terminal, and make sure you have superuser permissions:

sudo piclone

The software is very simple and just looks like this:

Select each device from the drop down lists, and click "Start".

After a little while you will have a bootable copy of your current OS.

Help documentation mentions a 10-15minutes wait, but it took quite longer as it depends on your storage size.

3. Launch your new card.

Finally:

  • shut down your Pi
  • swap cards, and
  • check it is all up and running
  • with the upgraded storage
Using GParted to check the new partition details

Spotify for Raspberry without Premium

Blocking page when accessing Spotify via Firefox ESR or Chromium

You would have thought that you could just plug your Raspberry Pi to your monitor and play some background music on Spotify through your browser from the usual open.spotify.com. Well, you probably found the message above and ran in circles for a while until you got here. Glad I can help!

Increased security on Spotify makes it only available via 64bit versions of Chrome, Firefox and Edge which restrict hacking and fraudulent streaming without a premium account.

Premium.

If you have a premium account, go the easy way and make use of one of the apps available like Raspicast (to stream from your phone), Raspotify and spotify-qt, which will grant you access to your music with some little config.

spotify-qt from snapcraft.io

Non-Premium.

For those of us who love listening to ads (and not paying a buck), the journey is not that hard. We just need to install the Widevine library:

sudo apt-get install libwidevinecdm0

Then we reboot the system and access open.spotify.com via Chromium.

Log in and you should see the usual interface without the previous annoying message.

Lastly, we can install a shortcut in our desktop using the button in the navigation bar. And that´s it! Now you can fully enjoy Spotify on your Raspberry!

Spotify web in Chromium Browser for Raspberry Pi

Any issues or comments, let me know via Twitter 🐦! See you soon!

🐦 @RoamingWorkshop