Raspberry
Raspberry Pi
Miscellaneous
- Raspberry pi quick start guide
- Learn and make resources from raspberrypi.org.
- Lifehacker's Complete Guide to Raspberry Pi
- http://elinux.org/RPi_Hub
- http://www.raspberrypi-spy.co.uk/
- wifi setup
# /etc/network/interfaces file auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp allow-hotplug wlan0 wpa-ssid "YOURSSID" wpa-psk "YOURPASSWORD
- video player: omxplayer videofile.mp4. See also the Android app OMX Remote (Raspberry Pi).
- force sound output from analog
- mp3 player: mpg321 "my file.mp3". See https://sites.google.com/site/semilleroadt/home/raspberry-pi about testing sound on Raspberry Pi.
- raspberry pi server
- re-run configuration
- HTG guide to getting started with Raspberry Pi
- A month with raspbian and my Beaglebone page about how to fix/change date/time.
- My youtube video demostrating GPIO function.
- N900 as a remote display
- Use Raspberry Pi behind a proxy http://www.raspberrypi.org/phpBB3/viewtopic.php?f=63&t=13986
- May 2013 issue of Linux Journal
- check current temperatury and cpu freq or this one which contains other RaspPi tricks.
cat /sys/class/thermal/thermal_zone0/temp
This is similar but not the same as the Udoo case where it uses cat /sys/devices/virtual/thermal/thermal_zone0/temp
USB HID keyboard
- Human interface device/HID
- What Is a Human Interface Device (HID)?
- Arduino Uno Into Usb Keyboard. Convert arduino uno into usb mouse or keyboard emulator.
- Macro keyboard from amazon. Ecarke USB Mini 3-Key Keypad
Pico
- https://www.raspberrypi.org/documentation/pico/getting-started/
- Raspberry Pi Pico - USB HID Auto Clicker with Circuit Python. How to use the USB HID on Raspberry Pi Pico with circuit python.
- Using Raspberry Pi Pico as Hid Device to control Mouse and Keyboard
- What Is a Raspberry Pico W and What Can You Use It For?
- Raspberry Pi Pico isn’t a “raspberry” device
- Pi zero vs Pi pico
- Raspberry Pi Pico vs Zero: The Differences | All3DP. One is MCU and the other is SBC.
- Pros of Pico over zero Everything about the Raspberry Pi Pico Feb 2022
Pi zero
- Turn Your Raspberry Pi Zero into a USB Keyboard (HID)
- USB Keyboard Emulation with the Raspberry Pi Zero
- Key Mime Pi: Turn Your Raspberry Pi into a Remote Keyboard
R
Cracking the Code: Unveiling the Hidden Language of USB HID Keyboards!
uname
Install 32 bit Raspberry Pi OS
$ uname -a Linux raspberrypi 6.1.21-v7+ #1642 SMP Mon Apr 3 17:20:52 BST 2023 armv7l GNU/Linux $ cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)" NAME="Raspbian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=raspbian ID_LIKE=debian
Play mp3/mp4
use omxplayer. To control volume
omxplayer -o local --vol -2000 Song_Title.mp3 # 10% omxplayer -o local --vol -602 Song_Title.mp3 # 50%
Get social: connecting with Raspberry Pi
https://www.raspberrypi.org/blog/connecting-raspberry-pi-social/
Why You Should Stop Using a Raspberry Pi for Everything
http://www.makeuseof.com/tag/stop-using-raspberry-pi-everything/
What is the Intel and AMD CPU equivalent of Raspberry Pi 4
Different generations
- https://en.wikipedia.org/wiki/Raspberry_Pi
- Raspberry Pi 1 B (512MB memory, 2x USB 2.0, ethernet 10/100 Mb/s, released 2012), Raspberry Pi model B vs B+
- Raspberry Pi 2 (released 2015. This has an identical form-factor to the existing Raspberry Pi 1 Model B+)
- Raspberry Pi Zero WH (released 2017)
- Raspberry Pi model 3B (released Feb 29, 2016).
- Raspberry Pi model 3B+ (released Mar 28, 2018). Better to use a power adapter with 5V/2.4A or better with 5V/3A. Raspberry Pi 3 Model B vs. 3 B+. Gigabit Ethernet, Dual-band 820.11ac Wi-Fi, Power over Ethernet (PoE).
- Raspberry Pi model 4B (released June 24, 2019)
Checking Your Raspberry Pi Revision Number & Board Version
cat /proc/device-tree/model
Raspberry Pi 4 Rev 1.2. How to tell the difference
Displayport connection
Does not work if I use a hdmi to displayport converter. In general, 'step up' is not working but 'step down' is OK. See discussion.
Write image to SD card
- dd command. The following tip is from zdnet where -p means to extract files to pipe (stdout). In my case, the status=progress option is not recognized.
unzip -p Image | dd of=/dev/sdX bs=4M iflag=fullblock oflag=direct status=progress
- pv command. Now You Can Write ISO Images To USB Disks Directly Using Pv Command In Linux
- GUI. Etcher.
- Raspberry Imager
Disk is write protected
It means the SD card is bad. My SD card is PNY 16GB Elite U1.
Create our own image
Make a self-healing raspberry pi: create a recovery partition. The goal is get the machine back to a clean install; particularly in the situation you don’t have access to another device to do the burning.
- Prepare your workspace: apt install
- Calculate the image size: fdisk
- Create the blank image: dd
- Partition the image: sfdisk
- Mount the images: losetup, partx, dd
- Configure and mount partitions: tune2fs, e2label, e2fsck, resize2fs, mount
- Set the boot partition: fdisk, nano
- Create the reset scripts: chmod, nano
- Fix fstab: cat
- Take a snapshot: dd, umount, losetup
- Burn and test: dd
- Physical reset
- Raspberry Pi recovery partition code and scripts
Modify a disk image to create a Raspberry Pi-based homelab May 2020. chroot, qemu-user-static, xz, arm-image-installer (for Fedora).
Remote access
https://www.raspberrypi.org/documentation/remote-access/access-over-Internet/
Several options are available if you don't want to forward your port, for example, Dataplicity.
Headless Raspberry Pi Setup and SSH access
PS. As of the November 2016 release, Raspbian has the SSH server disabled by default. You will have to enable it manually.
For headless setup, SSH can be enabled by placing a file named 'ssh', without any extension, onto the boot partition of the SD card.
For some reason, I got an error ssh: connect to host raspberrypi.local port 22: Connection refused or “No supported key exchange algorithms. One solution is to generate the keys again Or just wait a little longer for Raspbian to generate keys.
It is also useful to give Pi a new hostname (rpi1, rpi2, rpi3, ...). See Change the Hostname of your Pi.
raspi-config on headless Raspberry Pi
Yes, we can still run sudo raspi-config on headless pi.
Change the default password/allow weak password
Follow https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=7684, we can ignore checking the password strength (my own simple passwords can not pass when I use the raspi-config utility).
If I just use passwd to change the password, the password cannot be too short or simple. However if I use sudo raspi-config, it is fine.
If we like to allow weaker passwords, see here.
$ sudo su - ... # passwd pi ... # exit $
Note it is a good idea to save the password hint as a text file in the HOME directory in case I forget the non-default password. If I forget the password, I can pop out the SD card and insert it into another machine. Then all files can be seen.
Disable the Annoying SSH Password Warning on Raspberry Pi
- How to Disable the Annoying SSH Password Warning on Raspberry Pi (assume running on desktop)
- Remove SSH warning about default password (works on Raspberry OS Lite). sudo rm /etc/profile.d/sshpwd.sh
Raspbian is not asking for a password for the sudo command
- https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=97334 and search
- "by ripat"
- "by RaTTuS"
- https://raspberrypi.stackexchange.com/questions/33758/sudo-without-password-more-of-an-issue-on-apple
- https://www.raspberrypi.org/documentation/linux/usage/users.md
Assign .local domain to Raspberry Pi
Avahi Daemon = Bonjour = Zeroconf = UDP multicast
http://www.howtogeek.com/167190/how-and-why-to-assign-the-.local-domain-to-your-raspberry-pi/
So I can use ssh [email protected] to access RPi. Note the default name may change. This happened when I use a USB wifi dongle.
sudo apt-get update sudo apt-get install avahi-daemon # No reboot is necessary for raspberry pi ps -ef | grep avahi # avahi-daemon: running [raspberrypi-2.local] # Or look at the output sudo systemctl status avahi-daemon # from other machines or even Raspi itself ping raspberrypi-2.local
The idea was first discovered in Beaglebone.
Get the internal IP address
- 6 Ways to Find a Raspberry Pi's IP Address
- https://www.raspberrypi.org/documentation/remote-access/ip-address.md
# From another computer ping raspberrypi.local # Within raspberry pi hostname -I
Conky approach
https://www.novaspirit.com/2017/02/23/desktop-widget-raspberry-pi-using-conky/ and my conkyrc.
{Pre} $ sudo apt-get install conky -y $ wget -O /home/pi/.conkyrc https://raw.githubusercontent.com/novaspirit/rpi_conky/master/rpi3_conkyrc
I modify .conkyrc file and move NETWORK section to under the 'SYSTEM' section. I also change wlan0 to eth0 since I am using ethernet for connecting to internet.
We can test it by calling conky from the command line (run export DISPLAY=:0.0 if we are calling conky from SSH).
We could make conky running on boot by creating the following two files (+ reboot).
sudo nano /usr/bin/conky.sh
#!/bin/sh (sleep 4s && conky) & exit 0
sudo nano /etc/xdg/autostart/conky.desktop
[Desktop Entry] Name=conky Type=Application Exec=sh /usr/bin/conky.sh Terminal=false Comment=system monitoring tool. Categories=Utility;
Note that conky is using 10% CPU (one core) as I see from the htop command. After I remove unnecessary pulling of the system information, it reduces to 4.5% CPU. Another approach is to increase the polling period so that the application is not polling as often.
Note that the top processes shown on conky are not quite correct. The top command gives the top processes. I saw the inconsistency when I import a large database in MySQL.
Set up a static IP address
- /etc/static_ip.conf from one of partitions
- Setting up Raspberry Pi WiFi with Static IP on Raspbian Stretch Lite. Two files need to be changed.
- /etc/wpa_supplicant/wpa_supplicant.conf - take care of the wifi
- /etc/dhcpcd.conf - take care of a static IP
interface wlan0 static ip_address=192.168.1.88 static routers=192.168.1.1 static domain_name_servers=8.8.8.8
- https://www.raspberrypi.org/learning/networking-lessons/rpi-static-ip-address/ (works on debian stretch). The website is hosted on github. Just need to change /etc/dhcpcd.conf.
- https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/net_tutorial.md
- http://raspberrypi.stackexchange.com/questions/37920/how-do-i-set-up-networking-wifi-static-ip-address (works!)
- https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=140252
- https://discourse.pi-hole.net/t/how-do-i-set-a-static-ip-address-in-raspbian-jessie-using-etc-dhcpcd-conf/239 or https://www.jeffgeerling.com/blog/2017/setting-pi-hole-whole-home-adtracker-blocking
Show IP before login
https://askubuntu.com/a/797600
Add one line about eth0 to /etc/issue file. For example on Debian 10,
Debian GNU/Linux 10 \n \l eth0: \4{eth0}
Run Graphical App on remote computer: export DISPLAY
export DISPLAY=:0 application_name
Please note that when you close your SSH session, most of the time the remote application will close. If you want to disconnect from SSH but leave the application running, you need to launch it in a special way using something like screen (keeps the SSH session running in the background) or nohup, or another method. Here’s an example using nohup:
nohup application_name > /dev/null 2>&1 &
Under voltage
he red LED going out is an indicator that the supply voltage is too low. You should also see a small coloured square in the top corner of the screen. See the posts
- https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=102814&p=711578
- https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=103099&p=713298
Install minimal browser
Note that at the end of sudo make install, it will create an item in the menu -> Internet. From the installation output,
sudo install -g dialout web /usr/bin sudo install -g audio piradio /usr/local/bin sudo chmod +x /usr/local/bin/piradio sudo cp ./web.desktop /usr/share/applications sudo cp ./minimalwebbrowser.png /usr/share/pixmaps sudo cp ./web.1.gz /usr/share/man/man1 sudo cp ./web-omxplayer.sh /usr/local/bin sudo chmod +x /usr/local/bin/web-omxplayer.sh
Options for displays/monitors
8 Essentials to Keep in Mind When Choosing a Display for Your Raspberry Pi
HDMI screen resolution
If the screen size is small (i.e. you can see black margins on 4 sides), uncomment the line about disable_overscan=1.
# sudo nano /boot/config.txt disable_overscan=1
On my SainSmart 9" monitor, its native resolution 1024x600 is not supported by Raspberry Pi (/boot/config.txt). The resolution becomes 1280x720 if I don't modify anything.
However, there is a workaround on raspberry pi forum. This technique works on Ubuntu-Mate 15 and Raspbian Jessie versions. The two lines (hdmi_group and hdmi_mode) are quite mysterious on Raspbian Jessie but more clear on Ubuntu-Mate.
... #hdmi_ignore_edid=0xa5000080 hdmi_cvt=1024 600 60 3 0 0 0 hdmi_group=2 hdmi_mode=87 disable_overscan=1
HDMI CEC
Raspberry Pi: Power On / Off A TV Connected Via HDMI-CEC
HDMI monitor/display
- Official 7" touchscreen LCD 800x480. Element 14, Official Raspberry Pi 7″ Touch Screen LCD Display assembly guide – install and tips
- It works on my Samsung monitor S22C350 (1920x1080).
- SainSmart 7" LCD Display Touch Screen TFT Monitor from amazon or from sainsmart.com. 800x480. $39.99 no touch screen, or $49.99 w/ touch screen. Good reviews.
- 8" IPS LCD Screen with Driver Board Kit for Raspberry Pi$70 frames and support are included!
- 10.1 inch LCD Display 1366x768 HDMI/VGA/NTSC/PAL there are several issues (poor picture quality, flicker a couple times a second, Overheating, nothing appears on the display) reported in comments.
- 10" inch TFT LCD Display w/ HDMI+VGA+Video Driver Board for Raspberry Pi
- 7" TFT LCD Screen Display Monitor for Raspberry Pi B B+ HDMI Board w/ Clear Case
- 3.5 inch HDMI LCD touchscreen 3.5inch IPS display from waveshare. 480 x 320 (original) or 800x480 (follow their instruction) or DMT mode 9 800x600 60Hz (Raspberry Pi Configuration). For drivers, see
- spotpear.com. I save a copy of the tarball in my github. I use the latest 2019-04-19 Raspbian Stretch. Only the (3.5) HDMI LCD one works for enabling the touch function is sudo ./LCD35-HDMI-800x480-show (Note that using the full path will fail). Other commands such as ./LCD35B-show, ./LCD35B-show-V2 or ./LCD35-show does not work. The webpage said the instruction works for Raspbian/Ubuntu mate/RetroPie but it does not work on Ubuntu mate 18.04.2 (Bionic) (RPi will not be able to start).
- waveshare. The original website. It includes an instruction to calibrate the display. I save the file under my github. The instruction is to 1. unzip 2. cd xinput-calibrator_0.7.5-1_armhf 3. sudo dpkg -i -B xinput-calibrator_0.7.5-1_armhf.deb 4. Click Menu -> Preferences -> Calibrate touchscreen 5. Save the output shown on screen to a file /ect/X11/xorg.conf.d/99-calibration.conf (the directory needs to be created first) according to the screen's instruction. 6. Reboot.
- Power usage (with ethernet): 0.66 (lcd off), 0.86 (lcd on). Raspberry Pi 3 B+ is used here.
- Power usage (without ethernet): 0.56 (lcd off), 0.76 (lcd on), 0.86 (lcd on, wifi on), 1.0 (lcd on, wifi on, chrome)
- Tip of power the pi + LCD by PC USB port: turn off the wifi & unplug the ethernet cable before starting.
Move a Window Without Clicking the Titlebar
Move a Window Without Clicking the Titlebar in Ubuntu. Hold down either the Control, Alt, or “Win” key then click in the window anywhere, and move your mouse.
For Windows see How to Move Off-Screen Window back On-Screen in Windows 10
Use VNC Connect
Raspbian shipped with VNC connect. We can use Android or iOS to connect to the Raspbian desktop.
Make your own screen from an old laptop
See the Hardware page.
Audio output
https://www.raspberrypi.org/documentation/configuration/audio-config.md
Method 1 (works on Raspbian or Ubuntu)
amixer cset numid=3 1
Method 2 (works only on Raspbian)
sudo raspi-config
Select Option 8 Advanced Options and hit Enter, then select Option A6: Audio and hit Enter.
Method 3. Edit /boot/config.txt and setting hdmi_drive variable or hdmi_ignore_edid_audio variable. See the Raspberry Pi config.txt web page.
Capacitive touch vs resistive touch
https://techexplainer.wordpress.com/2012/04/02/resistive-vs-capacitive-touchscreen/
Resistive touch is used in low cost products. It does not support multi-touch.
The official Raspberry Pi DSI touch display & the Kivy library
- https://www.raspberrypi.org/blog/the-eagerly-awaited-raspberry-pi-display/. There are two videos demonstrating the (multipoint) touch functionality using Kivy (Python GUI development system) library on the website.
- How to build your own smart coffee machine
800×480 display @60fps, 24-bit colour, FT5406 10 point capacitive touchscreen, 70 degree viewing angle, Metal-backed display with mounting holes for the Pi
Adafruit touch screen for Raspi
- PiTFT Assembled 320x240 2.8" TFT $35
RCA video output resolution
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=29&t=47527
KVM over IP
- KVM over IP/KVM switch
- Pi-KVM
Playing DRM videos in chromium browser
How to build a $100 productivity PC with a Raspberry Pi 4
Hardware acceleration video player
Use omxplayer not VLC. When I use omxplayer to play mp4 videos, htop shows CPUs are not used and the playback is quite smooth. VLC will have a hard time playing the mp4 videos (black screen) not to say all 4 cores are 100% busy on Raspi2. Raspberry Pi software update brings VLC media player with hardware-accelerated video playback
- http://elinux.org/Omxplayer
- http://kodi.wiki/view/Raspberry_Pi_FAQ
- Minimal Kiosk Browser: Kweb - Fast Reliable Web Browser for Raspberry Pi PC.
- Linux command to query video driver
- How To Enable Hardware Acceleration In Chromium On Raspberry Pi OS (RPi 4)
lspci -nnk | grep -i vga -A3 | grep 'in use'
It shows 'nouvea' for my PC Desktop which uses NVIDIA gpu. The command does not work on my Ubuntu-Mate.
pi@pi-ubuntu:~$ lspci -nnk | grep -i vga -A3 | grep 'in use' pcilib: Cannot open /proc/bus/pci lspci: Cannot find any working access method.
Chromium
How To Enable Hardware Acceleration In Chromium On Raspberry Pi OS (RPi 4)
Memory
When I use 'free -m' or 'htop' command in Raspbian, I see the total memory size only 373MB (Beaglebone black shows 496MB in htop). The reason is Raspbian reserved 128MB for GPU. See
cat /boot/config.txt
Watch youtube with Raspbian
- http://www.raspberrypi.org/forums/viewtopic.php?t=40860
- http://www.raspi.today/5-things-you-need-to-know-about-the-raspberry-pis-epiphany-web-browser/ and an announcement from raspberrypi.org.
- http://www.raspians.com/Knowledgebase/how-to-watch-youtube-on-the-raspberry-pi/
- http://raspberrypi.stackexchange.com/questions/13955/watch-youtube-in-browser-with-raspbian
- http://93.93.128.176/forums/viewtopic.php?t=59384&p=445257
Probably a practical approach is to use 'youtube-dl' program to download the video and then use 'omxplayer' to play it (not streaming anyway). Downloading Youtube Videos to your Raspberry Pi and Play HD Youtube from the Raspberry Pi Command Line
Cast Youtube from your phone
How To Cast YouTube Videos From Your Phone To Raspberry Pi Using YouTube On TV (youtube.com/tv)
Auto Startup Application
You can configure what applications should be started at login (NOT at boot time or on start up), in addition to the default startup applications configured on the system.
- Ubuntu.
- How To Manage StartUp Applications In Ubuntu
- How to autostart a program in Raspberry Pi or Linux
- How to Autorun application at the start up in Linux
- lynda.com
When I try to add calibre, I see a new file "calibre.desktop" is added to ".config/autostart/" folder.
[Desktop Entry] Type=Application Exec=/usr/bin/calibre Hidden=false NoDisplay=false X-GNOME-Autostart-enabled=true Name[en_US]=Calibre Name=Calibre Comment[en_US]= Comment=
Startup script
- http://www.stuffaboutcode.com/2012/06/raspberry-pi-run-program-at-start-up.html. The procedure works for tightvncserver and live-streaming examples. Note that running tightvncserver will use a lot of Raspberry Pi CPU (> 80%).
sudo nano /etc/init.d/NameOfYourScript # Create script in /etc/init.d sudo chmod 755 /etc/init.d/NameOfYourScript # Make script executable sudo /etc/init.d/NameOfYourScript start # Test starting the program sudo /etc/init.d/NameOfYourScript stop # Test stopping the program # Register your script to be run at start-up and shutdown, run the following command: sudo update-rc.d NameOfYourScript defaults # If you ever want to remove the script from start-up, run the following command: sudo update-rc.d -f NameOfYourScript remove
Disk Performance
Raspberry Pi 4 vs Desktop PC
$100 PC VS Raspberry Pi 4 8GB - Can The Pi4 Replace a Desktop PC?
Power consumption comparison
- https://www.raspberrypi.org/magpi/raspberry-pi-specs-benchmarks/
- https://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-pi-zero-power
- How much power does the Pi4B use? Power Measurements, Raspberry Pi 4 Review: The New Gold Standard for Single-Board Computing
- PC & SBC Power Consumption from ExplainingComputers. Raspberry Pi 4, Pi 3B+, Pi 3A+, Pi Zero W, Pi 400, the Odroid N2+, Rock Pi X, LattePanda Delta, Odyssey X86J4105, and the UDOO Bolt V8.
How long does the RPi last on a battery?
- https://raspberrypi.stackexchange.com/a/19825. If you have a 500mAh battery, that will output 500mA (0.5A) for one hour, or 1000mA (1A) for half an hour. Similarly, a 2000mAh battery will give you 2000mA (2A) for one hour or 1000mA (1A for two hours).
- Raspberry Pi Battery Life Calculator. For example with RPi 3B + Wifi + Camera + 10,000 mAH lasts 14.2 hours.
- From my test, RPi 3B + Wifi + Camera (3 hours time-lapse) + 10,000 mAH lasts 10:42 hours.
Bash script to check the RPi status
- A simple shell script that logs the current status to a text file:
#!/bin/bash # Set the log file path and name LOG_FILE="/home/pi/battery_log.txt" while true do # Get the current time CURRENT_TIME=$(date +"%Y-%m-%d %H:%M:%S") # Get the uptime (in seconds) UPTIME_SECONDS=$(cat /proc/uptime | awk '{print $1}') # Convert uptime to hours, minutes, and seconds UPTIME_HOURS=$(bc -l <<< "scale=0; $UPTIME_SECONDS / 3600") UPTIME_MINUTES=$(bc -l <<< "scale=0; ($UPTIME_SECONDS % 3600) / 60") UPTIME_SECONDS=$(bc -l <<< "scale=0; $UPTIME_SECONDS % 60") # Log the current status to the file echo "$CURRENT_TIME - Uptime: $UPTIME_HOURS:$UPTIME_MINUTES:$UPTIME_SECONDS" >> $LOG_FILE # Wait for 1 minute before logging again sleep 60 done
chmod +x ./battery_log.sh nohup ./battery_log.sh > /dev/null 2>&1 &
- On beaglebone black.
nano check_uptime.sh#!/bin/bash DATE=$(date '+%Y-%m-%d %H:%M:%S') echo "$DATE - Server is up" >> /home/debian/server_uptime.log
chmod +x check_uptime.sh
0 * * * * /home/debian/check_uptime.sh
- The script below will check RPi every 60 seconds (need to keep SSH connection)
#!/bin/bash while true do if ping -c 1 192.168.1.11 &> /dev/null then date else break fi sleep 60 done
Ways to power your raspberry pi
Power Raspberry Pi by AA batteries
http://www.raspberrypi-spy.co.uk/2013/04/raspberry-pi-aa-battery-shoot-out/
This also teaches to know how long the battery will die by using Putty and linux command
watch -n 60 uptime
Power by 9V battery
https://youtu.be/h6Bl0Bckl2k You need a regulator (output 1.5V) such as TS7800/TS7805.
Power Raspberry Pi by Lipo batteries
- https://learn.adafruit.com/pocket-pigrrl?view=all
- Building our own backup server using the Raspberry PI & MainWP
Solar power
- Solar panel kit installation
- Remote water monitoring with a solar powered Raspberry Pi
- How-To: Build a Solar Powered Raspberry Pi (video) and materials from adafruit.
- Create a portable battery and solar powered Raspberry Pi Zero web server
- Solar Powered Weather Station featured MagPi81.
- Solar-powered Raspberry Pi Camera from MagPi 2020.
- Powering a PI from 12V
- Solar Powered Raspberry Pi. It includes a calculation of running time.
- How to Build a Solar-Powered Raspberry Pi
- Tutorial: Solar Power for Raspberry Pi
- Making a Solar Powered Raspberry Pi. It also has an estimated hours.
CPU Benchmark
- Raspberry Pi 3 (launched 2/29/2016)
- SysBench, nBench, Power, MemTester and more from Element14
- http://makezine.com/2016/02/28/meet-the-new-raspberry-pi-3/ (and the original post https://www.raspberrypi.org/blog/raspberry-pi-3-on-sale/)
- https://www.raspberrypi.org/magpi/raspberry-pi-3-specs-benchmarks/
- http://lifehacker.com/how-the-raspberry-pi-3-benchmarks-against-older-models-1762417275
- http://www.phoronix.com/scan.php?page=article&item=raspberry-pi-3&num=1
- Raspberry Pi 2 runs nbench and sysbench by Adafruit.
- hackday.com. It includes info about OpenGL benchmark.
- http://www.linuxlinks.com/article/20150305172325136/RaspberryPi2-Benchmarks.html
# RPi 1 pi@raspberrypi:~ $ sysbench --num-threads=1 --test=cpu --cpu-max-prime=20000 --validate run sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 1 Additional request validation enabled. Doing CPU performance benchmark Threads started! Done. Maximum prime number checked in CPU test: 20000 Test execution summary: total time: 1412.6014s total number of events: 10000 total time taken by event execution: 1412.5301 per-request statistics: min: 132.41ms avg: 141.25ms max: 403.27ms approx. 95 percentile: 172.59ms Threads fairness: events (avg/stddev): 10000.0000/0.00 execution time (avg/stddev): 1412.5301/0.00
The timing 1412s I got is close to 1318s reported by element14.com.
For nBench, my result of cpu floating-point index 1.753 is also close to element14's 1.884.
pi@raspberrypi:~/nbench-byte-2.2.3 $ ./nbench BYTEmark* Native Mode Benchmark ver. 2 (10/95) Index-split by Andrew D. Balsa (11/97) Linux/Unix* port by Uwe F. Mayer (12/96,11/97) TEST : Iterations/sec. : Old Index : New Index : : Pentium 90* : AMD K6/233* --------------------:------------------:-------------:------------ NUMERIC SORT : 202.91 : 5.20 : 1.71 STRING SORT : 30.842 : 13.78 : 2.13 BITFIELD : 8.2161e+07 : 14.09 : 2.94 FP EMULATION : 43.409 : 20.83 : 4.81 FOURIER : 1660.8 : 1.89 : 1.06 ASSIGNMENT : 2.2719 : 8.65 : 2.24 IDEA : 702.86 : 10.75 : 3.19 HUFFMAN : 421.78 : 11.70 : 3.73 NEURAL NET : 2.7206 : 4.37 : 1.84 LU DECOMPOSITION : 73.846 : 3.83 : 2.76 ==========================ORIGINAL BYTEMARK RESULTS========================== INTEGER INDEX : 11.255 FLOATING-POINT INDEX: 3.161 Baseline (MSDOS*) : Pentium* 90, 256 KB L2-cache, Watcom* compiler 10.0 ==============================LINUX DATA BELOW=============================== CPU : ARMv6-compatible processor rev 7 (v6l) L2 Cache : OS : Linux 4.1.13+ C compiler : gcc version 4.9.2 (Raspbian 4.9.2-10) libc : libc-2.19.so MEMORY INDEX : 2.415 INTEGER INDEX : 3.146 FLOATING-POINT INDEX: 1.753 Baseline (LINUX) : AMD K6/233*, 512 KB L2-cache, gcc 2.7.2.3, libc-5.4.38 * Trademarks are property of their respective holder.
OpenGL
Pi5 vs n100
Picademy
UPS
- SunFounder Raspberry Pi UPS Power Supply Output: 5V/3A. Battery capacity 7.4V 2000mAh. Life 3-4 hours.
- http://raspi-ups.appspot.com/en/index.jsp
- Raspberry Pi Waveshare UPS 2022
Books, Magazines, Blogs
- Exploring Raspberry Pi
- MagPi: The Unofficial Raspberry Pi Magazine
- Beginner's Guide
- ODROID Magazine
- 15 books for kids who (you want to) love Linux and open source
- Top 10 Raspberry Pi blogs to follow
Minecraft
- A Parent’s Guide to Playing Minecraft With Your Kids
- Minecraft Essentials by MagPi.
- https://www.makeuseof.com/?s=minecraft
- Use Minecraft to Teach Your Kids Pretty Much Anything
Installation
Make sure to use a class 10 (micro)SD card to avoid a hanging problem. This rule applies to other SoC device like Beaglebone and Udoo.
Roll your own Raspberry Pi OS
https://hackaday.com/2018/01/19/roll-your-own-raspberry-pi-os/
64-bit
It is said 64-bit is supported on Pi3/3B/4.
But I have a successful experience on Pi3B but not Pi3. See
- https://downloads.raspberrypi.org/raspios_arm64/images/
- Firmware push arm_64bit.
- Raspberry Pi 3 64 bit Install
- Boot options in config.txt
- Update Raspberry Pi firmware with rpi-update 2014. sudo rpi-update See also rpi-update. What does rpi-update do?.
- Run 64-bit Raspberry Pi OS beta test version
Download an image
- Raspberry Pi Imager
- NOOBS (retired, see PINN next)
- Missing NOOBS? Install Multiple Operating Systems on Your Raspberry Pi with PINN
- BerryBoot The OS in BerryBoot is quite old!!
- PINN (PINN is not NOOBS) - An enhanced Operating System installer for the Raspberry Pi
Raspberry Pi Imager
- https://github.com/raspberrypi/rpi-imager. To build from the source (needed in eg Debian OS):
sudo apt install --no-install-recommends build-essential devscripts debhelper cmake git libarchive-dev libcurl4-gnutls-dev liblzma-dev \ qtbase5-dev qtbase5-dev-tools qtdeclarative5-dev libqt5svg5-dev qttools5-dev libgnutls28-dev \ qml-module-qtquick2 qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qtquick-templates2 qml-module-qtquick-window2 qml-module-qtgraphicaleffects git clone --depth 1 https://github.com/raspberrypi/rpi-imager cd rpi-imager debuild -uc -us # rpi-imager_1.8.5_amd64.deb has been generated in the upper dir
- Raspberry Pi Imager update to v1.6. Hit Ctrl-Shift-X to get the advanced options like wifi, locale setting, enable SSH, turn off telemetry. Why not to have a button labeled “Advanced settings”?
- After Imager finished writing an iso to a USB drive, Imager said we can remove the USB drive.
- "df -h" does not show the USB drive. This is consistent with the "Disks" application or "sudo mount" command.
- File manager Files/Nautilus for GNOME shows the USB drive can be umounted?? But if we click it to umount the USB drive, Imager or Etcher cannot find the USB drive unless we unplug and plug the drive again.
- After running sudo umount /dev/sdX* , Files still shows we can umount the USB drive. And Imager or Etcher can use the USB drive.
- So, use "df -h" to decide if the USB drive is mounted or can be removed. Use "lsblk" to decide if the USB drive is available by the system like Imager or Etcher.
Raspberry Pi OS 1.1 Bulleye
How To Upgrade To Raspberry Pi OS 11 Bullseye (From Buster)
Format a SD card using SD Formatter (Windows & Mac)
SD Card Speed Test: agnostics
- SD Card Speed Test - Pi Diagnostics
- Raspberry Pi just got a new SD card speed test tool and imaging utility
- USB stick running Raspbian. Speed test. Raspberry Pi 4
- On Ubuntu OS, we can just use the Disks utility to run a benchmark.
Install an image to a SD card
For example, if I want to install coder, I first download/uncompress the file. Then from the linux command line (assume microSD card is on /dev/sdc)
sudo umount /dev/sdc* sudo dd bs=4M if=Downloads/coder_v0.4/raspi.img of=/dev/sdc; sync
If I want to watch the progress, I can open another terminal and issue
sudo pkill -USR1 -n -x dd
The output of it still is shown on the 1st terminal where dd is issued. The output looks like
224+0 records in 224+0 records out 939524096 bytes (940 MB) copied, 40.9672 s, 22.9 MB/s 268+0 records in 268+0 records out 1124073472 bytes (1.1 GB) copied, 62.7471 s, 17.9 MB/s
Monitor the progress using pipe viewer
- http://blog.urfix.com/9-tricks-pv-pipe-viewer/
- http://askubuntu.com/questions/215505/how-do-you-monitor-the-progress-of-dd
- https://wiki.archlinux.org/index.php/core_utilities
sudo apt-get install pv dd if=/dev/urandom | pv | dd of=/dev/null
Check the filesystem on microSD card
Repairing a Raspberry Pi Boot Partition
# rootfs is ext4 umount /dev/sdc2 sudo fsck /dev/sdc2 # boot partition is fat32 sudo dosfsck -t -a -w /dev/sdc1
Secure your Raspberry Pi
- Take These Steps to Secure Your Raspberry Pi Against Attackers
- 5 Online Threats That Could Ruin Your Raspberry Pi Experience
- 5 projects for Raspberry Pi at home
Wifi setup
A new wifi setup is included in the Raspbian. It is called dhcpcd and dhcpcd-ui. The package name is called 'raspberrypi-net-mods'. PS. the old way is called 'wpa_gui'.
See the blog on May 5, 2015.
NetworkManager - nmcli/nmtui
- Configuration -> Networking from the official Raspberry Pi Documentation.
- In the old days, the network configuration file is typically located at /etc/wpa_supplicant/wpa_supplicant.conf. Currently, Raspberry Pi OS is using Network Manager. We can confirm this and manage wireless connections by using the commands: nmcli device or sudo systemctl status NetworkManager.
- Two essential commands:
nmcli device wifi sudo nmtui
- Installing Network Manager on Raspberry Pi OS 2022
- By default, the Raspberry Pi uses an older software called dhcpcd for its network handling. It is a bit more complicated to configure and has been superseded by Network Manager. Note. Bookworm use NM by default.
- I follow the instruction to change the default network method from dhcpcd to NetworkManager
- After reboot, the wifi icon shows no connection
- I have a USB wifi adapter. I use the USB wifi adapter to connect to my hotspot (not the primary network) and the pi's broadcom BCM43438 combo is connected to my primary network
- 'nmcli device wifi list' shows both have 100 SIGNAL though the hotspot one has 130 Mbit/s but the primary network has 2870 Mbit/s
- On my hotspot host, I can use ip neigh to get the connected device's IP, like 10.42.0.xxx. Or using the command nmap -sn 10.42.0.0/24
sudo apt install network-manager # fix "NetworkManager is not running" # but it seems it will disconnect the default method 'dhcpcd' # in raspbian 11 (bullseye) 32-bit sudo /etc/init.d/network-manager start # OR sudo systemctl start NetworkManager # List available WiFi networks including SSID, Channel, Rate, Signal, Bars, and Security. # The 'RATE' will show something like 130 Mbits/s nmcli device wifi list nmcli device wifi connect <SSID> password <password> # Connect to a WiFi network nmcli con show # Show all network connections nmcli con up id <connection_name> # Bring up a connection # OR use nmtui # then go to 'Activate a connection'
- The network connection profiles are stored in the /etc/NetworkManager/system-connections/ directory.
Multiple WiFi Networks
- Configure WiFi Settings on a Headless Raspberry Pi and Connect Multiple Wireless Networks 2023
- ip a
- sudo nano /etc/wpa_supplicant/wpa_supplicant.conf (OR /etc/wpa_supplicant/wpa_supplicant-wlan1.conf if we use wlan1)
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=US network={ ssid="Network1_SSID" psk="Network1_Password" } network={ ssid="Network2_SSID" psk="Network2_Password" }
- sudo systemctl restart dhcpcd
- Working with multiple WiFi interfaces on a Raspberry Pi 2021
Use a usb wifi dongle instead of build in wifi
- Disable onboard WiFi & Bluetooth Raspberry Pi 3 & https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README
- How do I use a usb wifi dongle instead of build in wifi?
USB adapters
- tp-link AC600 (rtl8812au)
- Raspberry Pi 3 TP-LINK AC 600 (T2UH) wireless USB adapter (Raspbian Lite)
- Installing TP-Link AC600 High Gain Wifi on Raspberry Pi 4 and the 2 links over there.
- lsusb shows it is RTL8811AU.
- See the comment title 'Works for Raspberry Pi with some work' from Amazon
- Install TP-Link AC600 Archer T2U Nano WiFi USB Adapter In Linux
- I have 3 old USB wifi adapters and they work well in Raspbian. One trick: before I connect the ethernet cable, the wifi was not on for some reason. But once I connect the ethernet cable, it immediately shows SSIDs. This is tested on Pi 2B (it does not include wifi) and Raspbian Buster with desktop (recommended software) released on 2020-02-13.
Wi-Fi is currently blocked by rfkill
How to disable "Wi-Fi is currently blocked by rfkill." message?
Processor
- Processors BCM2835, BCM2836, BCM2837, BCM2837B0, BCM2711
- BCM2835 or BCM2837 use by Raspberry-Pi 3 Model B v1.2 ?
- BCM2835 on an RPi 3?
- RPi 3 with BCM2835 ??? cat /proc/device-tree/model
Bootloader
Boot from USB
It works on my pi3 b+ but not pi3 b.I don't know if this depends on the USB drive I used. Right now I am using Micro Center 32GB usb 3.1 drive.- https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md
- Install Raspbian on a USB Flash drive from MacOS or Linux
- How to boot your Raspberry Pi from a USB mass storage device
- 告別 microSD USB 裝置起動 Raspberry Pi 4 測試版靭體推出
- Raspberry Pi 4 boot EEPROM
- How to Boot a Raspberry Pi From SSD and Use It for Permanent Storage
- Can a raspberry pi zero w boot be made to boot from USB?
- Your Pi3B uses a BCM2837 SoC and the ROM bootloader contains con that permits booting from a USB device. Your Pi0W uses a BCM2835 SoC and its ROM does not contain such code. So...no a Pi0W cannot boot directly from a USB device. However, you can build a minimal SD card to start the boot process and have it continue on and then use a USB device. Check to documentation for how to do this.
- Yup, just write Raspberry Pi OS to a USB drive and copy the bootcode.bin file to an empty FAT32 formatted SD card, then plug both into the system and power it up. Boot should proceed normally (with the OS running from the USB drive).
- Is this possible to boot the raspberry pi B+ model using USB drive? Note that USB booting is not compatible with all USB mass storage devices. Most will work. Some will cold boot but not reboot. Some won't work at all. Hard drives can be particularly problematic because of their high power requirements and long spin-up times. If you have trouble with one USB drive, make sure your OS is fully up-to-date, and if that doesn't help, try a different USB drive.
Put rootfs in USB
- How to Run Raspberry Pi 4 or 3 Off an SSD or Flash Drive
- Move the Raspberry PI root file system to a USB drive
- Raspberry Pi 4 USB Boot Config Guide for SSD / Flash Drives
- bootcode.bin link. rpi2 usb boot
- Kodi example
Network boot (PXE) w/o microSD
- Network boot your Raspberry Pi
- How to Network Boot a Raspberry Pi Without a MicroSD Card
- Hack my house: running raspberry pi without an sd card
- PXE-Boot Raspberry Pi From Proxmox Server | "Easy Mode" setup | Proxmox Home Server
USB network in Pi zero
Mount a USB drive at boot
Add the following line to /etc/fstab (change any values if necessary) and then run sudo mount -a
/dev/sda1 /mnt/share ext4 rw,user,auto 0 0
Also consider to change the mode of the new partition eg sudo chmod 777 /mnt/share.
Pi Desktop
https://www.element14.com/community/docs/DOC-83477
Remote desktop
RealVNC server
- Do not download the binary from RealVNC website since it will have a license issue when we want to connect to RPi
- VNC Connect and Raspberry Pi
- Use the instruction at Github
- The current Raspbian includes a vnc server. We need to enable it. No registration is needed when I use my home network. I tested using iOS vnc app.
- On linux client side, we can download the binary tar ball and set it executable after untar it.
Connect to Your Raspberry Pi With VNC Connect
- https://www.raspberrypi.org/blog/get-back-to-my-pi-from-anywhere-with-vnc-connect/
- https://raspberrytips.com/remote-desktop-raspberry-pi/
- http://lifehacker.com/you-can-now-easily-connect-to-your-raspberry-pi-from-an-1792438276
Chrome
Thin client
Dataplicity
It is not remote desktop but it allows you to access Raspberry Pi from any web browser (no router change, no VPN, no port forward).
To switch to a sudoable account, type su pi. From there you can 'sudo' as normal.
- Host a website from your Pi
- Remotely access Pi system stats using scout_realtime
- Raspberry Pi File Uploader
NoMachine
Tips on how to set up your Raspberry Pi for remote access via NoMachine
Web server
WordPress server
How to Host a WordPress Site on Raspberry Pi
Connection to Raspberry Pi with tightvnc
- How to Install VNC on Raspberry Pi OS (64 bit)
- http://elinux.org/RPi_VNC_Server
- https://wiki.ubuntu.com/Lubuntu/RemoteDesktop (Lubuntu specific)
- http://www.howtogeek.com/141157/how-to-configure-your-raspberry-pi-for-remote-shell-desktop-and-file-transfer/2/
A simple password like 'raspberry' would work. If we need to reset the password, use vncpasswd command.
# Server side sudo apt-get install tightvncserver vncserver # You will require a password to access your desktops. # Password: # Warning: password truncated to the length of 8. # Verify: # Would you like to enter a view-only password (y/n)? n # # New 'X' desktop is raspberrypi:1 # # Creating default startup script /home/pi/.vnc/xstartup # Starting applications specified in /home/pi/.vnc/xstartup # Log file is /home/pi/.vnc/raspberrypi:1.log ps -ef | grep vnc # pi 3134 1 0 16:59 pts/0 00:00:00 Xtightvnc :1 -desktop X -auth /home/pi/.Xauthority # -geometry 1024x768 -depth 24 -rfbwait 120000 -rfbauth /home/pi/.vnc/passwd -rfbport 5901 -fp # /usr/share/fonts/X11/misc/,/usr/share/fonts/X11/Type1/,/usr/share/fonts/X11/75dpi/,/usr/share/fonts/X# 11/100dpi/ -co /etc/X11/rgb # pi 3217 2666 0 17:01 pts/0 00:00:00 grep --color=auto tightvnc vncserver # This line seems not necessary vncserver –kill :1 # Client side; the most common mistake is to forget to add the port number to the IP address. sudo apt-get install xtightvncviewer xtightvncviewer 10.42.0.37:1 # It does not work if I just use raspberrypi.local:1 as the address
To start the tightvnc automatically when boot up, check out http://www.penguintutor.com/linux/tightvnc or my note on BBB.
Also note if the server uses '/usr/bin/vncserver :0', then the client uses 'xtightvncviewer 10.42.0.37'. But if the server uses '/usr/bin/vncserver :1', the client should uses 'xtightvncviewer 10.42.0.37:1', etc. Got the idea!
Note that to troubleshoot the message "GDBus Error:org freedesktop.PolicyKit1 Error.Failed; An Authentication agent already exixts for the given subject", follow the instruction at this message.
Connection from Raspberry Pi to Ubuntu
Follow the instruction and install xtightvncviewer using sudo apt-get and it works. To run the vnc client, just type 'xtightvncviewer' on the terminal.
Another instruction of using tightvnc is at http://www.penguintutor.com/linux/tightvnc.
I have successfully to follow the instruction at http://www.hiddentao.com/archives/2013/09/17/setting-up-tightvnc-on-ubuntu-12-04/ to connect to Ubuntu 12.04 (Unity desktop) from Xubuntu. After launching the following line in my local machine
ssh -L 5901:localhost:5901 [email protected]
I open another terminal window and type the following in my local machine
xtightvncviewer localhost:5901
the Ubuntu desktop appears on my local machine.
Connection from Raspberry Pi to Windows (RDP) with freerdp or rdesktop
The idea is to use Raspberry Pi as a thin client. For example, I can open two remote desktop connections to two separate Windows VMs and the RPi is still quite free in terms of its resource.
- http://blog.pi3g.com/2013/04/use-windows-remote-desktop-on-the-raspberry-pi/
- Using an Android Tablet as a Screen for Raspberry Pi
Method 1 Use xfreerdp program. Use Ctrl+Alt+Enter to toggle between full and regular screen. Non-full-screen-mode is useful if we want to monitor the RPi resource usage while we are using the remote desktop connection.
1. Open a root terminal. Run apt-get update apt-get install freerdp 2. Open a regular terminal. Run xfreerdp -u brb -x l -z 192.168.1.4
Method 2 We can also use rdesktop program. rdesktop is a free, open source client for Microsoft's proprietary RDP protocol. See wiki.archlinux.org for more tips and tricks about rdesktop. {Pre}} 1. Open a root terminal and run apt-get update apt-get install rdesktop 2. Open a regular terminal and run (-f means full screen. Or we can use -g 1280x700 to specify the display resolution) rdesktop -f -u brb 192.168.1.4
Method 3 There is also an interesting project called RPi-TC/Raspberry Pi Thin Client project. I have not tried it yet.
Using a Kindle Fire As a Monitor
Using a Kindle Fire As a Monitor
Raspbian
Desktop vs Console
- Desktop: 105MB memory
- Console: 50MB memory
Directly Connect to a Raspberry Pi Without Internet
http://www.makeuseof.com/tag/directly-connect-raspberry-pi-without-internet/
Recovery partition
Make a self-healing raspberry pi: create a recovery partition
Working from home with your Raspberry Pi
https://www.raspberrypi.org/blog/working-from-home-with-your-raspberry-pi/. Set up email, Office, Google Drive, VPN client, Google hangout (video conference), Skype, VPN Connect.
Raspbian desktop for PC
Download it from here.
Tested Debian Stretch version (2019-4-11) on Virtualbox. It can be installed as either 32-bit or 64-bit OS (uname -m).
Raspbian repository and mirrors
- https://www.raspberrypi.org/downloads/raspbian/
- http://www.raspbian.org/RaspbianMirrors
- UMD mirror (http|rsync)://mirror.umd.edu/raspbian/raspbian
Releases lists
- distrowatch.com
- Raspbian Stretch and some notes
- Release Notes
- https://en.wikipedia.org/wiki/Raspbian
Raspbian package repository URL
http://archive.raspbian.org/raspbian/pool/main/r/r-base/
Widevine support to play Amazon Prime,..
- Raspberry Pi OS Gets Official Widevine Support (Allowing You To Play Netflix, Amazon Prime, Hulu, Etc.)
- https://widevine.com/
Sending an email on boot
See the wiki page - Email IP On Boot.
- The python code works interactively when I use in in a command line. But it does not work when I use it in /etc/rc.local nor /boot/boot.rc.
- The cron method works for my case (wifi connection); see looking at it the cron job is more reliable, placing it in the rc.local file fails on wifi.
@reboot sleep 300 && python /home/pi/startup_mailer.py
- Make sure the gmail account is set up to be "less secure"; see Login credentials not working with Gmail SMTP. Is it possible to use salted password?
- How to Send Emails with Gmail using Python
Fix Dirty COW
https://www.raspberrypi.org/blog/fix-dirty-cow-raspberry-pi/ (10/25/2016)
Kernel building
- https://www.raspberrypi.org/documentation/linux/kernel/building.md
- http://elinux.org/Raspberry_Pi_Kernel_Compilation
Create a custom kernel using Vagrant
Emulate Raspbian on Linux/Windows
Emulate Intel X86 on raspberry Pi (ARM)
https://eltechs.com/product/exagear-desktop/ (non-free)
Digital clock format
Right click task bar -> Panel Settings -> Panel applets -> Digital clock -> Preferences -> "%r %a %D" (default is %R). This will give something like "08:19:11 PM Sun 01/21/18".
Browser
GNOME Web/Epiphany browser
This is the default in Raspbian Jessie.
Some annoying thing is the browser is using the DuckDuckGo as the search engine which is not configurable.
Some web pages cannot be shown correctly (see my comment in LuaKit)
LuaKit - an extremely lightweight browser based on webkit and GTK+
This is very cool. It solves the issue of using Web to open http://magazine.odroid.com. It even supports Adobe Flash (eg some videos from Amazon.com)
sudo apt-get install luakit
Mastering keybinds is the key to use it (Even a mouse cannot be used to close a Tab).
Some examples:
- :open URL to open a new website
- j/k to scroll down/up
- space or ctrl+d / Ctrl+u to scroll down/up one page
- h/l to scroll left/right
- +/- to zoom in/out.
- (ctrl + o) OR (shift + h) to go to the previous page. Ctrl + i to go forward.
- forward slash (/) to search within the page. Use n to find the next occurrance, N to find the previous one.
- B for bookmark
- gB to show bookmarks
- gH to go to home page
- : command mode
- Esc normal mode
- t open webpage in new tab
- d delete current tab
- :print print page
We can modify the key bindings. I run
sudo nano /etc/xdg/luakit/binds.lua
and on line 321 about "Go back in the browser history" (search the keyword 'history'): change "H" to "b". Now I can hit the lowercase 'b' button to go back to a previous web page instead of Shift+h.
key({}, "b", "Go back in the browser history `[count=1]` items.", function (w, m) w:back(m.count) end),
Iceweasel browser
This browser looks like a clone of Firefox (firefox is not available in the repository). The version in Raspbian Jessie is 38.4.0. If iceweasel is not installed (e.g. jessie 8.0), we can install it by
sudo apt-get install iceweasel --no-install-recommends
Firefox browser
See Iceweasel above. Firefox package has been replaced by Iceweasel so it is not available via apt-get install.
Vivaldi browser
http://www.makeuseof.com/tag/vivaldi-best-browser-raspberry-pi/
Chinese input
sudo apt-get install fcitx fcitx-chewing
Reboot. Menu - Preferences - fcitx - click ‘+’ sign - uncheck’Only show current language’ - select chewing. Done. The task bar will show an icon to let you switch the language (ctrl + space bar). Tested on jessie 8.0 and buster 10.
Raspbian uses PIXEL desktop, a modified LXDE desktop environment.
We need to add chewing to the input method. See this postfor a detailed instruction.
Bluetooth keyboard
The GUI program blueman does not work on the pairing step (it does not accept my entered keys) for my bluetooth keyboard (my bluetooth mouse works).
My working example is to use the command line way (bluetoothctl). The bluetoothctl utility is part of the bluez package I think. Raspbian Jessie does not have the bluez-utils package). See https://wiki.archlinux.org/index.php/Bluetooth
# Press the 'connect' button on the bluetooth keyboard first! $ bluetoothctl # no sudo is needed [bluetooth] default-agent [bluetooth] scan on [bluetooth] pair 90:7F:61:8F:D0:38 # it will ask to enter a pin code [bluetooth] connect 90:7F:61:8F:D0:38
It is also interesting to see bluetooth related programs under /usr/bin directory. Those programs shown on my Raspbian are quite different from the ones shown on my Ubuntu 14.04.
New Bluetooth GUI in Raspbian
https://www.raspberrypi.org/blog/another-update-raspbian/ (May 13, 2016). This should solve the problem mentioned above though I haven't tried it.
Text editor
Why Coding for Raspberry Pi Is Way Better With Code-OSS, a community compiled version of VS Code, on the Raspberry Pi.
Pi zero
- http://osoyoo.com/2017/06/introduction-of-raspberry-pi-gpio/
- https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=170006
Getting Started with the Raspberry Pi Zero W (mini HDMI) without a Monitor
https://www.losant.com/blog/getting-started-with-the-raspberry-pi-zero-w-without-a-monitor (Raspbian Stretch)
Turn Raspberry Pi Zero into a USB gadget
- http://blog.gbaman.info/?p=791 (this can only work with the RPi Zero). Allowing ssh, sftp, vnc etc over a single usb cable.
- Pi Zero USB OTG. GPIO Zero is installed by default in the Raspbian image
- Connect To A Raspberry Pi Zero With A USB Cable And SSH. The same procedure works on Pi Zero W. Still there is no internet on my zero W unless we create wpa_supplicant.conf under /boot. In summary, we need to modify 2 files and create 1 file.
- config.txt (?)
- cmdline.txt (?)
- wpa_supplicant.conf (wifi password)
- /etc/dhcpcd.conf (static IP)
- ssh
# Stretch lite pi@raspberrypi:~ $ free -m total used free shared buff/cache available Mem: 433 23 336 3 73 359 Swap: 99 0 99
- Run sudo raspi-config and sudo apt update after we connect RasPi.
- On Mac, I can immediately connect to raspberry pi zero by using ssh [email protected]. However, on Ubuntu, I cannot. The solution is simple. Open the network setting, choose "Ethernet Coneected" > "Wired connection 2" and click "IPv4". Choose "Link-Local Only" instead of the default "Automatic (DHCP)". Then click the "Apply" button.
- How to Connect a Raspberry Pi to a PC or Laptop Using USB. Works on RPi 4, Zero/Zero W/Zero 2W.
- Use GNOME to share the internet to other computers (USB ethernet).
Add USB type A to Raspberry Pi zero
Raspberry Pi Zero with USB socket Type-A expand (solder)
Top 10 Raspberry Pi Zero Projects That Make Use of Its Small Stature
http://lifehacker.com/top-10-raspberry-pi-zero-projects-that-make-use-of-its-1792403310
OpenElec
I use NOOBS to install OpenElec with Raspbian.
Still there is no a regular web browser. Not a joke. Remember OpenElec is installed in multiboot mode through NOOBS. Probably a better approach is to consider Arch-Linux.
There is a program called 'Web viewer'. Wonder when would it be useful.
Need to change 2 settings in order to get date & time correctly.
Another installation method is to download/install the image directly from the OpenELEC website. See
- http://openelec.tv/get-openelec
- http://wiki.openelec.tv/index.php/HOW-TO:Installing_OpenELEC/Writing_The_Disk_Image
Minimal server
Set up a minimal server on a Raspberry Pi
- Static IP using IP4
- Disable IPv6
- Disable WiFi, Bluetooth, and audio
- Disable modem service
- Install Cockpit
Fedora ARM minimal server
Set Up a Test Server on Raspberry Pi. Cockpit.
Email server
Host your own email with projectx/os and a Raspberry Pi
SMS server
Kodi black screen when exit
A temporary solution is use Ctrl + Alt + F2 then Ctrl + Alt + F1. See
- https://www.raspberrypi.org/forums/viewtopic.php?t=91111&p=637126.
- https://gist.github.com/aperezm-vlex/75d7481afff0db8f5894 A script to fix this problem. Some people have issues.
- https://www.raspberrypi.org/forums/viewtopic.php?t=139758&p=926771. Create a new file by sudo nano /usr/local/bin/startkodi. chmod +x and put the following.
#!/bin/bash fbset_bin=`which fbset` xset_bin=`which xset` xrefresh_bin=`which xrefresh` if [ ! -z $fbset_bin ]; then DEPTH2=`$fbset_bin | head -3 | tail -1 | cut -d " " -f 10` fi kodi "$@" if [ ! -z $fbset_bin ]; then if [ "$DEPTH2" == "8" ]; then DEPTH1=16 else DEPTH1=8 fi $fbset_bin -depth $DEPTH1 > /dev/null 2>&1 $fbset_bin -depth $DEPTH2 > /dev/null 2>&1 fi if [ ! -z $xset_bin ] && [ ! -z $xrefresh_bin ]; then if [ -z $DISPLAY ]; then DISPLAY=":0" fi $xset_bin -display $DISPLAY -q > /dev/null 2>&1 if [ "$?" == "0" ]; then $xrefresh_bin -display $DISPLAY > /dev/null 2>&1 fi fi VT="$(fgconsole)" if [ "$VT" ]; then sudo chvt 7 sudo chvt "$VT" fi
#!/bin/bash kodi if [ "$?" = "0" ]; then killall kodi fbset -depth 8 && fbset -depth 16 xrefresh fi
Corebird - twitter client
We also need automake, autoconf, autogen, intltool packages.
Unfortunately running ./autogen.sh --prefix=/usr gets stuck at the error message 'configure error: valac >= 0.28.0 is required'. At this moment, valac has a version 0.26. See https://packages.debian.org/jessie/valac.
Backup Raspbian
How to Back Up Your Raspberry Pi as a Disk Image Aug 2020. The approach is not to back up directly to a microSD card but to create a compressed disk image that’s even smaller than the amount of used space on the source microSD card you’re backing up. The instruction confused me. If pishink can shrink an image, why do we need to bother gparted? Gparted can shrink a partition on microSD card but pishrink is used to shrink an image file. So the steps
- (Optional) Put the Raspberry Pi microSD in another Linux computer and use Gparted to shrink the rootfs partition
- Boot from Raspberry Pi from the microSD card
- Use the dd command to create an image. Add the count attribute if rootfs has been shrunk. Note: if I follow the instruction to specify the count parameter, I will run into an error pishrink.sh v0.1.2 pishrink.sh: Gathering data ... Error: Can't have a partition outside the disk! pishrink.sh: ERROR occured in line 273: parted failed with rc 1 in the step of calling pishrink.sh. I got the same error no matter I run pishrink.sh from Raspberry Pi or Ubuntu.
- Apply pishrink utility to shrink the image file
My case:
# On Pi # I use gparted to resize SD card's rootfs on another Ubuntu computer # The writing speed is 13.3 MB/s. So it took about 17000/13.3/60=21 min # The output img size is 30GB (My SD card is 32 GB) $ df -h / Filesystem Size Used Avail Use% Mounted on /dev/root 17G 15G 1.1G 94% / $ sudo dd if=/dev/mmcblk0 of=/media/pi/ext4/rpi3backup.img bs=4M status=progress $ sudo umount /dev/sda # On Ubuntu 18.04 $ sudo pishrink.sh -z -v -a /media/brb/ext4/rpi3backup.img ~/rpi3backup.img.gz pishrink.sh v0.1.2 pishrink.sh: Copying /media/brb/ext4/rpi3backup.img to /home/brb/rpi3backup.img... ... pishrink.sh: Gathering data ... Creating new /etc/rc.local pishrink.sh: Checking filesystem ... rootfs: Inode 3266 extent tree (at level 2) could be narrower. IGNORED. rootfs: Inode 258285 extent tree (at level 1) could be narrower. IGNORED. rootfs: Inode 258318 extent tree (at level 1) could be narrower. IGNORED. rootfs: 307763/1072512 files (0.2% non-contiguous), 3887460/4354048 blocks resize2fs 1.44.1 (24-Mar-2018) pishrink.sh: Shrinking filesystem ... resize2fs 1.44.1 (24-Mar-2018) Resizing the filesystem on /dev/loop0 to 4180645 (4k) blocks. Begin pass 2 (max = 50911) Relocating blocks XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Begin pass 3 (max = 133) Scanning inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Begin pass 4 (max = 38066) Updating inode references XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX The filesystem on /dev/loop0 is now 4180645 (4k) blocks long. pishrink.sh: Shrinking image ... pishrink.sh: Using pigz on the shrunk image ... /home/brb/rpi3backup.img to /home/brb/rpi3backup.img.gz pishrink.sh: Shrunk /home/brb/rpi3backup.img.gz from 30G to 7.1G ...
https://www.raspberrypi.org/documentation/linux/filesystem/backup.md
# Backup sudo dd bs=4M if=/dev/sdb | gzip > raspbian.img.gz sudo dd bs=4M if=/dev/sdb | pigz -9 > raspbian.img.gz # Restore gunzip --stdout raspbian.img.gz | sudo dd bs=4M of=/dev/sdb
See also
- Periodic backup of Rpi3 Stretch SD card 2019-Oct
- Can a Raspberry Pi be used to create a backup of itself?
- Backup Raspberry Pi automatically, with incremental backups
- Using rsync to backup Pi
- How to Clone Raspberry Pi SD Card on Windows, Linux and macOS
SD Card Copier
Raspbian Menu > Accessories > SD Card Copier. It works. The SD card size can be smaller than the original one as long as it has a larger size than the current "/dev/root" partition. After the microSD card has been used once by SD Card Copier, then it can not be used again by the utility (the SD card is labelled in Copy to Device option but it's greyed out. Note even the File Manager cannot mount it in Raspbian but Ubuntu still can auto mount the microSD card). Why? When I insert a ext4-formatted USB drive, the SD Card Copier can use it.
- lynda.com.
- Raspberry Pi Blog 2016 for Pi3 release
- Clone your micro sd directly on rpi
piclone
https://github.com/raspberrypi-ui/piclone
PiShrink
-
https://github.com/Drewsif/PiShrink. PiShrink is a bash script that automatically shrink a pi image (assume you have ) that will then resize to the max size of the SD card on boot. This will make putting the image back onto the SD card faster and the shrunk images will compress better. In addition the shrinked image can be compressed with gzip and xz to create an even smaller image.
$ sudo pishrink.sh pi.img
- How to Back Up Your Raspberry Pi as a Disk Image. pishink was used Raspberry Pi.
- PiShrink – Make Raspberry Pi Images Smaller. pishrink can be used in any unix-like systems.
- Pishrink: Shrink Raspberry Pi sd card images with Virtualbox Linux machine. pishrink was used in Ubuntu.
Others
- raspiBackup - Backup and restore your running Raspberries, raspiBackup - Use pishrink to reduce dd backups to a minimum size
- * https://robotzero.one/headless-pi-zero-backup-clone/
How to transfer a Raspbian image from a 16GB MicroSD card to an 8GB SD card
- SD Card Copier
- How to shrink Raspberry Pi SD card images with GParted and dd
- https://www.reddit.com/r/raspberry_pi/comments/3vo3al/how_to_transfer_a_raspbian_image_from_a_16gb/
- https://twocanoes.com/clone-sd-card-from-a-larger-size-sd-card-to-a/
Backup server
- https://opensource.com/life/16/3/turn-your-old-raspberry-pi-automatic-backup-server using rdiff-backup utility.
Git server
Host Git Server on RaspberryPi! | 4K TUTORIAL
USB over ip
Its mainuse is to let you access data on USB drives stored on other hardware.
Top 10 Apps You Should Install on Your Raspberry Pi
RAID
How to Set up RAID-1 on the Raspberry Pi, the Easy Way
NAS
- Create a hardened Raspberry Pi NAS Dec 2016
- It includes installing Docker and installing an nginx web server.
- It also use software RAID-1 with two hard drives for redundancy.
- Samba
- NFS: unencrypted but gives higher level of performance than Samba between Linux/UNIX hosts. Can be mounted over the network to appear as a local directory
- SFTP
- Backup using rsync
- Building a network attached storage device with a Raspberry Pi 2018.
- Create a NAS with your Raspberry Pi and Samba
- How to Turn a Raspberry Pi into a Low-Power Network Storage Device
- HTGWA: Create a Samba (SMB) share on a Raspberry Pi. Simple and it works.
ownCloud
- Enable External Access to Your ownCloud Raspberry Pi Server
- Build Your Own DIY NAS Server Using Raspberry Pi 4
OpenMediaVault
- lynda.com
- How To Install OpenMediaVault 5 on Raspberry Pi 3/4. Default username/password: admin/openmediavault
NextCloudPi
https://ownyourbits.com/nextcloudpi/
Proxy server
How to Use a Raspberry Pi as a Proxy Server (with Privoxy)
DNS server
- 3 reasons to turn your Raspberry Pi into a DNS server with dnsmasq
- Your own DNS server with Raspberry Pi: How to
Pi-hole
- The World’s Greatest Pi-hole (and Unbound) Tutorial 2023
- https://github.com/pi-hole/ and https://github.com/pi-hole/pi-hole
- http://pi.hole/admin
- Complete Guide to Setting up Pi-hole on a Raspberry Pi with IPv6 Support on Docker including Using Pi-hole as Your DHCP Server, Adding More Blocklists, Unblocking Domains & Using DNS over HTTPS (all queries from Pi-hole will be encrypted and your ISP will not be able to see them).
- Create a Network-Wide Ad Blocker with a Raspberry Pi
- Pi Hole Ad Blocker with Pi Zero W (and PiOLED)
- Setting up a Pi Hole for whole-home ad/tracker blocking (Raspbian)
- How to change DNS server on your Android phone or tablet
- Pi hole prevent ads from appearing on Internet-connected devices that aren't a Web browser. Pi-hole can be installed on hardware that's not a Raspberry Pi.
- Installing pi-hole on ubuntu 18.04 LTS
- How to block mobile ads with Raspberry Pi and Pi-hole
- Millions of hits to a random IP lookup from my router at 3AM. Happened on both my PiHoles. Ideas?
- oisd blocklist
- Change DNS in android 11 , 12 ... to use with pihole
One way to test it is to open the Android app 'Taiwan Radio' or 'FainTV'. You will see the ads cannot be loaded anymore. In fact, this also fixed the buffering problem when I use the 'Taiwan Radio' app.
Install on Pi
- No 'sudo'
- Uncheck to install lighttpd since I have apache installed already
curl -sSL https://install.pi-hole.net | bash
- I am using wifi and it works fine
- New directories /var/www/html/admin (main directory) and /var/www/html/pihole (only 2 files) are created.
- At the end it will say the install log is in /etc/pihole
- The web interface is at http://pi.hole/admin or http://192.168.x.x/admin. The Admin Webpage login password will be shown on the text UI and the terminal too (remember to save it).
- The pi-hole admin password can be reset by pihole -a -p
- Ports 53 and 80 need to be opened. sudo netstat -tulpn | grep LISTEN
- To change the interface from eth0 to wlan0, use pihole -r to reconfigure. see Change ip adress
- My current pi-hole version is v4.4 (2020-04), AdminLTE v4.3.3 and FTL v4.3.1. pihole -v It also shows what is the latest versions.
- On my Dasung non-ereader tablet (Android 8.1.0) it does not have DNS option on WiFi network. I install DNSPipe. It seems to work. It does ask something related VPN, why?
Local DNS Record This allows you to map your own domains to your private network.
Update
$ pihole -up
After I upgrade to 5.0, the stats on the dashboard is not working. A solution is here. sudo apt install php7.0-sqlite and sudo service apache2 restart. Use php -v to check your PHP version before confirming the exact module name to install.
Uninstall
sudo rm -rf /etc/.pihole /etc/pihole /opt/pihole \ /usr/bin/pihole-FTL /usr/local/bin/pihole \ /var/www/html/pihole /var/www/html/admin
$ pihole uninstall .... [i] The following dependencies may have been added by the Pi-hole install: dhcpcd5 git iproute2 whiptail cron curl dnsutils iputils-ping lsof netcat psmisc sudo unzip wget idn2 sqlite3 libcap2-bin dns-root-data libcap2 lighttpd php7.0-common php7.0-cgi php7.0-sqlite3 php7.0-xml php-intl [?] Do you wish to go through each dependency for removal? (Choosing No will leave all dependencies installed) [Y/n] n [✓] Removed Web Interface [✓] Removed /etc/cron.d/pihole [✓] Removed lighttpd configs [✓] Removed config files [✓] Removed pihole-FTL [✓] Removed pihole man page [✓] Removed 'pihole' user ...
Migrating Pi-Hole from lighttpd to apache
sudo apt-get remove lighttpd
Whitelist
Use Web Interface to log in and use Whitelist to allow an access to some domains.- Use Domain on left panel
- Command line: pihole -w somedomain.com anotherdomain.net (add to whitelist)
- Collection of commonly white listed domains for Pi-Hole®
Use pi-hole as the only DNS
On my Android galaxy tab s6 lite, I set up two DNSs. Even pi-hole is the 1st DNS, for some reason, the 2nd DNS was used. So ads are not blocked.
I can try checking the Pi-hole logs to see if there are any issues or errors that could be causing delays in resolving queries. I can access the logs by logging in to the Pi-hole web interface and navigating to the “Tools” section and then selecting “Tail pihole.log”. This will show you a live view of the Pi-hole log file and you can see if there are any issues or errors that could be causing delays in resolving queries.
I can also try adjusting the cache size in Pi-hole. Please note that increasing the cache size may improve performance, but it will also increase memory usage. You should choose a cache size that is appropriate for your system’s resources.
sudo nano /etc/dnsmasq.d/01-pihole.conf # Find the line that starts with cache-size and change the value sudo service pihole-FTL restart
VPN server
VPN client
How to Install a VPN on Your Raspberry Pi
IPV6 connectivity
https://raspberrypi.stackexchange.com/questions/37/ipv6-connectivity
There are no hardware limitations for IPv6 connectivity, only software must support it. On Arch distribution, IPv6 is enabled by default, so if you have a router with DHCPv6 or RA, you will automatically get connected to the IPv6 internet.
Raspbian supports IPv6, but the kernel module is not loaded by default (which is a crying shame in the wake of recent developments). IPv6 can be enabled at run time by modprobe ipv6 command or at boot time by appending ipv6 to /etc/modules.
Connect your dumb USB printer to your home network
Raspberry Pi Print Server: Setup a Network Printer. The steps are
- Installing the Raspberry Pi Print Server Software (Cups)
- Setting up SAMBA for the Pi Print Server (Samba)
- Adding a printer to CUPS
- Adding a Raspberry Pi Print Server to Windows
Done!
Another instruction How to set up a print server on a Raspberry Pi
6 Ways to Print With a Raspberry Pi
NagiosPi: Turn Your Raspberry Pi into a Network Monitoring Tool
- https://www.makeuseof.com/tag/turn-raspberry-pi-network-monitoring-tool/
- 8 Types of Raspberry Pi Disk Image You Can Install Today
Embedded Linux
What I Wish I’d Known When I Was an Embedded Linux Newbie from Linux Journal.
How to Install Windows Software on Raspberry Pi Using Wine
https://www.makeuseof.com/tag/install-windows-software-raspberry-pi/
Virtualization
Rpi-Monitor: monitor a Linux system
- https://xavierberger.github.io/RPi-Monitor-docs/index.html, https://github.com/XavierBerger/RPi-Monitor
- https://rpi-experiences.blogspot.com/p/rpi-monitor.html
- Mentioned in Create a portable battery and solar powered Raspberry Pi Zero web server
Monitor/manage multiple raspberry pis
Use a systemd unit/service file to control an application to start when Raspberry pi boots up
- Systemd Essentials: Working with Services, Units, and the Journal
# Start the service sudo systemctl start nginx.service # Stop the service sudo systemctl stop nginx.service # Restart the service sudo systemctl restart nginx.service # Reload the service sudo systemctl reload nginx.service # Enable a service to start automatically at boot sudo systemctl enable nginx.service # Disable the service again sudo systemctl disable nginx.service # List all active unit files systemctl systemctl | grep epaper.service # Note: ps -ef won't detect epaper.service # List all the units installed on the system systemctl list-unit-files
- See Raspberry PI 3 E-paper 2.7 inch Clock and Weather Display example from E-ink section.
- Configure Docker to start on boot
Install node.js
Install Node.js and Npm on Raspberry Pi
Share your keyboard and mouse between computers with Barrier
Create a GUI app by GTK+
Ultrasonically detect bats with Raspberry Pi
Mate Ubuntu
The desktop looks good. But it does not include Mathematica software nor Arduino. It does include Scratch, Sonic Pi (under Programming) and Minecraft Pi (under Games).
After Raspi2 is on for several days with Firefox browser use, the memory is getting lost even Firefox is closed. top command shows /usr/sbin/irqbalance ate 48% memory. It works when I use sudo kill -9 to stop the process. See some discussions at askubuntu.com set ENABLED=0 in /etc/default/irqbalance.
The system looks very stable. See my screenshots below.
Ubuntu-mate 16.04 on Rpi 3B+
- 16.04.2 image 2017 Feb. The problem is the old image would not boot on (new) Rpi 3B+.
- How to enable support for Raspberry Pi 3B+ and 3A+ in Ubuntu MATE
- 16.04.2 Won’t boot on RPi 3 Model B+
- Set Up and Upgrade Ubuntu MATE 16.04 on a Pi 2/3/3B+
64-bit Ubuntu and more
- Speed comparison of Pi 4 using Raspberry Pi OS 32-bit vs Ubuntu 20.04 64-bit.
- Raspberry Pi 4 64-Bit Operating Systems: Manjaro, Ubuntu, Gentoo & More! from ExplainingComputers.
- Install Fedora on a Raspberry Pi 3
SSH server
The website said the server is not installed by default. To install it, run sudo apt install openssh-server
sudo systemctl enable ssh.service
Change to use static IP
Use GUI network manager
Install more screensaver themes
http://greyblake.com/blog/2013/02/02/install-more-screensavers-on-mate-desktop/
Take a look at the .desktop files under /usr/share/applications/screensavers.
Web browser
Ubuntu-Mate includes Firefox. I can feel FF is more slow than the browser in Raspbian.
Printer
(Update 12/11/2016): the instruction below using PPD file still has a problem when I print pdf files. The instruction here solves the problem. The idea is to download the official Linux driver (<linux-brprinter-installer-2.1.1-1.gz>) from brother website HL-5250DN.
When I try to add a new Printer (network printer, Brother HL-5250DN) through automatic detected method, I got an error "server-error-internal-error". When I looked at the /var/log/cups/error_log file, it showed "empty PPD file". The following two pages are helpful.
- https://bugs.launchpad.net/ubuntu/+source/system-config-printer/+bug/254202
- http://www.openprinting.org/printer/Brother/Brother-HL-5250DN (PPD file). A copy of the ppd file (a text file) is saved on github.
The manual approach mentioned in bugs.launchpad.net (#6) works.
- System -> Adminstration -> Printers -> Add
- Enter URI and specify ipp://192.168.1.88:631/ipp as the Device URI (the address is obtained through the nmap command and look for port 631)
- Check the 2nd option 'Provide PPD file' instead of the 1st one 'Select printer from database'.
- Browse the location of the PPD file
- Continue the procedure until the end. We can print a test page to make sure the setup is successful.
The printer test page said the driver is BR5250_2.PPD and version 1.03.
PS. About the technology terms
- PPD (PostScript Printer Description)
- URI (Uniform Resource Identifier)
- IPP (Internet Printing Protocol)
Kodi
After I used apt-get to install Kodi, Kodi will not be able to launch:( On Raspbian, the Kodi installed by apt-get works!!!
Operating Systems for Various Purposes
- Best Raspberry Pi Operating Systems for Various Purposes
- 7 of the Best Lightweight Operating Systems for Raspberry Pi
Twister OS
Twister OS Gallery
Arch Linux
Kodi can be installed in ArchLinux by installing the kodi-rbp package. See wiki.archlinux.org.
Android
- RaspAnd($9), currently it is Android 7.1.1. See RaspAnd brings Android 7.1.1 Nougat to your Raspberry Pi
- Android TV Nougat ROM now available for Raspberry Pi 3
- How to Install Android on a Raspberry Pi Apr 10, 2018
- How to Install Android (Emteria) on Raspberry Pi (Raspberry Pi 3 Model B) Jan 25, 2020
- How to Setup Android 7 for the Raspberry Pi (EmteriaOS) including GApps.
- How to Build an Android TV Box With a Raspberry Pi (LineageOS 18.1, Android 11) May, 2022
- How to Build Your Own Android TV Box with Raspberry Pi Dec 2021
- The 5 Best Options to Run Android on Raspberry Pi Jan, 2024
pi-top
I pledged pi-topCEED ($99 + shipping is $25). The hardware looks cool: 14 inch, 1366x768 resolution (like an old laptop/Hanns.G monitor) & a GPIO card that helps to connect 3 wires from pi-top hub to Raspberry Pi. One problem is after connecting the wires from pi-top hub to Raspberry Pi, there is not enough space for me to slide in the cover.
Unfortunately the pi-top OS is unstable (tested 7/1/2016).
- first try - screen flicked & is frozen
- I download the image (homepage -> Community -> FAQ) and write it to the sd card - works great but after another boot the screen appeared and then disappeared.
I found when I connect the wires of 3-pins with a wrong direction, Raspi still works (pi-top OS & Raspbian). It seems only the 5v and gnd pins are needed.
For some reason, after I shut down the computer the back light is still on. The software from rricharz in github can let Rasbpian users to change the brightness of the screen and also power off the pi-top (bright light off). The original post is on the pi-top forum with the subject 'Using standard Raspbian Jessie on pi-top'.
40-pin connector vs jumper cables. We can use Google account to join.
- The current pi-topCEED webpage
- Detect and configure pi-top hubs and accessories on Github
- pi-topHub-v1 used by pi-topSEED. The hub is responsible for managing the display and audio signals.
Some pictures (left: Pi-top, middle: pi-top hub, right: raspberry pi 3 with a GPIO card). The pin numbers are sequential.
- Cable 1: connect to pins 4 (red to 5v) & 6 (black to GND).
- Cable 2: connect to pins 19, 21 & 23 (3 holes face down). All are SPI pins.
- Cable 3: connect to pin 26. SPI pin.
Backlight: When the display goes to blank, the backlight is still on. With Pi-Top Sirius OS, it (see the Github page) provides a python command to turn the backlight off. The problem is this has to be done manually (pt-brightness --backlight 0 ). And after we did it manually we are unable to see the screen; so it is difficult to interact with the system ? (simple experiment: pt-brightness --backlight 0; sleep 15; pt-brightness --backlight 1 )
Maybe it is possible to add a button/switch to launch a command for controlling the backlight.
- Using a push button with Raspberry Pi GPIO. This works after we change the callback function. Step 1. Run the script ‘’python push_button.py’’, step 2. Run ‘’pt-brightness —backlight 0’’ when we want to turn off the backlight 3. Press the button when we want to turn back the backlight.
import os def button_callback(channel) os.system(‘date; pt-brightness —backlight 1’)
- When press button, python script runs automatically on Raspberry Pi
- How to Add a Power Button to Your Raspberry Pi
pi-topOS
- https://pi-top.github.io/docs/index.html
- Sirius is based on Raspbian 10 (Buster). It is leaner (~200MB RAM). This version fixed the problem in pi-topCEED Hub. Note "pi-top hub - Mk1 OS Fix" does not solves the issues on regular Raspbian 10 even it can be installed.
- Bullseye. It is too heavy (>400MB RAM). Using pi-top Hardware with Raspberry Pi OS (formerly Raspbian)
- https://blog.pi-top.com/new-pi-topos
- https://knowledgebase.pi-top.com/knowledge
It is based on LXDE but the desktop looks very modern (thumbs up). It is based on the latest Raspbian (Buster).
I feels the theme is like Pop!_OS. Very clean and good icon/font size on pi-topCeed.
Media server
How to Set Up a Raspberry Pi Media Server: 7 Ways 2020
Plex
- How to Turn a Raspberry Pi into a Cheap Plex Player with RasPlex
- How to Turn a Raspberry Pi Into a Plex Media Server
- How to Turn a Raspberry Pi into a Plex Server. Just about every Plex player supports MKV without transcoding on the fly.
DVR
How to build a cheap cord-cutting DVR using Raspberry Pi
Kodi/XBMC and OpenElec
- Install Kodi on Raspbian
- For some reason, I did not find 'Display Mode' option in the System > Settings > System > Video Output in the OpenElec. When I install Kodi (14.2 Mar 27 2015) in Ubuntu 14.04, I can see this option.
Then OpenElec from NOOB works fine.
How to fix Youtube daily limit exceeded
https://kodihome.blogspot.com/
How to Set Up a Kodi Remote Control
https://www.makeuseof.com/tag/set-up-kodi-remote-control/
7 Essential Kodi Tips for New Users
http://www.makeuseof.com/tag/essential-kodi-tips-new-users/
12 Ways to Make Kodi the Best Media Player for You
http://www.makeuseof.com/tag/make-kodi-best-media-player/
The 12 Best Kodi Add-Ons for Watching Live News
https://www.makeuseof.com/tag/best-kodi-add-ons-live-news/
What is OpenElec
Unlike other Kodi solutions, OpenELEC is not based on Ubuntu. In fact, it's not based on any Linux distribution; OpenELEC has been built from scratch specifically to act as a media center. That means it doesn't include drivers for things that just won't be used like 3G cards and graphics tablets, for example.
OpenELEC, however, only includes software required to run Kodi. Because of that it is tiny (roughly 150MB), it installs literally in minutes, and, it can boot extremely quickly in 5-20 seconds, depending on the hardware type used.
In addition, OpenELEC is designed to be managed as an appliance: it can automatically update itself and can be managed entirely from within the graphical interface. Even though it runs on Linux, you will never need to see a management console, command terminal or have Linux knowledge to use it.
Default folders for OpenElec
OpenELEC:~ # ls backup emulators music screenshots videos downloads lost+found pictures tvshows OpenELEC:~ # df -h Filesystem Size Used Available Use% Mounted on devtmpfs 165.2M 0 165.2M 0% /dev /dev/mmcblk0p5 159.8M 103.7M 56.1M 65% /flash /dev/mmcblk0p6 13.3G 706.6M 11.9G 5% /storage /dev/loop0 93.9M 93.9M 0 100% / tmpfs 170.2M 0 170.2M 0% /dev/shm tmpfs 170.2M 4.6M 165.6M 3% /run tmpfs 170.2M 0 170.2M 0% /sys/fs/cgroup tmpfs 170.2M 4.0K 170.2M 0% /tmp tmpfs 170.2M 412.0K 169.8M 0% /var /dev/mmcblk0p1 820.2M 744.4M 75.8M 91% /var/media/RECOVERY /dev/mmcblk0p3 27.0M 1.2M 23.5M 5% /var/media/SETTINGS
Youtube plugin error
How to Fix Kodi’s YouTube “Quota Exceeded” Problem
How to Cast YouTube and Other Web Videos to Kodi (Like the Chromecast)
- https://giverhell.com/2017/01/15/how-to-stream-from-iphone-ipad-or-android-to-kodi/
- http://www.howtogeek.com/277116/how-to-cast-youtube-and-other-web-videos-to-kodi-like-the-chromecast/
No sound
http://forum.kodi.tv/showthread.php?tid=130371
Click on the Volume icon and raise the volume from the default -60dB to a higher value.
Fix date/time in OpenElec
http://www.htpcbeginner.com/fix-openelec-incorrect-time-raspberry-pi/
Note the original post does not work on the current Kodi 14.1. The utility /usr/sbin/ntpdate is not found. Search the keyword 'daCaPo says' on the above webpage and following his answer does solve the problem. nano /storage/.config/autostart.sh and add the following
#!/bin/sh (sleep 30; \ /sbin/ntpd -p pool.ntp.org; \ )&
Then chmod +x /storage/.config/autostart.sh. No need to reboot.
UPnP
When I enable the UPnP server function in Kodi, the Kodi can be found in the UPnp client program eg VLC (desktop), BubleUPnP, BSPlayer, Kodi, ....
The Kodi server will be seen to have Music Library and Video Library. The files in Video Library are the same as what I have in the Kodi but the Music Library does not have any songs (it only has Categories like Genres, Artists, Albums, Songs, Years, Top 100, Recently added albums, Recently played albums). According to this Kodi's wiki page: Your audio files MUST have a valid ID tag for them to work properly in the Kodi music library. . Probably it is for this reason, the songs do not appear in the UPnP client software (except the BSPlayer which can find all my songs in the music directory, but BSPlayer does not show my image files in the pictures directory. Such a pity!)
Display Chinese characters
http://forum.kodi.tv/showthread.php?tid=81081
Go to System - Settings - Appearance - Font and choose 'Arial'.
Add-ons
The USTV VoD and Navi-X and USTVNow (require US citizen & registration, free NBC, CBS, ABC, CW, FOX & PBS channels) work well. Just download the zip files in the linux and install them from xbmc -> system -> add ons -> install from local zip files.
- Power Up Your XBMC Installation with These Awesome Add-Ons
- How to Make XBMC Easier to Use (Especially for Non-Geeks)
- Keyboard shortcut. For example, backslash \ for toggle full-screen and windowed mode.
- xbmchub maintenance and fix buffering problem.
- 5 Best Live TV Addons For Kodi
- TVADDONS - A Collection of Unofficial Addons for Kodi.
- How to install Exodus for Kodi
- Youtube Youtube addon included in Kodi is marked for deletion. Use this link to download the zip file (5.1.20.1) install the new it.
Take a screenshot
ssh and run
kodi-send --action="TakeScreenshot"
A new file <screenshot000.png> will be saved under screenshots folder.
LXDE (same as Lubuntu) X11 desktop environment used by Raspbian OS
Inside .config/lxpanel is a directory with the name of your current lxsession profile - and inside this is a further subdirectory called panels.Each file in this directory is the definition of a single panel. See Magpi33.pdf.
Screenshots
Taking a screenshot
Quick launch bar
To add lxterminal to quick launch bar,
Right click any empty space on taskbar -> Panel Setting -> Panel Preferences -> Panel Applets -> Application launch bar & Edit -> Accessories & lxterminal
We can use the same procedure to add Midori to the quick launch bar.
Keyboard shortcut
The shortcuts are defined in the file ~/.config/openbox/lxde-rc.xml
For example,
- open the lxpanelctl menu, click Ctrl + ESC.
- open launch an application, click Windows + r.
- Toggle full screen, Alt + F11.
- Launch task manager, Ctrl + Alt + Del.
Get internet by sharing the internet from another machine
- https://wiki.archlinux.org/index.php/Internet_Share
- static iP. Set up host eth0 IP and then set up RPi IP:
- In Windows, allow Internet sharing. An IP of 192.168.0.2 will be automatically assigned to the Laptop's network card. Make static IP of 192.168.0.2 in Rasp Pi. Enter subnet mask and gateway (192.168.0.1). Also make an entry in /etc/resolv.conf with nameserver=192.168.0.1. Reboot and Rasp Pi will get Net all right.
- In Linux, An IP of 10.42.0.37 will be assigned to eth0 card. Make static IP of 10.42.0.37 in Rasp Pi. Enter subset mask and gateway (10.42.0.1). Also make an entry in /etc/resolv.conf with nameserver=10.42.0.1. Reboot and Rasp Pi will get Net all right.
- Other thoughts:
sudo nano /etc/network/interfaces iface eth0 inet static address 192.168.100.1 netmask 255.255.255.0 network 192.168.100.0 broadcast 192.168.100.255 gateway 192.168.100.254
The gateway is important and in most cases will always point to your firewalls, switch or routers IP address.
In my current setting, the host machine's eth0 has IP 10.42.0.1 (inet addr). The RPi has IP 10.42.0.37 and gateway 10.42.0.1.
$ netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0 10.42.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 wlan0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
And /etc/resolv.conf may be worth to be changed too. /etc/hostname and /etc/hosts are unnecessary.
An example of /etc/resolv.conf (set up linux DNS) shown from my RPi is
nameserver 10.42.0.1
But maybe another choice is nameserver 8.8.8.8.
Some tools for discovering the IPs in a network include Fing (iOS/Android) or Scapy (python).
Get internet from mobile tethering
https://github.com/InitialState/rpi-gps/wiki/10%20Part%203.%20Mobile%20Data
IP scan tools
- arp-scan utility
sudo apt install arp-scan sudo arp-scan --interface=INTERFACE_NAME --localnet # eg wlan0
- arp Address Resolution Protocol (fastest, installed by default). No "sudo" is required; i.e. "sudo" give the same result.
sudo apt install net-tools arp -a arp -a -i eth1 # if eth1 comes from a USB ethernet adapter
- nmap command
- fing (ios, android, linux, windows). Command line usage
sudo fing -n 192.168.1.1/24
where /24 means 'network prefix' size 24 bits. Check wikipedia classless inter domain routing. For example, CIDR notation 192.168.100.0/24 would be equivalent to 192.168.100.0/255.255.255.0.
- Angry ip scanner cross platform. open source. It shows all instead of found ip's.
- netbios. It does not discover linux boxes, however.
- The 4 Best Network Scanning and Enumeration Tools
- nmap
- Zenmap (GUI of nmap)
- Nessus
- Netdiscover
Use Raspberry Pi as a Tunnel Gateway/Router
- Build a 10 USD Raspberry Pi Tunnel Gateway
- Build a router with mobile connectivity using Raspberry Pi
Clustering
Five years of Raspberry Pi clusters 2020. The Docker load-balanced LED cluster Raspberry Pi is interesting!
with 2 Pis
This Linux Journal article teaches how to run GlusterFS Server on two Raspberry Pis. This is also called redundant filesystem. So if one Pi is down, the other keeps the system up.
4 Pis
http://makezine.com/projects/build-a-compact-4-node-raspberry-pi-cluster/. It also shows how to display IP on 1 4pins 16x2 LCD (worked for Arduino & Raspberry Pi). No fancy software were installed to make the cluster.
Hadoop
- http://www.nigelpond.com/uploads/How-to-build-a-7-node-Raspberry-Pi-Hadoop-Cluster.pdf
- A Raspberry Pi Hadoop Cluster with Apache Spark on YARN: Big Data 101
Qt on Raspberry Pi
Check out https://qt-project.org/wiki/Qt-RaspberryPi
Native build Qt
http://qt-project.org/wiki/Native_Build_of_Qt5_on_a_Raspberry_Pi
Qt-Creator
Ubuntu Snappy
Some more information about ubuntu snappy (username/password is ubuntu/ubuntu):
- http://www.ubuntu.com/cloud/tools/snappy
- http://developer.ubuntu.com/en/snappy/
- http://www.ubuntu.com/things#try-beaglebone
- http://www.viclog.com/entry/snappy-raspberry-pi-2-snap-pi (this matches what I observe)
- https://darrenjw2.wordpress.com/2015/02/07/getting-started-with-snappy-ubuntu-core-on-the-raspberry-pi-2/
Suppose I connect my Raspberry Pi 2 get its internet through my computer's USB-ethernet adapter. Then once RPi 2 is on, I can open my browser on my host PC and go to http://webdm.local:4200/. It shows
Note that the SNAPPY UBUNTU CORE image for RPi seems buggy. For example, {Pre} ubuntu@localhost:~$ sudo su root@localhost:/home/ubuntu# dpkg-reconfigure tzdata cp: cannot create regular file '/etc/localtime.dpkg-new': Read-only file system
Current default time zone: 'America/New_York' Local time is now: Thu Jan 1 01:01:42 UTC 1970. Universal Time is now: Thu Jan 1 01:01:42 UTC 1970.
debconf: DbDriver "config": could not write /var/cache/debconf/config.dat-new: Read-only file system
root@localhost:/home/ubuntu# snappy info release: ubuntu-core/devel frameworks: webdm apps: root@localhost:/home/ubuntu# snappy versions Traceback (most recent call last):
File "/usr/bin/snappy", line 25, in <module> status = Main().__main__() File "/usr/lib/python3/dist-packages/snappy/main.py", line 195, in __main__ return callback(args) File "/usr/lib/python3/dist-packages/snappy/main.py", line 334, in _do_versions click_versions = ClickDataSource().versions(all) File "/usr/lib/python3/dist-packages/snappy/click.py", line 189, in versions all_updates_list = repo.get_upgradable() File "/usr/lib/python3/dist-packages/click/repository.py", line 183, in get_upgradable headers={"content-type": "application/json"}) File "/usr/lib/python3/dist-packages/click/network.py", line 70, in http_request curl.perform()
pycurl.error: (60, 'server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none')
Docker
- https://blog.hypriot.com/getting-started-with-docker-on-your-arm-device/
- Is that a Docker Engine in your pocket??
Docker swarm
- Docker Swarm on PI Zero
- Top 5 Cool Projects around Docker, Raspberry Pi & Blinkt! ~ Monitoring Docker Swarm using LEDs – Part I
Databases
How to set up a Postgres database on a Raspberry Pi
Coding
Scratch
Connect Arduino to Raspberry Pi
- The Arduino, while not a full-fledged computer, has a few things it does better, like converting analog-to-digital with its built-in ADC chip. How to Use Raspberry Pi and Arduino Together
- See doctormonk.com where python-serial module is used and /dev/ttyACM0 is the serial port or the name for the USB interface to the Arduino Uno.
- Serial port programming
- https://learn.adafruit.com/arduino-lesson-17-email-sending-movement-detector?view=all (closer to Arduino than Raspi). See this internal link. The idea is 1. use Arduino will use PIR to sense any movement. If it detects motion, it will print a string to the serial port 2. the python program has an infinite loop that reads the serial port. If the serial port contains a string starts with the 'M' letter, it will send out an email. So the communication here is one way.
Connect to cell network
Connect Your Raspberry Pi to a Cell Network
openFrameworks (oF)
openFrameworks is an open source C++ toolkit designed to assist the creative process by providing a simple and intuitive framework for experimentation.
GPIO experiments
RPi.GPIO & gpiozero python libraries
https://www.raspberrypi.org/magpi-issues/Essentials_GPIOZero_v1.pdf#page=10
from RPi import GPIO GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(4, GPIO.IN, GPIO.PUD_UP) while GPIO.input(4): pass print("Button pushed!")
vs
from gpiozero import Button btn = Button(4) while not btn.is_pressed: pass print("Button pushed!")
Processing
Shutdown/power off
Tested on pi 3b. For some reason, after I shut down the system, the power LED is still on and the board is still receiving power from the power supply.
- On a Pi 3B, the red LED functions as a power supply monitor. If the Pi is being supplied with the correct voltage, the red LED will be on steadily. This is true, even if the Pi has been shutdown. Power LED on shutdown - Pi3,
- The power LED on the Pi 3B+ is connected across 5V and 0V so lights up whenever power is supplied, whether through the micro-USB connector, GPIO or test points. The LED can however be shorted out and turned off by using the STATUS_LED_R control line. (solved) Disable red power led on 3B+
- I click shutdown and red light stays on
- Power usage:
- Time-lapse script: 4 W
- Idle: 2.6-3 W
- Power off: 0.5 W
Power off and on
http://raspi.tv/2012/making-a-reset-switch-for-your-rev-2-raspberry-pi
When we use a diy wire to connect two holes, it will shutdown the RPi immediately. If we disconnect the 2 holes, it will power on the RPi again. I tested it on my Model B running the OpenElec OS. COOL:)
For model B+/Pi 2 model B, see this post. This post also provides another way (GPIO pins 5&6) to shut down RPi.
This has pictures for all raspi models.
How to Add a Power Button to Your Raspberry Pi, lynda.com.
Power from GPIO pins
- Pi-top
- Powering the Raspberry Pi A+
- Power your Raspberry Pi: expert advice for a supply
- USB 5V FTDI CP2102 Serial Adapter
- Raspberry Pi Waveshare UPS 4 pins are enough. Pin2 (5v), pins 3 & 5 (I2c), pin 9(GND). See Pinout
Connect to console using TTL/Serial cable
I purchased the TTL cable through dealextream.com. The RaspPi is power by the microUSB (Or we can use the 5V pin on TTL module to connect to 5V on RaspPi. If I try to use 3.3V pin on TTL module to connect to either 3.3V or 5V on RaspPi, it does not work). The connection is done by
RaspPi TTL ========= 5V 5V GND GND TX (14) RX RX (15) TX
Note that it takes 45 seconds for the screen to respond when I tested it using Putty. The ACT and PWR lights should be on. The tuturial on adafruit is helpful.
C libraries
- wiringPi and GPIO examples
- http://www.airspayce.com/mikem/bcm2835/
- http://elinux.org/RPi_Low-level_peripherals
- C vs Python
GPIO layout
- pinout command from Checking Your Raspberry Pi Revision Number & Board Version
- 40 pins https://pinout.xyz/
- 26 pins www.raspberrypi-spy.co.uk ,
- 26 pins raspi.tv
- Printable:
- Printable PDF pin layout from here (Colored, lots in one page)
- Another one from here (Good detail, B/W)
- https://mikaelleven.files.wordpress.com/2015/11/rpi_b_gpio_card_mikael-leven.pdf (Colored, only 1)
- https://www.computerhilfen.de/info/wp-content/uploads/2016/04/computerhilfen_de-gpio-pdf-2.pdf (Cool)
Node-RED
WebIOPi
WebIOPi is a REST framework and a webapp which allows you to control Raspberry Pi's GPIO. It does not require apache to be installed. So we can use web browser from Android to control the GPIO in Raspbery Pi ... Another choice is Web.py.
Run Python using webiopi module
sudo python -m webiopi 8000
Start/stop the background service
sudo /etc/init.d/webiopi start sudo /etc/init.d/webiopi end
Start webiopi at startup:
sudo update-rc.d webiopi defaults
Note that we shall browse to http://localhost:8000/ instead of http://localhost:8000/webiopi. If something is still wrong, use a different port. The default user is "webiopi" and password is "raspberry".
It seems the code is still not stable. I kept getting a message "Error response" Error code 404. Message: Not Found. Error code explanation: 404 = Nothing matches the given URI.
Web.py
See the article The Python Pit - drive your Raspberry Pi with a mobile phone in http://www.themagpi.com/en/issue/9.
Circuit and Electronics
- 電路與電子學
- Circuits and Electronics by MIT
Blink a single LED
I follow the instruction in https://projects.drogon.net/raspberry-pi/gpio-examples/tux-crossing/gpio-examples-1-a-single-led/ to install gpio program/library in raspberry pi. Here is the result
- without PI cobbler: check out my video Raspberry Pi + single LED success.
- with PI cobbler: see the picture below. The soldering part is not easy for a beginner. Be sure to follow some instruction on youtube videos to begin with. Note that the white stripe is on the edge closest to the SD card.
- Another example by using C++ code. No extra library needs to be installed. http://hertaville.com/2012/11/18/introduction-to-accessing-the-raspberry-pis-gpio-in-c/. The site also shows the program to create the diagram is from http://www.fritzing.org.
- Python approach. Here it is assumed pin 9 (or 6) is used for GND and pin 11 for GPIO17 (see the GPIO layout above). The LED was connected using a 330 ohm resistor in series with pin 9 (or 6) and 11 to limit the current. Note use “sudo” to run the python code.
import RPi.GPIO as GPIO import time # blinking function def blink(pin): GPIO.output(pin,GPIO.HIGH) time.sleep(1) GPIO.output(pin,GPIO.LOW) time.sleep(1) return # to use Raspberry Pi board pin numbers GPIO.setmode(GPIO.BOARD) # set up GPIO output channel GPIO.setup(11, GPIO.OUT) # blink GPIO17 50 times for i in range(0,50): blink(11) GPIO.cleanup()
- LED test by gpiozero library.
- Google: raspberry pi python led
RGB
http://www.instructables.com/id/Using-a-RPi-to-Control-an-RGB-LED/?ALLSTEPS
16x2 LCD
http://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi. The '16x2' LCD means it can show 16 characters per row and there are 2 rows in total. Each character consists of 8x5 (height x width) dots.
http://makezine.com/projects/build-a-compact-4-node-raspberry-pi-cluster/ also tells how to show the IP on the LCD.
8x8 Matrix LED Backpack (I2C)
http://learn.adafruit.com/matrix-7-segment-led-backpack-with-the-raspberry-pi/overview
Another more versatile output from the 8x8 matrix is by using C program. See Mark Williams blog.
I also create a version of launching LED using R. See my youtube video. <youtube>TwoWrPp6_iw</youtube>
IR Remote with XBMC
http://learn.adafruit.com/using-an-ir-remote-with-a-raspberry-pi-media-center
Stepper motor
Sound sensor
Set up a sound sensor with the Raspberry Pi
I modify the code by
- adding a counter in the code for my own interest. See this post for declaring a variable as global.
- adding a timestamp to show when an event happened
Note I am connect OUT pin of the sensor to BCM26 on my pi zero.
If I install tmux on my pi zero, I can run the python code, disconnect ssh and connect to it again to see how many time a sound has been detected.
#!/usr/bin/python import RPi.GPIO as GPIO import time import datetime #GPIO SETUP channel = 26 GPIO.setmode(GPIO.BCM) GPIO.setup(channel, GPIO.IN) counter = 0 def callback(channel): global counter if GPIO.input(channel): counter += 1 print("Sound Detected! {0} {1}".format(counter,datetime.datetime.now())) else: counter += 1 print("Sound Detected! {0} {1}".format(counter,datetime.datetime.now())) GPIO.add_event_detect(channel, GPIO.BOTH, bouncetime=300) GPIO.add_event_callback(channel, callback) # infinite loop while True: time.sleep(1)
KOOKYE Smart Home Sensor Kit
CamJam Edukit 3 Robotics Kit
Ryanteck Budget Robotics Kit
https://www.indiegogo.com/projects/ryanteck-budget-robotics-kit-for-raspberry-pi
The software control is based on Spacebrew
HummingBird robot
http://www.hummingbirdkit.com/learning/tutorials/raspberry-pi
Add a push button
- https://learn.adafruit.com/playing-sounds-and-using-buttons-with-raspberry-pi?view=all Play sound
- https://sanje2v.wordpress.com/2014/02/16/adding-shutdownrestart-pushbutton-for-raspberry-pi/ shutdown
- https://embeddedcode.wordpress.com/2013/10/18/adding-a-shutdown-button-to-the-raspberry-pi/ shutdown
- http://www.raspberry-pi-geek.com/Archive/2013/01/Adding-an-On-Off-switch-to-your-Raspberry-Pi shutdown switch
- http://www.instructables.com/id/Raspberry-Pi-Internet-Monitor/?ALLSTEPS Internet monitor with a shutdown switch
Speech synthesis and a push button
Festival speech package
sudo apt-get install festival # Add voice file sudo apt-get install festvox-rablpc16k # British English sudo apt-get install festvox-kallpc16k # American English
Speaking
echo "Hello World!" | festival --tts wget http://history.eserver.org/jefferson-inaugural.txt festival --tts jefferson-inaugural.txt
Speak Easier: Flite
sudo apt-get install flite flite -t "All good men come to the aid of the rebellion" flite -f jefferson-inaugural.txt flite -lv flite -voice awb -t "The Raspberry Pi is a great Maker platform!"
Fun Uses for Speech
sudo apt-get install fortune-mod fortune | flite
Wav output
flite -t "Shall we play a game?" -o wargames1.wav aplay wargames1.wav
Reading the Weather
sudo apt-get install weather-util weather washington weather -q fips1600190345 | flite
Playing sounds using push buttons (Python).
Use a Simple Button to Control LED
The following site has some elaboration about 'pull down' of resistors. http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/buttons_and_switches/
Get a Flashing Meeting Reminder with a Raspberry Pi
http://makezine.com/projects/get-a-flashing-meeting-reminder-with-a-raspberry-pi/
Using a servo motor, PWM
- http://learn.adafruit.com/adafruits-raspberry-pi-lesson-8-using-a-servo-motor?view=all
- How to use a servo motor with Raspberry Pi
LED dimming using software PWM (pulse-width modulation)
http://raspi.tv/2013/how-to-use-soft-pwm-in-rpi-gpio-pt-2-led-dimming-and-motor-speed-control
Reading analog input using external ADC (analog to digital converter) MCP3008
Reading temperature
https://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing?view=all
Raspberry Pi has no ADC (Analog to Digital Converter), it cannot directly use an analog temperature sensor like the TMP36.
http://www.cyberciti.biz/faq/linux-find-out-raspberry-pi-gpu-and-arm-cpu-temperature-command/.
I got 74C on my RP3B CPU when it is idle (leave it outside 89F)! What is the maximum temperature a Raspberry Pi 3 can be exposed to? Bring RP3B indoor can reduce the temperature to 60C. I'm using pi-top OS based on Debian 11 bullseye.
# CPU vcgencmd measure_temp # OR cpu=$(</sys/class/thermal/thermal_zone0/temp) echo "$((cpu/1000)) c"
and putting them together
#!/bin/bash # Script: my-pi-temp.sh # Purpose: Display the ARM CPU and GPU temperature of Raspberry Pi 2/3 # Author: Vivek Gite <www.cyberciti.biz> under GPL v2.x+ # ------------------------------------------------------- cpu=$(</sys/class/thermal/thermal_zone0/temp) echo "$(date) @ $(hostname)" echo "-------------------------------------------" echo "GPU => $(/opt/vc/bin/vcgencmd measure_temp)" echo "CPU => $((cpu/1000))'C"
For my Raspberry Pi 3, the temperature is 52C when it is idle. The temperature can go up to 84C when I build R 3.3.1.
For Pi Zero W, the temperature is 59C when I build R.
How to Get a Discord or Slack Alert If Your Raspberry Pi Is Too Hot. Webhook.
MCP23017 GPIO expander (extra 16 pins)
- http://learn.adafruit.com/mcp230xx-gpio-expander-on-the-raspberry-pi
- http://raspi.tv/2013/using-the-mcp23017-port-expander-with-wiringpi2-to-give-you-16-new-gpio-ports-part-3
Serial Peripheral interface (SPI)
- https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md
- https://learn.sparkfun.com/tutorials/raspberry-pi-spi-and-i2c-tutorial/all
- https://radiostud.io/understanding-spi-in-raspberry-pi/
- https://www.raspberrypi-spy.co.uk/category/hardware/interfaces/spi/
- http://www.brianhensley.net/2012/07/getting-spi-working-on-raspberry-pi.html
MIDI port
Camera
- CSI-2 (Camera Serial Interface 2) "Unicam"
- Raspberry Pi Camera Comparison (2017)
- Raspberry Pi High Quality Camera on sale now at $50, Raspberry Pi's improved camera module supports interchangeable lenses
- MagPi Essential: Camera module guide 2017
- http://www.raspberrypi-spy.co.uk/2013/05/capturing-hd-video-with-the-pi-camera-module/
- New command is libcamera-still (no need to enable). Old/legacy camera stack, 2021 command is raspistill
- libcamera-hello --list-cameras, libcamera-hello
- vcgencmd get_camera is only relevant for the legacy camera stack
- https://elinux.org/Omxplayer
# Still image 2592 x 1944 raspistill -vf -hf -o cam.jpg # -vf and -hf is to fix upside-down gpicview cam.jpg # View the image # Video raspivid -o myvid.h264 -t 60000 # 60 seconds. Default is 6 seconds which generates 10MB for 1080p, 6.4MB for 720p. # it will show a preview 'window' raspivid -t 60000 --nopreview -o output.h264 raspivid -o myvid.h264 -t 60000 -vf -hf # fix upside-down raspivid -o myvid.h264 -w 1280 -h 720 # 1280 x 720 instead of 1920 x 1080 raspivid -o myvid.h264 -w 1280 -h 720 -rot 180 # rotation 180 degree raspivid -o myvid.h264 -w 1280 -h 720 -b 8000000 # “8000000” is a bitrate of 8000Kbs (kilo bits per second) or 8Mb (8 mega bits per second). # The default is usually 17000000. # One problem with h264 file is it does not contain the duration metadata. # If we convert h264 to mp4, the mp4 file will contain the duration metdata # convert h264 to mp4 sudo apt install ffmpeg ffmpeg -framerate 30 -i input.h264 -c copy output.mp4 # OR sudo apt-get install -y gpac MP4Box -fps 30 -add myvid.h264 myvid.mp4 # play the video omxplayer myvid.h264 Omxplayer —-win 0,0,800,640 myvid.h264 omxplayer myvid.mp4
- http://elinux.org/Rpi_Camera_Module. There are several Android apps to control the camera (Pi or USB) on Raspberry Pi. For example, RaspiCam Remote.
- NoIR http://www.raspberrypi.org/learning/infrared-bird-box/
- Motion Guide
- Surveillance camera by codeproject.com. The same one is also hosted on instructables.com.
- http://www.home-automation-community.com/surveillance-with-raspberry-pi-noir-camera-howto/ (take care of user 'motion').
sudo usermod -a -G motion pi sudo chown motion:motion /home/pi/images sudo service motion start
To rotate the image, change 'rotate 0' to 'rotate 180' by sudo nano /etc/motion.conf (still not right).
- http://pingbin.com/2012/12/raspberry-pi-web-cam-server-motion/ (regular webcam is used)
- A post from opsactive.com. Similar to the above.
- Turn a Raspberry Pi into a CCTV Security System from averagemanvsraspberrypi.com.
- Raspberry Pi CCTV with netcat and mplayer, Netcat (nc) Command with Examples
Detect camera
libcamera-hello --list-cameras
This should report a list of detected cameras and their operating modes. If it reports "No cameras available" or your camera is not listed then these instructions are for you. [https://forums.raspberrypi.com/viewtopic.php?t=362707 What to do if your camera is not detected].
New commands vs legacy camera
- If I enable legacy camera support, then the new libcamera-hello command will not work. If I disable legacy camera, the new libcamera-hello works again.
- Raspberry Pi Documentation about Raspberry Pi Cameras.
- The `libcamera-still` and `libcamera-vid` commands were introduced as part of the `libcamera` framework, which came into the spotlight with the release of the Debian 11 (Bullseye) based Raspberry Pi OS. This new release replaced the familiar `raspistill` and `raspicam` camera commands with a new suite of open-source tools dedicated to getting the most from all of the official Raspberry Pi cameras¹. The exact release date is not specified, but it was sometime before November 14, 2021. As of February 7, 2023, the official `pycamera2` library has been provided for `libcamera`, making it easier for users to call Python demos.
- Camera software from the official Raspberry Pi Documentation
- Search "Pi 3" on the documentation.
- On Raspberry Pi 3 and earlier devices running Bullseye you need to re-enable Glamor in order to make the X-Windows hardware accelerated preview window work. To do this enter sudo raspi-config at a terminal window and then choose Advanced Options, Glamor and Yes. Finally quit raspi-config and let it reboot your Raspberry Pi.
- How To Use Raspberry Pi Cameras with Bullseye
- Examples
Still pictureslibcamera-hello libcamera-hello -t 0 # need to switch of terminal and Ctrl+c libcamera-still -o output.jpg libcamera-still -o output.jpg -t 5000 --width 1920 --height 1080 libcamera-still -t 60000 --datetime -n --timelapse 2000 # take a picture every 2 seconds (-t means timeout/delay in milliseconds) and last for 60 seconds # The format of the file will be MMDDhhmmss.jpg, where MM and DD are the month and date number, # and hh, mm and ss are hours, minutes and seconds. # taking a picture every second (--timelapse 1000) is difficult for the camera. # SSH nohup libcamera-still -o output.jpg > /dev/null 2>&1 nohup libcamera-still -o output.jpg --width 1920 --height 1080 > /dev/null 2>&1 nohup libcamera-still --width 1920 --height 1080 -t 10800000 --datetime -n --timelapse 30000 > /dev/null 2>&1 & # take a photo every 30 seconds, and last for 3 hours. So totally there are 360 photos. # If we convert them to a video with 24 fps, it will last for only 15 seconds. # it takes about 150MB. nohup libcamera-still --width 1920 --height 1080 -t 10800000 --datetime -n --timelapse 5000 > /dev/null 2>&1 & # Every 5 seconds + 3 hours = 2160 pictures = 90 seconds if we consider 24 fps. nohup libcamera-still --width 1920 --height 1080 -t 7200000 --datetime -n --timelapse 5000 > /dev/null 2>&1 & # Every 5 seconds + 2 hours = 1440 pictures = 60 seconds if we consider 24 fps. tiv $(ls -t *.jpg | head -1) # look at the picture through a terminal
Videos
libcamera-vid -t 10000 -o test.h264 # 640x480, 30 fps, 2.7MB for 10 seconds # default is -t 5000 (5 seconds) libcamera-vid --width 1920 --height 1080 -o full_hd.h264 -t 10000 # 30 fps, 7MB for 10 seconds libcamera-vid --width 1280 --height 720 --framerate 50 -o 50fps.h264
hardware/sensor
- Hardware specification
- A complete guide to help you choose lenses for your Raspberry Pi High Quality Camera
- Origina: 5-megapixel OmniVision OV5647
- V2: Sony IMX219 8-megapixel sensor
- High quality: 12.3 megapixel Raspberry Pi upgrades camera module with Sony IMX477R sensor
- Check and Test the Camera
v4l2-ctl --list-formats-ext
For example, Smraza Wide Angle Fish-Eye Camera Lense shows 2592x1944.
- Camera module 3
- https://www.raspberrypi.com/products/camera-module-3/, 12MP
- Raspberry Pi Camera Module v3 Review: A New Angle on Photography (comparison chart), How To Use Raspberry Pi Camera Module 3 with Python Code
- Raspberry Pi's new 12MP Camera Module 3 now has autofocus, HDR capture and more
- Arducam IMX708 HDR 120°(H) Wide Angle, Amazon
$ libcamera-hello --list-cameras Available cameras ----------------- 0 : imx708_wide [4608x2592] (/base/soc/i2c0mux/i2c@1/imx708@1a) Modes: 'SBGGR10_CSI2P' : 1536x864 [30.00 fps - (0, 0)/0x0 crop] 2304x1296 [30.00 fps - (0, 0)/0x0 crop] 4608x2592 [30.00 fps - (0, 0)/0x0 crop]
Connect camera module
- Raspberry Pi, the blue part (non-metal) on the cable faces the ethernet port.
- On camera module, the blue (non-metal) part is on the same side as the white plastic holder.
- The above rule applies to Pi zero W too. That is, the non-metal part faces up and the metal part faces down.
How to connect Raspberry Pi camera module to Raspberry Pi Zero W and the official case
Just Enough Raspberry Pi. The book/site include pictures of different versions of Raspi with large size (cool!). For Raspi Zero W, it shows v1.1 whose camera connector is smaller than a regular Raspi. The camera cable included in pi zero case is a must (one side is regular size and the other side is smaller).
I also find my camera connector is broken when I try to tighten it. Just slide a piece of thick paper or cardboard will solve the problem; see here and Broken retaining clip on Camera Board.
Pi camera mount
- Tripod Camera Mount for Raspberry Pi. The tripod hole is 5mm.
- Night Vision Camera for Raspberry Pi
PiCameraApp
Connect a USB camera
- https://www.raspberrypi.org/documentation/usage/webcams/. It says the quality and configurability of the camera module is highly superior to a standard USB webcam.
sudo apt-get install fswebcam fswebcam -r 1280x720 image2.jpg
- Streaming H264 with Logitech C920
Use as a USB Webcam
Fisheye Cam
Dash Cam
- http://pidashcam.blogspot.com/ (with mounting pictures) or http://pidashcam.blogspot.nl/
- http://www.raspberrypi-spy.co.uk/2014/11/how-to-create-a-raspberry-pi-video-capture-unit-part-1/ (with mounting pictures)
- https://programmaticponderings.wordpress.com/2013/06/30/low-cost-dashboard-camera-using-motion-ffmpeg-and-the-raspberry-pi/
- http://www.dreamgreenhouse.com/projects/2013/picar/index.php
- http://www.stuffaboutcode.com/2013/10/raspberry-pi-car-cam-gps-data-map.html
- A RASPBERRY PI HELMET CAM WITH GPS LOGGING
- DIY WiFi Raspberry Pi Touchscreen Camera
- http://zachhuff386.github.io/dashcam/
- http://hackaday.com/2014/11/01/delicious-dash-pi-driving-data/
Time-lapse
- Shell script 1: Taking pictures. This can create a one-minute video according to the script 2 below. To kill the processes, run pkill libcamera-still
#!/bin/bash # Define the duration in minutes DURATION_MINUTES=180 # Define the timelapse in seconds TIMELAPSE_SECONDS=30 # Convert minutes to milliseconds DURATION=$((DURATION_MINUTES * 60 * 1000)) # Convert seconds to milliseconds TIMELAPSE=$((TIMELAPSE_SECONDS * 1000)) # Run the libcamera-still command with the converted duration and timelapse nohup libcamera-still --width 1920 --height 1080 -t $DURATION --datetime \ -n --timelapse $TIMELAPSE > /dev/null 2>&1 &
- Shell script 2: Overlay date and time. See also convert options.
LOCATION=NorthEast for img in *.jpg; do convert "$img" -gravity $LOCATION -pointsize 24 -fill yellow \ -annotate +10+10 "%[exif:DateTimeOriginal]" "$img" done
- Shell script 3: Convert images into a video
ffmpeg -framerate 24 -pattern_type glob -i "*.jpg" -c:v libx265 -crf 28 output.mp4 # OR fps=12 with a slightly larger file size ffmpeg -framerate 12 -pattern_type glob -i "*.jpg" -c:v libx265 -crf 28 output.mp4
"-framerate 24" sets the framerate for the video. You can adjust this value as needed. "-vcodec libx265" sets the video codec to libx265, which is a more efficient codec for compression. "-crf 28" sets the Constant Rate Factor (CRF) to 28. The CRF is a quality-controlled variable bitrate, lower values would result in higher quality and larger files, higher values would result in lower quality and smaller files. See CRF Guide & H.264 Video Encoding Guide from ffmpeg website.
- 5 Ways to Use the Raspberry Pi Camera Module for Time-Lapse Photography
- How to Shoot Time-Lapse Videos with Raspberry Pi
- Time-lapse animations with a Raspberry Pi. Every 60 seconds takes a picture.
convert -delay 10 -loop 0 image*.jpg animation.gif # very very slow, gif file 63MB
-delay 10: This option sets the delay between frames in the GIF. The value is in hundredths of a second, so -delay 10 means each frame will be displayed for 0.1 seconds. -loop 0: This option sets how many times the animation will loop. A value of 0 means the animation will loop indefinitely.
- Shell script (not python): Raspberry Pi Time-Lapse in Four Easy Steps, Raspberry Pi 5: Video Editing, Video Calling & Passive Cooling
- How often to take pictures for time-lapse video. The interval between each shot in a time-lapse sequence, also known as the time-lapse interval, can vary greatly depending on the subject and the desired effect. Here are some general guidelines:
- For scenes with minimal movement, such as a calm day with little wind and cloud movement, you might want to set an interval of one shot every 30 seconds.
- For scenes with a lot of movement, you might want to set an interval of one shot every 5 seconds or less.
- If you have a specific length for the final video in mind, you can calculate the interval. For example, if you want a 30-second video at 25 frames per second (fps), you’ll need 750 frames (30 seconds * 25 fps). If your shooting duration is 2 hours (7200 seconds), then your interval would be approximately 10 seconds (7200 seconds / 750 frames).
Remote viewing
A Remote Viewing Camera With Raspberry Pi
Create a button-operated camera
https://www.raspberrypi.org/magpi-issues/MagPi45.pdf p27
Streaming
Stream video over a network with rpicam-apps from official Raspberry Pi. The instruction is based on Raspberry Pi OS Bookworm where it renamed the camera capture applications from libcamera-* to rpicam-*.
- UDP method (require the client IP). Prioritizes speed over reliability. It sends data without establishing a connection, resulting in lower latency but potential packet loss. Ideal for real-time applications like live streaming and gaming.
libcamera-vid -t 0 --width 1920 --height 1080 --inline -o udp://Client-IP:8888
I found VLC closed automatically for some reason. ffplay seems to be quite stable. Also the streaming does not use much of CPU.
ffplay udp://Server-IP:8888 -fflags nobuffer -flags low_delay -framedrop
- TCP method. Medium Latency. Suitable for applications where data accuracy is crucial.
- RTSP method. Medium-High Latency.
libcamera-vid -t 0 --inline -o - | cvlc stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/stream1}' :demux=h264
On the client side (eg Android),
vlc rtsp://Server-IP:8554/stream1
Live stream to youtube
- Live Stream to YouTube With a Raspberry Pi from makeuseof.
- Live stream to YouTube with your Raspberry Pi and Docker
- EZ Streamer-Pi lets you live stream from four cameras at once
RTSP and ZoneMinder
- Streaming using http has a delay but it works.
- Use mplayer rtsp://IP:8081/. But quite delay.
- Use ffplay rtsp://IP:8081/. Quite delay.
- mjpg-streamer
- Install dependencies
sudo apt-get update sudo apt-get upgrade sudo apt-get install build-essential libjpeg-dev libv4l-dev cmake git
- Compile MJPG-streamer
git clone https://github.com/jacksonliam/mjpg-streamer.git cd mjpg-streamer/mjpg-streamer-experimental make sudo make install
- Start MJPG-streamer
./mjpg_streamer -i "./input_uvc.so -y -n -r 640x480 -f 10" -o "./output_http.so -w ./www"
- Access http://<raspberry-pi-ip>:8080/?action=stream.
- Install dependencies
- Low-latency network stream
- How To Stream Live Video From Your Raspberry Pi Camera
- Easiest way to hardware accelerated RTSP streaming with Raspberry PI 4
- How To Add Raspberry Pi RTSP Camera Stream To Home Assistant
- CCTV: Build your own video surveillance system with ZoneMinder. The delay is about 5 sec.
sudo apt update sudo apt install vlc cd ~ nano rtsp.sh
#!/bin/bash raspivid -o - -t 0 -w 1280 -h 720 -fps 15 -n | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8081/x}' :demux=h264
Then run,
chmod +x rtsp.sh ./rtsp.sh
Open VLC vlc -vvv rtsp://IP:8081/x or vlc -vvv rtsp://username:password@IP:8081/x (this gave an error if I use the original script. VLC is unable to open the MRL 'rtsp://....'. Check the log for details. The solution is to add a filename, like "x" in above. See Cannot get VLC to play stream).
rtsp://192.168.0.100:8081/x
sudo nano /etc/systemd/system/rtsp.service
[Unit] Description=auto start rtsp stream After=multi-user.target [Service] Type=simple ExecStart=/home/pi/rtsp.sh WorkingDirectory=/home/pi Restart=always User=pi [Install] WantedBy=multi-user.target
sudo systemctl start rtsp.service sudo systemctl status rtsp.service sudo systemctl enable rtsp.service exit
- Simple MODECT (Motion Detection) zone in ZoneMinder
RPi Cam (Live stream and Cam Web Interface)
http://elinux.org/RPi-Cam-Web-Interface as used in portable streaming camera and it supports motion detection as seen on Web controlled Raspberry Pi Camera.
It also supports recording videos manually (MotionEye cannot).
The installation is quite simple and the basic installation just works (1/21/2017) with my Pi Camera v2. By default, I can access the live stream by visiting http://raspberrypi.local/html/. The web interface allows me to change camera settings (eg flip image), record video, record image, timelapse, etc. Quite amazing. The first screenshot shows one text dialog during installation and the 2nd screenshot shows the web interface. By default, the live stream will be auto-start. It can be installed on Raspbian-Lite too.
sudo apt-get update sudo apt-get dist-upgrade git clone https://github.com/silvanmelchior/RPi_Cam_Web_Interface.git cd RPi_Cam_Web_Interface chmod u+x *.sh ./install.sh
How to Use Raspberry Pi as a PC Webcam
How to Use Raspberry Pi as a PC Webcam
Security Camera: motion and motionEyeOS
See motionEye.
Intruder detection
http://www.instructables.com/id/Intruder-Detector-With-Raspberry-Pi-and-Pushbullet/
Raspberry Pi dog detector
Chat Bot prevented a burglary
How a Chat Bot prevented a burglary
Pan and tilt security camera controlled by Arduino
http://www.makeuseof.com/tag/diy-pan-and-tilt-network-security-cam-raspberry-pi/
Slow motion
http://www.averagemanvsraspberrypi.com/2015/07/raspberry-pi-camera-module-slow-motion-video.html
Motion triggered infrared wildlife camera, night version camera
- https://blog.adafruit.com/2015/09/04/how-to-make-a-motion-triggered-infrared-wildlife-camera-with-raspberry-pi-piday-raspberrypi-raspberry_pi/
- How Do Night Vision Cameras Work?
- How to Use a Security Camera’s Night Vision Through a Window
- IR-CUT Camera Night Vision Focal Adjustable 5MP Fish Eye Auto Switch Day-Night Aliexpress
Solar powered nature camera
- https://www.raspberrypi.org/blog/solar-powered-nature-camera/
- Solar Powered Raspberry Pi Camera
- Raspberry Pi listening posts ‘hear’ the Borneo rainforest
Baby monitor
SleePi sounds alarm when Raspberry Pi detects sleepiness
SleePi sounds alarm when Raspberry Pi detects sleepiness
Tiddlybot
- https://www.kickstarter.com/projects/1320310506/tiddlybot-fun-and-simple-raspberry-pi-robot/comments
- https://www.shopstarter.com/s/Tiddlybot/
- http://www.pibot.org/tiddlybot/
- https://github.com/Agilic-Development
- https://github.com/discoverycode/discoverybot_api The Discovery Bot
- http://www.pibot.org/tiddlybot/images/ V1.1 image download link
- http://pibot.org/forum/index.php Forum
- Two recommended wifi adapters: Edimax EW-7811Un, and the TP link TL-WN725N
- http://pibot.org/forum/index.php?topic=45.0 Pin out with a nice graph
- http://pibot.org/forum/index.php?topic=50.0 Raspi A+ is better than V2 in terms of power consumption. See also this post & this new one from raspi.tv.
- Turn on wifi (pc/tablet/phone) and connect to TiddlyBot_01 SSID with the password 'Raspberry'. Use the address http://192.168.42.1. When we turn on RasPi, we shall see the wifi led keep flashing. If not, eject uSD and insert again (and boot). If we connect RasPi to a monitor, it will drop to the shell. The default username/password is pi/raspberry (lower case).
The battery it includes is Nokia BL-5C 1020mAh 3.7V 3.8Wh ~ $5.35 US. Note that the battery has 3 pins. One of them labelled as T is for temperature.
To turn off the robot, switch the slider to the buzzer.
To run a small dhcp server, it uses udhcpd.
pi@raspberrypi ~ $ sudo service --status-all [ ? ] alsa-utils [ - ] bootlogs [ ? ] bootmisc.sh [ ? ] cgroup-bin [ ? ] checkfs.sh [ ? ] checkroot-bootclean.sh [ - ] checkroot.sh [ - ] console-setup [ + ] cron [ + ] dbus [ ? ] dphys-swapfile [ ? ] fake-hwclock [ + ] hostapd [ - ] hostname.sh [ ? ] hwclock.sh [ + ] ifplugd [ - ] kbd [ - ] keyboard-setup [ ? ] killprocs [ ? ] kmod [ - ] lightdm [ - ] motd [ ? ] mountall-bootclean.sh [ ? ] mountall.sh [ ? ] mountdevsubfs.sh [ ? ] mountkernfs.sh [ ? ] mountnfs-bootclean.sh [ ? ] mountnfs.sh [ ? ] mtab.sh [ ? ] networking [ - ] nfs-common [ + ] ntp [ ? ] plymouth [ ? ] plymouth-log [ - ] procps [ ? ] raspi-config [ ? ] rc.local [ - ] rmnologin [ - ] rpcbind [ - ] rsync [ + ] rsyslog [ ? ] screen-cleanup [ ? ] sendsigs [ + ] ssh [ - ] sudo [ + ] triggerhappy [ + ] udev [ ? ] udev-mtab [ ? ] udhcpd [ ? ] umountfs [ ? ] umountnfs.sh [ ? ] umountroot [ - ] urandom [ - ] x11-common
Bird feed
Raspberry Pi catches the early bird
View Stonehenge in real time via Raspberry Pi
View Stonehenge in real time via Raspberry Pi and the site.
Unlock your PC with a pushup or two (Machine learning)
Unlock your PC with a pushup or two
ESP8266
Connect an ESP8266 to your RaspberryPi
IFTTT
See Fridge monitor (p41-45) of TheMagPi September 2015.
Control a 12V lamp with GPIO ZERO
http://raspi.tv/2015/gpio-zero-test-drive-making-light-of-security
Grandpa scarer & Laser cutter
https://www.raspberrypi.org/learning/grandpa-scarer/worksheet/
Color sensing
https://www.raspberrypi.org/blog/colour-sensing-raspberry-pi/
Relay
- Raspberry Pi Zero waters your plants and records growth timelapse
- How to Build a Light-Sensing Smart Switch With Raspberry Pi and IFTTT
Smart suitcase
http://www.instructables.com/id/How-to-Make-a-Smart-Suitcase-With-a-Raspberry-Pi/
Identify Bird Sounds With BirdNET-Pi
Identify Bird Sounds With BirdNET-Pi on Raspberry Pi
Other cool stuff
Hosting Without The Need to Port Forward, Tunnelling
Home Automation
Uses in office
11 Uses for a Raspberry Pi Around the Office. DNS Server, Toilet Occupied Sign, Honeypot Trap for Hackers, Print Server, Network Attached Storage, Ticketing Server, Digital Signage, Directories and Kiosks, Basic Intranet Web Server, Penetration Tester, VPN Server, and Wireless Coffee Machine.
Track Internet Dropouts
- http://makezine.com/projects/send-ticket-isp-when-your-internet-drops/. Keywords: speedtest-cli, cron, IFTTT, google spreadsheet.
- PCWorld
GPS tracker
http://blog.initialstate.com/new-python-gps-tracker/
Retro Game Console/Emulator
- See RetroPie.
- Raspberry Pi Zero 2 W from ETA prime
pygame
- Code a Kung-Fu Master style beat-’em-up | Wireframe #32
- Recreate Flappy Bird’s flight mechanic | Wireframe #29
Three great games from GameMaker: Studio
https://www.raspberrypi.org/blog/three-great-gamemaker-games-raspberry-pi/
Raspberry Pi Based Wireless FM Microphone
http://www.instructables.com/id/Raspberry-Pi-Based-Wireless-Microphone/?ALLSTEPS
Dashboard/Kiosk by dashing.io
- See the article USE AN ODROID-C1 AS A WALL DASHBOARD on 2015/5 ODROID magazine
- http://www.fusonic.net/en/blog/2013/07/31/diy-info-screen-using-raspberry-pi-dashing/
- Search google: dashing raspberry pi
balenaCloud Dashboard
Build a Raspberry Pi Desktop Dashboard
Ashley’s top five projects for Raspberry Pi first-timers
https://www.raspberrypi.org/blog/ashleys-top-five-projects-for-raspberry-pi-first-timers/
5 Raspberry Pi Digital Signage Projects You Should Try
https://www.makeuseof.com/tag/raspberry-pi-digital-signage-projects/
6 Raspberry Pi tutorials to try out
https://opensource.com/article/20/3/raspberry-pi-tutorials
- VPN server
- Create an object-tracking camera
- Photo slideshow
- Retro game
- Build a clock for your entertainment center
Go to space
- Raspberry Pi in space (nearly) 35.5 km Pi balloon launch and a GoPro version.
OpenCV
- Face recognition treasure box from adafruit.
Wii Remote, bluetooth
- Wii remote based on CWiid Python library (it works on my UDOObuntu 2). Another very similar example.
- Controlling an i-racer RC car using a Wii Balance Board and Raspberry_Pi
- Wii Nunchuck and C code. This is based on Python.
- WiiChuck Adapter
- CamJam Edukit 3 Robotics Kit no instruction.
Wii balance board
- https://en.wikipedia.org/wiki/Wii_Balance_Board
- Smart beer fridge with wii balance board and Raspberry Pi (ARM). The weight scale example works fine when I tested on UDOO. Plus there are only 3 packages to install (python-bluetooth, bluez and python-gobject).
- Wii-Scale and Web page
- DIY internet-enabled bathroom scale
- A Hackable, Weight Tracking, Text Messaging Scale with a Sense of Humor
- Use the Wii Balance Board as a pretty accurate weight scale How to use?
- Sends weight to Google Docs spreadsheet, shows it on an LCD and outputs text to speech
- https://www.hackster.io/claude4/wii-balance-board-cloud-scale-400a4b
- Wii balance board with GUI (tested on UDOObuntu 2 beta2 based on Ubuntu 14.04.3 LTS, Nov 2015 AND Raspbian on Raspberry Pi Dec 2017). One inconvenient thing is I need to press the sync button every time I run the program.
sudo apt-get install autoconf autogen automake gcc bluetooth libbluetooth3-dev \ libgtk2.0-dev pkg-config python2.7-dev flex bison git-core \ libbluetooth-dev python-pygame python-tk # NOTE: libbluetooth2-dev becomes libbluetooth3-dev now # python2.5-dev becomes python2.7-dev now sudo apt-get install bluez # no need to create wiibalance directory git clone https://github.com/abstrakraft/cwiid.git # the svn method does not work # 131 commits. Last commit is Feb 21, 2010. cd cwiid aclocal autoconf # if something messed up, run 'autoreconf' # Follow http://wiki.labomedia.org/index.php/Blender:Wiimote_:_Compilation_de_cwiid_sur_Linux_Mint_12 # to fix an error "wmdemo undefined reference to symbol str2ba" when running 'make' # That is, edit wmdemo/Makefile.in line 11 # LDLIBS += -lcwiid -lbluetooth # make clean sed -i 's/lcwiid/lcwiid -lbluetooth/g' wmdemo/Makefile.in ./configure # no need of '--libdir=/usr/lib' make sudo make install # Test Wii remote with GUI sudo wmgui/wmgui cd python sudo python setup.py install # install the Wii balance board software: git clone git://github.com/videntity/python-omhe.git cd python-omhe sudo python setup.py install # Install pycurl; see https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=103188 sudo apt-get install python-pycurl sudo python ./omhe/hardware/wiibalance/wiibal-weighdemo.py # Strangely, the code is for bal board but the instruction is for Wiimote # Just ignore this test and/or its result wget http://abstrakraft.org/cwiid/raw-attachment/ticket/63/scalesgui.py wget http://abstrakraft.org/cwiid/raw-attachment/ticket/63/system.ini chmod a+x scalesgui.py nano system.ini # On my 800x480 display, I change <system.ini> file # width=1200 -> 800, height=960 -> 420, size=300 -> 50 # On Pi-top (1366 x 768), I use width = 1200, height = 650 nano scalesgui.py # change line 170 in order to change kg to pounds # weight_sprite.weight = weight*2.20462 # change line 161 to use 'q' letter instead of 'F1' to quit the program # if event.key == K_q: sudo python ./scalesgui.py # better to keep pressing the red sync button until ... # <system.ini> and <scalesgui.py> are in the same dir # To exit the program you should press the “F12” key. # I change the code in scalesguy.py to use the 'q' key to quit the program.
Robot control
- http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/robot_control/
- Linux User & Developer 132
Compile R from source
Tested on R 3.0.1
- cd R-3.0.1
- ./configure --with-recommended-packages=no
- sudo apt-get install openjdk-7-jdk
- nano src/library/tools/R/install.R and pass "perl = TRUE" to sub()
SHLIB_EXT <- sub(".*= ", "", grep("^SHLIB_EXT", mconf, value = TRUE), perl = TRUE) SHLIB_LIBADD <- sub(".*= ", "", grep("^SHLIB_LIBADD", mconf, value = TRUE), perl = TRUE)
to get rid of the error gcc: error: SHLIB_LIBADD: No such file or directory.
- make
Temperature/Humidity Sensors for Data Analysis in R
Setting Up Raspberry Pi Temperature/Humidity Sensors for Data Analysis in R
Google Coder
PS. Code is based on node.js (Early version of shiny-server also depends on node.js).
http://pi.gadgetoid.com teaches us how to install Coder on a Raspberry Pi running on Raspbian. Note that Coder can turn Raspberry Pi into a web server. We can develop the code on a remote computer.
In fact, it is possible to run Code for Raspberry Pi on your own PC. Just run 7 lines of script at here. Note: My experience shows it is safe to use the version on Sep-17-2013; otherwise you'll get the following error when using 'nodejs server.js'
$ nodejs server.js no certificate found. generating self signed cert. module.js:337 throw new Error("Cannot find module '" + request + "'"); ^ Error: Cannot find module '/home/pi/coder/coder-base/apps/auth/app'
So the successful steps to install coder on Ubuntu is
- download zip file from Sep-17-2013 tree
- cd coder-base; npm install
- modify 'config.js'
- launch it by 'node server.js'.
I don't have to use sudo when I use 'npm install' and 'node server.js'.
The password requirement for coder is at least 6 characters, at least one lower case and at least 2 upper cases or numbers.
Also, on Ubuntu it will complain the user 'pi' does not exist. So we shall do this 'sudo adduser pi' too. Pick the same password as we use in coder (eg Raspberry99).
Update: After I played with it, I found Coder does not let us work on more than one HTML, CSS or Javscript file. This makes the development more difficult.
Another choice is to run Cloud9 IDE on RPi. The Cloud 9 IDE was preinstalled on Beaglebone black/
Wolframe Mathematica
- http://www.wolfram.com/raspberry-pi/
- http://www.wolfram.com/broadcast/video.php?channel=105/?fp=left&video=1571 (Video)
- http://www.raspberrypi.org/archives/5282
- http://www.raspberrypi.org/phpBB3/viewtopic.php?t=61746&p=459159 (Download locally first)
For some reason, the Mathematica is not shown on the menu (it only happened on self-installed version). We can start Mathematica from the command line
/usr/bin/mathematica
We can try a 3D plot like seen in youtube
Plot3D[Sin[x*y], {x,0,Pi}, {y,0,Pi}]
The following screenshot shows how to calculate the derivative of f(x)=sin(x)*exp(2x) using Wolfram.
- Note that the language is case-sensitive. For example, sin[x] is not recognized and it should be Sin[x].
- Wolfram language uses square brackets instead of parentheses for function's arguments.
- See this page for Wolfram language & system documentation.
- Another way is to type D[Sin[x] * Exp[2x], x]
Note that Mathematica is a GUI program so it is kind of slow when it is running on Raspberry Pi. The Wolfram program is a command line interface program so it is much faster although we can not do any plotting there.
Use RaspPi as Media Center
http://www.packtpub.com/raspberry-pi-media-center/book
IN-FLIGHT entertainment system
Record TV
- http://www.redrobe.com/mike/record-tv-on-raspberry-pi-with-tvheadend/. This is from the same author of Raspicam Remote for Android.
Bitcoin Miner
- http://www.linuxuser.co.uk/tutorials/mine-bitcoins-with-raspberry-pi
- https://learn.adafruit.com/piminer-raspberry-pi-bitcoin-miner/initial-setup-and-assembly
How to Track Satellite (ISS) Fly-Bys with Raspberry Pi
How to Track Satellite Fly-Bys with Raspberry Pi
Wifi extender
- RaspAP Web interface to control wifi, hostapd and related services
- Hostapd : The Linux Way to create Virtual Wifi Access Point
- Simple Raspberry Pi WiFi Extender
- How to Setup a Wireless Access Point on the Raspberry Pi
# 1. Update sudo apt update; sudo apt upgrade # 2. Install software sudo apt install dnsmasq hostapd # 3. Setup wlan0 (if this has been done before, go to step 5) sudo nano /etc/wpa_supplicant/wpa_supplicant.conf # 4. Create an entry of network={ ssid=" " psk=" " } # 5. Setup dhcpcd sudo nano /etc/dhcpcd.conf # 6. Add lines interface wlan1 static ip_address=192.168.220.1/24 static routers=192.168.220.0 # 7. Restart dhcpd service sudo service dhcpcd restart # 8. Adjust hostapd configuration sudo nano /etc/hostapd/hostapd.conf # 9. Adjust the ssid=, wpa_passphrase= and # driver= line to the best driver for your device, interface=wlan1 driver=nl80211 hw_mode=g channel=6 ieee80211n=1 wmm_enabled=1 ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40] macaddr_acl=0 ignore_broadcast_ssid=0 auth_algs=1 wpa=2 wpa_key_mgmt=WPA-PSK rsn_pairwise=CCMP ssid=Pi3-Extender wpa_passphrase=raspberry # 10. sudo nano /etc/default/hostapd # 11. Replace the line #DAEMON_CONF="" with DAEMON_CONF="/etc/hostapd/hostapd.conf" # 12. sudo nano /etc/init.d/hostapd # 13. Replace the line #DAEMON_CONF= with DAEMON_CONF=/etc/hostapd/hostapd.conf # 14. setting up dnsmasq sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig # 15. sudo nano /etc/dnsmasq.conf # 16. add the following lines interface=wlan1 # Use interface wlan1 listen-address=192.168.220.1 # Specify the address to listen on bind-interfaces # Bind to the interface server=8.8.8.8 # Use Google DNS domain-needed # Don't forward short names bogus-priv # Drop the non-routed address spaces. dhcp-range=192.168.220.50,192.168.220.150,12h # IP range and lease time # 17. forward all traffic from our wlan1 connection over to our wlan0 connection sudo nano /etc/sysctl.conf # 18. Replace the line #net.ipv4.ip_forward=1 with net.ipv4.ip_forward=1 # 19. sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward" # 20. configure a NAT between our wlan0 interface and our wlan1 interface. sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE sudo iptables -A FORWARD -i wlan0 -o wlan1 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i wlan1 -o wlan0 -j ACCEPT # 21. sudo sh -c "iptables-save > /etc/iptables.ipv4.nat" # 22. sudo nano /etc/rc.local # 23. Find the line exit 0 Add ABOVE: iptables-restore < /etc/iptables.ipv4.nat # 24. start the two services and enable them in systemctl. sudo systemctl unmask hostapd sudo systemctl enable hostapd sudo service hostapd start sudo service dnsmasq start # 25. sudo nano /etc/network/interfaces allow-hotplug wlan0 iface wlan0 inet dhcp # wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf allow-hotplug wlan1 # 26. sudo reboot
I can see the SSID. But I cannot connect to that.
sudo systemctl status hostapd sudo systemctl status dnsmasq
Converting Any USB Device to A Wireless USB
Converting Any USB Device to A Wireless USB using Raspberry Pi Zero. VirtualHere $49.
Raspberry Pi Wifi Ethernet Bridge
DIY Raspberry Pi Wifi Ethernet Bridge (2/26/2023). Raspberry pi connected to internet through wifi. Another device (or a hub if we want to connect multiple devices) connects to Raspberry Pi by an ethernet cable and gets internet through Pi's wifi.
- Turn your Raspberry Pi into a WiFi Router using OpenWrt. It works and quite stable.
- Very small (16MB). I've downloaded 64-bit version (22.03-5).
- I connect RPI to a display/monitor for a quick setup which is necessary before we can use OpenWRT.
- No need to use web interface.
- I got a speed of 28Mb/s at best using RPI 3b.
cd /etc/config vi network vi wireless reboot network /etc/init.d/network restart
- RaspAP & https://github.com/RaspAP/raspap-webgui. The web interface is http://raspberrypi.local/. It works (2023-7-23). See the note below.
- Eth and wifi running but no internet. you need to enable ipv4 forwarding, edit /etc/sysctl.conf to include this line net.ipv4.ip_forward=1, then reboot.
- Web access. username/password is admin/secret.
- Note the interface is kind of slow on Rasp 3b.
- I'm testing using 32-bit Lite Bulleye.
- Not stable.
- Share WiFi With Ethernet Port on a Raspberry Pi
- How to Turn a Raspberry Pi Into a Wi-Fi Access Point
- How to use your Raspberry Pi as a wireless access point. PS. it does not work and it even broke the eth0 connection:(
- Turn a Raspberry Pi into a Wi-Fi access point or repeater
- Wireless Bridge
- The main use cases for wireless bridges are:
- Extending a wired network wirelessly to an area without cables
- Connecting two wired networks in different buildings wirelessly instead of pulling cables
- Connecting a wired network to a wireless one and vice versa
- How to Turn an Old Router Into a Wireless Bridge. A wireless bridge is a connection type where you join two or more local area networks (LAN) wirelessly. By combining two networks together through a wireless bridge, you essentially make one larger network where all devices are connected and have access to the internet. This allows devices on the two previously separated networks to communicate with each other as if they were on the same local network.
- The main use cases for wireless bridges are:
Turn Raspi into a wireless hotspot / access point
(2023/8/2) Going Camping? Jellyfin on Raspberry Pi Is the Perfect Offline Media Server
(2022/9/12) How to Turn a Raspberry Pi Into a Wi-Fi Access Point by using Network Manager (instead of using dhcpcd file) from the latest Raspberry Pi OS update.
I am using TP-LINK TP-WN722N wifi adapter.
- (Not stable) http://elinux.org/RPI-Wireless-Hotspot. Also see some of my notes on Beaglebone page. The instruction asks to install hostapd and udhcpd (not dhcp). I made a copy of the changed files in Github. It appears there is a typo on the /etc/udhcpd.conf file. See Setting up Pi as a Wifi Hotspot. That is, use option instead of opt on subnet and lease lines. Issue 1: I have a problem with automatically or manually starting udhcpd service. Issue 2: even the hotspot is connected but no internet was found. See
- http://askubuntu.com/questions/699995/hotspot-created-and-connected-from-linux-but-no-internet-access-on-phone
- http://superuser.com/questions/1061849/connected-to-hostapd-hotspot-but-no-internet
- I found out a solution for my case. Running 'ifconfig' and 'route -n', my problem is the wlan0 ip is wrong (becomes 169.254.0.0). So I need to run sudo ifdown wlan0 && sudo ifup wlan0 or better sudo /etc/init.d/networking restart to fix the ip error.
pi@raspberrypi:~ $ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 10.42.0.1 0.0.0.0 UG 202 0 0 eth0 10.42.0.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 303 0 0 wlan0 192.168.42.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0 pi@raspberrypi:~ $ ifconfig eth0 Link encap:Ethernet HWaddr b8:27:eb:24:6b:a0 inet addr:10.42.0.37 Bcast:10.42.0.255 Mask:255.255.255.0 ... lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 ... wlan0 Link encap:Ethernet HWaddr f8:d1:11:0b:52:6f inet addr:192.168.42.1 Bcast:192.168.42.255 Mask:255.255.255.0 ...
- (Adafruit) You can setup wlan0 in standalone mode or bridge it with eth0. Digital Free Library also includes how to set up Raspi as an access point/apache server/dhcp server (but no internet connection).
- http://raspberry-at-home.com/hotspot-wifi-access-point/
- Turn Your Raspberry Pi Into a WiFi Hotspot with Edimax Nano USB EW-7811Un. This instruction is using bridge-utils and hostapd packages.
- Setup Wireless Access Point (WAP) with Hostapd for Debian/Ubuntu by installing hostapd & bridge-utils packages.
- This is a similar post using hostapd and isc-dhcp-server packages.
- How to Turn Your Raspberry Pi into a Wireless Access Point (2020), (Adafruit) Setting up a Raspberry Pi as a WiFi access point (2024).
1. Install hostapd, dnsmasq, FW plugins 2. Assign a static IP to wlan0 /etc/dhcpcd.conf 3. Enable routing/port forward /etc/sysctl.d/routed-ap.conf 4. Configure both DHCP on wlan0 and local wlan0 DNS /etc/dnsmasq.conf 5. Create a wifi SSID and WPA password /etc/hostapd/hostapd.conf
Midi keyboard
Bike computer
https://www.raspberrypi.org/blog/bike-computer-for-the-myopic/ This build uses the Kindle as a display
OctoPrint
The snappy web interface for your 3D printer.
Connect your printer to a small embedded and WiFi enabled device such as the popular Raspberry Pi, install OctoPrint on it and you have an instant wireless printer.
Orange Pi
- Block Ads on All Your Devices at Home with Pi-hole
- Kernel Backdoor found in Gadgets Powered by Popular Chinese ARM Maker
- We (orange pi) are subsidized by the government
Mozilla Project Things
E-ink
Magic mirror
- https://github.com/MichMich/MagicMirror
- Raspberry Pi 4 Desktop Dashboard On a 7" Touchscreen | MagicMirror Setup
How to measure particulate matter
- https://opensource.com/article/18/3/how-measure-particulate-matter-raspberry-pi. Lighttpd, HTML, JavaScript, and CSS are used.
- How to build a mobile particulate matter sensor with a Raspberry Pi
Designing a Raspberry Pi Based Intelligent Ultrasonic Bat Detector App
Designing a Raspberry Pi Based Intelligent Ultrasonic Bat Detector App
Calculate pi
- See this tweet
> pi [1] 3.141593 > k <- seq(0, 10^7) > 4 * sum((-1)^k / (2*k + 1)) [1] 3.141593 > k <- seq(1, 10^7) > sqrt(6 * sum(1 / k^2)) [1] 3.141593 > f <- function(n) if(n) sqrt(1/2 + 1/2*f(n-1)) else sqrt(1/2) > 2 / prod(sapply(0:11, f)) [1] 3.141593
- Estimating pi with Monte Carlo simulation
8086
Raspberry Pi HAT Brings 1984 CPU to 2022
Alternatives
DietPi
DietPi is an extremely lightweight Debian-based OS.
- https://github.com/MichaIng/DietPi
- Comparison
- Complete Guide
- Password explaination
- Installation
- Change global software password for DietPi-software installs. The password will be encrypted and saved to /var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin to be used by DietPi-Software as initial password for e.g. web application and frontend logins. This does not affect any previously installed software, just new installs. We especially recommend to change it, if you did not change it in "dietpi.txt" yet. NB: we highly recommend to apply individual passwords for each software title after first login. Would you like to change the global software password now? OK/Cancel.
- Change login password for "root" and "diepi" users? DietPi has two accounts by default: "root" and "dietpi". On first boot, both share the password "dietpi", respectively the one set in "dietpi.txt". It is highly recommended to change this password, ideally, it should be different than the global software password. Would you like to change the login password for "root" and "dietpi" now? OK/Cancel. It seems this does affect the (same) password for root & dietpip.
- A serial/UART console .... would you like to disable it? Yes/No.
- Memory is 20.9/477M according to htop (on my RPi 1B, armv6)
- Default username/password is root/dietpi
- Dropbear was used instead of openssh by default
- After a login, it will remind some useful commands
- dietpi-launcher (can run 'dietpi-config' and 'dietpi-software').
- DietPi-Drive_Manager: control multiple external drives (eg Samba drives)
- DietPi-AutoStart
- DietPi-Services
- DietPi-Cron: Mailto/cron.minutely/cron.hourly/cron.daily/cron.weekly/cron.monthly
- DietPi-Backup
- DietPi-Cleaner
- DietPi-Sync
- DietPi-VPN: setup a VPN connection: NordVPN/ProtonVPN/IPVanish/PIA/Custom (need .ovpn file)
- DietPi-DDNS: DuckDNS/NO-IP/Dynu/FreeDNS/OVH/YDNS/Custom (need Domains & token)
- dietpi-config (similar to raspi-config)
- dietpi-software: lots of software we can easily install and they are categorized.
- Desktops: LXDE, MATE, Xfce, LXQt
- Remote desktop: TigerVNC Server, XRDP, NoMachine, RealVNC Server
- Media systems: Kodi
- BitTorrent & download: youtube-dl
- Cloud & Backup: Syncthing, nextcloud, vaultwarden, File Browser, Rclone
- Gaming & Emulation: Amiberry
- Social & Search: mediawiki
- Camera & Surveillance: RPi Cam Web Interface, motionEye, mjpg-streamer
- System Stats & management: LinuxDash, phpSysInfo, Netdata, RPi-Monitor, Docker, DietPi-Dashboard, Homer
- Remote Access
- Hardware projects
- System security
- Webserver stacks
- DNS servers
- File servers (ProFTPD, Samba, NFS)
- VPN servers (tailscale, PiVPN, Wireguard, ZeroTier)
- Advaced networking (wifi hotspot, tor)
- Home automation
- Printing
- SSH clients (openssh)
- File server clients (samba client, NFS client)
- File managers (MC, ViFM)
- System (Alsa, X.org, FFmpeg, UnRAR)
- Databases (phpMyAdmin, ...)
- Network tools (Iperf, iftop, avahi-daemon, ...)
- Development & programming (git, node.js, python3, vscodium)
- Text editors (emacs, vim, neovim)
- Desktop utilities (QuiteRSS, GIMP, xfce power manager)
- htop: Very few processes are running (~10)
- cpu
- dietpi-launcher (can run 'dietpi-config' and 'dietpi-software').
- It is better to install one software at a time in order to gain more information about a new software. For example when it is installing filebrowser, it shows a new directory "/mnt/dietpi_userdata/filebrowser" was created and the OS user "dietpi" & its credential can be used to log in. The program was installed in /opt/filebrowser. The web URL is http://IP:8084. sudo ss -tulpn | grep LISTEN can be used to find open ports.
- tailscale can be installed
other SBC
- BeagleBone Black (no built-in wifi or bluetooth)
- UDOO with built-in wifi. Bluetooth relies on USB.
- ODROID H2 Celeron J4105, M.2 PCIe 2.0 x4 slot for one NVMe storage, 2x SATA 3.0 ports, eMMC flash support
- Atomic Pi x386. Atom x5-Z8350 benchmark: 1268.
- Rock Pi 4B: RK3399 cpu, M.2 NVME SSD & USB 3.0
- RockPro64 from pine64.org
- Orange Pi 3. Not good. See the review by explainingcomputers.com.
- NanoPi NEO4 supports PCIe. Rockchip RK3399.