Raspberry: Difference between revisions

From 太極
Jump to navigation Jump to search
 
(284 intermediate revisions by the same user not shown)
Line 34: Line 34:
</syntaxhighlight>
</syntaxhighlight>
This is similar but not the same as the [[Udoo#Check_imx_CPU_temperature|Udoo]] case where it uses ''cat /sys/devices/virtual/thermal/thermal_zone0/temp''
This is similar but not the same as the [[Udoo#Check_imx_CPU_temperature|Udoo]] case where it uses ''cat /sys/devices/virtual/thermal/thermal_zone0/temp''
== USB HID keyboard ==
* [https://en.wikipedia.org/wiki/Human_interface_device Human interface device/HID]
* [https://www.howtogeek.com/713565/what-is-a-human-interface-device-hid/ What Is a Human Interface Device (HID)?]
* [https://www.instructables.com/Arduino-Uno-Into-Usb-Keyboard/ Arduino Uno Into Usb Keyboard]. Convert arduino uno into usb mouse or keyboard emulator.
* [https://smile.amazon.com/macro-keyboard/s?k=macro+keyboard&sa-no-redirect=1 Macro keyboard] from amazon. [https://smile.amazon.com/Ecarke-Mechanical-Keyboard-Programming-Software/dp/B08P1GY3GN Ecarke USB Mini 3-Key Keypad]
=== Pico ===
* https://www.raspberrypi.org/documentation/pico/getting-started/
* [https://youtu.be/onBkPkaqDnk Raspberry Pi Pico - USB HID Auto Clicker with Circuit Python]. How to use the USB HID on Raspberry Pi Pico with [https://circuitpython.org/ circuit python].
* [https://hridaybarot.home.blog/2021/01/31/using-raspberry-pi-pico-has-hid-device-to-control-mouse-and-keyboard/ Using Raspberry Pi Pico as Hid Device to control Mouse and Keyboard]
* [https://www.makeuseof.com/raspberry-pi-pico-w-what-you-can-use-it-for/ What Is a Raspberry Pico W and What Can You Use It For?]
* [https://notenoughtech.com/news/raspberry-pi-pico-isnt-a-raspberry-device/ Raspberry Pi Pico isn’t a “raspberry” device]
* Pi zero vs Pi pico
** [https://all3dp.com/2/raspberry-pi-pico-vs-zero-compared/ Raspberry Pi Pico vs Zero: The Differences | All3DP]. One is MCU and the other is SBC.
** Pros of Pico over zero [https://picockpit.com/raspberry-pi/everything-about-the-raspberry-pi-pico/ Everything about the Raspberry Pi Pico] Feb 2022
=== Pi zero ===
* [https://gndtovcc.home.blog/2020/04/17/turn-your-raspberry-pi-zero-into-a-usb-keyboard-hid/ Turn Your Raspberry Pi Zero into a USB Keyboard (HID)]
* [https://makerhacks.com/usb-keyboard-emulation-with-the-raspberry-pi-zero/ USB Keyboard Emulation with the Raspberry Pi Zero]
* [https://mtlynch.io/key-mime-pi/ Key Mime Pi: Turn Your Raspberry Pi into a Remote Keyboard]
=== R ===
[https://www.r-bloggers.com/2023/09/cracking-the-code-unveiling-the-hidden-language-of-usb-hid-keyboards/ Cracking the Code: Unveiling the Hidden Language of USB HID Keyboards!]
== uname ==
Install 32 bit Raspberry Pi OS
<pre>
$ 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
</pre>


== Play mp3/mp4 ==
== Play mp3/mp4 ==
Line 47: Line 86:
== Why You Should Stop Using a Raspberry Pi for Everything ==
== Why You Should Stop Using a Raspberry Pi for Everything ==
http://www.makeuseof.com/tag/stop-using-raspberry-pi-everything/
http://www.makeuseof.com/tag/stop-using-raspberry-pi-everything/
== What is the Intel and AMD CPU equivalent of Raspberry Pi 4 ==
* [https://www.quora.com/What-is-the-Intel-and-AMD-CPU-equivalent-of-Raspberry-Pi-4 Atom chip such as the N3050]
* [https://raspberrypi.stackexchange.com/a/116044 Pi 4 performance against x86 - CI/CD server with Java/Maven]


== Different generations ==
== Different generations ==
* https://en.wikipedia.org/wiki/Raspberry_Pi
* https://en.wikipedia.org/wiki/Raspberry_Pi
* Raspberry Pi 1 B (512MB memory, released 2012), [http://computers.tutsplus.com/tutorials/the-raspberry-pi-b-explored-and-explained--cms-21821 Raspberry Pi model B vs B+]
* Raspberry Pi 1 B (512MB memory, 2x USB 2.0, ethernet 10/100 Mb/s, released 2012), [http://computers.tutsplus.com/tutorials/the-raspberry-pi-b-explored-and-explained--cms-21821 Raspberry Pi model B vs B+]
* [http://www.raspberrypi.org/raspberry-pi-2-on-sale/ Raspberry Pi 2] (released 2015. This has an identical form-factor to the existing Raspberry Pi 1 Model B+)
* [http://www.raspberrypi.org/raspberry-pi-2-on-sale/ Raspberry Pi 2] (released 2015. This has an identical form-factor to the existing Raspberry Pi 1 Model B+)
* [https://www.raspberrypi.org/blog/zero-wh/ Raspberry Pi Zero WH] (released 2017)
* [https://www.raspberrypi.org/blog/zero-wh/ Raspberry Pi Zero WH] (released 2017)
Line 70: Line 113:


== Write image to SD card ==
== Write image to SD card ==
* Command line. The following tip is from [http://www.zdnet.com/article/raspberry-pi-a-closer-look-at-raspbian-pixel/ zdnet] where '''-p''' means to extract files to pipe (stdout). In my case, the ''status=progress'' option is not recognized.
<ul>
<li>'''dd''' command. The following tip is from [http://www.zdnet.com/article/raspberry-pi-a-closer-look-at-raspbian-pixel/ zdnet] where '''-p''' means to extract files to pipe (stdout). In my case, the ''status=progress'' option is not recognized.
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
unzip -p Image | dd of=/dev/sdX bs=4M iflag=fullblock oflag=direct status=progress
unzip -p Image | dd of=/dev/sdX bs=4M iflag=fullblock oflag=direct status=progress
</syntaxhighlight>
</syntaxhighlight>
* GUI. [https://etcher.io/ Etcher].
<li>'''pv''' command. [https://ostechnix.com/write-iso-images-to-usb-disks-using-pv-command-in-linux/ Now You Can Write ISO Images To USB Disks Directly Using Pv Command In Linux]
* [https://www.ivarch.com/programs/pv.shtml Pipe Viewer]
<li>GUI. [https://etcher.io/ Etcher].
<li>Raspberry Imager
</ul>


This is not the end of the process since we cannot use SSH to access Pi. If we follow the instruction to add a 'ssh' to the boot partition, we may get an error ''[http://askubuntu.com/questions/205179/ssh-problem-read-from-socket-failed-connection-reset-by-peer SSH problem - Read from socket failed: Connection reset by peer]''. So it is necessary to hook Pi to a monitor for the first time if we want to access it from SSH.
=== Disk is write protected ===
It means the SD card is bad. My SD card is PNY 16GB Elite U1.


== Create our own image ==
== Create our own image ==
Line 96: Line 145:
#
#


[https://opensource.com/article/20/5/disk-image-raspberry-pi Modify a disk image to create a Raspberry Pi-based homelab] May 2020
[https://opensource.com/article/20/5/disk-image-raspberry-pi 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 ==
== Remote access ==
Line 115: Line 164:
It is also useful to give Pi a new hostname (rpi1, rpi2, rpi3, ...). See [https://www.dexterindustries.com/howto/change-the-hostname-of-your-pi/ Change the Hostname of your Pi].
It is also useful to give Pi a new hostname (rpi1, rpi2, rpi3, ...). See [https://www.dexterindustries.com/howto/change-the-hostname-of-your-pi/ Change the Hostname of your Pi].


== Change the default password ==
=== raspi-config on headless Raspberry Pi ===
Yes, we can still run '''sudo raspi-config''' on headless pi.
 
== Change the default password/allow weak password ==
<strike>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).</strike>
<strike>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).</strike>


Line 131: Line 183:


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.
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 ===
* [https://www.tomshardware.com/how-to/disable-ssh-password-warning-raspberry-pi How to Disable the Annoying SSH Password Warning on Raspberry Pi] (assume running on desktop)
* [https://raspberrypi.stackexchange.com/a/58733 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 ==
== Raspbian is not asking for a password for the sudo command ==
Line 144: Line 200:
http://www.howtogeek.com/167190/how-and-why-to-assign-the-.local-domain-to-your-raspberry-pi/
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.
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.  
<pre>
<pre>
sudo apt-get update
sudo apt-get update
sudo apt-get install avahi-daemon
sudo apt-get install avahi-daemon
# No reboot is necessary for raspberry pi
# 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
# from other machines or even Raspi itself
ping raspberrypi.local
ping raspberrypi-2.local
</pre>
</pre>


Line 157: Line 217:


== Get the internal IP address ==
== Get the internal IP address ==
https://www.raspberrypi.org/documentation/remote-access/ip-address.md
* [https://www.makeuseof.com/ways-to-find-raspberry-pi-ip-address/ 6 Ways to Find a Raspberry Pi's IP Address]
* https://www.raspberrypi.org/documentation/remote-access/ip-address.md


<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
Line 208: Line 269:


== Set up a static IP address ==
== Set up a static IP address ==
* '''/etc/static_ip.conf''' from one of partitions
* [https://electrondust.com/2017/11/25/setting-raspberry-pi-wifi-static-ip-raspbian-stretch-lite/ Setting up Raspberry Pi WiFi with Static IP on Raspbian Stretch Lite]. Two files need to be changed.
* [https://electrondust.com/2017/11/25/setting-raspberry-pi-wifi-static-ip-raspbian-stretch-lite/ 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/wpa_supplicant/wpa_supplicant.conf''' - take care of the wifi
Line 221: Line 283:
* https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=140252
* 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
* 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,
<pre>
Debian GNU/Linux 10 \n \l
eth0: \4{eth0}
</pre>
== Run Graphical App on remote computer: export DISPLAY ==
<pre>
export DISPLAY=:0
application_name
</pre>
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:
<pre>
nohup application_name > /dev/null 2>&1 &
</pre>


== Under voltage ==
== Under voltage ==
Line 241: Line 323:
sudo chmod +x /usr/local/bin/web-omxplayer.sh
sudo chmod +x /usr/local/bin/web-omxplayer.sh
</pre>
</pre>
== Options for displays/monitors ==
[https://www.makeuseof.com/raspberry-pi-display-essential-factors-when-choosing/ 8 Essentials to Keep in Mind When Choosing a Display for Your Raspberry Pi]


== HDMI screen resolution ==
== HDMI screen resolution ==
Line 279: Line 364:


=== Move a Window Without Clicking the Titlebar ===
=== Move a Window Without Clicking the Titlebar ===
[https://www.howtogeek.com/howto/ubuntu/move-a-window-without-clicking-the-titlebar-in-ubuntu/ Move a Window Without Clicking the Titlebar in Ubuntu]. Hold down the '''Alt''' key and then click in the window anywhere, and move your mouse.
[https://www.howtogeek.com/howto/ubuntu/move-a-window-without-clicking-the-titlebar-in-ubuntu/ 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 [https://www.tenforums.com/tutorials/87172-move-off-screen-window-back-screen-windows-10-a.html How to Move Off-Screen Window back On-Screen in Windows 10]


=== Use VNC Connect ===
=== Use VNC Connect ===
Line 323: Line 410:
== RCA video output resolution ==
== RCA video output resolution ==
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=29&t=47527
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=29&t=47527
== KVM over IP ==
* [https://en.wikipedia.org/wiki/KVM_switch KVM over IP/KVM switch]
* Pi-KVM
** [https://www.tomshardware.com/how-to/kvm-over-ip-raspberry-pi How to Build a KVM Over IP with Raspberry Pi]
** [https://youtu.be/plP9Y1likRg DIY Raspberry Pi KVM-Over-IP Under $60 with Pi-KVM]
** [https://youtu.be/PppcpSVYh0E Control any computer, ANYWHERE — PiKVM v4 is here!]


== Playing DRM videos in chromium browser ==
== Playing DRM videos in chromium browser ==
Line 333: Line 427:
* http://kodi.wiki/view/Raspberry_Pi_FAQ
* http://kodi.wiki/view/Raspberry_Pi_FAQ
* [http://mycomputerhelp.net/2015/11/08/minimal-kiosk-browser-kweb-web-browser-fast-reliable-web-browser-for-raspberry-pi-pc/ Minimal Kiosk Browser: Kweb] - Fast Reliable Web Browser for Raspberry Pi PC.
* [http://mycomputerhelp.net/2015/11/08/minimal-kiosk-browser-kweb-web-browser-fast-reliable-web-browser-for-raspberry-pi-pc/ Minimal Kiosk Browser: Kweb] - Fast Reliable Web Browser for Raspberry Pi PC.
* [http://askubuntu.com/questions/23238/how-can-i-find-what-video-driver-is-in-use-on-my-system Linuc command to query video driver]
* [http://askubuntu.com/questions/23238/how-can-i-find-what-video-driver-is-in-use-on-my-system Linux command to query video driver]
* [https://www.linuxuprising.com/2021/04/how-to-enable-hardware-acceleration-in.html How To Enable Hardware Acceleration In Chromium On Raspberry Pi OS (RPi 4)]
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
lspci -nnk | grep -i vga -A3 | grep 'in use'
lspci -nnk | grep -i vga -A3 | grep 'in use'
Line 343: Line 438:
lspci: Cannot find any working access method.
lspci: Cannot find any working access method.
</syntaxhighlight>
</syntaxhighlight>
=== Chromium ===
[https://www.linuxuprising.com/2021/04/how-to-enable-hardware-acceleration-in.html How To Enable Hardware Acceleration In Chromium On Raspberry Pi OS (RPi 4)]


== Memory ==
== Memory ==
Line 357: Line 455:
* http://93.93.128.176/forums/viewtopic.php?t=59384&p=445257
* 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).
Probably a practical approach is to use 'youtube-dl' program to download the video and then use 'omxplayer' to play it (not streaming anyway). [http://www.reuk.co.uk/wordpress/raspberry-pi/downloading-youtube-videos-to-your-raspberry-pi/ Downloading Youtube Videos to your Raspberry Pi] and [https://6ftdan.com/allyourdev/2015/07/25/play-hd-youtube-from-the-raspberry-pi-command-line/ Play HD Youtube from the Raspberry Pi Command Line]
 
== Cast Youtube from your phone ==
[https://www.linuxuprising.com/2021/04/how-to-cast-youtube-videos-from-your.html How To Cast YouTube Videos From Your Phone To Raspberry Pi Using YouTube On TV (youtube.com/tv)]


== Auto Startup Application ==
== Auto Startup Application ==
Line 402: Line 503:
== Disk Performance ==
== Disk Performance ==
* [http://hackaday.com/2016/12/29/improving-raspberry-pi-disk-performance/ Improving disk performance] & [https://www.linux-toys.com/?p=1153 the original post].
* [http://hackaday.com/2016/12/29/improving-raspberry-pi-disk-performance/ Improving disk performance] & [https://www.linux-toys.com/?p=1153 the original post].
== Raspberry Pi 4 vs Desktop PC ==
[https://youtu.be/zRKmlwA5law $100 PC VS Raspberry Pi 4 8GB - Can The Pi4 Replace a Desktop PC?]


== Power consumption comparison ==
== Power consumption comparison ==
Line 407: Line 511:
* https://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-pi-zero-power
* https://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-pi-zero-power
* [https://raspi.tv/2019/how-much-power-does-the-pi4b-use-power-measurements How much power does the Pi4B use? Power Measurements], [https://www.tomshardware.com/reviews/raspberry-pi-4-b,6193.html Raspberry Pi 4 Review: The New Gold Standard for Single-Board Computing]
* [https://raspi.tv/2019/how-much-power-does-the-pi4b-use-power-measurements How much power does the Pi4B use? Power Measurements], [https://www.tomshardware.com/reviews/raspberry-pi-4-b,6193.html Raspberry Pi 4 Review: The New Gold Standard for Single-Board Computing]
* [https://youtu.be/9ofoqDc6RaE 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? ===
=== 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).  
* 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).  
* [https://spellfoundry.com/raspberry-pi-battery-runtime-calculator/ Raspberry Pi Battery Life Calculator]. For example with RPi 3B + Wifi + Camera + 10,000 mAH lasts 14.2 hours.
* [https://spellfoundry.com/raspberry-pi-battery-runtime-calculator/ 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 ===
=== Bash script to check the RPi status ===
The script below will check RPi every 60 seconds.
<ul>
<li>A simple shell script that logs the current status to a text file:
<pre>
<pre>
#!/bin/bash
#!/bin/bash
# Set the log file path and name
LOG_FILE="/home/pi/battery_log.txt"
while true
while true
do
do
   if ping -c 1 192.168.1.11 &> /dev/null
  # Get the current time
   then
  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
</pre>
<pre>
chmod +x ./battery_log.sh
nohup ./battery_log.sh > /dev/null 2>&1 &
</pre>
 
<li>On beaglebone black.</br>
nano check_uptime.sh
<pre>
#!/bin/bash
DATE=$(date '+%Y-%m-%d %H:%M:%S')
echo "$DATE - Server is up" >> /home/debian/server_uptime.log
</pre>
chmod +x check_uptime.sh
<pre>
0 * * * * /home/debian/check_uptime.sh
</pre>
 
<li>The script below will check RPi every 60 seconds (need to keep SSH connection)
<pre>
#!/bin/bash
while true
do
   if ping -c 1 192.168.1.11 &> /dev/null
   then
     date
     date
   else
   else
Line 427: Line 578:
done
done
</pre>
</pre>
</ul>


== Ways to power your raspberry pi ==
== Ways to power your raspberry pi ==
[https://www.lifewire.com/ways-to-power-your-raspberry-pi-4092246 10 Ways to Power your Raspberry Pi]
* [https://www.lifewire.com/ways-to-power-your-raspberry-pi-4092246 10 Ways to Power your Raspberry Pi]
* [https://www.makeuseof.com/raspberry-pi-power-methods/ 5 Different Ways to Power a Raspberry Pi]


=== Power Raspberry Pi by AA batteries ===
=== Power Raspberry Pi by AA batteries ===
Line 447: Line 600:


=== Solar power ===
=== Solar power ===
* [https://youtu.be/j-nQGoIq1CA Solar panel kit installation]
* [https://medium.com/@jamesblight/remote-water-monitoring-with-a-solar-powered-raspberry-pi-4923f4731b88 Remote water monitoring with a solar powered Raspberry Pi]
* [https://medium.com/@jamesblight/remote-water-monitoring-with-a-solar-powered-raspberry-pi-4923f4731b88 Remote water monitoring with a solar powered Raspberry Pi]
* [https://youtu.be/YpAYDcW_Jx0 How-To: Build a Solar Powered Raspberry Pi] (video) and [http://juliansarokin.com/how-to-build-a-solar-powered-raspberry-pi/ materials] from adafruit.
* [https://youtu.be/YpAYDcW_Jx0 How-To: Build a Solar Powered Raspberry Pi] (video) and [http://juliansarokin.com/how-to-build-a-solar-powered-raspberry-pi/ materials] from adafruit.
* [https://www.stewright.me/2017/07/a-portable-battery-powered-raspberry-pi-zero-web-server-with-solar-panel/ Create a portable battery and solar powered Raspberry Pi Zero web server]
* [https://www.stewright.me/2017/07/a-portable-battery-powered-raspberry-pi-zero-web-server-with-solar-panel/ Create a portable battery and solar powered Raspberry Pi Zero web server]
* [https://github.com/masneyb/weather-station Solar Powered Weather Station] featured [https://www.raspberrypi.org/magpi-issues/MagPi81.pdf#page=33 MagPi81].
* [https://github.com/masneyb/weather-station Solar Powered Weather Station] featured [https://www.raspberrypi.org/magpi-issues/MagPi81.pdf#page=33 MagPi81].
* [https://magpi.raspberrypi.org/articles/solar-powered-raspberry-pi-camera Solar-powered Raspberry Pi Camera] from MagPi 2020.
* [https://raspberrypi.stackexchange.com/questions/7913/powering-a-pi-from-12v Powering a PI from 12V]
* [https://www.instructables.com/id/Solar-Powered-Raspberry-Pi/ Solar Powered Raspberry Pi]. It includes a calculation of running time.
* [https://howchoo.com/g/mmfkn2rhoth/raspberry-pi-solar-power How to Build a Solar-Powered Raspberry Pi]
* [https://blog.voltaicsystems.com/powering-a-raspberry-pi-from-solar-power/ Tutorial: Solar Power for Raspberry Pi]
* [https://www.activecountermeasures.com/making-a-solar-powered-raspberry-pi/ Making a Solar Powered Raspberry Pi]. It also has an estimated hours.


== CPU Benchmark ==
== CPU Benchmark ==
Line 537: Line 697:
== OpenGL ==
== OpenGL ==
* [https://www.raspberrypi.org/blog/another-new-raspbian-release/ OpenGL driver for the desktop which uses the GPU to provide hardware acceleration] 2/9/2016
* [https://www.raspberrypi.org/blog/another-new-raspbian-release/ OpenGL driver for the desktop which uses the GPU to provide hardware acceleration] 2/9/2016
== Pi5 vs n100 ==
* [https://www.youtube.com/watch?v=dljAxpjyRVc Raspberry Pi 5 vs Intel N100 Mini PC - Which Is Right For You]


== Picademy ==
== Picademy ==
Line 543: Line 706:


== UPS ==
== UPS ==
* [https://www.amazon.com/SunFounder-Raspberry-Expansion-Compatible-Included/dp/B0C1GFX5LW 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
* http://raspi-ups.appspot.com/en/index.jsp
* [https://youtu.be/p86AbqgRaIo?t=303 Raspberry Pi Waveshare UPS] 2022


== Books, Magazines, Blogs ==
== Books, Magazines, Blogs ==
Line 565: Line 730:
https://hackaday.com/2018/01/19/roll-your-own-raspberry-pi-os/
https://hackaday.com/2018/01/19/roll-your-own-raspberry-pi-os/


== Download an image ==
== 64-bit ==
It is suggested to use torrent to download. In my experience to downloading [https://www.raspberrypi.org/downloads/raspbian/ Raspbian], the number of peers is 50 and the download speed is about 8MB/s.  
It is said 64-bit is supported on Pi3/3B/4.  


If we want to use the command line to download the image, we should pay attention to the output file name.
But I have a successful experience on Pi3B but not Pi3. See
<syntaxhighlight lang='bash'>
* https://downloads.raspberrypi.org/raspios_arm64/images/
wget --trust-server-names https://downloads.raspberrypi.org/raspbian_latest
* [https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=250730 Firmware push arm_64bit].
# Or
* [https://wiki.gentoo.org/wiki/Raspberry_Pi_3_64_bit_Install Raspberry Pi 3 64 bit Install]
curl -JLO https://downloads.raspberrypi.org/raspbian_lite_latest
* [https://www.raspberrypi.org/documentation/configuration/config-txt/boot.md Boot options in config.txt]
</syntaxhighlight>
* [https://www.unixtutorial.org/update-raspberry-pi-firmware-with-rpi-update/ Update Raspberry Pi firmware with rpi-update] 2014. ''' sudo rpi-update'''  See also [https://github.com/Hexxeh/rpi-update rpi-update]. [https://raspberrypi.stackexchange.com/questions/4379/what-does-rpi-update-do What does rpi-update do?].
* [https://raspberrypi.stackexchange.com/questions/113047/run-64-bit-raspberry-pi-os-beta-test-version Run 64-bit Raspberry Pi OS beta test version]


The best way of using Raspberry Pi is being able to run multiboot; that is, we have a list of operating systems we can choose to boot.
== Download an image ==
* [https://www.raspberrypi.org/downloads/ Raspberry Pi Imager]
* [https://www.raspberrypi.org/downloads/ Raspberry Pi Imager]
* [http://www.raspberrypi.org/downloads/ NOOBS]
* [http://www.raspberrypi.org/downloads/ NOOBS] (retired, see [https://github.com/procount/pinn PINN] next)
* [https://www.makeuseof.com/noobs-multiple-operating-system-on-raspberry-pi-pinn/ Missing NOOBS? Install Multiple Operating Systems on Your Raspberry Pi with PINN]
* [http://sourceforge.net/projects/berryboot/ BerryBoot] The OS in BerryBoot is quite old!!
* [http://sourceforge.net/projects/berryboot/ BerryBoot] The OS in BerryBoot is quite old!!
* [https://github.com/procount/pinn PINN (PINN is not NOOBS)] - An enhanced Operating System installer for the Raspberry Pi
=== Raspberry Pi Imager ===
<ul>
<li>https://github.com/raspberrypi/rpi-imager. To build from the source (needed in eg Debian OS):
{{Pre}}
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
</pre>
<li>[https://www.raspberrypi.org/blog/raspberry-pi-imager-update-to-v1-6/ 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”?
<li>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 [https://en.wikipedia.org/wiki/GNOME_Files 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.
</ul>
=== Raspberry Pi OS 1.1 Bulleye ===
[https://www.linuxuprising.com/2021/11/how-to-upgrade-raspberry-pi-os-10.html How To Upgrade To Raspberry Pi OS 11 Bullseye (From Buster)]


== Format a SD card using [https://www.sdcard.org/downloads/formatter_4/ SD Formatter] (Windows & Mac) ==
== Format a SD card using [https://www.sdcard.org/downloads/formatter_4/ SD Formatter] (Windows & Mac) ==
Line 587: Line 779:
* [https://www.zdnet.com/article/raspberry-pi-just-got-a-new-sd-card-speed-test-tool-and-imaging-utility/ Raspberry Pi just got a new SD card speed test tool and imaging utility]
* [https://www.zdnet.com/article/raspberry-pi-just-got-a-new-sd-card-speed-test-tool-and-imaging-utility/ Raspberry Pi just got a new SD card speed test tool and imaging utility]
* [https://youtu.be/w6lM0tyFtOk USB stick running Raspbian. Speed test. Raspberry Pi 4]
* [https://youtu.be/w6lM0tyFtOk 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  ==
== Install an image to a SD card  ==
Line 616: Line 809:
dd if=/dev/urandom | pv | dd of=/dev/null
dd if=/dev/urandom | pv | dd of=/dev/null
</syntaxhighlight>
</syntaxhighlight>
== Check the filesystem on microSD card ==
<ul>
<li>Check SD card for any error
<pre>
dmesg | grep -i "mmc"
# OR
journalctl -k | grep -i "mmc\|I/O error\|mmcblk"
</pre>
Look for messages like “mmc0: Timeout waiting for hardware,” “I/O error,” or “Buffer I/O error on dev mmcblk0p2,” which indicate potential SD card problems.
<li>[https://platfrastructure.life/post/rpi_boot_repair/ Repairing a Raspberry Pi Boot Partition]
<pre>
# rootfs is ext4
umount /dev/sdc2
sudo fsck /dev/sdc2
# boot partition is fat32
sudo dosfsck -t -a -w /dev/sdc1
</pre>
</ul>


== Secure your Raspberry Pi ==
== Secure your Raspberry Pi ==
Line 626: Line 839:


See [https://www.raspberrypi.org/blog/another-raspbian-desktop-user-interface-update/ the blog] on May 5, 2015.
See [https://www.raspberrypi.org/blog/another-raspbian-desktop-user-interface-update/ the blog] on May 5, 2015.
=== NetworkManager - nmcli/nmtui ===
<ul>
<li>[https://www.raspberrypi.com/documentation/computers/configuration.html#networking Configuration -> Networking] from the official Raspberry Pi Documentation.
<li>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'''.
<li>Two essential commands:
<syntaxhighlight lang='sh'>
nmcli device wifi
sudo nmtui
</syntaxhighlight>
<li>[https://pimylifeup.com/raspberry-pi-network-manager/ 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'''
<syntaxhighlight lang='sh'>
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'
</syntaxhighlight>
<li>The network connection profiles are stored in the '''/etc/NetworkManager/system-connections/''' directory.
</ul>
=== Multiple WiFi Networks ===
<ul>
<li>[https://www.digikey.com/en/maker/tutorials/2023/configure-wifi-settings-on-a-headless-raspberry-pi-and-connect-multiple-wireless-networks Configure WiFi Settings on a Headless Raspberry Pi and Connect Multiple Wireless Networks] 2023
<ul>
<li>ip a
<li>sudo nano /etc/wpa_supplicant/wpa_supplicant.conf (OR /etc/wpa_supplicant/wpa_supplicant-wlan1.conf if we use wlan1)
<pre>
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"
}
</pre>
<li>sudo systemctl restart dhcpcd
</ul>
<li>[https://www.jeffgeerling.com/blog/2021/working-multiple-wifi-interfaces-on-raspberry-pi Working with multiple WiFi interfaces on a Raspberry Pi] 2021
</ul>
=== Use a usb wifi dongle instead of build in wifi ===
* [https://raspberrypi.stackexchange.com/questions/61760/disable-onboard-wifi-bluetooth-raspberry-pi-3 Disable onboard WiFi & Bluetooth Raspberry Pi 3] & https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README
* [https://www.reddit.com/r/raspberry_pi/comments/gsb8ba/how_do_i_use_a_usb_wifi_dongle_instead_of_build/ How do I use a usb wifi dongle instead of build in wifi?]


=== USB adapters ===
=== USB adapters ===
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.
* [https://www.tp-link.com/us/home-networking/usb-adapter/archer-t2u-nano/ tp-link AC600] (rtl8812au)
** [https://unix.stackexchange.com/questions/282710/raspberry-pi-3-tp-link-ac-600-t2uh-wireless-usb-adapter-raspbian-lite Raspberry Pi 3 TP-LINK AC 600 (T2UH) wireless USB adapter (Raspbian Lite)]
** [https://raspberrypi.stackexchange.com/questions/116279/installing-tp-link-ac600-high-gain-wifi-on-raspberry-pi-4 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 [https://www.amazon.com/TP-Link-Mini-Wireless-Supports-10-9-10-14/dp/B07PB1X4CN?th=1 Amazon]
** [https://ostechnix.com/install-tp-link-ac600-archer-t2u-nano-wifi-usb-adapter-in-linux/ 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.


[[:File:Wifiusb.jpg]]
[[:File:Wifiusb.jpg]]
=== Wi-Fi is currently blocked by rfkill ===
[https://raspberrypi.stackexchange.com/a/123724 How to disable "Wi-Fi is currently blocked by rfkill." message?]
== Processor ==
* [https://www.raspberrypi.com/documentation/computers/processors.html Processors] BCM2835, BCM2836, BCM2837, BCM2837B0, BCM2711
* [https://forums.raspberrypi.com/viewtopic.php?t=190329 BCM2835 or BCM2837 use by Raspberry-Pi 3 Model B v1.2 ?]
** [https://raspberrypi.stackexchange.com/questions/75089/bcm2835-on-an-rpi-3 BCM2835 on an RPi 3?]
** [https://forums.raspberrypi.com/viewtopic.php?t=188544 RPi 3 with BCM2835 ???] '''cat /proc/device-tree/model'''
== Bootloader ==
* [https://pimylifeup.com/raspberry-pi-bootloader/ Updating the Bootloader on a Raspberry Pi]
* [https://www.makeuseof.com/boot-raspberry-pi-4-via-ssd-network/ How to Boot Raspberry Pi 4 via SSD or Network]


== Boot from USB ==
== Boot from USB ==
* <s>It works on my pi3 b+ but not pi3 b.</s> 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
* https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md
* [https://github.com/raspberrypi/documentation/blob/master/hardware/raspberrypi/bootmodes/msd.md How to boot from a USB Mass Storage Device on a Raspberry Pi 3]
* [https://www.stewright.me/2017/06/install-raspbian-usb-flash-drive-macos-linux/ Install Raspbian on a USB Flash drive from MacOS or Linux]
* [https://www.stewright.me/2017/06/install-raspbian-usb-flash-drive-macos-linux/ Install Raspbian on a USB Flash drive from MacOS or Linux]
* [https://thepi.io/how-to-boot-your-raspberry-pi-from-a-usb-mass-storage-device/ How to boot your Raspberry Pi from a USB mass storage device]
* [https://thepi.io/how-to-boot-your-raspberry-pi-from-a-usb-mass-storage-device/ How to boot your Raspberry Pi from a USB mass storage device]
* [https://www.pcmarket.com.hk/2020/05/22/告別microsd-usb裝置起動-raspberry-pi-4測試版靭體推出/ 告別 microSD USB 裝置起動 Raspberry Pi 4 測試版靭體推出]
* [https://www.pcmarket.com.hk/2020/05/22/告別microsd-usb裝置起動-raspberry-pi-4測試版靭體推出/ 告別 microSD USB 裝置起動 Raspberry Pi 4 測試版靭體推出]
* [https://www.raspberrypi.org/documentation/hardware/raspberrypi/booteeprom.md Raspberry Pi 4  boot EEPROM]
* [https://www.makeuseof.com/how-to-boot-raspberry-pi-ssd-permanent-storage/ How to Boot a Raspberry Pi From SSD and Use It for Permanent Storage]
* [https://forums.raspberrypi.com/viewtopic.php?t=334894 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).
* [https://forums.raspberrypi.com/viewtopic.php?t=277431 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 /root in USB ==
== Put rootfs in USB ==
[https://www.tomshardware.com/news/boot-raspberry-pi-from-usb,39782.html How to Run Raspberry Pi 4 or 3 Off an SSD or Flash Drive]
* [https://www.tomshardware.com/news/boot-raspberry-pi-from-usb,39782.html How to Run Raspberry Pi 4 or 3 Off an SSD or Flash Drive]
* [https://www.pragmaticlinux.com/2020/08/move-the-raspberry-pi-root-file-system-to-a-usb-drive/ Move the Raspberry PI root file system to a USB drive]
* [https://jamesachambers.com/raspberry-pi-4-usb-boot-config-guide-for-ssd-flash-drives/ Raspberry Pi 4 USB Boot Config Guide for SSD / Flash Drives]
* [https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin bootcode.bin] link. [https://forums.raspberrypi.com/viewtopic.php rpi2 usb boot]
* [[Kodi#Install_to_USB|Kodi]] example


== Network boot (PXE) w/o microSD ==
== Network boot (PXE) w/o microSD ==
Line 646: Line 963:
* [https://www.makeuseof.com/tag/network-boot-raspberry-pi-without-microsd/ How to Network Boot a Raspberry Pi Without a MicroSD Card]
* [https://www.makeuseof.com/tag/network-boot-raspberry-pi-without-microsd/ How to Network Boot a Raspberry Pi Without a MicroSD Card]
* [https://hackaday.com/2018/10/08/hack-my-house-running-raspberry-pi-without-an-sd-card/ Hack my house: running raspberry pi without an sd card]
* [https://hackaday.com/2018/10/08/hack-my-house-running-raspberry-pi-without-an-sd-card/ Hack my house: running raspberry pi without an sd card]
* [https://youtu.be/G5BhQqRLN4A PXE-Boot Raspberry Pi From Proxmox Server] | "Easy Mode" setup | Proxmox Home Server


== USB network in Pi zero ==
== USB network in Pi zero ==
* [http://www.circuitbasics.com/raspberry-pi-zero-ethernet-gadget/ Pi zero USB/ethernet gadget tutorial]
* [http://www.circuitbasics.com/raspberry-pi-zero-ethernet-gadget/ Pi zero USB/ethernet gadget tutorial]
* [https://hackaday.io/project/27142-terrible-cluster Terrible Cluster]
* [https://hackaday.io/project/27142-terrible-cluster Terrible Cluster]
== Pi zero 2W ==
* Power port is on the corner, and the OTG port is the 2nd.
* [https://youtu.be/lKS2ElWQizA?si=0ga5TzCDK8YJCLN-&t=98 The Raspberry Pi Zero 2 W review].
** Wired performance is better than wireless.
** [https://youtu.be/lKS2ElWQizA?si=zfiu5UP57ddteXla&t=616 Power and OTG locations from Radxa Zero are different from Raspberry Pi zero (2)]
* OTG port can be used to power Pi zero 2W if we don't need to connect other USB devices. See [https://forums.raspberrypi.com/viewtopic.php?t=203338 Powering Pi Zero W OTG].
* Pi zero 2W is 64bit capable. It is similar to Pi 3b although the outside is similar to Pi zero w.


== Mount a USB drive at boot ==
== Mount a USB drive at boot ==
Line 677: Line 1,003:
=== Chrome ===
=== Chrome ===
[https://chrome.google.com/webstore/detail/vnc%C2%AE-viewer-for-google-ch/iabmpiboiopbgfabjmgeedhcmjenhbla VNC Viewer]
[https://chrome.google.com/webstore/detail/vnc%C2%AE-viewer-for-google-ch/iabmpiboiopbgfabjmgeedhcmjenhbla VNC Viewer]
== Thin client ==
[[Virtualbox#Thin_client|Proxmox thin client]]


== [https://www.dataplicity.com/ Dataplicity] ==
== [https://www.dataplicity.com/ Dataplicity] ==
Line 780: Line 1,109:
'''Method 3'''
'''Method 3'''
There is also an interesting project called [http://rpitc.blogspot.com RPi-TC/Raspberry Pi Thin Client project]. I have not tried it yet.
There is also an interesting project called [http://rpitc.blogspot.com RPi-TC/Raspberry Pi Thin Client project]. I have not tried it yet.
== Using a Kindle Fire As a Monitor ==
[https://www.instructables.com/how-to-use-a-kindle-fire-as-a-monitor-for-raspberr/ Using a Kindle Fire As a Monitor]


= Raspbian =
= Raspbian =
== Desktop vs Console ==
* Desktop: 105MB memory
* Console: 50MB memory
== Directly Connect to a Raspberry Pi Without Internet ==
== Directly Connect to a Raspberry Pi Without Internet ==
http://www.makeuseof.com/tag/directly-connect-raspberry-pi-without-internet/
http://www.makeuseof.com/tag/directly-connect-raspberry-pi-without-internet/
Line 797: Line 1,133:


== Raspbian repository and mirrors ==
== Raspbian repository and mirrors ==
* https://www.raspberrypi.org/downloads/raspbian/
* http://www.raspbian.org/RaspbianMirrors
* http://www.raspbian.org/RaspbianMirrors
* UMD mirror (http|rsync)://mirror.umd.edu/raspbian/raspbian
* UMD mirror (http|rsync)://mirror.umd.edu/raspbian/raspbian
* Run '''sudo nano /etc/apt/sources.list''' and change the default to a mirror


== Releases lists ==
== Releases lists ==
Line 809: Line 1,145:
== Raspbian package repository URL ==
== Raspbian package repository URL ==
http://archive.raspbian.org/raspbian/pool/main/r/r-base/
http://archive.raspbian.org/raspbian/pool/main/r/r-base/
== Widevine support to play Amazon Prime,.. ==
* [https://www.linuxuprising.com/2021/03/raspberry-pi-os-gets-official-widevine.html Raspberry Pi OS Gets Official Widevine Support (Allowing You To Play Netflix, Amazon Prime, Hulu, Etc.)]
* https://widevine.com/


== Sending an email on boot ==
== Sending an email on boot ==
Line 862: Line 1,202:


Some examples:
Some examples:
* :open URL to open a new website
* j/k to scroll down/up
* j/k to scroll down/up
* space or ctrl+d / Ctrl+u to scroll down/up one page
* space or ctrl+d / Ctrl+u to scroll down/up one page
Line 903: Line 1,244:
sudo apt-get install fcitx fcitx-chewing
sudo apt-get install fcitx fcitx-chewing
</syntaxhighlight>
</syntaxhighlight>
Reboot and the task bar will show an icon to let you switch the language. Tested on Raspberry jessie 8.0.
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 [https://en.wikipedia.org/wiki/Raspbian PIXEL] desktop, a modified LXDE desktop environment.
Raspbian uses [https://en.wikipedia.org/wiki/Raspbian PIXEL] desktop, a modified LXDE desktop environment.
Line 938: Line 1,279:


== Turn Raspberry Pi Zero into a USB gadget ==
== 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.
* [https://gpiozero.readthedocs.io/en/stable/pi_zero_otg.html Pi Zero USB OTG]. '''GPIO Zero''' is installed by default in the Raspbian image
* [https://gpiozero.readthedocs.io/en/stable/pi_zero_otg.html Pi Zero USB OTG]. '''GPIO Zero''' is installed by default in the Raspbian image
* [https://www.thepolyglotdeveloper.com/2016/06/connect-raspberry-pi-zero-usb-cable-ssh/ 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.
* [https://www.thepolyglotdeveloper.com/2016/06/connect-raspberry-pi-zero-usb-cable-ssh/ 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
** config.txt (?)
** cmdline.txt
** cmdline.txt (?)
** wpa_supplicant.conf  
** wpa_supplicant.conf (wifi password)
** /etc/dhcpcd.conf (static IP)
** ssh
** ssh
: <syntaxhighlight lang='bash'>
: <syntaxhighlight lang='bash'>
Line 954: Line 1,295:
: Run ''sudo raspi-config'' and ''sudo apt update'' after we connect RasPi.
: 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 [https://www.raspberrypi.org/blog/programming-pi-zero-usb/ 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.
* On Mac, I can immediately connect to raspberry pi zero by using ''ssh [email protected]''. However, on Ubuntu, I cannot. The [https://www.raspberrypi.org/blog/programming-pi-zero-usb/ 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.
* [https://www.makeuseof.com/how-to-connect-raspberry-pi-to-laptop-or-pc-usb/ How to Connect a Raspberry Pi to a PC or Laptop Using USB]. Works on RPi 4, Zero/Zero W/Zero 2W.
* [https://unix.stackexchange.com/questions/592106/share-internet-to-a-raspberry-pi-zero-via-usb-connection Use GNOME to share the internet to other computers (USB ethernet)].


== Add USB type A to Raspberry Pi zero ==
== Add USB type A to Raspberry Pi zero ==
Line 973: Line 1,316:
# http://openelec.tv/get-openelec
# http://openelec.tv/get-openelec
# http://wiki.openelec.tv/index.php/HOW-TO:Installing_OpenELEC/Writing_The_Disk_Image
# http://wiki.openelec.tv/index.php/HOW-TO:Installing_OpenELEC/Writing_The_Disk_Image
== Minimal server ==
[https://opensource.com/article/21/1/minimal-server-raspberry-pi 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 ==
[https://www.cloudsavvyit.com/9867/set-up-a-test-server-on-raspberry-pi/ Set Up a Test Server on Raspberry Pi]. Cockpit.


== Email server ==
== Email server ==
Line 1,038: Line 1,392:


== Backup Raspbian ==
== Backup Raspbian ==
[https://www.tomshardware.com/how-to/back-up-raspberry-pi-as-disk-image 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:
{{Pre}}
# 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 ...
</pre>
https://www.raspberrypi.org/documentation/linux/filesystem/backup.md
https://www.raspberrypi.org/documentation/linux/filesystem/backup.md
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
# Backup
# Backup
sudo dd bs=4M if=/dev/sdb | gzip > raspbian.img.gz
sudo dd bs=4M if=/dev/sdb | gzip > raspbian.img.gz
sudo dd bs=4M if=/dev/sdb | pigz -9 > raspbian.img.gz
# Restore
# Restore
gunzip --stdout raspbian.img.gz | sudo dd bs=4M of=/dev/sdb
gunzip --stdout raspbian.img.gz | sudo dd bs=4M of=/dev/sdb
Line 1,063: Line 1,465:


=== PiShrink ===
=== PiShrink ===
* https://github.com/Drewsif/PiShrink
<ul>
* https://robotzero.one/headless-pi-zero-backup-clone/
<li>
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.
<pre>
$ sudo pishrink.sh pi.img
</pre>
</li>
</ul>
* [https://www.tomshardware.com/how-to/back-up-raspberry-pi-as-disk-image How to Back Up Your Raspberry Pi as a Disk Image]. pishink was used Raspberry Pi.
* [https://ostechnix.com/pishrink-make-raspberry-pi-images-smaller/ PiShrink – Make Raspberry Pi Images Smaller]. pishrink can be used in any unix-like systems.
* [https://skjoldtech.wordpress.com/2020/07/26/pishrink-shrink-raspberry-pi-sd-card-images-with-virtualbox-linux-machine/ Pishrink: Shrink Raspberry Pi sd card images with Virtualbox Linux machine]. pishrink was used in Ubuntu.
 
Others
* [https://github.com/framps/raspiBackup raspiBackup - Backup and restore your running Raspberries], [https://www.linux-tips-and-tricks.de/en/all-pages-about-raspibackup/543-raspibackup-use-pishrink-to-reduce-dd-backups-to-a-minimum-size/ 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 ===
=== How to transfer a Raspbian image from a 16GB MicroSD card to an 8GB SD card ===
Line 1,074: Line 1,489:
== Backup server ==
== Backup server ==
* https://opensource.com/life/16/3/turn-your-old-raspberry-pi-automatic-backup-server using rdiff-backup utility.
* https://opensource.com/life/16/3/turn-your-old-raspberry-pi-automatic-backup-server using rdiff-backup utility.
== Git server ==
[https://youtu.be/jMqDJ0mcIvc Host Git Server on RaspberryPi! | 4K TUTORIAL]


== [http://usbip.sourceforge.net/ USB over ip] ==
== [http://usbip.sourceforge.net/ USB over ip] ==
Line 1,079: Line 1,497:


[http://www.makeuseof.com/tag/top-apps-install-raspberry-pi/ Top 10 Apps You Should Install on Your Raspberry Pi]
[http://www.makeuseof.com/tag/top-apps-install-raspberry-pi/ Top 10 Apps You Should Install on Your Raspberry Pi]
== RAID ==
[https://www.makeuseof.com/how-to-set-up-raid-1-on-the-raspberry-pi/ How to Set up RAID-1 on the Raspberry Pi, the Easy Way]


== NAS ==
== NAS ==
Line 1,093: Line 1,514:
** [https://opensource.com/article/18/9/host-cloud-nas-raspberry-pi Series 3] Host your own cloud with Raspberry Pi NAS
** [https://opensource.com/article/18/9/host-cloud-nas-raspberry-pi Series 3] Host your own cloud with Raspberry Pi NAS
* [https://howtoraspberrypi.com/create-a-nas-with-your-raspberry-pi-and-samba/ Create a NAS with your Raspberry Pi and Samba]
* [https://howtoraspberrypi.com/create-a-nas-with-your-raspberry-pi-and-samba/ Create a NAS with your Raspberry Pi and Samba]
* [https://www.howtogeek.com/139433/how-to-turn-a-raspberry-pi-into-a-low-power-network-storage-device/ How to Turn a Raspberry Pi into a Low-Power Network Storage Device]
* [https://www.jeffgeerling.com/blog/2021/htgwa-create-samba-smb-share-on-raspberry-pi HTGWA: Create a Samba (SMB) share on a Raspberry Pi]. Simple and it works.
=== ownCloud ===
* [https://www.makeuseof.com/access-owncloud-internet/ Enable External Access to Your ownCloud Raspberry Pi Server]
* [https://www.makeuseof.com/raspberry-pi-4-diy-nas-server-owncloud/ Build Your Own DIY NAS Server Using Raspberry Pi 4]


=== OpenMediaVault ===
=== OpenMediaVault ===
[https://www.lynda.com/Raspberry-Pi-tutorials/power-switch-Raspberry-Pi/5007872/2267849-4.html lynda.com]
* [https://www.lynda.com/Raspberry-Pi-tutorials/power-switch-Raspberry-Pi/5007872/2267849-4.html lynda.com]
* [https://dbtechreviews.com/2019/12/how-to-install-openmediavault-on-raspberry-pi-4/ How To Install OpenMediaVault 5 on Raspberry Pi 3/4]. Default username/password: admin/'''openmediavault'''


=== NextCloudPi ===
=== NextCloudPi ===
https://ownyourbits.com/nextcloudpi/
https://ownyourbits.com/nextcloudpi/
== Proxy server ==
[https://www.howtogeek.com/683971/how-to-use-a-raspberry-pi-as-a-proxy-server-with-privoxy/ How to Use a Raspberry Pi as a Proxy Server (with Privoxy)]


== DNS server ==
== DNS server ==
Line 1,105: Line 1,536:


=== [https://pi-hole.net/ Pi-hole] ===
=== [https://pi-hole.net/ Pi-hole] ===
* https://twitter.com/The_Pi_Hole
* [https://www.crosstalksolutions.com/the-worlds-greatest-pi-hole-and-unbound-tutorial-2023/ The World’s Greatest Pi-hole (and Unbound) Tutorial 2023]
* https://github.com/pi-hole/ and https://github.com/pi-hole/pi-hole
* https://github.com/pi-hole/ and https://github.com/pi-hole/pi-hole
* http://pi.hole/admin
* http://pi.hole/admin
* [https://danielrampelt.com/blog/install-pihole-raspberry-pi-docker-ipv6/ 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).
* [http://lifehacker.com/create-a-network-wide-ad-blocker-with-a-raspberry-pi-1727295925 Create a Network-Wide Ad Blocker with a Raspberry Pi]  
* [http://lifehacker.com/create-a-network-wide-ad-blocker-with-a-raspberry-pi-1727295925 Create a Network-Wide Ad Blocker with a Raspberry Pi]  
* [https://learn.adafruit.com/pi-hole-ad-blocker-with-pi-zero-w?view=all Pi Hole Ad Blocker with Pi Zero W] (and PiOLED)
* [https://learn.adafruit.com/pi-hole-ad-blocker-with-pi-zero-w?view=all Pi Hole Ad Blocker with Pi Zero W] (and PiOLED)
Line 1,115: Line 1,547:
* [https://linuxincluded.com/install-pi-hole-on-ubuntu/ Installing pi-hole on ubuntu 18.04 LTS]
* [https://linuxincluded.com/install-pi-hole-on-ubuntu/ Installing pi-hole on ubuntu 18.04 LTS]
* [https://www.comparitech.com/blog/vpn-privacy/block-mobile-ads-raspberry-pi-pihole/ How to block mobile ads with Raspberry Pi and Pi-hole]
* [https://www.comparitech.com/blog/vpn-privacy/block-mobile-ads-raspberry-pi-pihole/ How to block mobile ads with Raspberry Pi and Pi-hole]
* Use Web Interface to log in and use '''Whitelist''' to allow an access to some domains.
* [https://www.reddit.com/r/pihole/comments/tbtsxt/millions_of_hits_to_a_random_ip_lookup_from_my/ Millions of hits to a random IP lookup from my router at 3AM. Happened on both my PiHoles. Ideas?]
* [https://oisd.nl/ oisd blocklist]
* [https://www.reddit.com/r/pihole/comments/uuxai1/change_dns_in_android_11_12_to_use_with_pihole/ 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.
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.
Line 1,126: Line 1,560:
</syntaxhighlight>
</syntaxhighlight>
* I am using wifi and it works fine
* I am using wifi and it works fine
* At the end it will say the install log is in /etc/pihole
* 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 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).
* [https://discourse.pi-hole.net/t/how-do-i-set-or-reset-the-web-interface-password/1328 The pi-hole admin password can be reset] by '''pihole -a -p'''
* [https://discourse.pi-hole.net/t/how-do-i-set-or-reset-the-web-interface-password/1328 The pi-hole admin password can be reset] by '''pihole -a -p'''
Line 1,133: Line 1,568:
* 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.
* 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?
* 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'''
'''Update'''
Line 1,141: Line 1,578:


'''Uninstall'''
'''Uninstall'''
* [https://discourse.pi-hole.net/t/uninstall-pi-hole-on-raspberry-pi/30530/2 Unsupported OS]
<pre>
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
</pre>
* [https://discourse.pi-hole.net/t/can-i-disable-uninstall-pi-hole/844 Can I disable / uninstall Pi Hole?]
* [https://discourse.pi-hole.net/t/can-i-disable-uninstall-pi-hole/844 Can I disable / uninstall Pi Hole?]
* https://discourse.pi-hole.net/t/uninstalling-pihole/7619
* https://discourse.pi-hole.net/t/how-to-fully-uninstall-pihole/14133
* [https://omgdebugging.com/2018/07/17/uninstalling-pi-hole-on-ubuntu-16-04-with-openvpn/ Uninstalling Pi-Hole on Ubuntu 16.04 with OpenVPN]
* [https://omgdebugging.com/2018/07/17/uninstalling-pi-hole-on-ubuntu-16-04-with-openvpn/ Uninstalling Pi-Hole on Ubuntu 16.04 with OpenVPN]
{{Pre}}
{{Pre}}
Line 1,167: Line 1,608:
</pre>
</pre>


== VPN ==
'''Whitelist'''
[https://medium.freecodecamp.org/running-your-own-openvpn-server-on-a-raspberry-pi-8b78043ccdea How to run your own OpenVPN server on a Raspberry PI]
 
* <s>Use Web Interface to log in and use '''Whitelist''' to allow an access to some domains.</s>
* Use '''Domain''' on left panel
* Command line: '''pihole -w somedomain.com  anotherdomain.net'''  (add to whitelist)
* [https://github.com/anudeepND/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 '''[https://docs.pi-hole.net/ftldns/dns-cache/ 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.
<syntaxhighlight lang='bash'>
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
</syntaxhighlight>
 
== VPN server ==
* [https://opensource.com/article/19/6/raspberry-pi-vpn-server How to use your Raspberry Pi as a VPN server]
* [https://medium.freecodecamp.org/running-your-own-openvpn-server-on-a-raspberry-pi-8b78043ccdea How to run your own OpenVPN server on a Raspberry PI]
 
== VPN client ==
[https://www.makeuseof.com/tag/install-vpn-raspberry-pi/ How to Install a VPN on Your Raspberry Pi]


== IPV6 connectivity ==
== IPV6 connectivity ==
Line 1,177: Line 1,642:
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''.
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 printer to your home network ==
== Connect your dumb USB printer to your home network ==
[https://pimylifeup.com/raspberry-pi-print-server/ Raspberry Pi Print Server: Setup a Network Printer]. The steps are
[https://pimylifeup.com/raspberry-pi-print-server/ Raspberry Pi Print Server: Setup a Network Printer]. The steps are


Line 1,192: Line 1,657:


== NagiosPi: Turn Your Raspberry Pi into a Network Monitoring Tool ==
== NagiosPi: Turn Your Raspberry Pi into a Network Monitoring Tool ==
https://www.makeuseof.com/tag/turn-raspberry-pi-network-monitoring-tool/
* https://www.makeuseof.com/tag/turn-raspberry-pi-network-monitoring-tool/
* [https://www.makeuseof.com/tag/raspberry-pi-disk-images-install-weekend/ 8 Types of Raspberry Pi Disk Image You Can Install Today]


== Embedded Linux ==
== Embedded Linux ==
Line 1,201: Line 1,667:


== Virtualization ==
== Virtualization ==
[https://sohliloquies.blogspot.com/2016/10/virtualizing-raspberry-pi-with-qemu.html Virtualizing a Raspberry Pi with QEMU]
* [https://sohliloquies.blogspot.com/2016/10/virtualizing-raspberry-pi-with-qemu.html Virtualizing a Raspberry Pi with QEMU]
* [https://www.raspberrypi.org/blog/get-vmware-on-raspberry-pi/ Get VMWare on Raspberry Pi]


== Rpi-Monitor: monitor a Linux system ==
== Rpi-Monitor: monitor a Linux system ==
Line 1,243: Line 1,710:
== Share your keyboard and mouse between computers with Barrier ==
== Share your keyboard and mouse between computers with Barrier ==
[https://www.raspberrypi.org/blog/share-your-keyboard-and-mouse-between-computers-with-barrier/ Share your keyboard and mouse between computers with Barrier]
[https://www.raspberrypi.org/blog/share-your-keyboard-and-mouse-between-computers-with-barrier/ Share your keyboard and mouse between computers with Barrier]
== Create a GUI app by GTK+ ==
[https://www.raspberrypi.org/blog/ultrasonically-detect-bats-with-raspberry-pi/ Ultrasonically detect bats with Raspberry Pi]


= Mate Ubuntu =
= Mate Ubuntu =
Line 1,261: Line 1,731:
* [https://ubuntu-mate.community/t/how-to-set-up-and-upgrade-ubuntu-mate-16-04-on-a-pi-2-3-3b/18125 Set Up and Upgrade Ubuntu MATE 16.04 on a Pi 2/3/3B+]
* [https://ubuntu-mate.community/t/how-to-set-up-and-upgrade-ubuntu-mate-16-04-on-a-pi-2-3-3b/18125 Set Up and Upgrade Ubuntu MATE 16.04 on a Pi 2/3/3B+]


== 64 bit Ubuntu ==
== 64-bit Ubuntu and more ==
[https://youtu.be/G-w7ycyd8tA?t=771 Speed comparison] of Pi 4 using Raspberry Pi OS 32-bit vs Ubuntu 20.04 64-bit.
* [https://youtu.be/G-w7ycyd8tA?t=771 Speed comparison] of Pi 4 using Raspberry Pi OS 32-bit vs Ubuntu 20.04 64-bit.
* [https://youtu.be/80CU1j36Q6s Raspberry Pi 4 64-Bit Operating Systems: Manjaro, Ubuntu, Gentoo & More!] from ExplainingComputers.
** https://ubuntu.com/download/raspberry-pi
* [https://fedoramagazine.org/install-fedora-on-a-raspberry-pi/ Install Fedora on a Raspberry Pi 3]


== SSH server  ==
== SSH server  ==
Line 1,307: Line 1,780:
After I used apt-get to install Kodi, Kodi will not be able to launch:(  On Raspbian, the Kodi installed by apt-get works!!!
After I used apt-get to install Kodi, Kodi will not be able to launch:(  On Raspbian, the Kodi installed by apt-get works!!!


= Best Raspberry Pi Operating Systems for Various Purposes =
= Operating Systems for Various Purposes =
[https://itsfoss.com/raspberry-pi-os/ Best Raspberry Pi Operating Systems for Various Purposes]
* [https://itsfoss.com/raspberry-pi-os/ Best Raspberry Pi Operating Systems for Various Purposes]
* [https://www.maketecheasier.com/best-lightweight-operating-systems-raspberry-pi/ 7 of the Best Lightweight Operating Systems for Raspberry Pi]
 
== Twister OS ==
[https://twisteros.com/gallery.html Twister OS] Gallery


= [http://archlinuxarm.org/platforms/armv7/broadcom/raspberry-pi-2 Arch Linux] =
= [http://archlinuxarm.org/platforms/armv7/broadcom/raspberry-pi-2 Arch Linux] =
Line 1,314: Line 1,791:


= Android =
= Android =
Assuming you have Raspi 2 and 3.
* [http://raspex.exton.se/?p=144 RaspAnd]($9), currently it is Android 7.1.1. See [http://opensourceforu.com/2017/01/raspand-android-7-1-1-nougat-raspberry-pi/ RaspAnd brings Android 7.1.1 Nougat to your Raspberry Pi]
* [http://raspex.exton.se/?p=144 RaspAnd]($9), currently it is Android 7.1.1. See [http://opensourceforu.com/2017/01/raspand-android-7-1-1-nougat-raspberry-pi/ RaspAnd brings Android 7.1.1 Nougat to your Raspberry Pi]
* [https://androidcommunity.com/android-tv-nougat-rom-now-available-for-raspberry-pi-3-20170425/ Android TV Nougat ROM now available for Raspberry Pi 3]
* [https://androidcommunity.com/android-tv-nougat-rom-now-available-for-raspberry-pi-3-20170425/ Android TV Nougat ROM now available for Raspberry Pi 3]
* [https://www.makeuseof.com/tag/install-android-raspberry-pi/ How to Install Android on a Raspberry Pi] Apr 10, 2018
* [https://www.makeuseof.com/tag/install-android-raspberry-pi/ How to Install Android on a Raspberry Pi] Apr 10, 2018
* [https://www.makeuseof.com/tag/build-android-tv-box-raspberry-pi/ How to Build an Android TV Box With a Raspberry Pi] (LineageOS 15.1 (Android 8.1.0)) July 03, 2019
* [https://howchoo.com/g/ngjkywvkogr/install-android-raspberry-pi How to Install Android (Emteria) on Raspberry Pi] (Raspberry Pi 3 Model B) Jan 25, 2020
* [https://howchoo.com/g/ngjkywvkogr/install-android-raspberry-pi How to Install Android (Emteria) on Raspberry Pi] (Raspberry Pi 3 Model B) Jan 25, 2020
** [https://pimylifeup.com/raspberry-pi-android/ How to Setup Android 7 for the Raspberry Pi (EmteriaOS)] including GApps.
** [https://pimylifeup.com/raspberry-pi-android/ How to Setup Android 7 for the Raspberry Pi (EmteriaOS)] including GApps.
* [https://www.makeuseof.com/tag/build-android-tv-box-raspberry-pi/ How to Build an Android TV Box With a Raspberry Pi] (LineageOS 18.1, Android 11) May, 2022
* [https://beebom.com/build-android-tv-box-raspberry-pi/ How to Build Your Own Android TV Box with Raspberry Pi] Dec 2021
* [https://www.makeuseof.com/best-raspberry-pi-android-os/ The 5 Best Options to Run Android on Raspberry Pi] Jan, 2024


= [https://www.pi-top.com/ pi-top] =
= [https://www.pi-top.com/ pi-top] =
I pledged [https://www.indiegogo.com/projects/pi-topceed-the-first-99-raspberry-pi-desktop#/ pi-topCEED] ($99 + shipping is $25). The hardware looks cool: 14 inch, 1366x768 resolution (like an old laptop) & 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.
I pledged [https://www.indiegogo.com/projects/pi-topceed-the-first-99-raspberry-pi-desktop#/ 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).  
Unfortunately the pi-top OS is unstable (tested 7/1/2016).  
Line 1,337: Line 1,815:
* The current [https://shop.pi-top.com/products/pi-topceed pi-topCEED] webpage
* The current [https://shop.pi-top.com/products/pi-topceed pi-topCEED] webpage
* Detect and configure '''pi-top hubs''' and accessories on [https://github.com/pi-top/Device-Management Github]
* Detect and configure '''pi-top hubs''' and accessories on [https://github.com/pi-top/Device-Management Github]
* [https://github.com/pi-top/pi-topHUB-v1 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.
Some pictures (left: Pi-top, middle: pi-top hub, right: raspberry pi 3 with a GPIO card). The pin numbers are sequential.
Line 1,358: Line 1,837:


== pi-topOS ==
== pi-topOS ==
* https://pi-top.github.io/docs/index.html
** [https://www.pi-top.com/blog/new-pi-topos Sirius] is based on Raspbian 10 (Buster). It is leaner (~200MB RAM). This version fixed the problem in [https://knowledgebase.pi-top.com/knowledge/pi-top1-hub-fix pi-topCEED Hub]. Note "pi-top hub - Mk1 OS Fix" does not solves the issues on regular Raspbian 10 even it can be installed.
** [https://knowledgebase.pi-top.com/knowledge/pi-topos-bullseye-current Bullseye]. It is too heavy (>400MB RAM). [https://knowledgebase.pi-top.com/knowledge/pi-top-and-raspberry-pi-os Using pi-top Hardware with Raspberry Pi OS (formerly Raspbian)]
* https://blog.pi-top.com/new-pi-topos
* https://blog.pi-top.com/new-pi-topos
* https://knowledgebase.pi-top.com/knowledge
* https://knowledgebase.pi-top.com/knowledge
Line 1,367: Line 1,849:
[[:File:Pitopos.png]]
[[:File:Pitopos.png]]


= Plex =
= Media server =
[https://www.makeuseof.com/tag/4-ways-set-up-raspberry-pi-media-server/ How to Set Up a Raspberry Pi Media Server: 7 Ways] 2020
 
== Plex ==
* [http://www.howtogeek.com/283136/how-to-turn-a-raspberry-pi-into-a-cheap-plex-player-with-rasplex/ How to Turn a Raspberry Pi into a Cheap Plex Player with RasPlex]
* [http://www.howtogeek.com/283136/how-to-turn-a-raspberry-pi-into-a-cheap-plex-player-with-rasplex/ How to Turn a Raspberry Pi into a Cheap Plex Player with RasPlex]
* [https://www.makeuseof.com/tag/raspberry-pi-plex-media-server/ How to Turn a Raspberry Pi Into a Plex Media Server]
* [https://www.makeuseof.com/tag/raspberry-pi-plex-media-server/ How to Turn a Raspberry Pi Into a Plex Media Server]
Line 1,374: Line 1,859:
= DVR =
= DVR =
[https://www.techhive.com/article/3532434/how-to-build-a-cheap-cord-cutting-dvr-using-raspberry-pi.html How to build a cheap cord-cutting DVR using Raspberry Pi]
[https://www.techhive.com/article/3532434/how-to-build-a-cheap-cord-cutting-dvr-using-raspberry-pi.html How to build a cheap cord-cutting DVR using Raspberry Pi]
= Pi TV Hat =
[https://www.youtube.com/watch?v=dZPsOG0sOpw Raspberry Pi portable TV Recorder. Pi TV HAT]. ''The Raspberry Pi TV Tuner does not work in the US because the US uses '''ATSC''' and the tuner is for '''DVB-T''' and '''DVB-T2'''. I wish Raspberry Pi would make a TV HAT that was ATSC so I could use it in the US. There are USB tuners for ATSC that are available but not the HAT.''


= [http://kodi.wiki/view/HOW-TO:Install_Kodi_on_Raspberry_Pi Kodi/XBMC] and OpenElec =
= [http://kodi.wiki/view/HOW-TO:Install_Kodi_on_Raspberry_Pi Kodi/XBMC] and OpenElec =
Line 1,551: Line 2,039:


== IP scan tools ==
== IP scan tools ==
* '''arp''' (fastest, installed by default)
<ul>
<li>arp-scan utility
<syntaxhighlight lang='bash'>
sudo apt install arp-scan
sudo arp-scan --interface=INTERFACE_NAME --localnet  # eg wlan0
</syntaxhighlight>
<li>'''arp''' Address Resolution Protocol (fastest, installed by default). No "sudo" is required; i.e. "sudo" give the same result.
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
sudo apt install net-tools
arp -a  
arp -a  
arp -a -i eth1      # if eth1 comes from a USB ethernet adapter
arp -a -i eth1      # if eth1 comes from a USB ethernet adapter
</syntaxhighlight>
</syntaxhighlight>
* [[Linux#nmap_-_port_scanning_.26_IPs_in_local_network|nmap]] command
<li>[[Linux#nmap_-_port_scanning_.26_IPs_in_local_network|nmap]] command
* [https://www.fing.io/fingkit-sdk-downloads/ fing] (ios, android, linux, windows). Command line usage
<li>[https://www.fing.io/fingkit-sdk-downloads/ fing] (ios, android, linux, windows). Command line usage
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
sudo fing -n 192.168.1.1/24
sudo fing -n 192.168.1.1/24
</syntaxhighlight>
</syntaxhighlight>
where /24 means 'network prefix' size 24 bits. Check wikipedia [http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing 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.
where /24 means 'network prefix' size 24 bits. Check wikipedia [http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing 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.
* [http://angryip.org Angry ip scanner] cross platform. open source. It shows all instead of found ip's.
<li>[http://angryip.org Angry ip scanner] cross platform. open source. It shows all instead of found ip's.
* [http://www.nirsoft.net/utils/netbios_scanner.html netbios]. It does not discover linux boxes, however.
<li>[http://www.nirsoft.net/utils/netbios_scanner.html netbios]. It does not discover linux boxes, however.
<li>[https://www.makeuseof.com/best-network-scanning-enumeration-tools/ The 4 Best Network Scanning and Enumeration Tools]
* nmap
* [https://nmap.org/zenmap/ Zenmap] (GUI of nmap)
* Nessus
* Netdiscover
</ul>


= Use Raspberry Pi as a Tunnel Gateway/Router =
= Use Raspberry Pi as a Tunnel Gateway/Router =
[https://blog.alexellis.io/raspberry-pi-zero-tunnel-gateway/ Build a 10 USD Raspberry Pi Tunnel Gateway]
* [https://blog.alexellis.io/raspberry-pi-zero-tunnel-gateway/ Build a 10 USD Raspberry Pi Tunnel Gateway]
* [https://opensource.com/article/21/3/router-raspberry-pi Build a router with mobile connectivity using Raspberry Pi]


= Clustering =
= Clustering =
Line 1,658: Line 2,160:
* [http://elinux.org/Serial_port_programming Serial port programming]
* [http://elinux.org/Serial_port_programming Serial port programming]
* https://learn.adafruit.com/arduino-lesson-17-email-sending-movement-detector?view=all (closer to Arduino than Raspi). See [[Arduino#Python_and_Arduino|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.
* https://learn.adafruit.com/arduino-lesson-17-email-sending-movement-detector?view=all (closer to Arduino than Raspi). See [[Arduino#Python_and_Arduino|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 =
[https://www.makeuseof.com/connect-raspberry-pi-cell-network/ Connect Your Raspberry Pi to a Cell Network]


= [http://openframeworks.cc/about/ openFrameworks (oF)] =
= [http://openframeworks.cc/about/ openFrameworks (oF)] =
Line 1,689: Line 2,194:
== Processing ==
== Processing ==
* https://www.raspberrypi.org/blog/now-available-for-download-processing/
* https://www.raspberrypi.org/blog/now-available-for-download-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. [https://forums.raspberrypi.com/viewtopic.php?t=138160 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. [https://forums.raspberrypi.com/viewtopic.php?t=220362 (solved) Disable red power led on 3B+]
* [https://forums.raspberrypi.com/viewtopic.php?t=316462 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 ==
== Power off and on ==
Line 1,704: Line 2,220:
* [[#pi-top|Pi-top]]
* [[#pi-top|Pi-top]]
* [http://cs107e.github.io/guides/power/ Powering the Raspberry Pi A+]
* [http://cs107e.github.io/guides/power/ Powering the Raspberry Pi A+]
* [https://magpi.raspberrypi.com/articles/power-supply Power your Raspberry Pi: expert advice for a supply]
* USB 5V FTDI CP2102 Serial Adapter
* USB 5V FTDI CP2102 Serial Adapter
* [https://youtu.be/p86AbqgRaIo?t=303 Raspberry Pi Waveshare UPS] 4 pins are enough. Pin2 (5v), pins 3 & 5 (I2c), pin 9(GND). See [https://pinout.xyz/pinout/pin4_5v_power Pinout]


== Connect to console using TTL/Serial cable ==
== Connect to console using TTL/Serial cable ==
Line 1,968: Line 2,486:
Raspberry Pi has no ADC (Analog to Digital Converter), it cannot directly use an analog temperature sensor like the TMP36.
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/
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)! [https://raspberrypi.stackexchange.com/a/78225 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.
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
# GPU
/opt/vc/bin/vcgencmd measure_temp
# CPU
# CPU
vcgencmd measure_temp
# OR
cpu=$(</sys/class/thermal/thermal_zone0/temp)
cpu=$(</sys/class/thermal/thermal_zone0/temp)
echo "$((cpu/1000)) c"
echo "$((cpu/1000)) c"
Line 1,994: Line 2,513:


For Pi Zero W, the temperature is 59C when I build R.
For Pi Zero W, the temperature is 59C when I build R.
[https://www.howtogeek.com/discord-slack-alert-raspberry-pi-too-hot/ How to Get a Discord or Slack Alert If Your Raspberry Pi Is Too Hot]. Webhook.


== MCP23017 GPIO expander (extra 16 pins) ==
== MCP23017 GPIO expander (extra 16 pins) ==
Line 2,005: Line 2,526:
* https://www.raspberrypi-spy.co.uk/category/hardware/interfaces/spi/
* https://www.raspberrypi-spy.co.uk/category/hardware/interfaces/spi/
* http://www.brianhensley.net/2012/07/getting-spi-working-on-raspberry-pi.html
* http://www.brianhensley.net/2012/07/getting-spi-working-on-raspberry-pi.html
== MIDI port ==
* [https://en.wikipedia.org/wiki/MIPI_Alliance MIPI Alliance]
** [https://en.wikipedia.org/wiki/Camera_Serial_Interface Camera Serial Interface/CSI]
** [https://en.wikipedia.org/wiki/Display_Serial_Interface Display Serial Interface/DSI]


== [https://www.raspberrypi.org/documentation/usage/camera/raspicam/README.md Camera] ==
== [https://www.raspberrypi.org/documentation/usage/camera/raspicam/README.md Camera] ==
Line 2,010: Line 2,536:
* [http://www.semifluid.com/2017/01/23/raspberry-pi-camera-comparison/ Raspberry Pi Camera Comparison] (2017)
* [http://www.semifluid.com/2017/01/23/raspberry-pi-camera-comparison/ Raspberry Pi Camera Comparison] (2017)
* [https://www.raspberrypi.org/blog/new-product-raspberry-pi-high-quality-camera-on-sale-now-at-50/ Raspberry Pi High Quality Camera on sale now at $50], [https://www.engadget.com/raspberry-pi-12-megapixel-c-mount-camera-084145607.html?guccounter=1 Raspberry Pi's improved camera module supports interchangeable lenses]
* [https://www.raspberrypi.org/blog/new-product-raspberry-pi-high-quality-camera-on-sale-now-at-50/ Raspberry Pi High Quality Camera on sale now at $50], [https://www.engadget.com/raspberry-pi-12-megapixel-c-mount-camera-084145607.html?guccounter=1 Raspberry Pi's improved camera module supports interchangeable lenses]
* [http://www.makeuseof.com/tag/raspberry-pi-camera-module-timelapse-photography/ 5 Ways to Use the Raspberry Pi Camera Module for Time-Lapse Photography]
* [https://www.raspberrypi.org/magpi-issues/Essentials_Camera_v1.pdf MagPi Essential: Camera module guide] 2017
* [https://www.raspberrypi.org/magpi-issues/Essentials_Camera_v1.pdf MagPi Essential: Camera module guide] 2017
* http://www.raspberrypi-spy.co.uk/2013/05/capturing-hd-video-with-the-pi-camera-module/
* 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). [https://www.raspberrypi.com/news/new-old-functionality-with-raspberry-pi-os-legacy/ 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
* https://elinux.org/Omxplayer
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
Line 2,022: Line 2,550:
raspivid -o myvid.h264 -t 60000   
raspivid -o myvid.h264 -t 60000   
# 60 seconds. Default is 6 seconds which generates 10MB for 1080p, 6.4MB for 720p.
# 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 -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  # 1280 x 720 instead of 1920 x 1080
Line 2,028: Line 2,558:
# “8000000” is a bitrate of 8000Kbs (kilo bits per second) or 8Mb (8 mega bits per second).  
# “8000000” is a bitrate of 8000Kbs (kilo bits per second) or 8Mb (8 mega bits per second).  
# The default is usually 17000000.
# 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
# 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
sudo apt-get install -y gpac
MP4Box -fps 30 -add myvid.h264 myvid.mp4
MP4Box -fps 30 -add myvid.h264 myvid.mp4
Line 2,053: Line 2,589:
* [http://www.averagemanvsraspberrypi.com/2014/09/turn-raspberry-pi-into-cctv-security.html Turn a Raspberry Pi into a CCTV Security System] from averagemanvsraspberrypi.com.
* [http://www.averagemanvsraspberrypi.com/2014/09/turn-raspberry-pi-into-cctv-security.html Turn a Raspberry Pi into a CCTV Security System] from averagemanvsraspberrypi.com.
* [https://medium.com/@derwiki/raspberry-pi-cctv-with-netcat-and-mplayer-62643c5b3b82 Raspberry Pi CCTV with netcat and mplayer], [https://linuxize.com/post/netcat-nc-command-with-examples/ Netcat (nc) Command with Examples]
* [https://medium.com/@derwiki/raspberry-pi-cctv-with-netcat-and-mplayer-62643c5b3b82 Raspberry Pi CCTV with netcat and mplayer], [https://linuxize.com/post/netcat-nc-command-with-examples/ Netcat (nc) Command with Examples]
=== Detect camera ===
<pre>
libcamera-hello --list-cameras
</pre>
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 ===
<ul>
<li>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.
<li>[https://www.raspberrypi.com/documentation/computers/camera_software.html#getting-started Raspberry Pi Documentation] about Raspberry Pi Cameras.
<li>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.
<li>[https://www.raspberrypi.com/documentation/computers/camera_software.html 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.
<li>[https://www.tomshardware.com/how-to/use-raspberry-pi-camera-with-bullseye How To Use Raspberry Pi Cameras with Bullseye]
<li>Examples</br>
Still pictures
<syntaxhighlight lang='sh'>
libcamera-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
</syntaxhighlight>
Videos
<syntaxhighlight lang='sh'>
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
</syntaxhighlight>
</ul>


=== hardware/sensor ===
=== hardware/sensor ===
<ul>
<li>[https://www.raspberrypi.org/documentation/hardware/camera/ Hardware specification]
<li>[https://www.seeedstudio.com/blog/2020/06/18/a-complete-guide-to-help-you-choose-lenses-for-your-raspberry-pi-high-quality-camera-m/ A complete guide to help you choose lenses for your Raspberry Pi High Quality Camera]
* Origina: 5-megapixel OmniVision OV5647
* Origina: 5-megapixel OmniVision OV5647
* V2: Sony IMX219 8-megapixel sensor
* V2: Sony IMX219 8-megapixel sensor
* High quality: 12.3 megapixel [https://www.electronicsweekly.com/news/raspberry-pi-upgrades-camera-module-with-sony-imx477r-sensor-2020-05/ Raspberry Pi upgrades camera module with Sony IMX477R sensor]
* High quality: 12.3 megapixel [https://www.electronicsweekly.com/news/raspberry-pi-upgrades-camera-module-with-sony-imx477r-sensor-2020-05/ Raspberry Pi upgrades camera module with Sony IMX477R sensor]
<li>[https://www.arducam.com/docs/arducam-obisp-mipi-camera-module/3-use-on-raspberry-pi/3-3-check-and-test-the-camera/ Check and Test the Camera]
<pre>
v4l2-ctl --list-formats-ext
</pre>
For example, [https://smile.amazon.com/gp/product/B07L2SY756/ Smraza Wide Angle Fish-Eye Camera Lense] shows 2592x1944.
<li>Camera module 3
* https://www.raspberrypi.com/products/camera-module-3/, 12MP
* [https://www.tomshardware.com/reviews/raspberry-pi-camera-module-v3 Raspberry Pi Camera Module v3 Review: A New Angle on Photography] (comparison chart), [https://www.tomshardware.com/how-to/raspberry-pi-camera-module-3-python-picamera-2 How To Use Raspberry Pi Camera Module 3 with Python Code]
* [https://www.dpreview.com/news/4233987493/raspberry-pi-s-new-12mp-camera-module-3-now-has-autofocus-hdr-capture-and-more Raspberry Pi's new 12MP Camera Module 3 now has autofocus, HDR capture and more]
* [https://www.arducam.com/product/presalearducam-12mp-imx708-hdr-120-wide-angle-camera-module-with-m12-lens-for-raspberry-pi/  Arducam IMX708 HDR 120°(H) Wide Angle], [https://www.amazon.com/Arducam-Raspberry-Camera-Module-IMX708/dp/B0BZR6XL3Y/ Amazon]
<pre>
$ 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]
</pre>
</ul>


=== Connect camera module ===
=== Connect camera module ===
Line 2,068: Line 2,688:
'''[https://leanpub.com/jerpi/read 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).
'''[https://leanpub.com/jerpi/read 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 will solve the problem; see [https://www.reddit.com/r/raspberry_pi/comments/4pfz82/broken_pi_zero_camera_plastic_connector_how_to/ here].
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 [https://www.reddit.com/r/raspberry_pi/comments/4pfz82/broken_pi_zero_camera_plastic_connector_how_to/ here] and [https://forums.raspberrypi.com/viewtopic.php?t=262056 Broken retaining clip on Camera Board].


=== Pi camera mount ===
=== Pi camera mount ===
[https://www.instructables.com/id/Tripod-Camera-Mount-for-Raspberry-Pi/ Tripod Camera Mount for Raspberry Pi]. The tripod hole is 5mm.
* [https://www.instructables.com/id/Tripod-Camera-Mount-for-Raspberry-Pi/ Tripod Camera Mount for Raspberry Pi]. The tripod hole is 5mm.
* [https://medium.com/swlh/night-vision-camera-for-raspberry-pi-4db1686cb465 Night Vision Camera for Raspberry Pi]
 
=== PiCameraApp ===
[https://github.com/Billwilliams1952/PiCameraApp PiCameraApp]


=== USB camera ===
=== 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. <syntaxhighlight lang='bash'>
* 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. <syntaxhighlight lang='bash'>
sudo apt-get install fswebcam
sudo apt-get install fswebcam
Line 2,079: Line 2,703:
</syntaxhighlight>
</syntaxhighlight>
* [https://raspberrypi.stackexchange.com/questions/4412/streaming-h264-with-logitech-c920 Streaming H264 with Logitech C920]
* [https://raspberrypi.stackexchange.com/questions/4412/streaming-h264-with-logitech-c920 Streaming H264 with Logitech C920]
=== Use as a USB Webcam ===
[https://tutorial.cytron.io/2020/12/29/raspberry-pi-zero-usb-webcam/ Raspberry Pi Zero USB Webcam]


=== Fisheye Cam ===
=== Fisheye Cam ===
Line 2,094: Line 2,721:
* http://hackaday.com/2014/11/01/delicious-dash-pi-driving-data/
* http://hackaday.com/2014/11/01/delicious-dash-pi-driving-data/


=== Create a button-operated camera ===
=== Time-lapse ===
https://www.raspberrypi.org/magpi-issues/MagPi45.pdf p27
<ul>
<li>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'''
<syntaxhighlight lang='bash'>
#!/bin/bash


=== RPi Cam (Live stream and Cam Web Interface) ===
# Define the duration in minutes
http://elinux.org/RPi-Cam-Web-Interface as used in [http://opensource.com/life/15/9/turning-raspberry-pi-portable-streaming-camera portable streaming camera]
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 &
</syntaxhighlight>


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.  
<li>Shell script 2: [[Images#Overlay_the_date_and_time_onto_an_image|Overlay date and time]]. See also [https://imagemagick.org/script/convert.php convert options].
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
sudo apt-get update
LOCATION=NorthEast
sudo apt-get dist-upgrade
for img in *.jpg; do
  convert "$img" -gravity $LOCATION -pointsize 24 -fill yellow \
          -annotate +10+10 "%[exif:DateTimeOriginal]" "$img"
done
</syntaxhighlight>


git clone https://github.com/silvanmelchior/RPi_Cam_Web_Interface.git
<li>Shell script 3: [https://superuser.com/questions/1499968/creating-timelapse-from-still-images-jpg-to-mp4-using-ffmpeg Convert images into a video]
cd RPi_Cam_Web_Interface
<syntaxhighlight lang='bash'>
chmod u+x *.sh
ffmpeg -framerate 24 -pattern_type glob -i "*.jpg" -c:v libx265 -crf 28 output.mp4
./install.sh
# OR fps=12 with a slightly larger file size
ffmpeg -framerate 12 -pattern_type glob -i "*.jpg" -c:v libx265 -crf 28 output.mp4
</syntaxhighlight>
</syntaxhighlight>
"-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 [https://slhck.info/video/2017/02/24/crf-guide.html CRF Guide] & [https://trac.ffmpeg.org/wiki/Encode/H.264 H.264 Video Encoding Guide] from ffmpeg website.


[[File:RPi Cam Web.png|200px]]  [[File:RPi Cam Web2.png|180px]]
<li>[http://www.makeuseof.com/tag/raspberry-pi-camera-module-timelapse-photography/ 5 Ways to Use the Raspberry Pi Camera Module for Time-Lapse Photography]


=== How to Use Raspberry Pi as a PC Webcam ===
<li>[https://www.tomshardware.com/how-to/raspberry-pi-time-lapse-video How to Shoot Time-Lapse Videos with Raspberry Pi]
[https://www.tomshardware.com/how-to/use-raspberry-pi-as-pc-webcam How to Use Raspberry Pi as a PC Webcam]


=== Security Camera: motion and motionEyeOS ===
<li>[https://projects.raspberrypi.org/en/projects/timelapse-setup/7 Time-lapse animations with a Raspberry Pi]. Every 60 seconds takes a picture.
See [[Motioneye|motionEye]].
<syntaxhighlight lang='bash'>
convert -delay 10 -loop 0 image*.jpg animation.gif  # very very slow, gif file 63MB
</syntaxhighlight>
'''-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.  


=== Intruder detection ===
<li>Shell script (not python): [https://pimylifeup.com/raspberry-pi-time-lapse/ Raspberry Pi Time-Lapse in Four Easy Steps], [https://youtu.be/35_5wRKi_TI?si=xL55VrUiMCu2MKJ0&t=901 Raspberry Pi 5: Video Editing, Video Calling & Passive Cooling]
http://www.instructables.com/id/Intruder-Detector-With-Raspberry-Pi-and-Pushbullet/


=== Pan and tilt security camera controlled by Arduino ===
<li>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:
http://www.makeuseof.com/tag/diy-pan-and-tilt-network-security-cam-raspberry-pi/
* 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).
</ul>


=== Slow motion ===
=== Remote viewing ===
http://www.averagemanvsraspberrypi.com/2015/07/raspberry-pi-camera-module-slow-motion-video.html
[https://makezine.com/projects/beginner-project-a-remote-viewing-camera-with-raspberry-pi/ A Remote Viewing Camera With Raspberry Pi]


=== Motion triggered infrared wildlife camera, night version camera ===
=== Create a button-operated camera ===
* https://blog.adafruit.com/2015/09/04/how-to-make-a-motion-triggered-infrared-wildlife-camera-with-raspberry-pi-piday-raspberrypi-raspberry_pi/
https://www.raspberrypi.org/magpi-issues/MagPi45.pdf p27
* [http://www.howtogeek.com/291282/how-do-night-vision-cameras-and-goggles-work/ How Do Night Vision Cameras Work?]
* [https://www.howtogeek.com/407363/how-to-make-a-security-cameras-night-vision-work-through-a-window/ How to Use a Security Camera’s Night Vision Through a Window]


=== Solar powered nature camera ===
=== Streaming ===
* https://www.raspberrypi.org/blog/solar-powered-nature-camera/
[https://www.raspberrypi.com/documentation/computers/camera_software.html#stream-video-over-a-network-with-rpicam-apps 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-*.
* [https://kaspars.net/blog/solar-raspberry-pi-camera Solar Powered Raspberry Pi Camera]
<ul>
<li>'''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.
<syntaxhighlight lang='sh'>
libcamera-vid -t 0 --width 1920 --height 1080 --inline -o udp://Client-IP:8888
</syntaxhighlight>
I found VLC closed automatically for some reason. '''ffplay''' seems to be quite stable. Also the streaming does not use much of CPU.
<syntaxhighlight lang='sh'>
ffplay udp://Server-IP:8888 -fflags nobuffer -flags low_delay -framedrop
</syntaxhighlight>
<li>'''TCP''' method. Medium Latency. Suitable for applications where data accuracy is crucial.
<li>'''RTSP''' method. Medium-High Latency.
<syntaxhighlight lang='sh'>
libcamera-vid -t 0 --inline -o - | cvlc stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/stream1}' :demux=h264
</syntaxhighlight>
On the client side (eg Android),
<pre>
vlc rtsp://Server-IP:8554/stream1
</pre>
</ul>


=== Baby monitor ===
=== Live stream to youtube ===
* https://www.raspberrypi.org/blog/raspberry-pi-baby-monitor/
* [http://www.makeuseof.com/tag/live-stream-youtube-raspberry-pi/ Live Stream to YouTube With a Raspberry Pi] from makeuseof.
* [http://blog.alexellis.io/live-stream-with-docker/ Live stream to YouTube with your Raspberry Pi and Docker]
* [https://www.raspberrypi.com/news/ez-streamer-pi-lets-you-live-stream-from-four-cameras-at-once/ EZ Streamer-Pi lets you live stream from four cameras at once]


=== Tiddlybot ===
=== RTSP and ZoneMinder ===
* https://www.kickstarter.com/projects/1320310506/tiddlybot-fun-and-simple-raspberry-pi-robot/comments
<ul>
* https://www.shopstarter.com/s/Tiddlybot/
<li>[https://raspberrypi.stackexchange.com/questions/117100/how-to-stream-video-from-raspberry-pi-camera-module-as-http-not-rtsp Streaming using http] has a delay but it works.
* http://www.pibot.org/tiddlybot/
<li>Use '''mplayer rtsp://IP:8081/'''. But quite delay.
* https://github.com/Agilic-Development
<li>Use '''ffplay rtsp://IP:8081/'''. Quite delay.
* https://github.com/discoverycode/discoverybot_api The Discovery Bot
<li>[https://github.com/jacksonliam/mjpg-streamer mjpg-streamer]
* http://www.pibot.org/tiddlybot/images/ V1.1 image download link
<ul>
* http://pibot.org/forum/index.php Forum
<li>Install dependencies
* Two recommended wifi adapters: Edimax EW-7811Un, and the TP link TL-WN725N
<pre>
* http://pibot.org/forum/index.php?topic=45.0 Pin out with a nice graph
sudo apt-get update
* http://pibot.org/forum/index.php?topic=50.0 Raspi A+ is better than V2 in terms of power consumption. See also [http://raspi.tv/2014/raspberry-pi-a-how-much-power-does-it-need this post] & [http://raspi.tv/2015/raspberry-pi2-power-and-performance-measurement this new one] from raspi.tv.
sudo apt-get upgrade
* 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).  
sudo apt-get install build-essential libjpeg-dev libv4l-dev cmake git
</pre>
<li>Compile MJPG-streamer
<pre>
git clone https://github.com/jacksonliam/mjpg-streamer.git
cd mjpg-streamer/mjpg-streamer-experimental
make
sudo make install
</pre>
<li>Start MJPG-streamer
<pre>
./mjpg_streamer -i "./input_uvc.so -y -n -r 640x480 -f 10" -o "./output_http.so -w ./www"
</pre>
<li>Access http://<raspberry-pi-ip>:8080/?action=stream.
</ul>
<li>[https://forums.raspberrypi.com/viewtopic.php?t=279829 Low-latency network stream]
* [https://stackoverflow.com/a/17101647 Raspberry Pi no delay (<10ms) video stream]. GStreamer.
* [https://forums.developer.nvidia.com/t/how-can-we-further-reduce-the-latency-for-rtsp-streaming-sub-100ms-pipelines-given/109611 How can we further reduce the latency for RTSP streaming(sub 100ms)? Pipelines given] Jetson nano case.
<li>[https://www.tomshardware.com/how-to/stream-live-video-raspberry-pi How To Stream Live Video From Your Raspberry Pi Camera]
<li>[https://afivan.com/2021/12/24/easiest-way-to-hardware-accelerated-rtsp-streaming-with-raspberry-pi-4/ Easiest way to hardware accelerated RTSP streaming with Raspberry PI 4]
<li>[https://siytek.com/raspberry-pi-rtsp-to-home-assistant/ How To Add Raspberry Pi RTSP Camera Stream To Home Assistant]
<li>[https://youtu.be/QYFnbZgBZSM?si=DmuSYjqEI-VWWoA-&t=1828 CCTV: Build your own video surveillance system with ZoneMinder]. The delay is about 5 sec.
<pre>
sudo apt update
sudo apt install vlc
cd ~
nano rtsp.sh
</pre>
{{Pre}}
#!/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
</pre>
Then run,
<pre>
chmod +x rtsp.sh
./rtsp.sh
</pre>
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 [https://stackoverflow.com/a/45972575 Cannot get VLC to play stream]).
<pre>
rtsp://192.168.0.100:8081/x
</pre>
<pre>
sudo nano /etc/systemd/system/rtsp.service
</pre>
<pre>
[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


[[File:Tiddlybot.jpg|200px]]
[Install]
WantedBy=multi-user.target
</pre>
<pre>
sudo systemctl start rtsp.service
sudo systemctl status rtsp.service
sudo systemctl enable rtsp.service
exit
</pre>
<li>[https://youtu.be/AZwRnMImVIg?si=mWltDJPpYBxvvqXT Simple MODECT (Motion Detection) zone in ZoneMinder]
</ul>


The battery it includes is [http://www.amazon.com/Nokia-BL-5C-Extended-Li-Ion-Battery/dp/B0006HP7NC/ref=sr_1_1?ie=UTF8&qid=1439255229&sr=8-1&keywords=nokia+battery+bl+5c 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 [http://electronics.stackexchange.com/questions/10588/why-are-there-3-pins-on-some-batteries temperature].
=== RPi Cam (Live stream and Cam Web Interface) ===
http://elinux.org/RPi-Cam-Web-Interface as used in [http://opensource.com/life/15/9/turning-raspberry-pi-portable-streaming-camera portable streaming camera] and it supports motion detection as seen on [https://youtu.be/DutKbZ-Lr8U?si=V06mX3Ql-_OOpIc0 Web controlled Raspberry Pi Camera].  


To turn off the robot, switch the slider to the buzzer.
It also supports recording videos manually (MotionEye cannot).


To run a small dhcp server, it uses [https://en.wikipedia.org/wiki/Udhcpc udhcpd].
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.  
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
pi@raspberrypi ~ $ sudo service --status-all
sudo apt-get update
[ ? ]  alsa-utils
sudo apt-get dist-upgrade
[ - ]  bootlogs
 
[ ? ]  bootmisc.sh
git clone https://github.com/silvanmelchior/RPi_Cam_Web_Interface.git
[ ? ]  cgroup-bin
cd RPi_Cam_Web_Interface
[ ? ]  checkfs.sh
chmod u+x *.sh
[ ? ]  checkroot-bootclean.sh
./install.sh
[ - ]  checkroot.sh
</syntaxhighlight>
[ - ]  console-setup
 
[ + ]  cron
[[File:RPi Cam Web.png|200px]]  [[File:RPi Cam Web2.png|180px]]
[ + ] dbus
 
[ ? ] dphys-swapfile
=== How to Use Raspberry Pi as a PC Webcam ===
  [ ? ]  fake-hwclock
[https://www.tomshardware.com/how-to/use-raspberry-pi-as-pc-webcam How to Use Raspberry Pi as a PC Webcam]
[ + ] hostapd
 
[ - ] hostname.sh
=== Security Camera: motion and motionEyeOS ===
[ ? ]  hwclock.sh
See [[Motioneye|motionEye]].
[ + ]  ifplugd
 
[ - ]  kbd
=== Intruder detection ===
[ - ]  keyboard-setup
http://www.instructables.com/id/Intruder-Detector-With-Raspberry-Pi-and-Pushbullet/
[ ? ] killprocs
 
[ ? ]  kmod
=== Raspberry Pi dog detector ===
[ - ]  lightdm
[https://www.raspberrypi.org/blog/raspberry-pi-dog-detector-and-dopamine-booster/ Raspberry Pi dog detector]
[ - ]  motd
 
[ ? ] mountall-bootclean.sh
=== Chat Bot prevented a burglary ===
[ ? ] mountall.sh
[https://medium.com/@mellican/how-a-home-automation-chat-bot-prevented-a-burglary-901301557c70 How a Chat Bot prevented a burglary]
[ ? ]  mountdevsubfs.sh
 
[ ? ]  mountkernfs.sh
=== Pan and tilt security camera controlled by Arduino ===
[ ? ]  mountnfs-bootclean.sh
http://www.makeuseof.com/tag/diy-pan-and-tilt-network-security-cam-raspberry-pi/
[ ? ]  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
</syntaxhighlight>


=== Live stream to youtube ===
=== Slow motion ===
* [http://www.makeuseof.com/tag/live-stream-youtube-raspberry-pi/ Live Stream to YouTube With a Raspberry Pi] from makeuseof.
http://www.averagemanvsraspberrypi.com/2015/07/raspberry-pi-camera-module-slow-motion-video.html
* [http://blog.alexellis.io/live-stream-with-docker/ Live stream to YouTube with your Raspberry Pi and Docker]


=== Bird feed ===
=== Motion triggered infrared wildlife camera, night version camera ===
[https://www.instructables.com/id/Bird-Feeder-Monitor-V20/ Raspberry Pi catches the early bird]
* https://blog.adafruit.com/2015/09/04/how-to-make-a-motion-triggered-infrared-wildlife-camera-with-raspberry-pi-piday-raspberrypi-raspberry_pi/
* [http://www.howtogeek.com/291282/how-do-night-vision-cameras-and-goggles-work/ How Do Night Vision Cameras Work?]
* [https://www.howtogeek.com/407363/how-to-make-a-security-cameras-night-vision-work-through-a-window/ 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 [https://www.aliexpress.us/item/2251832695151739.html Aliexpress]


=== View Stonehenge in real time via Raspberry Pi ===
=== Solar powered nature camera ===
[https://www.raspberrypi.org/blog/view-stonehenge-in-real-time-via-raspberry-pi/ View Stonehenge in real time via Raspberry Pi] and the [https://stonehengeskyscape.co.uk/ site].
* https://www.raspberrypi.org/blog/solar-powered-nature-camera/
* [https://kaspars.net/blog/solar-raspberry-pi-camera Solar Powered Raspberry Pi Camera]
* [https://www.raspberrypi.org/blog/raspberry-pi-listening-posts-hear-the-borneo-rainforest/ Raspberry Pi listening posts ‘hear’ the Borneo rainforest]


== ESP8266 ==
=== Baby monitor ===
[http://www.instructables.com/id/Connect-an-ESP8266-to-your-RaspberryPi/?ALLSTEPS Connect an ESP8266 to your RaspberryPi]
* https://www.raspberrypi.org/blog/raspberry-pi-baby-monitor/


== IFTTT ==
=== SleePi sounds alarm when Raspberry Pi detects sleepiness ===
See Fridge monitor (p41-45) of [http://www.raspberrypi.org/magpi-issues/MagPi37.pdf TheMagPi September 2015].
[https://www.raspberrypi.org/blog/sleepi-sounds-alarm-when-raspberry-pi-detects-sleepiness/ SleePi sounds alarm when Raspberry Pi detects sleepiness]


== Control a 12V lamp with GPIO ZERO ==
=== Tiddlybot ===
http://raspi.tv/2015/gpio-zero-test-drive-making-light-of-security
* https://www.kickstarter.com/projects/1320310506/tiddlybot-fun-and-simple-raspberry-pi-robot/comments
 
* https://www.shopstarter.com/s/Tiddlybot/
== Grandpa scarer & Laser cutter ==
* http://www.pibot.org/tiddlybot/
https://www.raspberrypi.org/learning/grandpa-scarer/worksheet/
* https://github.com/Agilic-Development
 
* https://github.com/discoverycode/discoverybot_api The Discovery Bot
== Color sensing ==
* http://www.pibot.org/tiddlybot/images/ V1.1 image download link
https://www.raspberrypi.org/blog/colour-sensing-raspberry-pi/
* 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 [http://raspi.tv/2014/raspberry-pi-a-how-much-power-does-it-need this post] & [http://raspi.tv/2015/raspberry-pi2-power-and-performance-measurement 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).


== Relay ==
[[File:Tiddlybot.jpg|200px]]
[https://www.makeuseof.com/tag/build-light-sensing-smart-switch-raspberry-pi-ifttt/ How to Build a Light-Sensing Smart Switch With Raspberry Pi and IFTTT]


== Smart suitcase ==
The battery it includes is [http://www.amazon.com/Nokia-BL-5C-Extended-Li-Ion-Battery/dp/B0006HP7NC/ref=sr_1_1?ie=UTF8&qid=1439255229&sr=8-1&keywords=nokia+battery+bl+5c 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 [http://electronics.stackexchange.com/questions/10588/why-are-there-3-pins-on-some-batteries temperature].
http://www.instructables.com/id/How-to-Make-a-Smart-Suitcase-With-a-Raspberry-Pi/


= Other cool stuff =
To turn off the robot, switch the slider to the buzzer.
== Home Automation ==
* [http://makezine.com/projects/building-a-home-automation-system-with-openhab-to-control-leds-wirelessly/ OpenHAB]
* Linux User & Developer [http://www.linuxuser.co.uk/features/home-automation-with-your-pi-part-1 Part 1], [http://www.linuxuser.co.uk/features/home-automation-with-your-pi-part-2 Part 2]


== Uses in office ==
To run a small dhcp server, it uses [https://en.wikipedia.org/wiki/Udhcpc udhcpd].
[https://blog.dxmtechsupport.com.au/11-uses-for-a-raspberry-pi-around-the-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.
* [http://www.pcworld.com/article/3027446/hardware/irate-comcast-subscriber-turns-raspberry-pi-into-a-watchdog-for-slow-internet-speeds.html#tk.rss_all PCWorld]
 
== GPS tracker ==
http://blog.initialstate.com/new-python-gps-tracker/
 
== Retro Game Console/Emulator ==
* [https://retropie.org.uk/ RetroPie]
** [https://www.makeuseof.com/tag/install-retropie-app-raspberry-pi/ How to Install RetroPie as an App in Raspbian on Raspberry Pi], [https://retropie.org.uk/docs/Manual-Installation/ Manual installation]. It works (07/2020).
*** We can configure to start RetroPie at boot (see Manual installation).
*** If we want to start RetroPie from the command line, we need to exit the GUI Desktop and switch to terminal (eg '''Ctrl-Alt-F2'''). After enter username/password, type '''emulationstation''' to start RetroPie.
*** After we quit the emulationstation, we can start the GUI Desktop by '''startx'''.
** [http://lifehacker.com/how-to-turn-your-raspberry-pi-into-a-retro-game-console-498561192 How to transfer ROM from your primary computer]. For example copy *.smc files to ~/RetroPie/roms/snes folder.
** [https://digitalramnagar.com/retropie-how-to-exit-game Retropie How To Exit Game]. Press '''HotKey''' and '''X''' button used. Now you will see a Quick Menu, Press '''HotKey''' and '''B''' Button at the Same Time. Another way is the retroarch default hotkeys '''select + start''' On a keyboard that would be "Esc + enter".
** [https://raspberrypi.stackexchange.com/questions/76896/what-is-the-hotkey-enable-button-supposed-to-be What is the “Hotkey Enable” button supposed to be?]
** [https://retropie.org.uk/docs/Controller-Configuration/ Controller Configuration], [https://howchoo.com/g/ndy0njhhmzz/retropie-controllers#useful-retropie-hotkeys-and-where-to-find-more The Ultimate RetroPie Controller Guide]
** (backslash giving a #) [https://www.raspberrypi.org/forums/viewtopic.php?p=89618 Keyboard setup].
** Start emulation station from the command line: type '''emulationstation'''
 
* [https://smile.amazon.com/Super-NES-Classic-nintendo/dp/B0721GGGS9/ Super NES Classic] loaded with 21 games! [https://www.reviewgeek.com/10781/the-best-retro-and-mini-console-gifts/ The Best Retro And Mini Console Gifts] Dec 2018
* [http://emulator.online/snes/ Online emulator] (require adobe flash; eg Google Chrome)
* [https://opensource.com/article/18/9/retro-gaming-raspberry-pi 5 ways to play old-school games on a Raspberry Pi]
* [https://supernintendopi.wordpress.com/ Super Ninetendo Pi]
* [https://learn.adafruit.com/running-opengl-based-games-and-emulators-on-adafruit-pitft-displays?view=all Running OpenGL-based Games & Emulators on Adafruit PiTFT Displays]
* [http://magazine.odroid.com/wp-content/uploads/ODROID-Magazine-201506.pdf#page=17 Linux Gaming: Nintendo 64 Emulation] on Odroid.
* ROMS
** [https://romsmania.cc/roms/super-nintendo romsmania]
** http://www.freeroms.com/
** http://coolrom.com/emulators/psp/
** http://www.emuparadise.me/PSP_ROMs/
** http://romhustler.net/roms/psp
** http://www.downarea51.com/2014/04/daftar-game-iso-psp.html#.VzXUlZ5H8_t
** http://www.portalroms.com/en/isos/psp (include covers)
** https://www.youtube.com/watch?v=cdGSH5vy2Xw (some examples)
* [https://learn.adafruit.com/snes-ez-key-bluefruit-game-pad/overview SNES EZ Key Bluefruit Game Pad]
* http://makezine.com/projects/build-retro-gaming-console-raspberry-pi/
* http://lifehacker.com/how-to-turn-your-raspberry-pi-into-a-retro-game-console-498561192
* [https://www.kickstarter.com/projects/1836573872/pixel-vision-the-handmade-portable-game-system?ref=NewsDec0315&utm_campaign=Dec+03&utm_medium=email&utm_source=newsletter Pixel Vision] - a console capable of emulating some of the most classic game systems.
 
Username: pi, password: raspberry. See [https://github.com/RetroPie/RetroPie-Setup/wiki/SSH RetroPie wiki].
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
$ ssh pi@retropie.local
pi@raspberrypi ~ $ sudo service --status-all
[email protected]'s password:
[ ? ]  alsa-utils
 
[ - ]  bootlogs
The programs included with the Debian GNU/Linux system are free software;
[ ? ]  bootmisc.sh
the exact distribution terms for each program are described in the
[ ? ]  cgroup-bin
individual files in /usr/share/doc/*/copyright.
[ ? ]  checkfs.sh
 
[ ? ]  checkroot-bootclean.sh
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
[ - ]  checkroot.sh
permitted by applicable law.
[ - ]  console-setup
Last login: Wed May 11 17:35:37 2016 from 10.42.0.1
  [ + ]  cron
 
[ + ]  dbus
  .~~.  .~~.    Wednesday, 11 May 2016, 5:36:53 pm UTC
[ ? ]  dphys-swapfile
  '. \ ' ' / .'  Linux 4.1.19+ armv6l GNU/Linux
  [ ? ]  fake-hwclock
  .~ .~~~..~.
  [ + ] hostapd
  : .~.'~'.~. :  Filesystem      Size Used Avail Use% Mounted on
  [ - ] hostname.sh
  ~ (  ) (  ) ~ /dev/root        15G 2.2G  12G 16% /
  [ ? ] hwclock.sh
( : '~'.~.'~' : ) Uptime.............: 0 days, 00h04m04s
[ + ]  ifplugd
  ~ .~      ~. ~ Memory.............: 114884kB (Free) / 250692kB (Total)
[ - ]  kbd
  (  |  |  )  Running Processes..: 70
[ - ]  keyboard-setup
  '~        ~'  IP Address.........: 10.42.0.37
[ ? ]  killprocs
    *--~-~--*    Temperature........: CPU: 46°C/114°F GPU: 46°C/114°F
[ ? ]  kmod
                  The RetroPie Project, http://www.petrockblock.com
[ - ]  lightdm
 
[ - ]  motd
pi@retropie:~ $ df -h
[ ? ]  mountall-bootclean.sh
Filesystem      Size Used Avail Use% Mounted on
[ ? ]  mountall.sh
/dev/root        15G 2.2G  12G 16% /
[ ? ]  mountdevsubfs.sh
devtmpfs        119M    0 119M  0% /dev
[ ? ]  mountkernfs.sh
tmpfs          123M    0 123M  0% /dev/shm
[ ? ]  mountnfs-bootclean.sh
tmpfs          123M 8.5M 114M  7% /run
[ ? ]  mountnfs.sh
tmpfs          5.0M 4.0K 5.0M  1% /run/lock
[ ? ]  mtab.sh
tmpfs          123M    0 123M  0% /sys/fs/cgroup
[ ? ]  networking
/dev/mmcblk0p1  57M  20M  38M 35% /boot
[ - ]  nfs-common
</syntaxhighlight>
  [ + ]  ntp
 
  [ ? ] plymouth
== pygame ==
  [ ? ]  plymouth-log
* [https://www.raspberrypi.org/blog/code-a-kung-fu-master-style-beat-em-up-wireframe-32/ Code a Kung-Fu Master style beat-’em-up | Wireframe #32]
  [ - ]  procps
* [https://www.raspberrypi.org/blog/recreate-flappy-birds-flight-mechanic-wireframe-29/ Recreate Flappy Bird’s flight mechanic | Wireframe #29]
  [ ? ] raspi-config
 
[ ? ]  rc.local
== Three great games from GameMaker: Studio ==
  [ - ] rmnologin
https://www.raspberrypi.org/blog/three-great-gamemaker-games-raspberry-pi/
  [ - ]  rpcbind
 
  [ - ]  rsync
== Raspberry Pi Based Wireless FM Microphone ==
[ + ]  rsyslog
http://www.instructables.com/id/Raspberry-Pi-Based-Wireless-Microphone/?ALLSTEPS
[ ? ]  screen-cleanup
 
[ ? ]  sendsigs
== Dashboard/Kiosk by [http://dashing.io/ dashing.io] ==
[ + ] ssh
* See the article ''USE AN ODROID-C1 AS A WALL DASHBOARD'' on [http://magazine.odroid.com/assets/201505/pdf/ODROID-Magazine-201505.pdf 2015/5 ODROID magazine]
[ - ] sudo
* http://www.fusonic.net/en/blog/2013/07/31/diy-info-screen-using-raspberry-pi-dashing/
[ + ]  triggerhappy
* Search google: dashing raspberry pi
[ + ]  udev
 
[ ? ]  udev-mtab
== Ashley’s top five projects for Raspberry Pi first-timers ==
[ ? ]  udhcpd
https://www.raspberrypi.org/blog/ashleys-top-five-projects-for-raspberry-pi-first-timers/
[ ? ]  umountfs
 
[ ? ]  umountnfs.sh
== 5 Raspberry Pi Digital Signage Projects You Should Try ==
[ ? ] umountroot
https://www.makeuseof.com/tag/raspberry-pi-digital-signage-projects/
[ - ] urandom
 
[ - ]  x11-common
== 6 Raspberry Pi tutorials to try out ==
</syntaxhighlight>
https://opensource.com/article/20/3/raspberry-pi-tutorials
 
* VPN server
=== Bird feed ===
* Create an object-tracking camera
[https://www.instructables.com/id/Bird-Feeder-Monitor-V20/ Raspberry Pi catches the early bird]
* Photo slideshow
* Retro game
* Build a clock for your entertainment center
 
== Go to space ==
* [http://youtu.be/IM_DLgJEa0k Raspberry Pi in space (nearly) 35.5 km Pi balloon launch] and a [http://youtu.be/9CjjbauSvBE GoPro] version.


== OpenCV ==
=== View Stonehenge in real time via Raspberry Pi ===
* [https://learn.adafruit.com/raspberry-pi-face-recognition-treasure-box?view=all Face recognition treasure box] from adafruit.
[https://www.raspberrypi.org/blog/view-stonehenge-in-real-time-via-raspberry-pi/ View Stonehenge in real time via Raspberry Pi] and the [https://stonehengeskyscape.co.uk/ site].


== Wii Remote, bluetooth ==
=== Unlock your PC with a pushup or two (Machine learning) ===
* [http://www.raspberrypi-spy.co.uk/2013/02/nintendo-wii-remote-python-and-the-raspberry-pi/ Wii remote] based on CWiid Python library (it works on my UDOObuntu 2). Another very similar [http://www.brianhensley.net/2012/08/wii-controller-raspberry-pi-python.html example].
[https://www.raspberrypi.com/news/unlock-your-pc-with-a-pushup-or-two/ Unlock your PC with a pushup or two]
* [http://conoroneill.net/controlling-an-i-racer-rc-car-using-a-wii-balance-board-and-raspberry_pi/  Controlling an i-racer RC car using a Wii Balance Board and Raspberry_Pi]
* [http://whatacowpi.blogspot.com/2012/07/connecting-wii-nunchuck-to-raspberry-pi.html Wii Nunchuck] and C code. [http://computers.tutsplus.com/tutorials/using-a-wii-nunchuck-to-control-python-turtle--cms-20984 This] is based on Python.
* [https://www.sparkfun.com/products/9281 WiiChuck Adapter]
* [http://raspi.tv/2015/camjam-edukit-3-robotics-kit CamJam Edukit 3 Robotics Kit] no instruction.


=== Wii balance board ===
== ESP8266 ==
* https://en.wikipedia.org/wiki/Wii_Balance_Board
[http://www.instructables.com/id/Connect-an-ESP8266-to-your-RaspberryPi/?ALLSTEPS Connect an ESP8266 to your RaspberryPi]
* [https://github.com/InitialState/beerfridge/wiki/Part%201.%20Equipment Smart beer fridge] with wii balance board and Raspberry Pi (ARM). The [https://github.com/InitialState/beerfridge/wiki/Part-2.-Reading-the-Scale weight scale example] works fine when I tested on UDOO. Plus there are only [https://github.com/InitialState/beerfridge/wiki/Part-2.-Bluetooth-Setup 3 packages to install] (python-bluetooth, bluez and python-gobject).
* [https://github.com/aelveborn/Wii-Scale Wii-Scale] and [http://aelveborn.com/Wii-Scale/ Web page]
* [https://www.stavros.io/posts/your-weight-online/ DIY internet-enabled bathroom scale]
* [https://github.com/InitialState/smart-scale/wiki A Hackable, Weight Tracking, Text Messaging Scale with a Sense of Humor]
* [https://github.com/schellingb/WiiBalanceScale Use the Wii Balance Board as a pretty accurate weight scale] How to use?
* [https://github.com/iomihai/rpiscale 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
* [https://www.mattcutts.com/blog/linux-wii-balanceboard/ 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.
[[File:WiiBalBoard.jpg|200px]]
<syntaxhighlight lang='bash'>
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
== IFTTT ==
#  to fix an error "wmdemo undefined reference to symbol str2ba" when running 'make'
See Fridge monitor (p41-45) of [http://www.raspberrypi.org/magpi-issues/MagPi37.pdf TheMagPi September 2015].
#  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
== Control a 12V lamp with GPIO ZERO ==
sudo wmgui/wmgui
http://raspi.tv/2015/gpio-zero-test-drive-making-light-of-security


cd python
== Grandpa scarer & Laser cutter ==
sudo python setup.py install
https://www.raspberrypi.org/learning/grandpa-scarer/worksheet/
#  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
== Color sensing ==
sudo apt-get install python-pycurl
https://www.raspberrypi.org/blog/colour-sensing-raspberry-pi/
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
== Relay ==
wget http://abstrakraft.org/cwiid/raw-attachment/ticket/63/system.ini
* [https://www.raspberrypi.org/blog/raspberry-pi-zero-waters-your-plants-and-records-growth-timelapse/ Raspberry Pi Zero waters your plants and records growth timelapse]
chmod a+x scalesgui.py
* [https://www.makeuseof.com/tag/build-light-sensing-smart-switch-raspberry-pi-ifttt/ How to Build a Light-Sensing Smart Switch With Raspberry Pi and IFTTT]
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.
</syntaxhighlight>


== Robot control ==
== Smart suitcase ==
* http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/robot_control/
http://www.instructables.com/id/How-to-Make-a-Smart-Suitcase-With-a-Raspberry-Pi/
* [http://www.linuxuser.co.uk/tutorials/control-your-raspberry-pi-robot-from-a-web-connected-device Linux User & Developer 132]


== Compile R from source ==
== Identify Bird Sounds With BirdNET-Pi ==
Tested on R 3.0.1
[https://www.makeuseof.com/identify-bird-sounds-birdnet-raspberry-pi/ Identify Bird Sounds With BirdNET-Pi on Raspberry Pi]


* cd R-3.0.1
= Other cool stuff =
* ./configure --with-recommended-packages=no
== Hosting Without The Need to Port Forward, Tunnelling ==
* sudo apt-get install openjdk-7-jdk
See [[Ssh#awesome-tunneling|SSH > Awesome tunneling]]
* '''nano src/library/tools/R/install.R''' and pass "perl = TRUE" to sub()
<pre>
SHLIB_EXT <- sub(".*= ", "", grep("^SHLIB_EXT", mconf, value = TRUE), perl = TRUE)
SHLIB_LIBADD <- sub(".*= ", "", grep("^SHLIB_LIBADD", mconf, value = TRUE), perl = TRUE)
</pre>
to get rid of the error '''gcc: error: SHLIB_LIBADD: No such file or directory'''.
* make


== Temperature/Humidity Sensors for Data Analysis in R ==
== Home Automation ==
[https://roh.engineering/post/setting-up-raspberry-pi-temperature-humidity-sensors-for-data-analysis-in-r/ Setting Up Raspberry Pi Temperature/Humidity Sensors for Data Analysis in R]
* [http://makezine.com/projects/building-a-home-automation-system-with-openhab-to-control-leds-wirelessly/ OpenHAB]
* Linux User & Developer [http://www.linuxuser.co.uk/features/home-automation-with-your-pi-part-1 Part 1], [http://www.linuxuser.co.uk/features/home-automation-with-your-pi-part-2 Part 2]


== Google Coder ==
== Uses in office ==
PS. Code is based on [[node.js]] (Early version of [[R#shiny_server|shiny-server]] also depends on [[node.js]]).
[https://blog.dxmtechsupport.com.au/11-uses-for-a-raspberry-pi-around-the-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.


[http://pi.gadgetoid.com/article/running-google-coder-on-your-existing-raspberry-pi-or-desktop-pc 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.
== Track Internet Dropouts ==
* http://makezine.com/projects/send-ticket-isp-when-your-internet-drops/. Keywords: speedtest-cli, cron, IFTTT, google spreadsheet.
* [http://www.pcworld.com/article/3027446/hardware/irate-comcast-subscriber-turns-raspberry-pi-into-a-watchdog-for-slow-internet-speeds.html#tk.rss_all PCWorld]


In fact, it is possible to run Code for Raspberry Pi on your own PC. Just run 7 lines of script at  [http://chrismcleod.me/2013/09/13/run-coder-for-raspberry-pi-on-your-linux-pc/ here]. Note: My experience shows it is safe to use the version on
== GPS tracker ==
[https://github.com/googlecreativelab/coder/tree/99b70ee8e0722493eac3bf67558aa002713846c0 Sep-17-2013]; otherwise you'll get the following error when using 'nodejs server.js'
http://blog.initialstate.com/new-python-gps-tracker/
<pre>
 
$ nodejs server.js
== Retro Game Console/Emulator ==
no certificate found. generating self signed cert.
* See [[RetroPie|RetroPie]].
* [https://youtu.be/Jm8RiqAdHQE?t=525 Raspberry Pi Zero 2 W] from ETA prime


module.js:337
== pygame ==
    throw new Error("Cannot find module '" + request + "'");
* [https://www.raspberrypi.org/blog/code-a-kung-fu-master-style-beat-em-up-wireframe-32/ Code a Kung-Fu Master style beat-’em-up | Wireframe #32]
          ^
* [https://www.raspberrypi.org/blog/recreate-flappy-birds-flight-mechanic-wireframe-29/ Recreate Flappy Bird’s flight mechanic | Wireframe #29]
Error: Cannot find module '/home/pi/coder/coder-base/apps/auth/app'
</pre>
So the successful steps to install coder on Ubuntu is
# download zip file from [https://github.com/googlecreativelab/coder/tree/99b70ee8e0722493eac3bf67558aa002713846c0 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'.
== Three great games from GameMaker: Studio ==
https://www.raspberrypi.org/blog/three-great-gamemaker-games-raspberry-pi/


The password requirement for coder is at least 6 characters, at least one lower case and at least 2 upper cases or numbers.
== Raspberry Pi Based Wireless FM Microphone ==
http://www.instructables.com/id/Raspberry-Pi-Based-Wireless-Microphone/?ALLSTEPS


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).
== Dashboard/Kiosk by [http://dashing.io/ dashing.io] ==
* See the article ''USE AN ODROID-C1 AS A WALL DASHBOARD'' on [http://magazine.odroid.com/assets/201505/pdf/ODROID-Magazine-201505.pdf 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


'''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.
== balenaCloud Dashboard ==
[https://www.makeuseof.com/build-raspberry-pi-desktop-dashboard/ Build a Raspberry Pi Desktop Dashboard]


Another choice is to run [http://www.raspberrypi.org/phpBB3/viewtopic.php?t=9984 Cloud9 IDE] on RPi. The Cloud 9 IDE was preinstalled on [[Beaglebone|Beaglebone black]]/
== Ashley’s top five projects for Raspberry Pi first-timers ==
https://www.raspberrypi.org/blog/ashleys-top-five-projects-for-raspberry-pi-first-timers/


== Wolframe Mathematica ==
== 5 Raspberry Pi Digital Signage Projects You Should Try ==
* http://www.wolfram.com/raspberry-pi/
https://www.makeuseof.com/tag/raspberry-pi-digital-signage-projects/
* 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
== 6 Raspberry Pi tutorials to try out ==
<pre>
https://opensource.com/article/20/3/raspberry-pi-tutorials
/usr/bin/mathematica
* VPN server
</pre>
* Create an object-tracking camera
We can try a 3D plot like seen in [http://www.youtube.com/watch?v=7J3I2iHmC0c youtube]
* Photo slideshow
<pre>
* Retro game
Plot3D[Sin[x*y], {x,0,Pi}, {y,0,Pi}]
* Build a clock for your entertainment center
</pre>


The following screenshot shows how to calculate the derivative of f(x)=sin(x)*exp(2x) using Wolfram.  
== Go to space ==
* Note that the language is case-sensitive. For example, sin[x] is not recognized and it should be Sin[x].
* [http://youtu.be/IM_DLgJEa0k Raspberry Pi in space (nearly) 35.5 km Pi balloon launch] and a [http://youtu.be/9CjjbauSvBE GoPro] version.
* Wolfram language uses square brackets instead of parentheses for function's arguments.
* See [http://reference.wolfram.com/language/ this page] for Wolfram language & system documentation.  
* Another way is to type D[Sin[x] * Exp[2x], x]


[[File:WolframPi.png|150px]]
== OpenCV ==
* [https://learn.adafruit.com/raspberry-pi-face-recognition-treasure-box?view=all Face recognition treasure box] from adafruit.


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.
== Wii Remote, bluetooth ==
 
* [http://www.raspberrypi-spy.co.uk/2013/02/nintendo-wii-remote-python-and-the-raspberry-pi/ Wii remote] based on CWiid Python library (it works on my UDOObuntu 2). Another very similar [http://www.brianhensley.net/2012/08/wii-controller-raspberry-pi-python.html example].
== Use RaspPi as Media Center ==
* [http://conoroneill.net/controlling-an-i-racer-rc-car-using-a-wii-balance-board-and-raspberry_pi/  Controlling an i-racer RC car using a Wii Balance Board and Raspberry_Pi]
http://www.packtpub.com/raspberry-pi-media-center/book
* [http://whatacowpi.blogspot.com/2012/07/connecting-wii-nunchuck-to-raspberry-pi.html Wii Nunchuck] and C code. [http://computers.tutsplus.com/tutorials/using-a-wii-nunchuck-to-control-python-turtle--cms-20984 This] is based on Python.
* [https://www.sparkfun.com/products/9281 WiiChuck Adapter]
* [http://raspi.tv/2015/camjam-edukit-3-robotics-kit CamJam Edukit 3 Robotics Kit] no instruction.


== IN-FLIGHT entertainment system ==
=== Wii balance board ===
https://youtu.be/QESAI93Uqyg
* https://en.wikipedia.org/wiki/Wii_Balance_Board
* [https://github.com/InitialState/beerfridge/wiki/Part%201.%20Equipment Smart beer fridge] with wii balance board and Raspberry Pi (ARM). The [https://github.com/InitialState/beerfridge/wiki/Part-2.-Reading-the-Scale weight scale example] works fine when I tested on UDOO. Plus there are only [https://github.com/InitialState/beerfridge/wiki/Part-2.-Bluetooth-Setup 3 packages to install] (python-bluetooth, bluez and python-gobject).
* [https://github.com/aelveborn/Wii-Scale Wii-Scale] and [http://aelveborn.com/Wii-Scale/ Web page]
* [https://www.stavros.io/posts/your-weight-online/ DIY internet-enabled bathroom scale]
* [https://github.com/InitialState/smart-scale/wiki A Hackable, Weight Tracking, Text Messaging Scale with a Sense of Humor]
* [https://github.com/schellingb/WiiBalanceScale Use the Wii Balance Board as a pretty accurate weight scale] How to use?
* [https://github.com/iomihai/rpiscale 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
* [https://www.mattcutts.com/blog/linux-wii-balanceboard/ 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.
[[File:WiiBalBoard.jpg|200px]]
<syntaxhighlight lang='bash'>
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'


== Record TV ==
# Follow http://wiki.labomedia.org/index.php/Blender:Wiimote_:_Compilation_de_cwiid_sur_Linux_Mint_12
* http://www.redrobe.com/mike/record-tv-on-raspberry-pi-with-tvheadend/. This is from the same author of Raspicam Remote for Android.
#  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


== Bitcoin Miner ==
# Test Wii remote with GUI
* http://www.linuxuser.co.uk/tutorials/mine-bitcoins-with-raspberry-pi
sudo wmgui/wmgui
* https://learn.adafruit.com/piminer-raspberry-pi-bitcoin-miner/initial-setup-and-assembly


== Wifi extender ==
cd python
* [https://github.com/billz/raspap-webgui RaspAP] Web interface to control wifi, hostapd and related services
sudo python setup.py install
* [https://nims11.wordpress.com/2012/04/27/hostapd-the-linux-way-to-create-virtual-wifi-access-point/ Hostapd : The Linux Way to create Virtual Wifi Access Point]
#  install the Wii balance board software:
* [https://pimylifeup.com/raspberry-pi-wifi-extender/ Simple Raspberry Pi WiFi Extender]
git clone git://github.com/videntity/python-omhe.git
* [https://learn.pi-supply.com/make/how-to-setup-a-wireless-access-point-on-the-raspberry-pi/ How to Setup a Wireless Access Point on the Raspberry Pi]
cd python-omhe
<pre>
sudo python setup.py install
# 1. Update
sudo apt update; sudo apt upgrade


# 2. Install software
# Install pycurl; see https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=103188
sudo apt install dnsmasq hostapd
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


# 3. Setup wlan0 (if this has been done before, go to step 5)
wget http://abstrakraft.org/cwiid/raw-attachment/ticket/63/scalesgui.py
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
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.
</syntaxhighlight>


# 4. Create an entry of
== Robot control ==
network={
* http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/robot_control/
  ssid=" " 
* [http://www.linuxuser.co.uk/tutorials/control-your-raspberry-pi-robot-from-a-web-connected-device Linux User & Developer 132]
  psk=" "
}


# 5. Setup dhcpcd
== Compile R from source ==
sudo nano /etc/dhcpcd.conf
Tested on R 3.0.1


# 6. Add lines
* cd R-3.0.1
interface wlan1
* ./configure --with-recommended-packages=no
static ip_address=192.168.220.1/24
* sudo apt-get install openjdk-7-jdk
static routers=192.168.220.0
* '''nano src/library/tools/R/install.R''' and pass "perl = TRUE" to sub()
<pre>
SHLIB_EXT <- sub(".*= ", "", grep("^SHLIB_EXT", mconf, value = TRUE), perl = TRUE)
SHLIB_LIBADD <- sub(".*= ", "", grep("^SHLIB_LIBADD", mconf, value = TRUE), perl = TRUE)
</pre>
to get rid of the error '''gcc: error: SHLIB_LIBADD: No such file or directory'''.
* make


# 7. Restart dhcpd service
== Temperature/Humidity Sensors for Data Analysis in R ==
sudo service dhcpcd restart
[https://roh.engineering/post/setting-up-raspberry-pi-temperature-humidity-sensors-for-data-analysis-in-r/ Setting Up Raspberry Pi Temperature/Humidity Sensors for Data Analysis in R]


# 8. Adjust hostapd configuration
== Google Coder ==
sudo nano /etc/hostapd/hostapd.conf
PS. Code is based on [[node.js]] (Early version of [[R#shiny_server|shiny-server]] also depends on [[node.js]]).


# 9. Adjust the ssid=, wpa_passphrase= and
[http://pi.gadgetoid.com/article/running-google-coder-on-your-existing-raspberry-pi-or-desktop-pc 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.
#    driver= line to the best driver for your device,
interface=wlan1
driver=nl80211


hw_mode=g
In fact, it is possible to run Code for Raspberry Pi on your own PC. Just run 7 lines of script at  [http://chrismcleod.me/2013/09/13/run-coder-for-raspberry-pi-on-your-linux-pc/  here]. Note: My experience shows it is safe to use the version on
channel=6
[https://github.com/googlecreativelab/coder/tree/99b70ee8e0722493eac3bf67558aa002713846c0 Sep-17-2013]; otherwise you'll get the following error when using 'nodejs server.js'
ieee80211n=1
<pre>
wmm_enabled=1
$ nodejs server.js
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
no certificate found. generating self signed cert.
macaddr_acl=0
ignore_broadcast_ssid=0


auth_algs=1
module.js:337
wpa=2
    throw new Error("Cannot find module '" + request + "'");
wpa_key_mgmt=WPA-PSK
          ^
rsn_pairwise=CCMP
Error: Cannot find module '/home/pi/coder/coder-base/apps/auth/app'
</pre>
So the successful steps to install coder on Ubuntu is
# download zip file from [https://github.com/googlecreativelab/coder/tree/99b70ee8e0722493eac3bf67558aa002713846c0 Sep-17-2013 tree]
# cd coder-base; npm install
# modify 'config.js'
# launch it by 'node server.js'.


ssid=Pi3-Extender
I don't have to use sudo when I use 'npm install' and 'node server.js'.
wpa_passphrase=raspberry


# 10.  
The password requirement for coder is at least 6 characters, at least one lower case and at least 2 upper cases or numbers.
sudo nano /etc/default/hostapd


# 11.  
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).
Replace the line
#DAEMON_CONF=""
with
DAEMON_CONF="/etc/hostapd/hostapd.conf"


# 12.  
'''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.
sudo nano /etc/init.d/hostapd


# 13.
Another choice is to run [http://www.raspberrypi.org/phpBB3/viewtopic.php?t=9984 Cloud9 IDE] on RPi. The Cloud 9 IDE was preinstalled on [[Beaglebone|Beaglebone black]]/
Replace the line
#DAEMON_CONF=
with
DAEMON_CONF=/etc/hostapd/hostapd.conf


# 14. setting up dnsmasq
== Wolframe Mathematica ==
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
* 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)


# 15.  
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
sudo nano /etc/dnsmasq.conf
<pre>
/usr/bin/mathematica
</pre>
We can try a 3D plot like seen in [http://www.youtube.com/watch?v=7J3I2iHmC0c youtube]
<pre>
Plot3D[Sin[x*y], {x,0,Pi}, {y,0,Pi}]
</pre>


# 16. add the following lines
The following screenshot shows how to calculate the derivative of f(x)=sin(x)*exp(2x) using Wolfram.
interface=wlan1      # Use interface wlan1 
* Note that the language is case-sensitive. For example, sin[x] is not recognized and it should be Sin[x].  
listen-address=192.168.220.1  # Specify the address to listen on 
* Wolfram language uses square brackets instead of parentheses for function's arguments.
bind-interfaces      # Bind to the interface
* See [http://reference.wolfram.com/language/ this page] for Wolfram language & system documentation.  
server=8.8.8.8      # Use Google DNS 
* Another way is to type D[Sin[x] * Exp[2x], x]
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
[[File:WolframPi.png|150px]]
sudo nano /etc/sysctl.conf


# 18.  
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.
Replace the line
#net.ipv4.ip_forward=1
with
net.ipv4.ip_forward=1


# 19.
== Use RaspPi as Media Center ==
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
http://www.packtpub.com/raspberry-pi-media-center/book


# 20. configure a NAT between our wlan0 interface and our wlan1 interface.
== IN-FLIGHT entertainment system ==
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE 
https://youtu.be/QESAI93Uqyg
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.
== Record TV ==
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
* http://www.redrobe.com/mike/record-tv-on-raspberry-pi-with-tvheadend/. This is from the same author of Raspicam Remote for Android.


# 22.
== Bitcoin Miner ==
sudo nano /etc/rc.local
* http://www.linuxuser.co.uk/tutorials/mine-bitcoins-with-raspberry-pi
* https://learn.adafruit.com/piminer-raspberry-pi-bitcoin-miner/initial-setup-and-assembly


# 23.
== How to Track Satellite (ISS) Fly-Bys with Raspberry Pi ==
Find the line
[https://www.tomshardware.com/news/how-to-track-satellite-fly-bys-with-raspberry-pi How to Track Satellite Fly-Bys with Raspberry Pi]
exit 0
Add ABOVE:
iptables-restore < /etc/iptables.ipv4.nat


# 24. start the two services and enable them in systemctl.
== Wifi extender ==
sudo systemctl unmask hostapd
* [https://github.com/billz/raspap-webgui RaspAP] Web interface to control wifi, hostapd and related services
sudo systemctl enable hostapd
* [https://nims11.wordpress.com/2012/04/27/hostapd-the-linux-way-to-create-virtual-wifi-access-point/ Hostapd : The Linux Way to create Virtual Wifi Access Point]
sudo service hostapd start
* [https://pimylifeup.com/raspberry-pi-wifi-extender/ Simple Raspberry Pi WiFi Extender]
sudo service dnsmasq start
* [https://learn.pi-supply.com/make/how-to-setup-a-wireless-access-point-on-the-raspberry-pi/ How to Setup a Wireless Access Point on the Raspberry Pi]
<pre>
# 1. Update
sudo apt update; sudo apt upgrade


# 25. sudo nano /etc/network/interfaces
# 2. Install software
allow-hotplug wlan0
sudo apt install dnsmasq hostapd
iface wlan0 inet dhcp
 
# wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
# 3. Setup wlan0 (if this has been done before, go to step 5)
allow-hotplug wlan1
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf


# 26. sudo reboot
# 4. Create an entry of
</pre>
network={
I can see the SSID. But I cannot connect to that.
  ssid=" " 
<pre>
  psk=" "
sudo systemctl status hostapd
}
sudo systemctl status dnsmasq
</pre>


== Turn Raspi into a wireless hotspot / access point ==
# 5. Setup dhcpcd
I am using '''TP-LINK TP-WN722N''' wifi adapter.
sudo nano /etc/dhcpcd.conf


<ul>
# 6. Add lines
<li>(Not stable) http://elinux.org/RPI-Wireless-Hotspot. Also see some of my notes on [[Beaglebone#Create_wireless_access_point|Beaglebone page]]. The instruction asks to install '''hostapd''' and '''udhcpd''' (not '''dhcp'''). I made a copy of the changed files in [https://github.com/arraytools/hostapd Github]. It appears there is a typo on the '''/etc/udhcpd.conf''' file. See [https://sites.google.com/site/gmitresearch/raspberry-pi/setting-up-pi-as-a-wifi-hotspot 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
interface wlan1
  <ul>
static ip_address=192.168.220.1/24
  <li>http://askubuntu.com/questions/699995/hotspot-created-and-connected-from-linux-but-no-internet-access-on-phone </li>
static routers=192.168.220.0
  <li>http://superuser.com/questions/1061849/connected-to-hostapd-hotspot-but-no-internet </li>
 
  <li>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.
# 7. Restart dhcpd service
<pre>
sudo service dhcpcd restart
pi@raspberrypi:~ $ route -n
 
Kernel IP routing table
# 8. Adjust hostapd configuration
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
sudo nano /etc/hostapd/hostapd.conf
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 
# 9. Adjust the ssid=, wpa_passphrase= and
          inet addr:127.0.0.1  Mask:255.0.0.0
#    driver= line to the best driver for your device,
          ...
interface=wlan1
driver=nl80211


wlan0    Link encap:Ethernet  HWaddr f8:d1:11:0b:52:6f 
hw_mode=g
          inet addr:192.168.42.1 Bcast:192.168.42.255  Mask:255.255.255.0
channel=6
          ...
ieee80211n=1
</pre></li>
wmm_enabled=1
  </ul>
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
<li>(Adafruit) [https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point?view=all Setting up a Raspberry Pi as a WiFi access point] by installing '''hostapd''' and '''isc-dhcp-server''' packages. The instruction works and looks quite stable after I reboot Pi a few times. I found I don't need to run the final two lines to start the daemon services.
macaddr_acl=0
<pre>
ignore_broadcast_ssid=0
sudo service hostapd status
 
sudo service isc-dhcp-server status
auth_algs=1
</pre></li>
wpa=2
<li>(Adafruit) You can setup wlan0 in standalone mode or bridge it with eth0. [https://learn.adafruit.com/digital-free-library?view=all Digital Free Library] also includes how to set up Raspi as an access point/apache server/dhcp server (but no internet connection).</li>
wpa_key_mgmt=WPA-PSK
<li>http://raspberry-at-home.com/hotspot-wifi-access-point/ </li>
rsn_pairwise=CCMP
<li>[http://www.daveconroy.com/turn-your-raspberry-pi-into-a-wifi-hotspot-with-edimax-nano-usb-ew-7811un-rtl8188cus-chipset/ Turn Your Raspberry Pi Into a WiFi Hotspot with Edimax Nano USB EW-7811Un]. This instruction is using '''bridge-utils''' and  '''hostapd''' packages. </li>
<li>[http://www.cyberciti.biz/faq/debian-ubuntu-linux-setting-wireless-access-point/ Setup Wireless Access Point (WAP) with Hostapd for Debian/Ubuntu] by installing '''hostapd''' & '''bridge-utils''' packages. </li>
<li>[http://dashohoxha.blogspot.com/2013/06/how-to-setup-wifi-access-point-on-ubuntu.html This is] a similar post using '''hostapd''' and '''isc-dhcp-server''' packages. </li>
<li>[https://www.maketecheasier.com/how-to-turn-raspberry-pi-into-wireless-access-point/ How to Turn Your Raspberry Pi into a Wireless Access Point] (2020)
{| class="wikitable"
| 1. Install hostapd, dnsmasq, FW plugins
|
|-
| 2. Assign a static IP
| /etc/dhcpcd.conf
|-
| 3. Enable routing
| /etc/sysctl.d/routed-ap.conf
|-
| 4. Configure DHCP and DNS
| /etc/dnsmasq.conf
|-
| 5. Create a network name and pw
| /etc/hostapd/hostapd.conf
|}
</li></ul>


== Midi keyboard ==
ssid=Pi3-Extender
* [http://www.samplerbox.org/makeit SamplerBox] - [http://www.amazon.com/Akai-Professional-LPK25-Ultra-Portable-Controller/dp/B002M8GBDI/ref=cm_cr_pr_product_top?ie=UTF8 Akai LPK25 keyboard].
wpa_passphrase=raspberry


== Bike computer ==
# 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
</pre>
I can see the SSID. But I cannot connect to that.
<pre>
sudo systemctl status hostapd
sudo systemctl status dnsmasq
</pre>
 
== Converting Any USB Device to A Wireless USB ==
[https://youtu.be/I5zA1lU5Tw0 Converting Any USB Device to A Wireless USB using Raspberry Pi Zero]. [https://www.virtualhere.com/home VirtualHere] $49.
 
== Raspberry Pi Wifi Ethernet Bridge ==
[https://youtu.be/qhe6KUw3D78?t=272 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.
 
== Share internet ==
* [https://circuitdigest.com/microcontroller-projects/diy-router-using-raspberry-pi 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.
:<syntaxhighlight lang='bash'>
cd /etc/config
vi network
vi wireless
reboot network /etc/init.d/network restart
</syntaxhighlight>
* [https://mpolinowski.github.io/docs/DevOps/Linux/2021-09-02--openwrt-raspberry-pi/2021-09-02/ Installing OpenWRT on a Raspberry Pi 4]
* [https://raspberrytips.com/openwrt-on-raspberry-pi/ OpenWrt on Raspberry Pi: Use your Pi as a router (Tutorial)]
 
* [https://raspap.com/ RaspAP] & https://github.com/RaspAP/raspap-webgui. The web interface is http://raspberrypi.local/. It works (2023-7-23). See the note below.
** [https://github.com/RaspAP/raspap-webgui/issues/139 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.
* [https://www.instructables.com/Share-WiFi-With-Ethernet-Port-on-a-Raspberry-Pi/ Share WiFi With Ethernet Port on a Raspberry Pi]
* [https://www.tomshardware.com/how-to/raspberry-pi-access-point How to Turn a Raspberry Pi Into a Wi-Fi Access Point]
* [https://thepi.io/how-to-use-your-raspberry-pi-as-a-wireless-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:(
* [https://blog.balena.io/turn-a-raspberry-pi-into-a-wi-fi-access-point-or-repeater/ 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
** [https://www.makeuseof.com/tag/how-to-turn-an-old-router-into-a-wireless-bridge/ 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.
 
== Turn Raspi into a wireless hotspot / access point ==
(2023/8/2) [https://www.makeuseof.com/raspberry-pi-jellyfin-offline-media-server-camping/ Going Camping? Jellyfin on Raspberry Pi Is the Perfect Offline Media Server]
 
(2022/9/12) [https://www.tomshardware.com/how-to/raspberry-pi-access-point 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.
 
<ul>
<li>(Not stable) http://elinux.org/RPI-Wireless-Hotspot. Also see some of my notes on [[Beaglebone#Create_wireless_access_point|Beaglebone page]]. The instruction asks to install '''hostapd''' and '''udhcpd''' (not '''dhcp'''). I made a copy of the changed files in [https://github.com/arraytools/hostapd Github]. It appears there is a typo on the '''/etc/udhcpd.conf''' file. See [https://sites.google.com/site/gmitresearch/raspberry-pi/setting-up-pi-as-a-wifi-hotspot 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
  <ul>
  <li>http://askubuntu.com/questions/699995/hotspot-created-and-connected-from-linux-but-no-internet-access-on-phone </li>
  <li>http://superuser.com/questions/1061849/connected-to-hostapd-hotspot-but-no-internet </li>
  <li>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.
<pre>
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
          ...
</pre></li>
  </ul>
<li>(Adafruit) You can setup wlan0 in standalone mode or bridge it with eth0. [https://learn.adafruit.com/digital-free-library?view=all Digital Free Library] also includes how to set up Raspi as an access point/apache server/dhcp server (but no internet connection).</li>
<li>http://raspberry-at-home.com/hotspot-wifi-access-point/ </li>
<li>[http://www.daveconroy.com/turn-your-raspberry-pi-into-a-wifi-hotspot-with-edimax-nano-usb-ew-7811un-rtl8188cus-chipset/ Turn Your Raspberry Pi Into a WiFi Hotspot with Edimax Nano USB EW-7811Un]. This instruction is using '''bridge-utils''' and  '''hostapd''' packages. </li>
<li>[http://www.cyberciti.biz/faq/debian-ubuntu-linux-setting-wireless-access-point/ Setup Wireless Access Point (WAP) with Hostapd for Debian/Ubuntu] by installing '''hostapd''' & '''bridge-utils''' packages. </li>
<li>[http://dashohoxha.blogspot.com/2013/06/how-to-setup-wifi-access-point-on-ubuntu.html This is] a similar post using '''hostapd''' and '''isc-dhcp-server''' packages. </li>
<li>[https://www.maketecheasier.com/how-to-turn-raspberry-pi-into-wireless-access-point/ How to Turn Your Raspberry Pi into a Wireless Access Point] (2020), (Adafruit) [https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point?view=all Setting up a Raspberry Pi as a WiFi access point] (2024).
{| class="wikitable"
| 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
|}
</li></ul>
 
== Midi keyboard ==
* [http://www.samplerbox.org/makeit SamplerBox] - [http://www.amazon.com/Akai-Professional-LPK25-Ultra-Portable-Controller/dp/B002M8GBDI/ref=cm_cr_pr_product_top?ie=UTF8 Akai LPK25 keyboard].
 
== Bike computer ==
https://www.raspberrypi.org/blog/bike-computer-for-the-myopic/ This build uses the Kindle as a display
https://www.raspberrypi.org/blog/bike-computer-for-the-myopic/ This build uses the Kindle as a display


== [http://octoprint.org/ OctoPrint] ==  
== [http://octoprint.org/ OctoPrint] ==  
The snappy web interface for your 3D printer.
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 ==
* [http://piboards.com/2017/01/07/block-ads-on-all-your-devices-at-home-with-pi-hole-and-an-orange-pi/ Block Ads on All Your Devices at Home with Pi-hole]
* [http://thehackernews.com/2016/05/android-kernal-exploit.html Kernel Backdoor found in Gadgets Powered by Popular Chinese ARM Maker]
* [https://www.cnx-software.com/2017/07/15/office-factory-business-model-and-ambitious-plans-of-shenzhen-xunlong-software-orange-pi-maker/ We (orange pi) are subsidized by the government]
 
== Mozilla Project Things ==
https://iot.mozilla.org/
 
== E-ink ==
[[Eink|E-ink]]
 
== Magic mirror ==
* https://github.com/MichMich/MagicMirror
* [https://youtu.be/XN-TNhROrrE 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.
* [https://opensource.com/article/19/3/mobile-particulate-matter-sensor How to build a mobile particulate matter sensor with a Raspberry Pi]
 
== Designing a Raspberry Pi Based Intelligent Ultrasonic Bat Detector App ==
[https://www.rs-online.com/designspark/designing-a-raspberry-pi-based-intelligent-ultrasonic-bat-detector-app Designing a Raspberry Pi Based Intelligent Ultrasonic Bat Detector App]
 
== Calculate pi ==
<ul>
<li>See this [https://twitter.com/rafalab/status/1371094071507357696?s=20 tweet]
<pre>
> 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
</pre>
</li>
<li>[https://statisticaloddsandends.wordpress.com/2021/03/15/estimating-pi-using-the-method-of-moments/ Estimating pi with Monte Carlo simulation]
</li>
</ul>
 
== 8086 ==
[https://www.tomshardware.com/uk/news/raspberry-pi-8086-hat Raspberry Pi HAT Brings 1984 CPU to 2022]
 
= Alternatives =
* [https://www.msn.com/en-us/money/other/5-operating-systems-you-should-try-if-you-re-new-to-raspberry-pi/ 5 Operating Systems You Should Try If You're New To Raspberry Pi]
 
== DietPi ==
DietPi is an extremely lightweight Debian-based OS.  


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.
* https://github.com/MichaIng/DietPi
* [https://dietpi.com/stats.html Comparison]
* [https://raspberrytips.com/install-dietpi-raspberry-pi/ Complete Guide]
* [https://dietpi.com/forum/t/password-explanation/14415 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.


== Orange Pi ==
* Memory is 20.9/477M according to htop (on my RPi 1B, armv6)
* [http://piboards.com/2017/01/07/block-ads-on-all-your-devices-at-home-with-pi-hole-and-an-orange-pi/ Block Ads on All Your Devices at Home with Pi-hole]
* Default username/password is root/dietpi
* [http://thehackernews.com/2016/05/android-kernal-exploit.html Kernel Backdoor found in Gadgets Powered by Popular Chinese ARM Maker]
* Dropbear was used instead of openssh by default
* [https://www.cnx-software.com/2017/07/15/office-factory-business-model-and-ambitious-plans-of-shenzhen-xunlong-software-orange-pi-maker/ We (orange pi) are subsidized by the government]
* After a login, it will remind some useful commands
 
** '''dietpi-launcher''' (can run 'dietpi-config' and 'dietpi-software').
== Mozilla Project Things ==
*** DietPi-Drive_Manager: control multiple external drives (eg Samba drives)
https://iot.mozilla.org/
*** 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: [https://github.com/tariqbuilds/linux-dash LinuxDash], [https://github.com/phpsysinfo/phpsysinfo phpSysInfo], [https://www.netdata.cloud/ Netdata], [https://xavierberger.github.io/RPi-Monitor-docs/index.html RPi-Monitor], Docker, DietPi-Dashboard, [https://github.com/bastienwirtz/homer 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
* 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.
* [https://tailscale.com/download/linux tailscale] can be installed


== E-ink ==
== other SBC ==
* https://twitter.com/hashtag/epaper
* [https://www.raspberrypi.org/blog/using-e-ink-raspberry-pi/ Using E Ink displays with a Raspberry Pi]
* [https://www.hackster.io/sridhar-rajagopal/weather-station-with-epaper-and-raspberry-pi-c26a70 Weather Station with ePaper and Raspberry Pi] 2020
* [https://github.com/waveshare/e-Paper/tree/master/4.2inch_e-paper_code/RaspberryPi/python3 Waveshare hardware connection] from Github (4 SPI pins are needed). The first number (eg RES white -> 11) below is from a continuous sequence order (physical location) and the 2nd number (eg BCM: 17) is GPIO number (or BCM pin number).
: <syntaxhighlight lang='txt'>
    EPD        =>  Raspberry Pi
  * VCC  red    ->  3.3
  * GND  black  ->  GND
  * DIN  blue  ->  19 MOSI
  * CLK  yellow ->  23 SCLK
  * CS  orange ->  24 (Physical, BCM: CE0, 8)
  * D/C  green  ->  22 (Physical, BCM: 25)
  * RES  white  ->  11 (Physical, BCM: 17)
  * BUSY purple ->  18 (Physical, BCM: 24)
</syntaxhighlight>
:{| class="wikitable"
| vcc
| red
| 1
| 3v3
|-
| gnd
| black
| 6
| ground
|-
| rst
| white
| 11
| gpio17
|-
| busy
| purple
| 18
| gpio24
|-
| din
| blue
| 19
| gpio10 (spi mosi)
|-
| dc
| green
| 22
| gpio025
|-
| clk
| yellow
| 23
| gpio11 (spi sck)
|-
| cs
| orange
| 24
| gpio08 (spi ce0)
|}
* [https://diyprojects.io/test-waveshare-epaper-eink-2-7-spi-screen-raspberry-pi-python/ Test Waveshare ePaper (eInk) 2.7” inch 264×176 SPI screen on Raspberry Pi in Python]. Refresh time 6s.
** https://www.waveshare.com/wiki/2.7inch_e-Paper_HAT and [https://github.com/waveshare/e-Paper/tree/master/2.7inch_e-paper_code/RaspberryPi github] example. Five steps were needed to show a screen. 1. Reverse 2. White 3. Black 4. Reverse 5. Normal.
** [https://github.com/Neophytez/raspberry-waveshare-clock-weather Clock and weather display for E-Paper 2.7 inch display from Waveshare for Raspberry Pi 3]. The screen will refresh every minute (use CPU). It does work but the temperature is in C not F. To fix that, open "epaper.py" file, change the variable "DARK_SKY_UNITS" from "si" to "auto"; see [https://darksky.net/dev/docs#forecast-request Doc] from darksky.net. The cpu and memory usage shown on the screen is different from what I saw from the result of 'htop' (over estimate). Note that [https://darksky.net/details/39.1532,-77.0668/2019-7-16/us12/en darksky.net] web information is incredible friendly already. [https://www.macworld.com/article/3535217/apple-acquires-dark-sky-weather-app.html Apple acquires Dark Sky weather app] (3/30/2020).
::<syntaxhighlight lang='bash'>
sudo apt-get install libjpeg-dev
pip install -r requirements.txt
chmod +x run.sh
./run.sh  # DO NOT ADD sudo
# terminal will show messages from the code. For example, press button 4
# [Button] Btn #4 pressed
# [Button] Btn press handled.
# App is shuting down.
# Display shutdown icon ...
# [Epaper] Display.
# ... done.
# calling exit 0
</syntaxhighlight>
** Once we put the program in a service, it is tricky to change the settings. It is best to stop the service before doing any change; '''sudo systemctl stop epaper.service''' . Then we need to delete all auto-generated *.pyc file; '''find . -iname "*.pyc" -delete'''. Now we can start the service again; '''sudo systemctl start epaper.service''' .
** If the program was run through the service, press button 4 will shut down the code but the script will be launched again.
** Understand the code. Search '''shutting_down''', '''shutdown_hook''', '''pressed''' keywords
* [http://www.waveshare.net/shop/4.2inch-e-Paper.htm Waveshare ePaper 4.2 inch] 400 × 300. Refresh time 4s.
** https://github.com/waveshare/e-Paper/tree/master/2.7inch_e-paper_code/RaspberryPi/python3 shows what software we need to install.<syntaxhighlight lang='bash'>
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
</syntaxhighlight>
** http://www.waveshare.net/wiki/4.2inch_e-Paper_Module. Click on 示例程序 to download 4.2inch_e-paper_code.7z.  <syntaxhighlight lang='bash'>
wget http://www.waveshare.net/w/upload/8/80/4.2inch_e-paper_code.7z
mkdir 4.2inch_e-paper_code
cd 4.2inch_e-paper_code
sudo apt-get install p7zip-full
# It seems the "e" option from 7za will not keep the directory structure properly
# We need to use the "x" option.
7za x ../4.2inch_e-paper_code.7z # https://superuser.com/a/379594
cd RaspberryPi/python3
</syntaxhighlight> Then follow the [http://www.waveshare.net/w/upload/a/a7/4.2inch-e-paper-module-user-manual-cn.pdf#page=15 用户手册/manual] (useful) to install required software and run the demo.  Note when installing the [https://pillow.readthedocs.io/en/latest/installation.html Pillow] library (sudo pip3 install Pillow), I got an error: ''The headers or library files could not be found for jpeg''. To fix the problem, try <syntaxhighlight lang='bash'>
# The original instruction in the manual does not help
# sudo apt install libopenjp2-7-dev
sudo apt-get install libjpeg-dev
</syntaxhighlight> Don't forget to enable SPI (sudo raspi-config) before running "sudo python main.py". I actually got another error complaining ''font24 = ImageFont.truetype('/usr/share/fonts/truetype/wqy/wqy-microhei.ttc', 24)''. Follow the suggestion [https://www.raspberrypi.org/forums/viewtopic.php?p=1427208  2.13 epaper display problem] and install the required font by '''sudo apt-get install fonts-wqy-microhei''', I am able to run the demo program.
:: In order to resize an image to 400x300 and monotone scale (see the [http://www.waveshare.net/w/upload/a/a7/4.2inch-e-paper-module-user-manual-cn.pdf#page=26 last page of the manual]), we can use <syntaxhighlight lang='bash'>
sudo apt-get install imagemagick
wget http://worldartsme.com/images/spring-charlie-brown-clipart-1.jpg -O spring.jpg
convert spring.jpg -format bmp -resize 400x300! -monochrome 4in2_spring.bmp
cp 4in2.bmp 4in2_original.bmp
cp 4in2_spring.bmp 4in2.bmp
sudo python3 main.py
# notice the exclamation mark, "!".
# See http://www.imagemagick.org/script/command-line-processing.php#geometry
</syntaxhighlight>
* [https://github.com/aceisace/Inky-Calendar/blob/master/README.md E-ink calendar using a Raspberry Pi Zero]
* [https://lemariva.com/blog/2019/08/raspberry-pi-e-paper-display-widgets Raspberry Pi: an E-Paper display with Widgets]  Waveshare® 7.5" E-ink Screen.
* [http://www.waveshare.net/shop/7.5inch-e-Paper.htm Comparison of different e-inks] from Waveshare.net. Note the 7.5 inch epaper has a resolution 640x384 (cf 7 inch 800x400 official raspberry pi display).
* [https://waveshare-developmentkit.aliexpress.com/store/group/e-Paper-Display/216233_212201817.html?spm=2114.12010612.0.0.28bf6c53qbEYgj Aliexpress]
* [https://liliputing.com/2019/05/you-can-build-a-diy-e-ink-magic-mirror-for-under-100.html You can build a DIY E Ink “magic mirror” for under $100]
** [https://maker-tutorials.com/waveshare-e-paper-python-demo-code-raspberry-pi-3-installieren-raspbian/ Waveshare e-Paper python demo code to install on the Raspberry Pi 3 - raspbian eink]
* PaPiRus: ePaper Screen HAT for your Raspberry Pi
** https://www.adafruit.com/product/3420 $50 264 x 176
** https://youtu.be/obPcZwz4Dq4
** [https://medium.com/@derwiki/raspberry-pi-zero-e-ink-bus-predictions-d58e2a7e69a1 Raspberry Pi Zero E-Ink Bus Predictions]
** [https://opensource.com/article/20/3/pi-zero-display Adding a display to a travel-ready Raspberry Pi Zero]
 
== Magic mirror ==
* https://github.com/MichMich/MagicMirror
* [https://youtu.be/XN-TNhROrrE 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.
* [https://opensource.com/article/19/3/mobile-particulate-matter-sensor How to build a mobile particulate matter sensor with a Raspberry Pi]
 
== Designing a Raspberry Pi Based Intelligent Ultrasonic Bat Detector App ==
[https://www.rs-online.com/designspark/designing-a-raspberry-pi-based-intelligent-ultrasonic-bat-detector-app Designing a Raspberry Pi Based Intelligent Ultrasonic Bat Detector App]
 
= Alternatives =
* [[Beaglebone|BeagleBone Black]] (no built-in wifi or bluetooth)
* [[Beaglebone|BeagleBone Black]] (no built-in wifi or bluetooth)
* [[Udoo|UDOO]] with built-in wifi. Bluetooth relies on USB.
* [[Udoo|UDOO]] with built-in wifi. Bluetooth relies on USB.

Latest revision as of 20:34, 29 November 2024

Raspberry Pi

Miscellaneous

# /etc/network/interfaces  file
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
allow-hotplug wlan0
  wpa-ssid "YOURSSID"
  wpa-psk "YOURPASSWORD
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

Pico

Pi zero

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

Checking Your Raspberry Pi Revision Number & Board Version

raspberrypi-spy

cat /proc/device-tree/model

Raspberry Pi 4 Rev 1.2. How to tell the difference

https://youtu.be/_wt9NTa1UNE

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

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.

  1. Prepare your workspace: apt install
  2. Calculate the image size: fdisk
  3. Create the blank image: dd
  4. Partition the image: sfdisk
  5. Mount the images: losetup, partx, dd
  6. Configure and mount partitions: tune2fs, e2label, e2fsck, resize2fs, mount
  7. Set the boot partition: fdisk, nano
  8. Create the reset scripts: chmod, nano
  9. Fix fstab: cat
  10. Take a snapshot: dd, umount, losetup
  11. Burn and test: dd
  12. Physical reset
  13. 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

Raspbian is not asking for a password for the sudo command

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

# 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.

Conkyrpi.png

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

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

Install minimal browser

http://c-mobberley.com/wordpress/index.php/2013/04/30/raspberry-pi-best-fastest-web-browser-for-gui-usage/

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

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

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

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

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

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.

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

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

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

Solar power

CPU Benchmark

# 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

Books, Magazines, Blogs

Minecraft

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

Download an image

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

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

sudo apt-get install pv
dd if=/dev/urandom | pv | dd of=/dev/null

Check the filesystem on microSD card

  • Check SD card for any error
    dmesg | grep -i "mmc"
    # OR
    journalctl -k | grep -i "mmc\|I/O error\|mmcblk"
    

    Look for messages like “mmc0: Timeout waiting for hardware,” “I/O error,” or “Buffer I/O error on dev mmcblk0p2,” which indicate potential SD card problems.

  • 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

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

Use a usb wifi dongle instead of build in wifi

USB adapters

File:Wifiusb.jpg

Wi-Fi is currently blocked by rfkill

How to disable "Wi-Fi is currently blocked by rfkill." message?

Processor

Bootloader

Boot from USB

Put rootfs in USB

Network boot (PXE) w/o microSD

USB network in Pi zero

Pi zero 2W

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

Chrome

VNC Viewer

Thin client

Proxmox 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.

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

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.

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

Releases lists

Raspbian package repository URL

http://archive.raspbian.org/raspbian/pool/main/r/r-base/

Widevine support to play Amazon Prime,..

Sending an email on boot

See the wiki page - Email IP On Boot.

@reboot sleep 300 && python /home/pi/startup_mailer.py

Fix Dirty COW

https://www.raspberrypi.org/blog/fix-dirty-cow-raspberry-pi/ (10/25/2016)

Kernel building

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

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

  • 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.

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

  1. http://openelec.tv/get-openelec
  2. 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

    #!/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

and a simpler solution

#!/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

  1. (Optional) Put the Raspberry Pi microSD in another Linux computer and use Gparted to shrink the rootfs partition
  2. Boot from Raspberry Pi from the microSD card
  3. 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.
  4. 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

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.

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
    

Others

How to transfer a Raspbian image from a 16GB MicroSD card to an 8GB SD card

Backup server

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

ownCloud

OpenMediaVault

NextCloudPi

https://ownyourbits.com/nextcloudpi/

Proxy server

How to Use a Raspberry Pi as a Proxy Server (with Privoxy)

DNS server

Pi-hole

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 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

  1. Installing the Raspberry Pi Print Server Software (Cups)
  2. Setting up SAMBA for the Pi Print Server (Samba)
  3. Adding a printer to CUPS
  4. 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

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

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

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.

Mate1510Raspbery.png Mate1510Raspbery2.png

Ubuntu-mate 16.04 on Rpi 3B+

64-bit Ubuntu and more

SSH server

The website said the server is not installed by default. To install it, run sudo apt install openssh-server

To start it at startup,

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.

The manual approach mentioned in bugs.launchpad.net (#6) works.

  1. System -> Adminstration -> Printers -> Add
  2. 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)
  3. Check the 2nd option 'Provide PPD file' instead of the 1st one 'Select printer from database'.
  4. Browse the location of the PPD file
  5. 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

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

Twister OS

Twister OS Gallery

Arch Linux

Kodi can be installed in ArchLinux by installing the kodi-rbp package. See wiki.archlinux.org.

Android

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.

Pitop1.jpg Pitophub.jpg Raspi3.jpg

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’)

pi-topOS

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.

File:Pitopos.png

Media server

How to Set Up a Raspberry Pi Media Server: 7 Ways 2020

Plex

DVR

How to build a cheap cord-cutting DVR using Raspberry Pi

Pi TV Hat

Raspberry Pi portable TV Recorder. Pi TV HAT. The Raspberry Pi TV Tuner does not work in the US because the US uses ATSC and the tuner is for DVB-T and DVB-T2. I wish Raspberry Pi would make a TV HAT that was ATSC so I could use it in the US. There are USB tuners for ATSC that are available but not the HAT.

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)

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.

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

scrot

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

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

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):

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

SnappyRaspPi.png

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

Docker swarm

Databases

How to set up a Postgres database on a Raspberry Pi

Coding

https://code.org/

Scratch

THE SCRATCH OLYMPICS

Connect Arduino to Raspberry Pi

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

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.

Ftdi2ttlRaspPi.png

C libraries

GPIO layout

Node-RED

lynda.com

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

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.
SingleLED.jpg
  • 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.

RpyLCD.jpg

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

MatrixLED.jpg

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>

Weather Matrix Display

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

  1. adding a counter in the code for my own interest. See this post for declaring a variable as global.
  2. 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

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

http://raspi.tv/2013/rpi-gpio-basics-6-using-inputs-and-outputs-together-with-rpi-gpio-pull-ups-and-pull-downs

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

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

http://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi/overview

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)

Serial Peripheral interface (SPI)

MIDI port

Camera

# 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
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).

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 pictures
    libcamera-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

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

PiCameraApp

PiCameraApp

Connect a USB camera

Use as a USB Webcam

Raspberry Pi Zero USB Webcam

Fisheye Cam

160° Fish Eye

Dash Cam

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

RTSP and 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

RPi Cam Web.png RPi Cam Web2.png

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

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

Solar powered nature camera

Baby monitor

SleePi sounds alarm when Raspberry Pi detects sleepiness

SleePi sounds alarm when Raspberry Pi detects sleepiness

Tiddlybot

Tiddlybot.jpg

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

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

See SSH > Awesome tunneling

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

GPS tracker

http://blog.initialstate.com/new-python-gps-tracker/

Retro Game Console/Emulator

pygame

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

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

OpenCV

Wii Remote, bluetooth

Wii balance board

WiiBalBoard.jpg

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

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

  1. download zip file from Sep-17-2013 tree
  2. cd coder-base; npm install
  3. modify 'config.js'
  4. 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

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]

WolframPi.png

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

https://youtu.be/QESAI93Uqyg

Record TV

Bitcoin Miner

How to Track Satellite (ISS) Fly-Bys with Raspberry Pi

How to Track Satellite Fly-Bys with Raspberry Pi

Wifi extender

# 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.

Share internet

  • 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
  • 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.

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.

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

Mozilla Project Things

https://iot.mozilla.org/

E-ink

E-ink

Magic mirror

How to measure particulate matter

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
  • 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