Pi Recipes

We have a number of Raspberry Pi's around our home and family. The little system has been deployed to simplify techno-life, entertain or integrate household technology. This collection of Pi Recipes is maintained to help with builds/rebuilds and may range from half-baked concepts to step-by-step procedures, typically for my own pursuit, but possibly of interest to others. Pi recipes will slowly be migrated to this site from good old Ventures.TPedersen.net as needed, hopefully saving anything important before Google Transitions everyone to 'New' Sites.


Pi Recipes


Half Baked

  • PanelPi - Integrate hardwired home security sensors into smart home - VERY Early Stages (see below)

  • SmartiePi - Grandbaby is all grown up (4!), time for her first computer! - Early Stages

  • OccuPi - Remote controlled kiosk-like gizmo for my parents TV - Stalled (see below)

  • <more below>


Half-Baked

(Works in process, likely VERY unsettled)

CutiePi V4 Collection [Early]

A few links at this point ... my bookmarks are a mess

https://github.com/mental32/spotify.py

https://getuikit.com/

Related: Murmer Server for Push4Papa testing

Also: Dietpi possibilities for V4



TightVNC Server [Looks OK]

Bottomline: This MAY work if I need it ... more putzing to do to get it installed and not as full featured as rpi default vnc server (realvnc).


Considerations/ToDo's
- XP lookswitcher (XPQ4 Desktop) does not show in remote session (I'm probably NOT in the session I'd like to be)
- Below includes definitions for systemd service but I think I'd just fire this up via CLI on an as needed basis
- I still need to double check that it works via remote.it (remote control gizmo I use)

-------

Motivation: Struggling with stock (RealVNC) vncserver on latest GramPi rebuid ... thought I'd try TightVNC for the heck of it

Rough notes as I go ... Working with Q4OS, but I'd guess this will work on RaspiOS too

TightVNC looks to be GPL, actively maintained and has been around for a long time (> 10 years).

Most doc seems to be focused on windoze, but this guy posted a RPi step-by-step

Notes as I go in case I need to retrace my steps

  1. Turned off stock VNC Server via sudo raspi-config -> Interface Options -> Disable VNC

  2. Install via sudo apt-get install tightvncserver (this did remove package realvnc-vnc-server)

  3. Initial run of vncserver to setup passwords ... it went a little like this ...

    vncserver

    You will require a password to access your desktops.
    Password:
    Verify:
    Would you like to enter a view-only password (y/n)? n
    New 'X' desktop is GramPiV2:1
    Creating default startup script /home/pi/.vnc/xstartup
    Starting applications specified in /home/pi/.vnc/xstartup
    Log file is /home/pi/.vnc/GramPiV2:1.log

  4. Create service per devdude's example, it looks like this:
    cat /etc/systemd/system/vncserver.service


[Unit]
Description=TightVNC Server
After=network.target

[Service]
Type=forking
User=pi
ExecStart=/usr/bin/vncserver :1
ExecStop=/usr/bin/vncserver -kill :1

[Install]
WantedBy=multi-user.target

  1. Enable the service to get links built and such ... like this

sudo systemctl enable vncserver

systemctl status vncserver

● vncserver.service - TightVNC Server

Loaded: loaded (/etc/systemd/system/vncserver.service; disabled; vendor preset: enabled)

Active: inactive (dead)

pi@GramPiV2:~ $ systemctl enable vncserver

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-unit-files ===

Authentication is required to manage system service or unit files.

Multiple identities can be used for authentication:

1. pi

2. root

Choose identity to authenticate as (1-2): 1

Password:

==== AUTHENTICATION COMPLETE ===

Created symlink /etc/systemd/system/multi-user.target.wants/vncserver.service → /etc/systemd/syste

m/vncserver.service.

==== AUTHENTICATING FOR org.freedesktop.systemd1.reload-daemon ===

Authentication is required to reload the systemd state.

Multiple identities can be used for authentication:

1. pi

2. root

Choose identity to authenticate as (1-2): 1

Password:

==== AUTHENTICATION COMPLETE ===

  1. Tested via screen sharing on macbook and tigervnc viewer on linux ... seems to work
    some notes ...
    - port is 5901
    - not as full featured as realvnc






FlypaperPi (Honeypot) [Interesting]

Playing w/ OpenCanary Honeypot ... this is a mess/work-in-process

Sing-a-long w/ https://github.com/thinkst/opencanary#readme but ....
.... watching this one as I do: https://simpaul.com/opencanary-on-a-pi-quick-setup/

Step by step (notes to self)

RPIOS - lite is fine, usual setup: update/upgrade, rpi-config: pw, hn, local/kb, yada/yada

Switch to Ubuntu 20.04 LTS 32-Bit for 3 reasons - NOPE! That came out badly

From guide ....

  1. OS Tweaks: Set interesting Mac Address (per Paul's guide) ... add "smsc95xx.macaddr=<enticing mac>" to cmdline.txt

  2. Python Prep is a combo Open Canary Guide & Paul's (Including samba and scapy/pcapy because I want it all!)
    sudo apt-get install python3-dev python3-pip python3-virtualenv python3-venv python3-scapy libssl-dev libpcap-dev
    sudo apt install samba # if you plan to use the smb module

  3. Back to Paul's guide - looks like he skipped virtual env this go round ... sounds simpler

pip3 install --upgrade setuptools
git clone
https://github.com/thinkst/opencanary
cd opencanary
sudo apt-get install libffi-dev # Paul may have missed this one, fatal err missing
sudo python3 setup.py install

  1. Set up a couple of links ... from Paul's guide but check version of scripts directory in copy below ... his were 3.7, mine are 3.9
    sudo link /usr/local/bin/twistd /home/pi/opencanary/bin/twistd
    sudo cp ./build/scripts-3.9/opencanary.tac /usr/local/bin/opencanary.tac

  2. Back to Opencanary guide for this part ... it did generate config file for me
    $opencanaryd --copyconfig
    [*] A sample config file is ready /etc/opencanaryd/opencanary.conf
    [*] Edit your configuration, then launch with "opencanaryd --start"

  3. Edit /etc/opencanaryd/opencanary.conf ... I just poked around initially - Banners

  4. Fire it up ... see if it runs foreground
    opencanaryd --dev

  5. Couple of warnings to cleanup from initial run ...

<clip>
UserWarning: You do not have a working installation of the service_identity module: 'No module named 'service_identity''.
Please install it from <https://pypi.python.org/pypi/service_identity> and make sure all of its dependencies

are satisfied. Without the service_identity module, Twisted can perform only rudimentary TLS client hostname verifica

tion. Many valid certificate/hostname mappings may be rejected.

I'm a good guesser ... closed my eyes and fixed this via ...
pip3 install service_identity

  1. Turn it into a service so it starts on boot (thx again, Paul)
    File /etc/systemd/system/opencanary.service created, it now contains:

[Unit]
Description=OpenCanary honeypot

After=syslog.target

After=network.target


[Service]

User=root

Restart=always

WorkingDirectory=/home/pi/opencanary

ExecStart=/home/pi/opencanary/bin/opencanaryd --dev


[Install]

WantedBy=multi-user.target

  1. Fire it up ...
    sudo chmod 644 /etc/systemd/system/opencanary.service
    sudo systemctl enable opencanary.service
    sudo systemctl start opencanary.service
    sudo systemctl status opencanary.service

  2. Boot ... to see what happens

enough for now ...

-----------------

Leftovers to deal with
pip install scapy pcapy # optional

Install fail that forced me to install libffl h

Whoops! that failed
No package 'libffi' found
c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
15 | #include
<ffi.h>
| ^~~~~~~


Samba install output (in case I need it)

Setting up samba (2:4.13.13+dfsg-1~deb11u3) ...

Adding group `sambashare' (GID 125) ...

Done.

Samba is not being run as an AD Domain Controller: Masking samba-ad-dc.service

Please ignore the following error about deb-systemd-helper not finding those services.

(samba-ad-dc.service masked)

Created symlink /etc/systemd/system/multi-user.target.wants/nmbd.service → /lib/systemd/system/nmbd.service.

Failed to preset unit: Unit file /etc/systemd/system/samba-ad-dc.service is masked.

/usr/bin/deb-systemd-helper: error: systemctl preset failed on samba-ad-dc.service: No such file or directory

Created symlink /etc/systemd/system/multi-user.target.wants/smbd.service → /lib/systemd/system/smbd.service.

samba-ad-dc.service is a disabled or a static unit, not starting it.

Processing triggers for man-db (2.9.4-2) ...

Processing triggers for libc-bin (2.31-13+rpt2+rpi1+deb11u2) ...



MonitorPi or ContainmentPi [Good One!]

This one is turned into SentinelPi - original notes/fumbling/flailing moved over there

WiFi Bootstrapping : Comitup+Dietpi [Works!], Comitup+Q4OS [TBD]

I often make Pi's for others - pre-configuring them for WiFi in someone else's home is a pain in the drain!

Gave Comitup a quick once over - there was a downloadable image @ https://davesteele.github.io/comitup/. It looks to be JUST what I need AND it WORKS!

Posted experiences with the downloadable image (RaspOS that boots up with Comitup) in Raspberry Pi OS Alternatives.

I am currently exploring installing/incorporating Comitup packages into my projects as opposed to starting with the image because I use a variety of OS underpinnings - Q4OS, DietPi, Manjaro ... it (comitup-1.15-1) seems to be in latest RaspOS which should allow me to apt-get install on everything except Manjaro. I don't see it in Manjaro or Arch AUR

  1. Dietpi+Comitup:

    • Downloaded Dietpi ARMv6 32-bit. Uses the Raspbian package repository which provides comitup for install!

    • Booted on RPi4 to start with ... usual blow-by-blow

      • Auto updates itself & reboots - now at v8.3.1 - ~5min

      • Forced PW changes, disabled serial console

      • Dietpi config/software

        • Audio: Enabled, Sound card usb-dac (I'm going to mess with CutiePi enhancements)

        • Language/Regional: Locale en_US.UTF8, Timezone & us keyboard

        • Security: Set Hostname

        • Network/Adapters: Enable Wifi

        • Network/Other: Turned Off Boot wait for network (just to be safe)

        • Dietpi Software (season to taste: I installed stuff I want to live/play together): Shairport, Murmur, Raspotify, RPI.GPIO, python3, go, ALSA, GIT

      • Stuff I had to install by hand ... via ssh

        • My editor: good old joe - apt-get install joe

        • comitup from https://davesteele.github.io/comitup/ - apt-get install comitup
          // Whoops! WiFi was disabled by default in Dietpi, comitup choked during install - Make sure you add Network steps in dietpi-config above //

        • Whoops AGAIN! I forgot to RTFM @ https://github.com/davesteele/comitup/wiki/Installing-Comitup ... and I quote:

          • Allow NetworkManager to manage the wifi interfaces by removing references to them from /etc/network/interfaces.

          • Rename or delete /etc/wpa_supplicant/wpa_supplicant.conf.

          • The systemd.resolved service should be disabled and masked to avoid contention for providing DNS service.

          • The line dns=dnsmasq should not be in /etc/NetworkManager/NetworkManager.conf.

          • also changed default ssid in /etc/comitup/comitup.conf - now ap_name: <hostname>-<nnn>

        • I also added comitup to dietpi-services (right or wrong?)

        • comitup-cli is a useful command line tool here

    • Hey! It works!

  2. Q4OS+Comitup

    • <next in queue ... I'd think it would work, raspos-based>


PanelPi - Integrate hardwired home security sensors into smart home [Stalled]

Last Update - 21 July 2020

Here wee go again! PanelPi - A little Pi help to integrate old wired alarm system


*** VERY early in the project, this page is expected to be a mess for quite a while (as usual) ***


Background

PanelPi was initially cobbled together to explore sprucing up our wired home security system. Current plan is to integrate a number of hardwired sensors into our 'Smart' home. We'll see!

Software

  • Dietpi.com - My Favorite! Download latest RPI version (Donate!)

  • Etcher.io - Much easier way to flash OS images to SD

  • Couple of Software installs from DietPi's Optimised Software Collection

    • OpenSSH instead of Dropbear SSH Server. Supports SCP xfers

    • RPi-Monitor - Web interface system stats

    • RPi.GPIO - gpio interface library for rpi (python)

    • WebIOPi - web interface to control rpi.gpio

  • WebIOPi - web interface to control GPIO. Install by hand dietpi install fails

Hardware

Current Config

  • Raspberry Pi 1 Model B. Arm6 w/ Ethernet + two USB ports

  • EDIMAX USB WiFi adapter

  • Old/Original RPi Power Supply (1 amp!)

  • Really Old 8g Micro USB card

  • Multimeter, some hook clip test thingies (from my Burroughs days!!!)

Stuff to Explore


Step by Step (rough notes to self, I'll cleanup later)


Phase I - Pi in Panel.

Get Panel online - currently in Wifi deadspot. Use Webiopi to see what is going on with existing sensors.

  • Dietpi via etcher

    • dietpi-config - as usual - security, naming, etc

    • dietpi-software: Openssh + RPI-Monitor, RPi.GPIO from optimized software list

    • Don't forget my editor - apt-get install joe

  • Webiopi via instructions @ http://webiopi.trouch.com/INSTALL.html

    • Easiest to download via gui on main system and scp to PanelPi. Syntax:

    • scp WebIOPi-0.7.1.tar.gz root@panelpi:/home/WebIOPi-0.7.1.tar.gz

    • Via SSH:

      • Install (setup.sh took a looong time on RPi 1!)

      • $ tar xvzf WebIOPi-x.y.z.tar.gz

      • $ cd WebIOPi-x.y.z
        $ ./setup.sh

      • Fire it up to test

      • webiopi -d -c /etc/webiopi/config

    • Access via http://panelpi:8000

      • Default user/pw "webiopi"/"raspberry".

      • Change pw using webiopi-passwd

      • Check /etc/webiopi/config

    • Run a daemon

    • /etc/init.d/webiopi start/stop

    • Start at boot

    • update-rc.d webiopi defaults

    • <reboot> to get the witches out and to make sure it all comes up OK before disconnecting keyboard & monitorand moving to the panel!

  • Cleanup

    • RPi Monitor data.conf (no ethernet): Comment out network.conf, uncomment wlan.conf

    • Disable wifi powersave mode (iwconfig wlan0 power off DID NOT WORK)

      iw dev wlan0 set power_save off

    • Reboot with old PS, just to make sure it works!

  • Hardware Contraption

    • <coming soon>

Notes

- PanelPi will have to Wifi to SuitiePi - forgot to run Ethernet to panel area when I had wall out!!! Argh!

- remember to static route and reserve dhcp so I can find/access PanelPi on that subnet

- WebIOPI did not install via Dietpi ... attempting by hand

- RPi 1 Model B -> Install instructions @ http://webiopi.trouch.com/INSTALL.html

- RPi 2 and beyond (40pin GPIO) @ https://thepiguy.altervista.org/webiopi-rp3/

Log, Odd and Ends and fond memories


July 2020 - rebuild

  • Can't recall details but had to rebuild, Dietpi Buster

  • Decided to switch to RPI 1 Model B - good use for it

    • 26-pin GPIO is fine.

  • FINALLY traced my steps .... current recipe above


June 2020 - Back at it

  • Had to turn on WiFi reconnect in dietpi-config. I wonder if wifi is dowzing off, powersave?

downloaded attached a GPIO pinout leaf - We'll see if it helps, pretty small print for old eyes!

https://github.com/splitbrain/rpibplusleaf


- Ghazooks! To keep all this stuff going on our network remember the following.

  1. Add host to local DNS in protected router

  2. DHCP reservation in AP (SuitiePi), remember to change when hardware is swapped

  3. Static Route to PanelPi in ISP router


OccuPi - Remote Controlled Full Screen Kiosk-Like thingy [Stalled]

Moved to tech.tpedersen.net Feb 2022. Cut'n Paste from 'Classic' Google site page @ http://ventures.tpedersen.net/errata/raspberrypi/occupi ... VERY STRANGE, this page pasted into new sites quite well, PanelPi was a total mess!


OccuPi - Remote Controlled Full Screen Kiosk-Like thingy

Last update: 09 October 2020

Original 15 September 2020


VERY EARLY Stages, this page will be a mess as I stumble thru this ...


The Goal is to build a little Pi that will connect to my parents TV to allow me to share (project) videos, web pages and such. Will be used during COVID-19 to keep them occupied over the winter months. More to come as this idea develops.


Notes/Updates

09 Oct: Struggling to find OS fast enough to use Google Streetview in Full Screen or Kiosk mode on a Raspberry Pi 3. It appears that I MUST run Chromium browser to pull this off. Have tried Arch, Dietpi and Raspbian lite. On to Chromium OS. Also created subordinate startpage to simplify testing ... we may end up with a simple webpage providing links to all activities,


25 Sept: General concept works very well, even had an old gyration remote control working with it. RaspOS was painfully slow on the RPi3. Switching to LXDE desktop from Dietpi to see how that runs. Dietpi has been my goto for servers, really haven't played with desktop.


Dietpi/Chromium kiosk is pretty slow. Friggin streetview map is upside down too! Added a startpage to facilitate adding activities/features without connecting to or messing with OccuPi system


Research/Reference

- https://blog.gordonturner.com/2020/06/30/raspberry-pi-full-screen-browser-2020-05-27-raspios-buster/

- https://www.instantstreetview.com/

- https://peter.sh/experiments/chromium-command-line-switches/

- Upside down google maps - https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=274315

- Bigscreen Project - https://plasma-bigscreen.org/

- Chromium OS - Image to try quickly here - https://github.com/FydeOS/chromium_os-raspberry_pi/releases

- Chromium remote desktop - https://remotedesktop.google.com/?pli=1

- Puffins OS - https://www.puffin.com/raspberry-pi/ - Install


Software


- Stock RaspOS - Raspberry Pi OS (32-bit) with desktop to start

- Switching to Rspbian via Dietpi


Hardware

- RPi 3

- 16g

- Old Gyration MCE Remote!


Dietpi Setup Notes

  • Diepi-config ... minimal work here, let software packages tweak as needed

    • Language/Regional: en_US.UTF-8, set TZ and US Keyboard

    • Security: Set Hostname

    • Autostart: Try Chromium under browser kiosk! - NOT YET!

  • dietpi-software

    • [X} Chromium: web browser for desktop or autostart

    • [X] RealVNC Server: desktop for remote connection

    • [X] Remot3.it: (Weaved) access your device over the internet

    • REMEMBER to select START INSTALLATION!

  • NOW back to diet-pi-config

    • Autostart: Chromium under browser kiosk!



----------- RaspOS aborted for now - Save in case I fallback -----------

Steps (raspos)

  • Etcher

  • New RaspOS (or whatever) resizes & does a GUI setup on first boot

    • Set Language, Timezone and keyboard

    • Forces user pi password change

    • Screen Setup - gets rid of boarder

    • WiFi Connect (if needed)

    • Software Update - But .... "Error Comparing Versions" - Nice try!

    • <Attempted reboot ... but I wasnt read!>

    • Via Terminal - sudo raspi-config

      • Boot Options

        • Desktop w/ Autologin Pi

        • Wait for Network

        • Graphical Splash Screen

      • Interfacing Options

        • SSH Enable (for remote me!)

        • VNC Enabled (for remote me!)

    • Couple of Installs

      • Joe - my editor of choice -> sudo apt-get install joe

      • remote.it - Remote Control software (nice)

        • sudo apt-get install remoteit (to install)

        • http://occupi.local:29999 (to config - sooo nice!)

    • Now Attempt Full Screen Browser ...
      from
      https://blog.gordonturner.com/2020/06/30/raspberry-pi-full-screen-browser-2020-05-27-raspios-buster/

      • Finally learning to follow directions!

      • sudo apt-get update -y

      • sudo apt-get upgrade -y
        sudo apt-get dist-upgrade -y
        sudo apt-get autoremove -y

      • Install Dependencies

      • sudo apt-get install -y ttf-mscorefonts-installer unclutter x11-xserver-utils


      • According to guide:
        ttf-mscorefonts-installer adds common web fonts
        unclutter is used to hide the mouse cursor
        x11-xserver-utils installs xset, which is used to disable screen blanking




SmartiePi - First Computer for 4-5 Year Old [Looks pretty good]

Moved to tech.tpedersen.net Feb 2022. Cut'n Paste from 'Classic' Google site page @ http://ventures.tpedersen.net/errata/raspberrypi/smartiepi ... did not paste in very well!

SmartiePi - First Computer for 4-5 Year Old

Last update: 05 March 2021

Original 18 February 2021


ANOTHER project in VERY EARLY Stages, this page will be a mess as I stumble thru this ...


Goal here is a build an educational, 'First Computer' for our grandchild. Age range will be 4-10ish, with a vision of a complete system - keyboard, monitor/sound, mouse/trackpad and an operating environment that will introduce personal computing while working through educational software/apps. Basically a step up from good old CutiePi. More to come as this idea develops.


Notes/Updates

Feb 2021: New Project: Will start with a Raspberry Pi (3+) with GCompris loaded up. See what we have

Software

- Raspberry Pi OS *or* DietPi

- gcompris-qt


Hardware

- RPi 3+

- 32g SD

- Logitech K400r Keyboard/Trackpad*

- Small Monitor


Activity Log

(Flaky $hit Highlighted - Fixed Stuff)


March 2021: Pushing on! Prototype looked pretty good!

  • Tested GCompris on a RPi4 running RaspOS - it worked GREAT! A LOT better than RPi 3+

    • Even background music via HDMI

    • The question will be whether an RPi 4 will live in CutiePi world without burning up
      ... Pi-EzConnect HAT sits right on top of HAT, room for fan?
      ... We'll have to open the window shutters and door on the
      Lego Cottage Case, that's for sure

  • Prototype: Added a keyboard and monitor to CutiePi V3, installed desktop (WM) and GCompris

    • Here's what worked

      • Software: Dietpi (w/ Shairport-Sync & LXQT Desktop) + GCompris and CutiePi_V3 (gpio & pygame)

      • Hardware: RPi 3+, CutiePi GPIO Buttons/Lights, Logitech k400 keyboard/trackpad and HDMI monitor

    • Stuff to research/work on

      • No background Music - not sure if it was GCompris or PulseAudio not getting along with ALSA

      • SLUGGISH! Too much for RPI3+? or something with DietPi/LXQT

February 2021: Initial attempts

  • Minor update ... currently exploring adding lightweight desktop and gcompris to CutiePi. IF everything gets along together - dietpi, shairport-sync, my CutiePi script and desktop with gcompris. May work well, simply add monitor and bluetooth keyboard/trackpad to CutiePi !!!! Some notes ...

    • Installed lxqt desktop on cuitepi - getting a little crowded in there!

    • libpulse-mainloop-glib0 was not in dietpi software library ...
      Find name via "apt-cache search libpulse-mainloop"
      Package installed OK via "apt-get install libpulse-mainloop-glib0"

    • Sound issues!! Pulse seems to work, but gcompris doesn't play any sounds

    • <more to come>

  • Attempt#2: Installed RaspOS to be safe - 1st time using Raspberry Pi Imager from AUR (Nice!)

    • Download via https://www.gcompris.net/downloads-en.html ... RPi is Beta

    • Copied and 'Installed' to new gcompris directory (or it will end up installing under Downloads)

    • Hmmm ... gcompris-qt.sh says:

    • gcompris-qt: error while loading shared libraries: libpulse-mainloop-glib.so.0: cannot open shared object file: No such file or directory

      • I'd guess Pulse Audio! Installed Pulse Audio Emulation (apulse-0.1.12-2 to be specific)

      • Nope! It was PulseAudio Client libraries (glib support) - Package that needed to be installed was called libpulse-mainloop-glib0-12.2-4+deb10u1+rp3 - imagine that!

    • Wow! Gcompris looks amazing! I may simple connect a Monitor & Keyboard/Trackpad to CutiePi to see how everything gets along!

    • <maybe more to come>

  • Attempt#1: GCompris install on top of my goto operating environment - Dietpi w/ MATE
    Bad Idea! GCCompris is a QT-Based world that is not in package form - installed via scripts