Raspberry: Difference between revisions

From 太極
Jump to navigation Jump to search
 
(764 intermediate revisions by the same user not shown)
Line 5: Line 5:
* [http://www.raspberrypi.org/quick-start-guide Raspberry pi quick start guide]
* [http://www.raspberrypi.org/quick-start-guide Raspberry pi quick start guide]
* Learn and make [http://www.raspberrypi.org/resources/ resources] from raspberrypi.org.
* Learn and make [http://www.raspberrypi.org/resources/ resources] from raspberrypi.org.
* [https://lifehacker.com/s/raspberrypiguide Lifehacker's Complete Guide to Raspberry Pi]
* http://elinux.org/RPi_Hub
* http://elinux.org/RPi_Hub
* http://www.raspberrypi-spy.co.uk/
* http://www.raspberrypi-spy.co.uk/
Line 17: Line 18:
   wpa-psk "YOURPASSWORD
   wpa-psk "YOURPASSWORD
</pre>
</pre>
* [http://www.berryterminal.com/doku.php/berryboot Berryboot for multiple boots]
* [http://elinux.org/Omxplayer video player]: omxplayer videofile.mp4. See also the Android app [https://play.google.com/store/apps/details?id=com.tencarssoftware.omxremote OMX Remote (Raspberry Pi)].   
* [http://elinux.org/Omxplayer video player]: omxplayer videofile.mp4. See also the Android app [https://play.google.com/store/apps/details?id=com.tencarssoftware.omxremote OMX Remote (Raspberry Pi)].   
* [http://jeffskinnerbox.wordpress.com/2012/11/15/getting-audio-out-working-on-the-raspberry-pi/ force sound output from analog]  
* [http://jeffskinnerbox.wordpress.com/2012/11/15/getting-audio-out-working-on-the-raspberry-pi/ force sound output from analog]  
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 ==
use omxplayer. To [https://stackoverflow.com/questions/33162820/adjust-audio-volume-level-with-cli-omxplayer-raspberry-pi control volume]
<pre>
omxplayer -o local --vol -2000 Song_Title.mp3  # 10%
omxplayer -o local --vol -602 Song_Title.mp3  # 50%
</pre>
== 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 ==
* [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
* [http://www.raspberrypi.org/introducing-raspberry-pi-model-b-plus/ Raspberry Pi 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] (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+)
* [http://computers.tutsplus.com/tutorials/the-raspberry-pi-b-explored-and-explained--cms-21821 Raspberry Pi model B vs B+]
* [https://www.raspberrypi.org/blog/zero-wh/ Raspberry Pi Zero WH] (released 2017)
* Raspberry Pi model 3B (released Feb 29, 2016).
* Raspberry Pi model 3B+ (released Mar 28, 2018). Better to use a power adapter with 5V/2.4A or better with [https://www.pcworld.com/article/3396158/raspberry-pi-3-b-review.html 5V/3A]. [https://www.androidcentral.com/raspberry-pi-3-model-b-vs-3-b Raspberry Pi 3 Model B vs. 3 B+]. Gigabit Ethernet, Dual-band 820.11ac Wi-Fi, Power over Ethernet (PoE).
* Raspberry Pi model 4B (released June 24, 2019)
 
=== Checking Your Raspberry Pi Revision Number & Board Version ===
[https://www.raspberrypi-spy.co.uk/2012/09/checking-your-raspberry-pi-board-version/ raspberrypi-spy]
<pre>
cat /proc/device-tree/model
</pre>
 
=== Raspberry Pi 4 Rev 1.2. How to tell the difference ===
https://youtu.be/_wt9NTa1UNE


== Displayport connection ==
== Displayport connection ==
Line 45: 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>
 
=== Disk is write protected ===
It means the SD card is bad. My SD card is PNY 16GB Elite U1.
 
== Create our own image ==
[https://www.raspberrypi.org/magpi/raspberry-pi-recovery-partition/ Make a self-healing raspberry pi: create a recovery partition]. The goal is get the machine back to a clean install; particularly in the situation you don’t have access to another device to do the burning.
 
# Prepare your workspace: apt install
# Calculate the image size: fdisk
# Create the blank image: dd
# Partition the image: sfdisk
# Mount the images: losetup, partx, dd
# Configure and mount partitions: tune2fs, e2label, e2fsck, resize2fs, mount
# Set the boot partition: fdisk, nano
# Create the reset scripts: chmod, nano
# Fix fstab: cat
# Take a snapshot: dd, umount, losetup
# Burn and test: dd
# Physical reset
# Raspberry Pi recovery partition code and scripts
#
 
[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 ==
https://www.raspberrypi.org/documentation/remote-access/access-over-Internet/


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.
Several options are available if you don't want to forward your port, for example, [https://www.dataplicity.com/ Dataplicity].


== Headless Raspberry Pi Setup and SSH access ==
=== Headless Raspberry Pi Setup and SSH access ===
* https://www.raspberrypi.org/documentation/remote-access/ssh/
* https://www.raspberrypi.org/documentation/remote-access/ssh/
* http://frederickvandenbosch.be/?p=2385
* http://frederickvandenbosch.be/?p=2385
Line 63: Line 162:
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 [http://serverfault.com/questions/158151/sshd-shuts-down-with-no-supported-key-exchange-algorithms-error generate the keys] again Or just [https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=168371&p=1084622 wait a little longer] for Raspbian to generate keys.
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 [http://serverfault.com/questions/158151/sshd-shuts-down-with-no-supported-key-exchange-algorithms-error generate the keys] again Or just [https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=168371&p=1084622 wait a little longer] for Raspbian to generate keys.


It is also useful to give Pi a new hostname. 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].
 
=== 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>


== Change the default password ==
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.
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 we like to allow weaker passwords, see [https://raspberrypi.stackexchange.com/questions/7327/allowing-weak-passwords-for-users here].
<pre>
<pre>
$ sudo su -
$ sudo su -
Line 75: Line 181:
$  
$  
</pre>
</pre>
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 ==
* https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=97334 and search
** "by ripat"
** "by RaTTuS"
* https://raspberrypi.stackexchange.com/questions/33758/sudo-without-password-more-of-an-issue-on-apple
* https://www.raspberrypi.org/documentation/linux/usage/users.md


== Assign .local domain to Raspberry Pi ==
== Assign .local domain to Raspberry Pi ==
Line 81: 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>


The idea was first discovered in [[Beaglebone]].
The idea was first discovered in [[Beaglebone]].


== Set up a static IP address ==
== Get the internal IP address ==
* https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/net_tutorial.md
* [https://www.makeuseof.com/ways-to-find-raspberry-pi-ip-address/ 6 Ways to Find a Raspberry Pi's IP Address]
* http://raspberrypi.stackexchange.com/questions/37920/how-do-i-set-up-networking-wifi-static-ip-address (works!)
* https://www.raspberrypi.org/documentation/remote-access/ip-address.md
* https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=140252
 
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
sudo systemctl stop dhcpcd.service  # deactivate dhcpcd
# From another computer
sudo nano /etc/network/interfaces
ping raspberrypi.local
 
# Within raspberry pi
hostname -I
</syntaxhighlight>
</syntaxhighlight>
The original ''interfaces'' file looks like
<pre>
# interfaces(5) file used by ifup(8) and ifdown(8)


# Please note that this file is written to be used with dhcpcd
=== Conky approach ===
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
https://www.novaspirit.com/2017/02/23/desktop-widget-raspberry-pi-using-conky/ and [https://github.com/arraytools/Conky my conkyrc].


# Include files from /etc/network/interfaces.d:
{Pre}
source-directory /etc/network/interfaces.d
$ sudo apt-get install conky -y
$ wget -O /home/pi/.conkyrc https://raw.githubusercontent.com/novaspirit/rpi_conky/master/rpi3_conkyrc
</pre>
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.


auto lo
We can test it by calling conky from the command line (run '''export DISPLAY=:0.0''' if we are calling conky from SSH).
iface lo inet loopback


iface eth0 inet manual
We could make conky running on boot by creating the following two files (+ reboot).
<syntaxhighlight lang='bash'>
sudo nano /usr/bin/conky.sh
</syntaxhighlight>
<pre>
#!/bin/sh
(sleep 4s && conky) &
exit 0
</pre>


allow-hotplug wlan0
<syntaxhighlight lang='bash'>
iface wlan0 inet manual
sudo nano /etc/xdg/autostart/conky.desktop
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
</syntaxhighlight>
 
<pre>
allow-hotplug wlan1
[Desktop Entry]
iface wlan1 inet manual
Name=conky
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Type=Application
Exec=sh /usr/bin/conky.sh
Terminal=false
Comment=system monitoring tool.
Categories=Utility;
</pre>
</pre>


The new ''interfaces'' file will look like (You can set either or both eth0 or wlan0). <span style="color: red">Don't forget to include '''auto eth0''' or it won't work!!</span> ''auto'' is used to bring up the interface when ifup is run with the '''-a''' option. (This option is used by the system boot scripts.)
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.
<pre>
auto eth0
iface eth0 inet static
        address 192.168.1.88
        netmask 255.255.255.0
        gateway 192.168.1.1
        dns-nameservers 8.8.8.8 8.8.4.4


allow-hotplug wlan0
[[File:Conkyrpi.png|200px]]
iface wlan0 inet static
        address 192.168.1.89
        netmask 255.255.255.0
        gateway 192.168.1.1
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
</pre>
Then disable the DHCP client daemon and switch to standard Debian networking:
<syntaxhighlight lang='bash'>
sudo systemctl disable dhcpcd
sudo systemctl enable networking
sudo reboot # Reboot for the changes to take effect:
</syntaxhighlight>


== Under voltage ==
Note that the top processes shown on conky are not quite correct. The '''top''' command gives the top processes. I saw the inconsistency when I import a large database in MySQL.
 
== Set up a static IP address ==
* '''/etc/static_ip.conf''' from one of partitions
* [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/dhcpcd.conf''' - take care of a static IP<syntaxhighlight lang='bash'>
interface wlan0
static ip_address=192.168.1.88
static routers=192.168.1.1
static domain_name_servers=8.8.8.8
</syntaxhighlight>
* https://www.raspberrypi.org/learning/networking-lessons/rpi-static-ip-address/ (works on debian stretch). The website is hosted on [https://github.com/raspberrypilearning/networking-lessons github]. Just need to change '''/etc/dhcpcd.conf'''.
* https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/net_tutorial.md
* http://raspberrypi.stackexchange.com/questions/37920/how-do-i-set-up-networking-wifi-static-ip-address (works!)
* https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=140252
* https://discourse.pi-hole.net/t/how-do-i-set-a-static-ip-address-in-raspbian-jessie-using-etc-dhcpcd-conf/239 or https://www.jeffgeerling.com/blog/2017/setting-pi-hole-whole-home-adtracker-blocking
 
=== Show IP before login ===
https://askubuntu.com/a/797600
 
Add one line about '''eth0''' to '''/etc/issue''' file. For example on Debian 10,
<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 ==
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  
he red LED going out is an indicator that the supply voltage is too low. You should also see a small coloured square in the top corner of the screen. See the posts  
* https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=102814&p=711578  
* https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=102814&p=711578  
Line 167: 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 186: Line 345:
</pre>
</pre>


== HDMI monitor ==
== HDMI CEC ==
[https://www.linuxuprising.com/2019/07/raspberry-pi-power-on-off-tv-connected.html?m=1 Raspberry Pi: Power On / Off A TV Connected Via HDMI-CEC]
 
== HDMI monitor/display ==
* Official 7" touchscreen LCD 800x480. [https://www.element14.com/community/docs/DOC-78156/l/raspberry-pi-7-touchscreen-display Element 14], [https://maker-tutorials.com/en/official-raspberry-pi-7-touch-screen-lcd-display-assembly-guide-install-and-tips/ Official Raspberry Pi 7″ Touch Screen LCD Display assembly guide – install and tips]
* It works on my Samsung monitor S22C350 (1920x1080).
* It works on my Samsung monitor S22C350 (1920x1080).
* SainSmart 7" LCD Display Touch Screen TFT Monitor from [http://www.amazon.com/SainSmart-Display-AT070TN90-Controller-Raspberry/dp/B00GZCUNQ8 amazon] or from [http://www.sainsmart.com/7-inch-tft-lcd-monitor-for-raspberry-pi-touch-screen-driver-board-hdmi-vga-2av.html sainsmart.com]. 800x480. $39.99 no touch screen, or $49.99 w/ touch screen. Good reviews.
* SainSmart 7" LCD Display Touch Screen TFT Monitor from [http://www.amazon.com/SainSmart-Display-AT070TN90-Controller-Raspberry/dp/B00GZCUNQ8 amazon] or from [http://www.sainsmart.com/7-inch-tft-lcd-monitor-for-raspberry-pi-touch-screen-driver-board-hdmi-vga-2av.html sainsmart.com]. 800x480. $39.99 no touch screen, or $49.99 w/ touch screen. Good reviews.
* [https://www.sainsmart.com/collections/raspberry-pi/products/8-ips-lcd-screen-with-driver-board-kit-for-raspberry-pi 8" IPS LCD Screen with Driver Board Kit for Raspberry Pi]$70 frames and support are included!
* [http://www.seeedstudio.com/depot/101lcd-display-1366x768-hdmivgantscpal-p-1586.html 10.1 inch LCD Display 1366x768 HDMI/VGA/NTSC/PAL] there are several issues (poor picture quality, flicker a couple times a second, Overheating, nothing appears on the display) reported in comments.
* [http://www.seeedstudio.com/depot/101lcd-display-1366x768-hdmivgantscpal-p-1586.html 10.1 inch LCD Display 1366x768 HDMI/VGA/NTSC/PAL] there are several issues (poor picture quality, flicker a couple times a second, Overheating, nothing appears on the display) reported in comments.
* [http://www.ebay.com/itm/10-1-10-inch-TFT-LCD-Display-w-HDMI-VGA-Video-Driver-Board-for-Raspberry-Pi-/301581161486 10" inch TFT LCD Display w/ HDMI+VGA+Video Driver Board for Raspberry Pi]
* [http://www.ebay.com/itm/10-1-10-inch-TFT-LCD-Display-w-HDMI-VGA-Video-Driver-Board-for-Raspberry-Pi-/301581161486 10" inch TFT LCD Display w/ HDMI+VGA+Video Driver Board for Raspberry Pi]
* [http://www.ebay.com/itm/7-TFT-LCD-Screen-Display-Monitor-for-Raspberry-Pi-B-B-HDMI-Board-w-Clear-Case-/301279148024?pt=LH_DefaultDomain_2&hash=item4625a2f7f8 7" TFT LCD Screen Display Monitor for Raspberry Pi B B+ HDMI Board w/ Clear Case]
* [http://www.ebay.com/itm/7-TFT-LCD-Screen-Display-Monitor-for-Raspberry-Pi-B-B-HDMI-Board-w-Clear-Case-/301279148024?pt=LH_DefaultDomain_2&hash=item4625a2f7f8 7" TFT LCD Screen Display Monitor for Raspberry Pi B B+ HDMI Board w/ Clear Case]
* [https://www.aliexpress.com/item/Raspberry-Pi-3-5-inch-HDMI-LCD-touchscreen-3-5inch-display-60-fps-1920-1080/32809662038.html 3.5 inch HDMI LCD '''touchscreen''' 3.5inch IPS display] from waveshare. 480 x 320 (original)  or 800x480 (follow their instruction) or DMT mode 9 800x600 60Hz (Raspberry Pi Configuration). For drivers, see
** [http://spotpear.com/learn/EN/raspberry-pi/Raspberry-Pi-LCD/Drive-the-LCD.html spotpear.com]. I save a copy of the tarball in my [https://github.com/arraytools/raspi github]. I use the latest [https://downloads.raspberrypi.org/raspbian/images/raspbian-2019-04-09/ 2019-04-19 Raspbian Stretch]. Only the (3.5) '''HDMI''' LCD one works for enabling the touch function is '''sudo ./LCD35-HDMI-800x480-show''' (''Note that using the full path will fail''). Other commands such as ./LCD35B-show, ./LCD35B-show-V2 or ./LCD35-show does not work. The webpage said the instruction works for Raspbian/Ubuntu mate/RetroPie but '''it does not work on Ubuntu mate 18.04.2 (Bionic)''' (RPi will not be able to start).
** [https://www.waveshare.com/wiki/3.5inch_HDMI_LCD waveshare]. The original website. It includes an instruction to calibrate the display. I save the file under my [https://github.com/arraytools/raspi github]. The instruction is to 1. unzip 2. cd xinput-calibrator_0.7.5-1_armhf 3. sudo dpkg -i -B xinput-calibrator_0.7.5-1_armhf.deb 4. Click Menu -> Preferences -> Calibrate touchscreen 5. Save the output shown on screen to a file '''/ect/X11/xorg.conf.d/99-calibration.conf''' (the directory needs to be created first) according to the screen's instruction. 6. Reboot.
** Power usage (with ethernet): 0.66 (lcd off), 0.86 (lcd on). Raspberry Pi 3 B+ is used here.
** Power usage (without ethernet): 0.56 (lcd off), 0.76 (lcd on), 0.86 (lcd on, wifi on), 1.0 (lcd on, wifi on, chrome)
** Tip of power the pi + LCD by PC USB port: turn off the wifi & unplug the ethernet cable before starting.
=== Move a Window Without Clicking the Titlebar ===
[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 ===
Raspbian shipped with [https://www.realvnc.com/en/raspberrypi/ VNC connect]. We can use Android or iOS to connect to the Raspbian desktop.


=== Make your own screen from an old laptop ===
=== Make your own screen from an old laptop ===
Line 212: Line 390:
Method 3. Edit /boot/config.txt and setting '''hdmi_drive''' variable or '''hdmi_ignore_edid_audio''' variable. See the Raspberry Pi [https://www.raspberrypi.org/documentation/configuration/config-txt.md config.txt] web page.
Method 3. Edit /boot/config.txt and setting '''hdmi_drive''' variable or '''hdmi_ignore_edid_audio''' variable. See the Raspberry Pi [https://www.raspberrypi.org/documentation/configuration/config-txt.md config.txt] web page.


== The official Raspberry Pi DSI touch display ==
== Capacitive touch vs resistive touch ==
* https://www.raspberrypi.org/blog/the-eagerly-awaited-raspberry-pi-display/. There are two videos demonstrating the (multipoint) touch functionality using '''Kivy''' (Python GUI development system) library on the website.
https://techexplainer.wordpress.com/2012/04/02/resistive-vs-capacitive-touchscreen/
 
Resistive touch is used in low cost products. It does not support multi-touch.
 
== The official Raspberry Pi DSI touch display & the Kivy library ==
* https://www.raspberrypi.org/blog/the-eagerly-awaited-raspberry-pi-display/. There are two videos demonstrating the (multipoint) touch functionality using [https://kivy.org/#home Kivy] (Python GUI development system) library on the website.
* [https://www.techradar.com/au/how-to/how-to-build-your-own-smart-coffee-machine How to build your own smart coffee machine]


800×480 display @60fps,
800×480 display @60fps,
Line 226: 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 ==
[https://www.pcworld.com/article/3566079/how-to-build-a-100-dollar-pc-with-a-raspberry-pi-4.html How to build a $100 productivity PC with a Raspberry Pi 4]


== Hardware acceleration video player ==
== 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.
Use omxplayer not VLC. When I use omxplayer to play mp4 videos, '''htop''' shows CPUs are not used and the playback is quite smooth. <strike>VLC will have a hard time playing the mp4 videos (black screen) not to say all 4 cores are 100% busy on Raspi2.</strike> [https://liliputing.com/2018/11/raspberry-pi-software-update-brings-vlc-media-player-with-hardware-accelerated-video-playback.html Raspberry Pi software update brings VLC media player with hardware-accelerated video playback]


* http://elinux.org/Omxplayer
* http://elinux.org/Omxplayer
* 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 243: 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 257: 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 ==
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.
* [https://help.ubuntu.com/stable/ubuntu-help/startup-applications.html Ubuntu].
* [https://itsfoss.com/manage-startup-applications-ubuntu/ How To Manage StartUp Applications In Ubuntu]
* [https://neverbenever.wordpress.com/2015/02/11/how-to-autostart-a-program-in-raspberry-pi-or-linux/ How to autostart a program in Raspberry Pi or Linux]
* [https://developer.toradex.com/knowledge-base/how-to-autorun-application-at-the-start-up-in-linux How to Autorun application at the start up in Linux]
* [https://www.lynda.com/Raspberry-Pi-tutorials/Autostart-file-setup/5007872/2810625-4.html lynda.com]
 
When I try to add calibre, I see a new file "calibre.desktop" is added to ".config/autostart/" folder.
<pre>
[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=
</pre>


== Startup script ==
== Startup script ==
Line 281: Line 504:
* [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].


== CPU Benchmark ==
== Raspberry Pi 4 vs Desktop PC ==
* Raspberry Pi 3 (launched 2/29/2016)
[https://youtu.be/zRKmlwA5law $100 PC VS Raspberry Pi 4 8GB - Can The Pi4 Replace a Desktop PC?]
** [https://www.element14.com/community/community/raspberry-pi/blog/2016/02/29/the-most-comprehensive-raspberry-pi-comparison-benchmark-ever SysBench, nBench, Power, MemTester and more] from Element14
** http://makezine.com/2016/02/28/meet-the-new-raspberry-pi-3/ (and the original post https://www.raspberrypi.org/blog/raspberry-pi-3-on-sale/)
** https://www.raspberrypi.org/magpi/raspberry-pi-3-specs-benchmarks/
** http://lifehacker.com/how-the-raspberry-pi-3-benchmarks-against-older-models-1762417275
** http://www.phoronix.com/scan.php?page=article&item=raspberry-pi-3&num=1
* Raspberry Pi 2 runs nbench and sysbench by [https://learn.adafruit.com/introducing-the-raspberry-pi-2-model-b?view=all#performance-improvements Adafruit].
* [http://hackaday.com/2015/02/05/benchmarking-the-raspberry-pi-2/ hackday.com]. It includes info about OpenGL benchmark.
* http://www.linuxlinks.com/article/20150305172325136/RaspberryPi2-Benchmarks.html


<syntaxhighlight lang='bash'>
== Power consumption comparison ==
# RPi 1
* https://www.raspberrypi.org/magpi/raspberry-pi-specs-benchmarks/
pi@raspberrypi:~ $ sysbench --num-threads=1 --test=cpu --cpu-max-prime=20000 --validate run
* https://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-pi-zero-power
sysbench 0.4.12:  multi-threaded system evaluation benchmark
* [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.


Running the test with following options:
=== How long does the RPi last on a battery? ===
Number of threads: 1
* 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).
Additional request validation enabled.
* [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 ===
<ul>
<li>A simple shell script that logs the current status to a text file:
<pre>
#!/bin/bash


Doing CPU performance benchmark
# Set the log file path and name
LOG_FILE="/home/pi/battery_log.txt"


Threads started!
while true
Done.
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
</pre>
<pre>
chmod +x ./battery_log.sh
nohup ./battery_log.sh > /dev/null 2>&1 &
</pre>


Maximum prime number checked in CPU test: 20000
<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
  else
    break
  fi
  sleep 60
done
</pre>
</ul>


Test execution summary:
== Ways to power your raspberry pi ==
    total time:                         1412.6014s
* [https://www.lifewire.com/ways-to-power-your-raspberry-pi-4092246 10 Ways to Power your Raspberry Pi]
    total number of events:              10000
* [https://www.makeuseof.com/raspberry-pi-power-methods/ 5 Different Ways to Power a Raspberry Pi]
    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:
=== Power Raspberry Pi by AA batteries ===
    events (avg/stddev):           10000.0000/0.00
http://www.raspberrypi-spy.co.uk/2013/04/raspberry-pi-aa-battery-shoot-out/
    execution time (avg/stddev):  1412.5301/0.00
</syntaxhighlight>
The timing 1412s I got is close to 1318s reported by [https://www.element14.com/community/community/raspberry-pi/blog/2016/02/29/the-most-comprehensive-raspberry-pi-comparison-benchmark-ever element14.com].


For nBench, my result of cpu floating-point index 1.753 is also close to element14's 1.884.
This also teaches to know how long the battery will die by using Putty and linux command
<syntaxhighlight lang='bash'>
<pre>
pi@raspberrypi:~/nbench-byte-2.2.3 $ ./nbench
watch -n 60 uptime
</pre>
 
=== Power by 9V battery ===
https://youtu.be/h6Bl0Bckl2k You need a regulator (output 1.5V) such as TS7800/TS7805.
 
=== Power Raspberry Pi by Lipo batteries ===
* https://learn.adafruit.com/pocket-pigrrl?view=all
* [http://wpress.io/building-own-backup-server-with-raspberry-pi/ Building our own backup server using the Raspberry PI & MainWP]


BYTEmark* Native Mode Benchmark ver. 2 (10/95)
=== Solar power ===
Index-split by Andrew D. Balsa (11/97)
* [https://youtu.be/j-nQGoIq1CA Solar panel kit installation]
Linux/Unix* port by Uwe F. Mayer (12/96,11/97)
* [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://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://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.


TEST                : Iterations/sec.  : Old Index  : New Index
== CPU Benchmark ==
                    :                  : Pentium 90* : AMD K6/233*
* Raspberry Pi 3 (launched 2/29/2016)
--------------------:------------------:-------------:------------
** [https://www.element14.com/community/community/raspberry-pi/blog/2016/02/29/the-most-comprehensive-raspberry-pi-comparison-benchmark-ever SysBench, nBench, Power, MemTester and more] from Element14
NUMERIC SORT        :         202.91  :      5.20  :      1.71
** http://makezine.com/2016/02/28/meet-the-new-raspberry-pi-3/ (and the original post https://www.raspberrypi.org/blog/raspberry-pi-3-on-sale/)
STRING SORT        :          30.842  :      13.78  :      2.13
** https://www.raspberrypi.org/magpi/raspberry-pi-3-specs-benchmarks/
BITFIELD            :      8.2161e+07  :      14.09  :      2.94
** http://lifehacker.com/how-the-raspberry-pi-3-benchmarks-against-older-models-1762417275
FP EMULATION        :          43.409  :      20.83  :      4.81
** http://www.phoronix.com/scan.php?page=article&item=raspberry-pi-3&num=1
FOURIER            :          1660.8  :      1.89  :      1.06
* Raspberry Pi 2 runs nbench and sysbench by [https://learn.adafruit.com/introducing-the-raspberry-pi-2-model-b?view=all#performance-improvements Adafruit].
ASSIGNMENT          :          2.2719  :       8.65  :      2.24
* [http://hackaday.com/2015/02/05/benchmarking-the-raspberry-pi-2/ hackday.com]. It includes info about OpenGL benchmark.
IDEA                :          702.86  :      10.75  :      3.19
* http://www.linuxlinks.com/article/20150305172325136/RaspberryPi2-Benchmarks.html
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.
</syntaxhighlight>


== OpenGL ==
<syntaxhighlight lang='bash'>
* [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
# 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


== Picademy ==
Running the test with following options:
* https://www.raspberrypi.org/picademy/
Number of threads: 1
* https://www.raspberrypi.org/blog/picademy-questions-answered/
Additional request validation enabled.


== UPS ==
* http://raspi-ups.appspot.com/en/index.jsp


== Books, Magazines ==
Doing CPU performance benchmark
* [http://exploringrpi.com/ Exploring Raspberry Pi]
* [https://www.raspberrypi.org/magpi/ MagPi: The Unofficial Raspberry Pi Magazine]
* [http://magazine.odroid.com/ ODROID Magazine]


== Minecraft ==
Threads started!
* [http://lifehacker.com/a-parent-s-guide-to-playing-minecraft-with-your-kids-1788022798 A Parent’s Guide to Playing Minecraft With Your Kids]
Done.


= Installation =
Maximum prime number checked in CPU test: 20000
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]].


== Download an image ==
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.


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.
Test execution summary:
* [http://www.raspberrypi.org/downloads/ NOOBS]
    total time:                          1412.6014s
* [http://sourceforge.net/projects/berryboot/ BerryBoot] (just a simple operating system installer, the camera cannot be enabled. The multiple choices of OSs in BerryBoot is now available in NOOBS)
    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


== Format a SD card using [https://www.sdcard.org/downloads/formatter_4/ SD Formatter] (Windows & Mac) ==
Threads fairness:
* http://www.raspberrypi-spy.co.uk/2015/03/how-to-format-pi-sd-cards-using-sd-formatter/
    events (avg/stddev):          10000.0000/0.00
    execution time (avg/stddev):  1412.5301/0.00
</syntaxhighlight>
The timing 1412s I got is close to 1318s reported by [https://www.element14.com/community/community/raspberry-pi/blog/2016/02/29/the-most-comprehensive-raspberry-pi-comparison-benchmark-ever element14.com].


== Install an image to a SD card  ==
For nBench, my result of cpu floating-point index 1.753 is also close to element14's 1.884.
For example, if I want to install [http://googlecreativelab.github.io/coder/ coder], I first download/uncompress the file. Then from the linux command line (assume microSD card is on /dev/sdc)
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
sudo umount /dev/sdc*
pi@raspberrypi:~/nbench-byte-2.2.3 $ ./nbench
sudo dd bs=4M if=Downloads/coder_v0.4/raspi.img of=/dev/sdc; sync
</syntaxhighlight>
If I want to watch the progress, I can open another terminal and issue
<syntaxhighlight lang='bash'>
sudo pkill -USR1 -n -x dd
</syntaxhighlight>
The output of it still is shown on the 1st terminal where ''dd'' is issued. The output looks like
<pre>
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
</pre>


== Monitor the progress using pipe viewer ==
BYTEmark* Native Mode Benchmark ver. 2 (10/95)
* http://blog.urfix.com/9-tricks-pv-pipe-viewer/
Index-split by Andrew D. Balsa (11/97)
* http://askubuntu.com/questions/215505/how-do-you-monitor-the-progress-of-dd
Linux/Unix* port by Uwe F. Mayer (12/96,11/97)
* https://wiki.archlinux.org/index.php/core_utilities
<pre>
sudo apt-get install pv
dd if=/dev/urandom | pv | dd of=/dev/null
</pre>


== Wifi setup ==
TEST                : Iterations/sec.  : Old Index  : New Index
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'.  
                    :                  : Pentium 90* : AMD K6/233*
 
--------------------:------------------:-------------:------------
See [https://www.raspberrypi.org/blog/another-raspbian-desktop-user-interface-update/ the blog] on May 5, 2015.
NUMERIC SORT        :          202.91  :      5.20  :      1.71
 
STRING SORT        :          30.842  :      13.78  :      2.13
= Remote desktop =
BITFIELD            :     8.2161e+07  :      14.09  :      2.94
== [https://www.dataplicity.com/ Dataplicity] ==
FP EMULATION        :          43.409  :      20.83  :      4.81
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).
FOURIER            :          1660.8  :      1.89  :      1.06
 
ASSIGNMENT          :          2.2719  :       8.65  :      2.24
[http://www.instructables.com/id/Raspberry-Pi-File-Uploader/ Raspberry Pi File Uploader]
IDEA                :          702.86  :      10.75  :      3.19
 
HUFFMAN            :          421.78  :      11.70  :      3.73
== NoMachine ==
NEURAL NET          :          2.7206  :       4.37  :      1.84
[https://www.nomachine.com/tips-on-how-to-set-up-your-raspberry-pi-for-remote-access-via-nomachine Tips on how to set up your Raspberry Pi for remote access via NoMachine]
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.
</syntaxhighlight>


== RealVNC server ==
== OpenGL ==
* Do not download the binary from [https://www.realvnc.com/download/vnc/ RealVNC website] since it will have a license issue when we want to connect to RPi
* [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
* Use the instruction at [https://github.com/RealVNC/raspi-preview#startVnc Github]
* On linux client side, we can download the binary tar ball and set it executable after untar it.


== Connect to Your Raspberry Pi From Anywhere In World With '''VNC Connect''' ==
== Pi5 vs n100 ==
* https://www.raspberrypi.org/blog/get-back-to-my-pi-from-anywhere-with-vnc-connect/
* [https://www.youtube.com/watch?v=dljAxpjyRVc Raspberry Pi 5 vs Intel N100 Mini PC - Which Is Right For You]
* http://lifehacker.com/you-can-now-easily-connect-to-your-raspberry-pi-from-an-1792438276


== Connection to Raspberry Pi with tightvnc ==
== Picademy ==
* http://elinux.org/RPi_VNC_Server
* https://www.raspberrypi.org/picademy/
* https://wiki.ubuntu.com/Lubuntu/RemoteDesktop (Lubuntu specific)
* https://www.raspberrypi.org/blog/picademy-questions-answered/
* http://www.howtogeek.com/141157/how-to-configure-your-raspberry-pi-for-remote-shell-desktop-and-file-transfer/2/


A simple password like 'raspberry' would work. If we need to reset the password, use '''vncpasswd''' command.
== UPS ==
<syntaxhighlight lang='bash'>
* [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.
# Server side
* http://raspi-ups.appspot.com/en/index.jsp
sudo apt-get install tightvncserver
* [https://youtu.be/p86AbqgRaIo?t=303 Raspberry Pi Waveshare UPS] 2022
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
== Books, Magazines, Blogs ==
vncserver –kill :1
* [http://exploringrpi.com/ Exploring Raspberry Pi]
* [https://www.raspberrypi.org/magpi/ MagPi: The Unofficial Raspberry Pi Magazine]
* [https://www.raspberrypi.org/magpi/issues/beginners-guide/ Beginner's Guide]
* [http://magazine.odroid.com/ ODROID Magazine]
* [https://opensource.com/article/18/5/books-kids-linux-open-source 15 books for kids who (you want to) love Linux and open source]
* [https://opensource.com/article/18/8/top-10-raspberry-pi-blogs-follow Top 10 Raspberry Pi blogs to follow]
 
== Minecraft ==
* [http://lifehacker.com/a-parent-s-guide-to-playing-minecraft-with-your-kids-1788022798 A Parent’s Guide to Playing Minecraft With Your Kids]
* [https://www.raspberrypi.org/magpi/issues/essentials-minecraft-v1/ Minecraft Essentials] by MagPi.
* https://www.makeuseof.com/?s=minecraft
* [https://offspring.lifehacker.com/use-minecraft-to-teach-your-kids-pretty-much-anything-1838265622 Use Minecraft to Teach Your Kids Pretty Much Anything]
 
= Installation =
Make sure to use a class 10 (micro)SD card to avoid a hanging problem. This rule applies to other SoC device like [[Beaglebone]] and [[Udoo]].


# Client side; the most common mistake is to forget to add the port number to the IP address.
== Roll your own Raspberry Pi OS ==
sudo apt-get install xtightvncviewer
https://hackaday.com/2018/01/19/roll-your-own-raspberry-pi-os/
xtightvncviewer 10.42.0.37:1
# It does not work if I just use raspberrypi.local:1 as the address
</syntaxhighlight>
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!
== 64-bit ==
It is said 64-bit is supported on Pi3/3B/4.  


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 [http://www.raspberrypi.org/forums/viewtopic.php?f=91&t=96745 this message].
But I have a successful experience on Pi3B but not Pi3. See
* https://downloads.raspberrypi.org/raspios_arm64/images/
* [https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=250730 Firmware push arm_64bit].
* [https://wiki.gentoo.org/wiki/Raspberry_Pi_3_64_bit_Install Raspberry Pi 3 64 bit Install]
* [https://www.raspberrypi.org/documentation/configuration/config-txt/boot.md Boot options in config.txt]
* [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]


== Connection from Raspberry Pi to Ubuntu ==
== Download an image ==
Follow the [http://rob.rho.org.uk/2012/08/rasppi_vnc_howto.html instruction] and install xtightvncviewer using sudo apt-get and it works. To run the vnc client, just type 'xtightvncviewer' on the terminal.
* [https://www.raspberrypi.org/downloads/ Raspberry Pi Imager]
* [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!!
* [https://github.com/procount/pinn PINN (PINN is not NOOBS)] - An enhanced Operating System installer for the Raspberry Pi


Another instruction of using tightvnc is at http://www.penguintutor.com/linux/tightvnc.
=== 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


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
git clone --depth 1 https://github.com/raspberrypi/rpi-imager
<pre>
cd rpi-imager
ssh -L 5901:localhost:5901 [email protected]
debuild -uc -us
# rpi-imager_1.8.5_amd64.deb has been generated in the upper dir
</pre>
</pre>
I open another terminal window and type the following in my local machine
<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”?
<pre>
<li>After Imager finished writing an iso to a USB drive, Imager said we can remove the USB drive.
xtightvncviewer localhost:5901
* "df -h" does not show the USB drive. This is consistent with the "Disks" application or "sudo mount" command.
</pre>
* 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.
the Ubuntu desktop appears on my local machine.
* 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>


== Connection from Raspberry Pi to Windows (RDP) with freerdp or rdesktop ==
=== Raspberry Pi OS 1.1 Bulleye ===
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.  
[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) ==
* http://www.raspberrypi-spy.co.uk/2015/03/how-to-format-pi-sd-cards-using-sd-formatter/


http://blog.pi3g.com/2013/04/use-windows-remote-desktop-on-the-raspberry-pi/
== SD Card Speed Test: agnostics ==
* [https://www.raspberrypi.org/blog/sd-card-speed-test/ SD Card Speed Test] - Pi Diagnostics
* [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]
* On Ubuntu OS, we can just use the '''Disks''' utility to run a benchmark.


'''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.  
== Install an image to a SD card  ==
For example, if I want to install [http://googlecreativelab.github.io/coder/ coder], I first download/uncompress the file. Then from the linux command line (assume microSD card is on /dev/sdc)
<syntaxhighlight lang='bash'>
sudo umount /dev/sdc*
sudo dd bs=4M if=Downloads/coder_v0.4/raspi.img of=/dev/sdc; sync
</syntaxhighlight>
If I want to watch the progress, I can open another terminal and issue
<syntaxhighlight lang='bash'>
sudo pkill -USR1 -n -x dd
</syntaxhighlight>
The output of it still is shown on the 1st terminal where ''dd'' is issued. The output looks like
<pre>
<pre>
1. Open a root terminal. Run
224+0 records in
apt-get update
224+0 records out
apt-get install freerdp
939524096 bytes (940 MB) copied, 40.9672 s, 22.9 MB/s
2. Open a regular terminal. Run
268+0 records in
xfreerdp -u brb -x l -z 192.168.1.4
268+0 records out
1124073472 bytes (1.1 GB) copied, 62.7471 s, 17.9 MB/s
</pre>
</pre>


'''Method 2'''
== Monitor the progress using pipe viewer ==
We can also use rdesktop program. rdesktop is a free, open source client for Microsoft's proprietary RDP protocol. See [https://wiki.archlinux.org/index.php/rdesktop wiki.archlinux.org] for more tips and tricks about rdesktop.
* http://blog.urfix.com/9-tricks-pv-pipe-viewer/
* http://askubuntu.com/questions/215505/how-do-you-monitor-the-progress-of-dd
* https://wiki.archlinux.org/index.php/core_utilities
<syntaxhighlight lang='bash'>
sudo apt-get install pv
dd if=/dev/urandom | pv | dd of=/dev/null
</syntaxhighlight>
 
== Check the filesystem on microSD card ==
<ul>
<li>Check SD card for any error
<pre>
<pre>
1. Open a root terminal and run
dmesg | grep -i "mmc"
apt-get update
# OR
apt-get install rdesktop
journalctl -k | grep -i "mmc\|I/O error\|mmcblk"
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
</pre>
</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


'''Method 3'''
# boot partition is fat32
There is also an interesting project called [http://rpitc.blogspot.com RPi-TC/Raspberry Pi Thin Client project]. I have not tried it yet.
sudo dosfsck -t -a -w /dev/sdc1
</pre>
</ul>


= Raspbian =
== Secure your Raspberry Pi ==
== Directly Connect to a Raspberry Pi Without Internet ==
* [https://makezine.com/2017/09/07/secure-your-raspberry-pi-against-attackers/ Take These Steps to Secure Your Raspberry Pi Against Attackers]
http://www.makeuseof.com/tag/directly-connect-raspberry-pi-without-internet/
* [http://www.makeuseof.com/tag/online-threats-raspberry-pi/ 5 Online Threats That Could Ruin Your Raspberry Pi Experience]
* [https://opensource.com/article/17/4/5-projects-raspberry-pi-home 5 projects for Raspberry Pi at home]


== Raspbian repository and mirrors ==
== Wifi setup ==
* https://www.raspberrypi.org/downloads/raspbian/
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'.  
* http://www.raspbian.org/RaspbianMirrors
* UMD mirror (http|rsync)://mirror.umd.edu/raspbian/raspbian


== Releases lists ==
See [https://www.raspberrypi.org/blog/another-raspbian-desktop-user-interface-update/ the blog] on May 5, 2015.
[http://distrowatch.com/table.php?distribution=raspbian distrowatch.com]


== Raspbian package repository URL ==
=== NetworkManager - nmcli/nmtui ===
http://archive.raspbian.org/raspbian/pool/main/r/r-base/
<ul>
<li>[https://www.raspberrypi.com/documentation/computers/configuration.html#networking Configuration -> Networking] from the official Raspberry Pi Documentation.


== Fix Dirty COW ==
<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'''.
https://www.raspberrypi.org/blog/fix-dirty-cow-raspberry-pi/ (10/25/2016)
 
<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


== Kernel building ==
# fix "NetworkManager is not running"
* https://www.raspberrypi.org/documentation/linux/kernel/building.md
# but it seems it will disconnect the default method 'dhcpcd'
* http://elinux.org/Raspberry_Pi_Kernel_Compilation
# in raspbian 11 (bullseye) 32-bit
sudo /etc/init.d/network-manager start
# OR
sudo systemctl start NetworkManager


== Create a custom kernel using Vagrant ==
# List available WiFi networks including SSID, Channel, Rate, Signal, Bars, and Security.
* [https://learn.adafruit.com/raspberry-pi-kernel-o-matic?view=all Adafruit Pi Kernel-o-Matic]
# The 'RATE' will show something like 130 Mbits/s
nmcli device wifi list 


== Emulate Raspbian on Linux/Windows ==
nmcli device wifi connect <SSID> password <password>  # Connect to a WiFi network
* http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/


== Emulate Intel X86 on raspberry Pi (ARM) ==
nmcli con show  # Show all network connections
https://eltechs.com/product/exagear-desktop/ (non-free)


== Browser ==
nmcli con up id <connection_name>  # Bring up a connection


=== GNOME Web/Epiphany browser ===
# OR use
* https://en.wikipedia.org/wiki/Web_(web_browser)
nmtui  # then go to 'Activate a connection'
* https://wiki.gnome.org/Apps/Web
</syntaxhighlight>
<li>The network connection profiles are stored in the '''/etc/NetworkManager/system-connections/''' directory.
</ul>


This is the default in [https://www.raspberrypi.org/downloads/raspbian/ Raspbian Jessie].
=== 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


Some annoying thing is the browser is using the DuckDuckGo as the search engine which is not configurable.
network={
    ssid="Network1_SSID"
    psk="Network1_Password"
}


Some web pages cannot be shown correctly (see my comment in LuaKit)
network={
    ssid="Network2_SSID"
    psk="Network2_Password"
}
</pre>
<li>sudo systemctl restart dhcpcd
</ul>


=== LuaKit - an extremely lightweight browser based on webkit and GTK+ ===
<li>[https://www.jeffgeerling.com/blog/2021/working-multiple-wifi-interfaces-on-raspberry-pi Working with multiple WiFi interfaces on a Raspberry Pi] 2021
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)
</ul>
<syntaxhighlight lang='bash'>
sudo apt-get install luakit
</syntaxhighlight>


Mastering keybinds is the key to use it (Even a mouse cannot be used to close a Tab).
=== Use a usb wifi dongle instead of build in wifi ===
* https://wiki.archlinux.org/index.php/Luakit
* [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://github.com/luakit/luakit/wiki/Beginner-Guide
* [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 ===
* [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]]


Some examples:
=== Wi-Fi is currently blocked by rfkill ===
* j/k to scroll down/up
[https://raspberrypi.stackexchange.com/a/123724 How to disable "Wi-Fi is currently blocked by rfkill." message?]
* 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
== Processor ==
<syntaxhighlight lang='bash'>
* [https://www.raspberrypi.com/documentation/computers/processors.html Processors] BCM2835, BCM2836, BCM2837, BCM2837B0, BCM2711
sudo nano /etc/xdg/luakit/binds.lua
* [https://forums.raspberrypi.com/viewtopic.php?t=190329 BCM2835 or BCM2837 use by Raspberry-Pi 3 Model B v1.2 ?]
</syntaxhighlight>
** [https://raspberrypi.stackexchange.com/questions/75089/bcm2835-on-an-rpi-3 BCM2835 on an RPi 3?]
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.
** [https://forums.raspberrypi.com/viewtopic.php?t=188544 RPi 3 with BCM2835 ???] '''cat /proc/device-tree/model'''
<pre>
    key({}, "b", "Go back in the browser history `[count=1]` items.",
        function (w, m) w:back(m.count) end),
</pre>


=== [https://wiki.debian.org/Iceweasel Iceweasel] browser ===
== Bootloader ==
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
* [https://pimylifeup.com/raspberry-pi-bootloader/ Updating the Bootloader on a Raspberry Pi]
<syntaxhighlight lang='bash'>
* [https://www.makeuseof.com/boot-raspberry-pi-4-via-ssd-network/ How to Boot Raspberry Pi 4 via SSD or Network]
sudo  apt-get install iceweasel --no-install-recommends
</syntaxhighlight>


=== Firefox browser ===
== Boot from USB ==
See Iceweasel above. Firefox package has been replaced by Iceweasel so it is not available via apt-get install.
* <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.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://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.


== Bluetooth keyboard ==
== Put rootfs in USB ==
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).  
* [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


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
== Network boot (PXE) w/o microSD ==
<syntaxhighlight lang='bash'>
* [https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/net_tutorial.md Network boot your Raspberry Pi]
# Press the 'connect' button on the bluetooth keyboard first!
* [https://www.makeuseof.com/tag/network-boot-raspberry-pi-without-microsd/ How to Network Boot a Raspberry Pi Without a MicroSD Card]
$ bluetoothctl # no sudo is needed
* [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]
[bluetooth] default-agent
* [https://youtu.be/G5BhQqRLN4A PXE-Boot Raspberry Pi From Proxmox Server] | "Easy Mode" setup | Proxmox Home Server
[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
</syntaxhighlight>


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.
== USB network in Pi zero ==
* [http://www.circuitbasics.com/raspberry-pi-zero-ethernet-gadget/ Pi zero USB/ethernet gadget tutorial]
* [https://hackaday.io/project/27142-terrible-cluster Terrible Cluster]


== New Bluetooth GUI in Raspbian ==
== Pi zero 2W ==
https://www.raspberrypi.org/blog/another-update-raspbian/ (May 13, 2016). This should solve the problem mentioned above though I haven't tried it.
* 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.


== Turn Raspberry Pi Zero into a USB gadget ==
== Mount a USB drive at boot ==
* http://blog.gbaman.info/?p=791 (this can only work with the RPi Zero). Allowing ssh, sftp, vnc etc over a single usb cable.
Add the following line to '''/etc/fstab''' (change any values if necessary) and then run '''sudo mount -a'''
<pre>
/dev/sda1 /mnt/share ext4 rw,user,auto 0  0
</pre>
Also consider to change the mode of the new partition eg sudo chmod 777 /mnt/share.


== Top 10 Raspberry Pi Zero Projects That Make Use of Its Small Stature ==
== Pi Desktop ==
http://lifehacker.com/top-10-raspberry-pi-zero-projects-that-make-use-of-its-1792403310
https://www.element14.com/community/docs/DOC-83477


== OpenElec ==
= Remote desktop =
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.
== RealVNC server ==
* Do not download the binary from [https://www.realvnc.com/download/vnc/ RealVNC website] since it will have a license issue when we want to connect to RPi
* [https://help.realvnc.com/hc/en-us/articles/360002249917-VNC-Connect-and-Raspberry-Pi VNC Connect and Raspberry Pi]
* Use the instruction at [https://github.com/RealVNC/raspi-preview#startVnc Github]
* The current Raspbian includes a vnc server. We need to enable it. No registration is needed when I use my home network. I tested using iOS vnc app.
* On linux client side, we can download the binary tar ball and set it executable after untar it.
 
=== Connect to Your Raspberry Pi With '''VNC Connect''' ===
* https://www.raspberrypi.org/blog/get-back-to-my-pi-from-anywhere-with-vnc-connect/
* https://raspberrytips.com/remote-desktop-raspberry-pi/
* http://lifehacker.com/you-can-now-easily-connect-to-your-raspberry-pi-from-an-1792438276
 
=== Chrome ===
[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] ==
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 [https://docs.dataplicity.com/docs/superuser sudoable account], type '''su pi'''. From there you can 'sudo' as normal.


There is a program called 'Web viewer'. Wonder when would it be useful.
* [https://docs.dataplicity.com/docs/host-a-website-from-your-pi Host a website from your Pi]
* [https://docs.dataplicity.com/docs/remotely-monitor-your-pi Remotely access Pi system stats] using [https://scoutapp.github.io/scout_realtime/ scout_realtime]
* [http://www.instructables.com/id/Raspberry-Pi-File-Uploader/ Raspberry Pi File Uploader]


Need to change 2 settings in order to get date & time correctly.
== NoMachine ==
[https://www.nomachine.com/tips-on-how-to-set-up-your-raspberry-pi-for-remote-access-via-nomachine Tips on how to set up your Raspberry Pi for remote access via NoMachine]


Another installation method is to download/install the image directly from the OpenELEC website. See
== Web server ==
# http://openelec.tv/get-openelec
* [https://howtoraspberrypi.com/how-to-install-web-server-raspberry-pi-lamp/ How to install a web server on the Raspberry Pi (Apache + PHP + MySQL)] Apr 2018
# http://wiki.openelec.tv/index.php/HOW-TO:Installing_OpenELEC/Writing_The_Disk_Image


== SMS server ==
== WordPress server ==
* https://www.howtoforge.com/tutorial/how-to-install-raspberry-pi-sms-server/
[https://www.makeuseof.com/tag/host-wordpress-raspberry-pi/ How to Host a WordPress Site on Raspberry Pi]


== Kodi black screen when exit ==
== Connection to Raspberry Pi with tightvnc ==
A temporary solution is use Ctrl + Alt + F2 then Ctrl + Alt + F1. See
* [https://www.tomshardware.com/uk/how-to/install-vnc-raspberry-pi-os How to Install VNC on Raspberry Pi OS (64 bit)]
* https://www.raspberrypi.org/forums/viewtopic.php?t=91111&p=637126.
* http://elinux.org/RPi_VNC_Server
* https://gist.github.com/aperezm-vlex/75d7481afff0db8f5894 A script to fix this problem. Some people have issues.
* https://wiki.ubuntu.com/Lubuntu/RemoteDesktop (Lubuntu specific)
* https://www.raspberrypi.org/forums/viewtopic.php?t=139758&p=926771. Create a new file by '''sudo nano /usr/local/bin/startkodi'''. chmod +x and put the following.
* http://www.howtogeek.com/141157/how-to-configure-your-raspberry-pi-for-remote-shell-desktop-and-file-transfer/2/
<syntaxhighlight lang='bash'>
    #!/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
A simple password like 'raspberry' would work. If we need to reset the password, use '''vncpasswd''' command.
        if [ "$?" == "0" ]; then
{{Pre}}
          $xrefresh_bin -display $DISPLAY > /dev/null 2>&1
# Server side
        fi
sudo apt-get install tightvncserver
    fi
vncserver
    VT="$(fgconsole)"
# You will require a password to access your desktops.
    if [ "$VT" ]; then
# Password:
      sudo chvt 7
# Warning: password truncated to the length of 8.
      sudo chvt "$VT"
# Verify: 
    fi
# Would you like to enter a view-only password (y/n)? n
</syntaxhighlight>
#
and [https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=100811&start=75 a simpler solution]
# New 'X' desktop is raspberrypi:1
<syntaxhighlight lang='bash'>
#
#!/bin/bash
# Creating default startup script /home/pi/.vnc/xstartup
kodi
# Starting applications specified in /home/pi/.vnc/xstartup
if [ "$?" = "0" ]; then
# Log file is /home/pi/.vnc/raspberrypi:1.log
killall kodi
ps -ef | grep vnc
fbset -depth 8 && fbset -depth 16
# pi        3134    1  0 16:59 pts/0    00:00:00 Xtightvnc :1 -desktop X -auth /home/pi/.Xauthority
xrefresh
# -geometry 1024x768 -depth 24 -rfbwait 120000 -rfbauth /home/pi/.vnc/passwd -rfbport 5901 -fp
fi
# /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
</syntaxhighlight>
# pi        3217  2666  0 17:01 pts/0   00:00:00 grep --color=auto tightvnc
 
vncserver            # This line seems not necessary
vncserver –kill :1


== [https://github.com/baedert/corebird Corebird] - twitter client ==
# Client side; the most common mistake is to forget to add the port number to the IP address.
* https://mig5.net/content/installing-corebird-debian-jessie
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
</pre>
To start the tightvnc automatically when boot up, check out http://www.penguintutor.com/linux/tightvnc or my note on BBB.


We also need automake, autoconf, autogen, intltool packages.  
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!


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.
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 [http://www.raspberrypi.org/forums/viewtopic.php?f=91&t=96745 this message].


== Backup server ==
== Connection from Raspberry Pi to Ubuntu ==
* https://opensource.com/life/16/3/turn-your-old-raspberry-pi-automatic-backup-server using rdiff-backup utility.
Follow the [http://rob.rho.org.uk/2012/08/rasppi_vnc_howto.html instruction] and install xtightvncviewer using sudo apt-get and it works. To run the vnc client, just type 'xtightvncviewer' on the terminal.


== Connect your dumb printer to your home network ==
Another instruction of using tightvnc is at http://www.penguintutor.com/linux/tightvnc.
[https://pimylifeup.com/raspberry-pi-print-server/ Raspberry Pi Print Server: Setup a Network Printer]. The steps are


# Installing the Raspberry Pi Print Server Software (Cups)
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
# Setting up SAMBA for the Pi Print Server (Samba)
<pre>
# Adding a printer to CUPS
ssh -L 5901:localhost:5901 [email protected]
# Adding a Raspberry Pi Print Server to Windows
</pre>
I open another terminal window and type the following in my local machine
<pre>
xtightvncviewer localhost:5901
</pre>
the Ubuntu desktop appears on my local machine.


Done!
== 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.


== Embedded Linux ==
* http://blog.pi3g.com/2013/04/use-windows-remote-desktop-on-the-raspberry-pi/
[http://www.linuxjournal.com/content/what-i-wish-i%E2%80%99d-known-when-i-was-embedded-linux-newbie What I Wish I’d Known When I Was an Embedded Linux Newbie] from Linux Journal.
* [https://www.makeuseof.com/tag/android-tablet-screen-raspberry-pi/ Using an Android Tablet as a Screen for Raspberry Pi]


== Virtualization ==
'''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.
[https://sohliloquies.blogspot.com/2016/10/virtualizing-raspberry-pi-with-qemu.html Virtualizing a Raspberry Pi with QEMU]
<pre>
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
</pre>


= Mate Ubuntu =
'''Method 2'''
* https://ubuntu-mate.org/raspberry-pi/
We can also use rdesktop program. rdesktop is a free, open source client for Microsoft's proprietary RDP protocol. See [https://wiki.archlinux.org/index.php/rdesktop wiki.archlinux.org] for more tips and tricks about rdesktop.
* https://ubuntu-pi-flavour-maker.org/
{Pre}}
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).  
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
</pre>


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 [http://askubuntu.com/questions/17806/how-do-i-disable-irqbalance askubuntu.com] set ENABLED=0 in /etc/default/irqbalance.
'''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.


The system looks very stable. See my screenshots below.
== 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]


[[File:Mate1510Raspbery.png|150px]] [[File:Mate1510Raspbery2.png|150px]]
= Raspbian =
== Desktop vs Console ==
* Desktop: 105MB memory
* Console: 50MB memory


== Install more screensaver themes ==
== Directly Connect to a Raspberry Pi Without Internet ==
http://greyblake.com/blog/2013/02/02/install-more-screensavers-on-mate-desktop/
http://www.makeuseof.com/tag/directly-connect-raspberry-pi-without-internet/


Take a look at the .desktop files under /usr/share/applications/screensavers.
== Recovery partition ==
[https://www.raspberrypi.org/magpi/raspberry-pi-recovery-partition/ Make a self-healing raspberry pi: create a recovery partition]


== Web browser ==
== Working from home with your Raspberry Pi ==
Ubuntu-Mate includes Firefox. I can feel FF is more slow than the browser in Raspbian.
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.


== Printer ==
== Raspbian desktop for PC ==
(Update 12/11/2016): the instruction below using PPD file still has a problem when I print pdf files. The instruction [http://tutorialforlinux.com/2015/01/14/how-to-easy-install-the-brother-hl-5250dn-printer-driver-on-ubuntu-14-04-trusty-lts-linux/ here] solves the problem. The idea is to download the official Linux driver (<linux-brprinter-installer-2.1.1-1.gz>) from brother website [http://support.brother.com/g/b/downloadend.aspx?c=us&lang=en&prod=hl5250dn_all&os=128&dlid=dlf006893_000&flang=4&type3=625 HL-5250DN].  
Download it from [https://www.raspberrypi.org/downloads/raspberry-pi-desktop/ here].


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.
Tested Debian Stretch version (2019-4-11) on Virtualbox. It can be installed as either 32-bit or 64-bit OS ('''uname -m''').
* https://bugs.launchpad.net/ubuntu/+source/system-config-printer/+bug/254202
* http://www.openprinting.org/printer/Brother/Brother-HL-5250DN (PPD file). A copy of the ppd file (a text file) is saved on [https://gist.github.com/arraytools/57c119ea6c14cc385cd4 github].


The manual approach mentioned in bugs.launchpad.net (#6) works.
== Raspbian repository and mirrors ==
# System -> Adminstration -> Printers -> Add
* http://www.raspbian.org/RaspbianMirrors
# 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)
* UMD mirror (http|rsync)://mirror.umd.edu/raspbian/raspbian
# Check the 2nd option 'Provide PPD file' instead of the 1st one 'Select printer from database'.
* Run '''sudo nano /etc/apt/sources.list''' and change the default to a mirror
# Browse the location of the PPD file
# Continue the procedure until the end. We can print a test page to make sure the setup is successful.


The printer test page said the driver is BR5250_2.PPD and version 1.03.
== Releases lists ==
* [http://distrowatch.com/table.php?distribution=raspbian distrowatch.com]
* [https://www.raspberrypi.org/blog/raspbian-stretch/ Raspbian Stretch] and some notes
* [http://downloads.raspberrypi.org/raspbian/release_notes.txt Release Notes]
* https://en.wikipedia.org/wiki/Raspbian


PS. About the technology terms
== Raspbian package repository URL ==
* [https://en.wikipedia.org/wiki/PostScript_Printer_Description PPD (PostScript Printer Description)]
http://archive.raspbian.org/raspbian/pool/main/r/r-base/
* [https://en.wikipedia.org/wiki/Uniform_Resource_Identifier URI (Uniform Resource Identifier)]
* [https://en.wikipedia.org/wiki/Internet_Printing_Protocol IPP (Internet Printing Protocol)]


== Kodi ==
== Widevine support to play Amazon Prime,.. ==
After I used apt-get to install Kodi, Kodi will not be able to launch:(  On Raspbian, the Kodi installed by apt-get works!!!
* [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/


= [http://archlinuxarm.org/platforms/armv7/broadcom/raspberry-pi-2 Arch Linux] =
== Sending an email on boot ==
Kodi can be installed in ArchLinux by installing the '''kodi-rbp''' package. See [https://wiki.archlinux.org/index.php/Kodi#Raspberry_Pi wiki.archlinux.org].
See the wiki page - [https://elinux.org/RPi_Email_IP_On_Boot_Debian Email IP On Boot].
* The python code works interactively when I use in in a command line. But it does not work when I use it in /etc/rc.local nor /boot/boot.rc.
* The cron method works for my case (wifi connection); see [https://gist.github.com/johnantoni/8199088 looking at it the cron job is more reliable, placing it in the rc.local file fails on wifi].
:<syntaxhighlight lang='bash'>
@reboot sleep 300 && python /home/pi/startup_mailer.py
</syntaxhighlight>
* Make sure the gmail account is set up to be "less secure"; see [https://stackoverflow.com/a/27515883 Login credentials not working with Gmail SMTP]. Is it possible to use salted password?
* [https://stackabuse.com/how-to-send-emails-with-gmail-using-python/ How to Send Emails with Gmail using Python]


= Android =
== Fix Dirty COW ==
Assuming you have Raspi 2 B,
https://www.raspberrypi.org/blog/fix-dirty-cow-raspberry-pi/  (10/25/2016)


* [http://raspex.exton.se/?p=144 RaspAnd]($9), currently it is Android 5.1.
== Kernel building ==
* https://www.raspberrypi.org/documentation/linux/kernel/building.md
* http://elinux.org/Raspberry_Pi_Kernel_Compilation


= [https://www.pi-top.com/ pi-top] =
== Create a custom kernel using Vagrant ==
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 & 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.
* [https://learn.adafruit.com/raspberry-pi-kernel-o-matic?view=all Adafruit Pi Kernel-o-Matic]


Unfortunately the pi-top OS is unstable (tested 7/1/2016).
== Emulate Raspbian on Linux/Windows ==
* first try - screen flicked & is frozen
* http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/
* I download the [http://www.pi-top.com/download/pi-topOS 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.
== Emulate Intel X86 on raspberry Pi (ARM) ==
https://eltechs.com/product/exagear-desktop/ (non-free)


For some reason, after I shut down the computer the back light is still on. The software from [https://github.com/rricharz/pi-top-install 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'.  
== 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".


[http://support.pi-top.com/support/discussions Forum]. We can use Google account to join.
== Browser ==


Some pictures (left: Pi-top, middle: pi-top hub, right: raspberry pi 3 with a GPIO card)
=== GNOME Web/Epiphany browser ===
* https://en.wikipedia.org/wiki/Web_(web_browser)
* https://wiki.gnome.org/Apps/Web


[[File:Pitop1.jpg|200px]] [[File:Pitophub.jpg|200px]] [[File:Raspi3.jpg|200px]]
This is the default in [https://www.raspberrypi.org/downloads/raspbian/ Raspbian Jessie].


= Plex =
Some annoying thing is the browser is using the DuckDuckGo as the search engine which is not configurable.
[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://kodi.wiki/view/HOW-TO:Install_Kodi_on_Raspberry_Pi Kodi/XBMC] and OpenElec =
Some web pages cannot be shown correctly (see my comment in LuaKit)
* [https://www.raspberrypi.org/forums/viewtopic.php?t=99866 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.
=== 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)
<syntaxhighlight lang='bash'>
sudo apt-get install luakit
</syntaxhighlight>


== 12 Ways to Make Kodi the Best Media Player for You ==
Mastering keybinds is the key to use it (Even a mouse cannot be used to close a Tab).
http://www.makeuseof.com/tag/make-kodi-best-media-player/
* https://wiki.archlinux.org/index.php/Luakit
* https://github.com/luakit/luakit/wiki/Beginner-Guide


== [http://openelec.tv/home/what-is-openelec What is OpenElec] ==
Some examples:
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.
* :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


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.
We can modify the key bindings. I run
<syntaxhighlight lang='bash'>
sudo nano /etc/xdg/luakit/binds.lua
</syntaxhighlight>
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.
<pre>
    key({}, "b", "Go back in the browser history `[count=1]` items.",
        function (w, m) w:back(m.count) end),
</pre>


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.
=== [https://wiki.debian.org/Iceweasel 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
<syntaxhighlight lang='bash'>
sudo  apt-get install iceweasel --no-install-recommends
</syntaxhighlight>


== Default folders for OpenElec ==
=== Firefox browser ===
<pre>
See Iceweasel above. Firefox package has been replaced by Iceweasel so it is not available via apt-get install.
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
</pre>


== Youtube plugin error ==
=== Vivaldi browser ===
[http://www.howtogeek.com/273956/how-to-fix-kodis-youtube-quota-exceeded-problem/ How to Fix Kodi’s YouTube “Quota Exceeded” Problem]
http://www.makeuseof.com/tag/vivaldi-best-browser-raspberry-pi/


== How to Cast YouTube and Other Web Videos to Kodi (Like the Chromecast) ==
== Chinese input ==
http://www.howtogeek.com/277116/how-to-cast-youtube-and-other-web-videos-to-kodi-like-the-chromecast/
<syntaxhighlight lang='bash'>
sudo apt-get install fcitx fcitx-chewing
</syntaxhighlight>
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.


== No sound ==
Raspbian uses [https://en.wikipedia.org/wiki/Raspbian PIXEL] desktop, a modified LXDE desktop environment.
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.
We need to add chewing to the input method. See [https://www.raspberrypi.org/forums/viewtopic.php?t=222801 this post]for a detailed instruction.


== Fix date/time in OpenElec ==
== Bluetooth keyboard ==
http://www.htpcbeginner.com/fix-openelec-incorrect-time-raspberry-pi/
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).  


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
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
<pre>
<syntaxhighlight lang='bash'>
#!/bin/sh
# Press the 'connect' button on the bluetooth keyboard first!
(sleep 30; \
$ bluetoothctl # no sudo is needed
/sbin/ntpd -p pool.ntp.org; \
[bluetooth] default-agent
)&
[bluetooth] scan on
</pre>
[bluetooth] pair 90:7F:61:8F:D0:38        # it will ask to enter a pin code
Then chmod +x /storage/.config/autostart.sh. No need to reboot.
[bluetooth] connect 90:7F:61:8F:D0:38
</syntaxhighlight>


== [http://kodi.wiki/view/UPnP UPnP] ==
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.
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 [http://kodi.wiki/view/Adding_music_to_the_library 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!)
== 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.


== Display Chinese characters ==
== Text editor ==
http://forum.kodi.tv/showthread.php?tid=81081
[https://www.makeuseof.com/tag/raspberry-pi-code-oss/ Why Coding for Raspberry Pi Is Way Better With Code-OSS], a community compiled version of VS Code, on the Raspberry Pi.


Go to System - Settings - Appearance - Font and choose 'Arial'.  
== Pi zero ==
* http://osoyoo.com/2017/06/introduction-of-raspberry-pi-gpio/
* https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=170006


== Add-ons ==
== Getting Started with the Raspberry Pi Zero W (mini HDMI) without a Monitor ==
The [https://github.com/moneymaker365/repository.xbmcplus.xbmc-plugins/releases USTV VoD] and [https://code.google.com/p/navi-x/ Navi-X] and [http://www.ustvnow.com/ 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.
https://www.losant.com/blog/getting-started-with-the-raspberry-pi-zero-w-without-a-monitor (Raspbian Stretch)


* [http://lifehacker.com/5768174/power-up-your-xbmc-installation-with-these-new-add-ons Power Up Your XBMC Installation with These Awesome Add-Ons]
== Turn Raspberry Pi Zero into a USB gadget ==
* [http://lifehacker.com/5908682/how-to-make-xbmc-easier-to-use-especially-for-non-geeks How to Make XBMC Easier to Use (Especially for Non-Geeks)]
* [https://gpiozero.readthedocs.io/en/stable/pi_zero_otg.html Pi Zero USB OTG]. '''GPIO Zero''' is installed by default in the Raspbian image
* [http://kodi.wiki/view/Keyboard_controls Keyboard shortcut]. For example, backslash \ for toggle full-screen and windowed mode.
* [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.
* [http://youtu.be/aTZvjv0_7ag xbmchub maintenance] and [http://youtu.be/ByCuuYqU-eU fix buffering problem].
** config.txt (?)
* [http://beebom.com/2015/05/best-live-tv-addons-for-kodi-xbmc 5 Best Live TV Addons For Kodi]
** cmdline.txt (?)
* [http://addons.tvaddons.ag/ TVADDONS] - A Collection of Unofficial Addons for Kodi.
** wpa_supplicant.conf (wifi password)
* [https://seo-michael.co.uk/how-to-install-exodus-for-kodi/ How to install Exodus for Kodi]
** /etc/dhcpcd.conf (static IP)
* [http://forum.kodi.tv/showthread.php?tid=200735&page=230 Youtube] Youtube addon included in Kodi is marked for deletion. Use this link to download the zip file (5.1.20.1) install the new it.
** ssh
 
: <syntaxhighlight lang='bash'>
== Take a screenshot ==
# Stretch lite
ssh and run
pi@raspberrypi:~ $ free -m
<syntaxhighlight lang='bash'>
              total        used        free      shared  buff/cache  available
kodi-send --action="TakeScreenshot"
Mem:            433          23        336          3          73        359
Swap:            99          0          99
</syntaxhighlight>
</syntaxhighlight>
: 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.
* [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)].


A new file <screenshot000.png> will be saved under screenshots folder.
== Add USB type A to Raspberry Pi zero ==
[https://maker-tutorials.com/raspberry-pi-zero-mit-usb-buchse-typ-a-erweitern-anloeten/ Raspberry Pi Zero with USB socket Type-A expand (solder)]


= LXDE (same as Lubuntu) X11 desktop environment used by Raspbian OS =
== Top 10 Raspberry Pi Zero Projects That Make Use of Its Small Stature ==
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.
http://lifehacker.com/top-10-raspberry-pi-zero-projects-that-make-use-of-its-1792403310


== Screenshots ==
== OpenElec ==
* https://www.flickr.com/photos/xmodulo/sets/ and [https://www.flickr.com/photos/xmodulo/sets/72157637787192624/ Raspbian specific].
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.


== Quick launch bar ==
Need to change 2 settings in order to get date & time correctly.
To add lxterminal to quick launch bar,
<pre>
Right click any empty space on taskbar
-> Panel Setting
-> Panel Preferences
-> Panel Applets
-> Application launch bar & Edit
-> Accessories & lxterminal
</pre>
We can use the same procedure to add Midori to the quick launch bar.


== Keyboard shortcut ==
Another installation method is to download/install the image directly from the OpenELEC website. See
# http://openelec.tv/get-openelec
# http://wiki.openelec.tv/index.php/HOW-TO:Installing_OpenELEC/Writing_The_Disk_Image


The shortcuts are defined in the file '''~/.config/openbox/lxde-rc.xml'''
== 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


For example,
== Fedora ARM minimal server ==
* open the lxpanelctl menu, click Ctrl + ESC.
[https://www.cloudsavvyit.com/9867/set-up-a-test-server-on-raspberry-pi/ Set Up a Test Server on Raspberry Pi]. Cockpit.
* 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 =
== Email server ==
* https://wiki.archlinux.org/index.php/Internet_Share
[https://opensource.com/article/18/3/host-your-own-email Host your own email with projectx/os and a Raspberry Pi]
* 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:
<pre>
sudo nano /etc/network/interfaces


iface eth0 inet static
== SMS server ==
address 192.168.100.1
* https://www.howtoforge.com/tutorial/how-to-install-raspberry-pi-sms-server/
netmask 255.255.255.0
network 192.168.100.0
broadcast 192.168.100.255
gateway 192.168.100.254
</pre>
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.
== Kodi black screen when exit ==
<pre>
A temporary solution is use Ctrl + Alt + F2 then Ctrl + Alt + F1. See
$ netstat -rn
* https://www.raspberrypi.org/forums/viewtopic.php?t=91111&p=637126.
Kernel IP routing table
* https://gist.github.com/aperezm-vlex/75d7481afff0db8f5894 A script to fix this problem. Some people have issues.
Destination     Gateway         Genmask         Flags  MSS Window  irtt Iface
* https://www.raspberrypi.org/forums/viewtopic.php?t=139758&p=926771. Create a new file by '''sudo nano /usr/local/bin/startkodi'''. chmod +x and put the following.
0.0.0.0        192.168.1.1     0.0.0.0        UG        0 0          0 wlan0
<syntaxhighlight lang='bash'>
10.42.0.0       0.0.0.0        255.255.255.0  U        0 0          0 eth0
    #!/bin/bash
169.254.0.0     0.0.0.0        255.255.0.0     U        0 0          0 wlan0
    fbset_bin=`which fbset`
192.168.1.0    0.0.0.0        255.255.255.0  U         0 0          0 wlan0
    xset_bin=`which xset`
</pre>
    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


And '''/etc/resolv.conf''' may be worth to be changed too. /etc/hostname and /etc/hosts are unnecessary.
      $xset_bin -display $DISPLAY -q > /dev/null 2>&1
 
        if [ "$?" == "0" ]; then
An example of '''/etc/resolv.conf''' (set up linux DNS) shown from my RPi is
          $xrefresh_bin -display $DISPLAY > /dev/null 2>&1
<pre>
        fi
nameserver 10.42.0.1
    fi
</pre>
    VT="$(fgconsole)"
But maybe another choice is nameserver 8.8.8.8.
    if [ "$VT" ]; then
 
      sudo chvt 7
Some tools for discovering the IPs in a network include Fing (iOS/Android) or Scapy (python).
      sudo chvt "$VT"
 
    fi
== Get internet from mobile tethering ==
https://github.com/InitialState/rpi-gps/wiki/10%20Part%203.%20Mobile%20Data
 
== IP scan tools ==
* '''arp'''  (fastest, installed by default)
<syntaxhighlight lang='bash'>
arp -a
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
and [https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=100811&start=75 a simpler solution]
* [http://overlooksoft.com/ fing] (ios, android, linux, windows). Command line usage
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
sudo fing -n 192.168.1.1/24
#!/bin/bash
kodi
if [ "$?" = "0" ]; then
killall kodi
fbset -depth 8 && fbset -depth 16
xrefresh
fi
</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.
* [http://angryip.org Angry ip scanner] cross platform. open source. Basic knowledge on internet protocol. However, it is slow and show all instead of found ip's.
* [http://www.nirsoft.net/utils/netbios_scanner.html netbios]. It does not discover linux boxes, however.


= Clustering =
== [https://github.com/baedert/corebird Corebird] - twitter client ==
== with 2 Pis ==
* https://mig5.net/content/installing-corebird-debian-jessie
This [http://www.linuxjournal.com/content/two-pi-r 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.
 
We also need automake, autoconf, autogen, intltool packages.  


== 4 Pis ==
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.
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 ==
== Backup Raspbian ==
* http://www.nigelpond.com/uploads/How-to-build-a-7-node-Raspberry-Pi-Hadoop-Cluster.pdf
[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


== Docker swarm ==
My case:
* [https://github.com/alexellis/docker-arm/blob/master/ZERO.md Docker Swarm on PI Zero]
{{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


= Qt on Raspberry Pi =
# On Ubuntu 18.04
Check out https://qt-project.org/wiki/Qt-RaspberryPi
$ 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.


== Native build Qt ==
pishrink.sh: Shrinking image ...
http://qt-project.org/wiki/Native_Build_of_Qt5_on_a_Raspberry_Pi
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>


== Qt-Creator ==
https://www.raspberrypi.org/documentation/linux/filesystem/backup.md
* http://www.raspberrypi.org/phpBB3/viewtopic.php?f=31&t=43545
<syntaxhighlight lang='bash'>
* [[Odroid#Qt_Creator|Odroid xu4]]
# 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
</syntaxhighlight>
See also
* [https://raspberrypi.stackexchange.com/questions/104643/periodic-backup-of-rpi3-stretch-sd-card/104644#104644 Periodic backup of Rpi3 Stretch SD card] 2019-Oct
* [https://raspberrypi.stackexchange.com/questions/5427/can-a-raspberry-pi-be-used-to-create-a-backup-of-itself Can a Raspberry Pi be used to create a backup of itself?]
* [https://raspberrypi.stackexchange.com/questions/37842/backup-raspberry-pi-automatically-with-incremental-backups?noredirect=1&lq=1 Backup Raspberry Pi automatically, with incremental backups]
* [https://raspberrypi.stackexchange.com/questions/13611/using-rsync-to-backup-pi?noredirect=1&lq=1 Using rsync to backup Pi]
* [https://beebom.com/how-clone-raspberry-pi-sd-card-windows-linux-macos/ How to Clone Raspberry Pi SD Card on Windows, Linux and macOS]


= Raspberry Pi 2 =
=== SD Card Copier ===
[http://www.raspberrypi.org/raspberry-pi-2-on-sale/ Raspberry Pi 2] (Armv7 with quad core cpu and 1GB RAM) brings its hardware to the minimum requirements for several interesting projects. I got one from my local microcenter store ($35 + tax).
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.


One interesting thing is the Raspbian or Docker supports Raspberry Pi 1 and 2 (different ARM architectures).  
* [https://www.lynda.com/Raspberry-Pi-tutorials/Back-up-Raspberry-Pi/5007872/2922879-4.html lynda.com].
* [https://www.raspberrypi.org/blog/another-update-raspbian/ Raspberry Pi Blog 2016] for Pi3 release
* [https://pishop.co.za/blog/my-tutorial-post/clone-your-micro-sd-directly-on-rpi/ Clone your micro sd directly on rpi]


== Ubuntu Snappy ==
=== piclone ===
Some more information about ubuntu snappy (username/password is ubuntu/ubuntu):
https://github.com/raspberrypi-ui/piclone
* http://www.ubuntu.com/cloud/tools/snappy
 
* http://developer.ubuntu.com/en/snappy/
=== PiShrink ===
* http://www.ubuntu.com/things#try-beaglebone
<ul>
* http://www.viclog.com/entry/snappy-raspberry-pi-2-snap-pi (this matches what I observe)
<li>
* https://darrenjw2.wordpress.com/2015/02/07/getting-started-with-snappy-ubuntu-core-on-the-raspberry-pi-2/
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 ===
* SD Card Copier
* [http://www.knight-of-pi.org/how-to-shrink-raspberry-pi-sd-card-images-with-gparted-and-dd/ How to shrink Raspberry Pi SD card images with GParted and dd]
* https://www.reddit.com/r/raspberry_pi/comments/3vo3al/how_to_transfer_a_raspbian_image_from_a_16gb/
* https://twocanoes.com/clone-sd-card-from-a-larger-size-sd-card-to-a/
 
== Backup server ==
* https://opensource.com/life/16/3/turn-your-old-raspberry-pi-automatic-backup-server using rdiff-backup utility.


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
== Git server ==
[https://youtu.be/jMqDJ0mcIvc Host Git Server on RaspberryPi! | 4K TUTORIAL]


[[File:SnappyRaspPi.png|200px]]
== [http://usbip.sourceforge.net/ USB over ip] ==
Its mainuse is to let you access data on USB drives stored on other hardware.


Note that the [http://www.raspberrypi.org/downloads/ SNAPPY UBUNTU CORE image] for RPi seems buggy. For example,
[http://www.makeuseof.com/tag/top-apps-install-raspberry-pi/ Top 10 Apps You Should Install on Your Raspberry Pi]
<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'
== RAID ==
Local time is now:      Thu Jan  1 01:01:42 UTC 1970.
[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]
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
== NAS ==
* [http://blog.alexellis.io/hardened-raspberry-pi-nas/ Create a hardened Raspberry Pi NAS] Dec 2016
** It includes installing Docker and installing an nginx web server.
** It also use software RAID-1 with two hard drives for redundancy.
** Samba
** NFS: unencrypted but gives higher level of performance than Samba between Linux/UNIX hosts. Can be mounted over the network to appear as a local directory
** SFTP
** Backup using rsync
* [https://opensource.com/article/18/7/network-attached-storage-Raspberry-Pi Building a network attached storage device with a Raspberry Pi] 2018.
** Series 1. fdisk, autofs, NFS
** [https://opensource.com/article/18/8/automate-backups-raspberry-pi Series 2] Automating (incremental) backups on a Raspberry Pi NAS. It has a shell script to list yearly, monthly, weekly and daily backups.
** [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://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.


root@localhost:/home/ubuntu# snappy info
=== ownCloud ===
release: ubuntu-core/devel
* [https://www.makeuseof.com/access-owncloud-internet/ Enable External Access to Your ownCloud Raspberry Pi Server]
frameworks: webdm
* [https://www.makeuseof.com/raspberry-pi-4-diy-nas-server-owncloud/ Build Your Own DIY NAS Server Using Raspberry Pi 4]
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')
</pre>


== Docker ==
=== OpenMediaVault ===
* http://blog.hypriot.com/heavily-armed-after-major-upgrade-raspberry-pi-with-docker-1-dot-5-0
* [https://www.lynda.com/Raspberry-Pi-tutorials/power-switch-Raspberry-Pi/5007872/2267849-4.html lynda.com]
* [http://blog.alexellis.io/docker-engine-in-your-pocket/ Is that a Docker Engine in your pocket??]
* [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'''


= Coding =
=== NextCloudPi ===
== Scratch ==
https://ownyourbits.com/nextcloudpi/
[https://www.raspberrypi.org/blog/the-scratch-olympics/ THE SCRATCH OLYMPICS]


= Connect Arduino to Raspberry Pi =
== Proxy server ==
* See [http://www.doctormonk.com/2012/04/raspberry-pi-and-arduino.html doctormonk.com] where python-serial module is used and ''/dev/ttyACM0'' is the serial port or the name for the USB interface to the Arduino Uno.
[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)]
* [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.


= [http://openframeworks.cc/about/ openFrameworks (oF)] =
== DNS server ==
openFrameworks is an open source C++ toolkit designed to assist the creative process by providing a simple and intuitive framework for experimentation.
* [http://www.pcworld.com/article/3200117/linux/how-to-use-raspberry-pi-as-dns-server-with-dnsmasq.html 3 reasons to turn your Raspberry Pi into a DNS server with dnsmasq]
* [https://www.ionos.com/digitalguide/server/configuration/how-to-make-your-raspberry-pi-into-a-dns-server/ Your own DNS server with Raspberry Pi: How to]


= GPIO experiments =
=== [https://pi-hole.net/ 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
* 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]
* [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://www.jeffgeerling.com/blog/2017/setting-pi-hole-whole-home-adtracker-blocking Setting up a Pi Hole for whole-home ad/tracker blocking] (Raspbian)
* [http://www.androidbeat.com/2015/05/how-to-change-dns-server-android-phone-tablet/ How to change DNS server on your Android phone or tablet]
* [https://discourse.pi-hole.net/t/seven-things-you-may-not-know-about-pi-hole/3096 Pi hole prevent ads from appearing on Internet-connected devices that aren't a Web browser]. Pi-hole can be installed on hardware that's not a Raspberry Pi.
* [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.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]


* [https://www.raspberrypi.org/magpi-issues/Projects_Book_v1.pdf Official Raspberry Pi Projects Book]
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.
* [http://www.pi-tutorials.co.uk/ Keith's Pi tutorial]


== Processing ==
'''Install on Pi'''
* https://www.raspberrypi.org/blog/now-available-for-download-processing/
* No 'sudo'
* Uncheck to install '''lighttpd''' since I have '''apache''' installed already
:<syntaxhighlight lang='bash'>
curl -sSL https://install.pi-hole.net | bash
</syntaxhighlight>
* 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).
* [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'''
* 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 [https://discourse.pi-hole.net/t/change-ip-adress/3837 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?


== Power off and on ==
'''Local DNS Record''' This allows you to map your own domains to your private network.
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:)
'''Update'''
<pre>
$ pihole -up
</pre>
After I upgrade to 5.0, the stats on the dashboard is not working. A solution is [https://www.reddit.com/r/pihole/comments/ghceqw/no_stats_on_dashboard_after_upgrade/?utm_source=share&utm_medium=web2x 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.


For model B+/Pi 2 model B, see [http://www.makeuseof.com/tag/add-reset-switch-raspberry-pi/ this post]. This post also provides another way (GPIO pins 5&6) to shut down RPi.
'''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://omgdebugging.com/2018/07/17/uninstalling-pi-hole-on-ubuntu-16-04-with-openvpn/ Uninstalling Pi-Hole on Ubuntu 16.04 with OpenVPN]
{{Pre}}
$ 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
...
</pre>


[http://www.doctormonk.com/2017/01/on-switch-for-raspberry-pi.html This has pictures] for all raspi models.
'''Migrating Pi-Hole from lighttpd to apache'''


== Connect to console using TTL/Serial cable ==
I purchased the TTL cable through [http://dx.com/p/usb-2-0-to-ttl-uart-5-pin-cp2102-module-serial-converter-blue-152317 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
<pre>
<pre>
  RaspPi    TTL
sudo apt-get remove lighttpd
  =========
  5V          5V
  GND      GND
  TX (14)  RX
  RX (15)  TX
</pre>
</pre>
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 [http://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable?view=all adafruit] is helpful.


[[File:Ftdi2ttlRaspPi.png|200px]]
'''Whitelist'''


== C libraries ==
* <s>Use Web Interface to log in and use '''Whitelist''' to allow an access to some domains.</s>
* [https://projects.drogon.net/raspberry-pi/wiringpi/ wiringPi] and [https://projects.drogon.net/raspberry-pi/gpio-examples/ GPIO examples]
* Use '''Domain''' on left panel
* http://www.airspayce.com/mikem/bcm2835/
* Command line: '''pihole -w somedomain.com anotherdomain.net'''  (add to whitelist)
* http://elinux.org/RPi_Low-level_peripherals
* [https://github.com/anudeepND/whitelist Collection of commonly white listed domains for Pi-Hole®]
* [http://www.raspberrypi.org/phpBB3/viewtopic.php?f=33&t=22640 C vs Python]


== GPIO layout ==
'''Use pi-hole as the only DNS'''
The following picture was taken from [http://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/ www.raspberrypi-spy.co.uk]
 
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.


[[File:Raspberry-Pi-GPIO-Layout-Revision-2.png|200px]]
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.


The following cheatsheet was taken from http://raspi.tv/wp-content/uploads/2013/04/raspberry-pi-gpio-cheat-sheet.jpg
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>


[[File:raspberry-pi-gpio-cheat-sheet.jpg|200px]]
== 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]


== WebIOPi ==
== VPN client ==
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|Web.py]].
[https://www.makeuseof.com/tag/install-vpn-raspberry-pi/ How to Install a VPN on Your Raspberry Pi]


* https://code.google.com/p/webiopi/wiki/README
== IPV6 connectivity ==
* http://magpi.finalart.hu/The-MagPi-issue-9-en.pdf
https://raspberrypi.stackexchange.com/questions/37/ipv6-connectivity


Run Python using webiopi module
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.
<pre>
sudo python -m webiopi 8000
</pre>


Start/stop the background service
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''.
<pre>
sudo /etc/init.d/webiopi start
sudo /etc/init.d/webiopi end
</pre>


Start webiopi at startup:
== Connect your dumb USB printer to your home network ==
<pre>
[https://pimylifeup.com/raspberry-pi-print-server/ Raspberry Pi Print Server: Setup a Network Printer]. The steps are
sudo update-rc.d webiopi defaults
</pre>


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


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.
Done!


== Web interface to control wifi, hostapd and related services ==
Another instruction [https://opensource.com/article/18/3/print-server-raspberry-pi How to set up a print server on a Raspberry Pi]
[https://github.com/billz/raspap-webgui RaspAP]


== Web.py ==
[https://www.makeuseof.com/tag/ways-print-raspberry-pi/ 6 Ways to Print With a Raspberry Pi]
* http://webpy.org/
 
== 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/raspberry-pi-disk-images-install-weekend/ 8 Types of Raspberry Pi Disk Image You Can Install Today]
 
== Embedded Linux ==
[http://www.linuxjournal.com/content/what-i-wish-i%E2%80%99d-known-when-i-was-embedded-linux-newbie 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 ==
* [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 ==
* https://xavierberger.github.io/RPi-Monitor-docs/index.html, https://github.com/XavierBerger/RPi-Monitor
* https://rpi-experiences.blogspot.com/p/rpi-monitor.html
* Mentioned in [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]
 
== Monitor/manage multiple raspberry pis ==
* [https://geektechstuff.com/2019/08/11/monitoring-multiple-pis-with-nagios-raspberry-pi/ Monitoring Multiple Pis With Nagios (Raspberry Pi)]
 
== Use a systemd unit/service file to control an application to start when Raspberry pi boots up ==
* [https://www.digitalocean.com/community/tutorials/systemd-essentials-working-with-services-units-and-the-journal Systemd Essentials: Working with Services, Units, and the Journal] <syntaxhighlight lang='bash'>
# 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


See the article The Python Pit - drive your Raspberry Pi with a mobile phone in http://www.themagpi.com/en/issue/9.
# List all the units installed on the system
systemctl list-unit-files
</syntaxhighlight>
* See Raspberry PI 3 E-paper 2.7 inch Clock and Weather Display example from [[#E-ink|E-ink]] section.
* [https://docs.docker.com/install/linux/linux-postinstall/ Configure Docker to start on boot]


== Circuit and Electronics ==
== Install node.js ==
* [http://www.scribd.com/doc/31582947/%E9%9B%BB%E8%B7%AF%E8%88%87%E9%9B%BB%E5%AD%90%E5%AD%B8-Electric-Circuits-and-Electronics 電路與電子學]
[https://www.instructables.com/id/Install-Nodejs-and-Npm-on-Raspberry-Pi/ Install Node.js and Npm on Raspberry Pi]
* [http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-002-circuits-and-electronics-spring-2007/ Circuits and Electronics] by MIT


== Blink a single LED ==
== Share your keyboard and mouse between computers with Barrier ==
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
[https://www.raspberrypi.org/blog/share-your-keyboard-and-mouse-between-computers-with-barrier/ Share your keyboard and mouse between computers with Barrier]
* without [http://learn.adafruit.com/adafruit-pi-cobbler-kit/overview PI cobbler]: check out my video
<youtube>xWJZRK4W13Q</youtube>
* 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.
[[File:SingleLED.jpg|100px]]
* 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.
* [http://www.rpiblog.com/2012/09/using-gpio-of-raspberry-pi-to-blink-led.html 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.
<pre>
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()
</pre>
* Google: raspberry pi python led


== RGB ==
== Create a GUI app by GTK+ ==
http://www.instructables.com/id/Using-a-RPi-to-Control-an-RGB-LED/?ALLSTEPS
[https://www.raspberrypi.org/blog/ultrasonically-detect-bats-with-raspberry-pi/ Ultrasonically detect bats with Raspberry Pi]


== 16x2 LCD ==
= Mate Ubuntu =
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.
* https://ubuntu-mate.org/raspberry-pi/
* https://ubuntu-pi-flavour-maker.org/
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).  


[[File:RpyLCD.jpg|100px]]
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 [http://askubuntu.com/questions/17806/how-do-i-disable-irqbalance askubuntu.com] set ENABLED=0 in /etc/default/irqbalance.


http://makezine.com/projects/build-a-compact-4-node-raspberry-pi-cluster/ also tells how to show the IP on the LCD.
The system looks very stable. See my screenshots below.


== 8x8 Matrix LED Backpack (I2C) ==
[[File:Mate1510Raspbery.png|150px]] [[File:Mate1510Raspbery2.png|150px]]
http://learn.adafruit.com/matrix-7-segment-led-backpack-with-the-raspberry-pi/overview


[[File:MatrixLED.jpg |100px]]
== Ubuntu-mate 16.04 on Rpi 3B+ ==
* [https://ubuntu-mate.community/t/where-are-the-16-04-images/20265 16.04.2 image] 2017 Feb. The problem is the old image would not boot on (new) Rpi 3B+.
* [https://ubuntu-mate.community/t/how-to-enable-support-for-raspberry-pi-3b-and-3a-in-ubuntu-mate/18471 How to enable support for Raspberry Pi 3B+ and 3A+ in Ubuntu MATE]
* [https://ubuntu-mate.community/t/16-04-2-wont-boot-on-rpi-3-model-b/16210/21 16.04.2 Won’t boot on RPi 3 Model B+]
* [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+]


Another more versatile output from the 8x8 matrix is by using C program. See [http://marks-space.com/2013/01/16/raspberry-pi-and-an-8x8-led-matrix-using-c/ Mark Williams blog].
== 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/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]


I also create a version of launching LED using R. See my youtube video.
== SSH server  ==
<youtube>TwoWrPp6_iw</youtube>
The [https://ubuntu-mate.org/raspberry-pi/ website] said the server is not installed by default. To install it, run '''sudo apt install openssh-server'''


== IR Remote with XBMC ==
To [https://ubuntu-mate.community/t/automatically-start-ssh-server-on-boot/11971 start it at startup],
http://learn.adafruit.com/using-an-ir-remote-with-a-raspberry-pi-media-center
<pre>
sudo systemctl enable ssh.service
</pre>


== Stepper motor ==
== Change to use static IP ==
* http://www.raspberrypi-spy.co.uk/2012/07/stepper-motor-control-in-python/
Use GUI network manager
* [http://m.youtube.com/watch?v=rYKhGfZbj-0&feature=watch-vrec camera and step motter]


== CamJam Edukit 3 Robotics Kit ==
== Install more screensaver themes ==
* http://raspi.tv/2015/camjam-edukit-3-robotics-kit
http://greyblake.com/blog/2013/02/02/install-more-screensavers-on-mate-desktop/


== Ryanteck Budget Robotics Kit ==
Take a look at the .desktop files under /usr/share/applications/screensavers.
https://www.indiegogo.com/projects/ryanteck-budget-robotics-kit-for-raspberry-pi


The software control is based on [http://docs.spacebrew.cc/ '''Spacebrew''']
== Web browser ==
Ubuntu-Mate includes Firefox. I can feel FF is more slow than the browser in Raspbian.


== HummingBird robot ==
== Printer ==
http://www.hummingbirdkit.com/learning/tutorials/raspberry-pi
(Update 12/11/2016): the instruction below using PPD file still has a problem when I print pdf files. The instruction [http://tutorialforlinux.com/2015/01/14/how-to-easy-install-the-brother-hl-5250dn-printer-driver-on-ubuntu-14-04-trusty-lts-linux/ here] solves the problem. The idea is to download the official Linux driver (<linux-brprinter-installer-2.1.1-1.gz>) from brother website [http://support.brother.com/g/b/downloadend.aspx?c=us&lang=en&prod=hl5250dn_all&os=128&dlid=dlf006893_000&flang=4&type3=625 HL-5250DN].


== Power Raspberry Pi by AA batteries ==
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.
http://www.raspberrypi-spy.co.uk/2013/04/raspberry-pi-aa-battery-shoot-out/
* https://bugs.launchpad.net/ubuntu/+source/system-config-printer/+bug/254202
* http://www.openprinting.org/printer/Brother/Brother-HL-5250DN (PPD file). A copy of the ppd file (a text file) is saved on [https://gist.github.com/arraytools/57c119ea6c14cc385cd4 github].


This also teaches to know how long the battery will die by using Putty and linux command
The manual approach mentioned in bugs.launchpad.net (#6) works.
<pre>
# System -> Adminstration -> Printers -> Add
watch -n 60 uptime
# 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)
</pre>
# Check the 2nd option 'Provide PPD file' instead of the 1st one 'Select printer from database'.
# Browse the location of the PPD file
# Continue the procedure until the end. We can print a test page to make sure the setup is successful.
 
The printer test page said the driver is BR5250_2.PPD and version 1.03.


== Power Raspberry Pi by Lipo batteries ==
PS. About the technology terms
* https://learn.adafruit.com/pocket-pigrrl?view=all
* [https://en.wikipedia.org/wiki/PostScript_Printer_Description PPD (PostScript Printer Description)]
* [http://wpress.io/building-own-backup-server-with-raspberry-pi/ Building our own backup server using the Raspberry PI & MainWP]
* [https://en.wikipedia.org/wiki/Uniform_Resource_Identifier URI (Uniform Resource Identifier)]
* [https://en.wikipedia.org/wiki/Internet_Printing_Protocol IPP (Internet Printing Protocol)]


== Solar power ==
== Kodi ==
* [https://medium.com/@jamesblight/remote-water-monitoring-with-a-solar-powered-raspberry-pi-4923f4731b88 Remote water monitoring with a solar powered Raspberry Pi]
After I used apt-get to install Kodi, Kodi will not be able to launch:(  On Raspbian, the Kodi installed by apt-get works!!!


== Add a push button ==
= Operating Systems for Various Purposes =
* https://learn.adafruit.com/playing-sounds-and-using-buttons-with-raspberry-pi?view=all Play sound
* [https://itsfoss.com/raspberry-pi-os/ Best Raspberry Pi Operating Systems for Various Purposes]
* https://sanje2v.wordpress.com/2014/02/16/adding-shutdownrestart-pushbutton-for-raspberry-pi/ shutdown
* [https://www.maketecheasier.com/best-lightweight-operating-systems-raspberry-pi/ 7 of the Best Lightweight Operating Systems for Raspberry Pi]
* https://embeddedcode.wordpress.com/2013/10/18/adding-a-shutdown-button-to-the-raspberry-pi/ shutdown
* http://www.raspberry-pi-geek.com/Archive/2013/01/Adding-an-On-Off-switch-to-your-Raspberry-Pi shutdown switch
* http://www.instructables.com/id/Raspberry-Pi-Internet-Monitor/?ALLSTEPS Internet monitor with a shutdown switch


== Speech synthesis and a push button ==
== Twister OS ==
* https://learn.adafruit.com/speech-synthesis-on-the-raspberry-pi?view=all
[https://twisteros.com/gallery.html Twister OS] Gallery


Festival speech package
= [http://archlinuxarm.org/platforms/armv7/broadcom/raspberry-pi-2 Arch Linux] =
<syntaxhighlight lang='bash'>
Kodi can be installed in ArchLinux by installing the '''kodi-rbp''' package. See [https://wiki.archlinux.org/index.php/Kodi#Raspberry_Pi wiki.archlinux.org].
sudo apt-get install festival
# Add voice file
sudo apt-get install festvox-rablpc16k # British English
sudo apt-get install festvox-kallpc16k # American English
</syntaxhighlight>


Speaking
= Android =
<syntaxhighlight lang='bash'>
* [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]
echo "Hello World!" | festival --tts
* [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://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://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


wget http://history.eserver.org/jefferson-inaugural.txt
= [https://www.pi-top.com/ pi-top] =
festival --tts jefferson-inaugural.txt
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.
</syntaxhighlight>


Speak Easier: Flite
Unfortunately the pi-top OS is unstable (tested 7/1/2016).
<syntaxhighlight lang='bash'>
* first try - screen flicked & is frozen
sudo apt-get install flite
* I download the [http://www.pi-top.com/download/pi-topOS image] (homepage -> Community -> FAQ) and write it to the sd card - works great but after another boot the screen appeared and then disappeared.


flite -t "All good men come to the aid of the rebellion"
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.
flite -f jefferson-inaugural.txt


flite -lv
For some reason, after I shut down the computer the back light is still on. The software from [https://github.com/rricharz/pi-top-install 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'.
flite -voice awb -t "The Raspberry Pi is a great Maker platform!"
</syntaxhighlight>


Fun Uses for Speech
[https://support.pi-top.com/support/discussions/topics/6000038827 40-pin connector vs jumper cables]. We can use Google account to join.
<syntaxhighlight lang='bash'>
sudo apt-get install fortune-mod
fortune | flite
</syntaxhighlight>


Wav output
* The current [https://shop.pi-top.com/products/pi-topceed pi-topCEED] webpage
<syntaxhighlight lang='bash'>
* Detect and configure '''pi-top hubs''' and accessories on [https://github.com/pi-top/Device-Management Github]
flite -t "Shall we play a game?" -o wargames1.wav
* [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.
aplay wargames1.wav
</syntaxhighlight>


Reading the Weather
Some pictures (left: Pi-top, middle: pi-top hub, right: raspberry pi 3 with a GPIO card). The pin numbers are sequential.
<syntaxhighlight lang='bash'>
* Cable 1: connect to pins 4 (red to 5v) & 6 (black to GND).
sudo apt-get install weather-util
* Cable 2: connect to pins 19, 21 & 23 (3 holes face down). All are SPI pins.
weather washington
* Cable 3: connect to pin 26. SPI pin.
weather -q fips1600190345 | flite
</syntaxhighlight>


Playing sounds using push buttons (Python).
[[File:Pitop1.jpg|200px]] [[File:Pitophub.jpg|200px]] [[File:Raspi3.jpg|200px]]


== Use a Simple Button to Control LED ==
'''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'' )
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.
Maybe it is possible to add a button/switch to launch a command for controlling the backlight.  
http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/buttons_and_switches/
* [https://raspberrypihq.com/use-a-push-button-with-raspberry-pi-gpio/ 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.
<pre>
import os
def button_callback(channel)
    os.system(‘date; pt-brightness —backlight 1’)
</pre>
* [https://stackoverflow.com/a/43150421 When press button, python script runs automatically on Raspberry Pi]
* [https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi How to Add a Power Button to Your Raspberry Pi]


== Get a Flashing Meeting Reminder with a Raspberry Pi ==
== pi-topOS ==
http://makezine.com/projects/get-a-flashing-meeting-reminder-with-a-raspberry-pi/
* 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://knowledgebase.pi-top.com/knowledge


== Using a servo motor, PWM ==
It is based on LXDE but the desktop looks very modern (thumbs up). It is based on the latest Raspbian (Buster).
http://learn.adafruit.com/adafruits-raspberry-pi-lesson-8-using-a-servo-motor?view=all


== LED dimming using software PWM (pulse-width modulation) ==
I feels the theme is like [https://system76.com/pop Pop!_OS]. Very clean and good icon/font size on pi-topCeed.
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 ==
[[:File:Pitopos.png]]
http://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi/overview


== Reading temperature ==
= Media server =
https://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing?view=all
[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


Raspberry Pi has no ADC (Analog to Digital Converter), it cannot directly use an analog temperature sensor like the TMP36.
== 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]
* [https://www.makeuseof.com/tag/raspberry-pi-plex-media-server/ How to Turn a Raspberry Pi Into a Plex Media Server]
* [https://www.howtogeek.com/400958/how-to-turn-a-raspbery-pi-into-a-plex-server/ How to Turn a Raspberry Pi into a Plex Server]. Just about every Plex player supports MKV without transcoding on the fly.


http://www.cyberciti.biz/faq/linux-find-out-raspberry-pi-gpu-and-arm-cpu-temperature-command/
= DVR =
<syntaxhighlight lang='bash'>
[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]
# GPU
/opt/vc/bin/vcgencmd measure_temp


# CPU
= Pi TV Hat =
cpu=$(</sys/class/thermal/thermal_zone0/temp)
[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.''
echo "$((cpu/1000)) c"
</syntaxhighlight>
and putting them together
<syntaxhighlight lang='bash'>
#!/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"
</syntaxhighlight>


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.
= [http://kodi.wiki/view/HOW-TO:Install_Kodi_on_Raspberry_Pi Kodi/XBMC] and OpenElec =
* [https://www.raspberrypi.org/forums/viewtopic.php?t=99866 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.


== MCP23017 GPIO expander (extra 16 pins) ==
Then OpenElec from NOOB works fine.
* http://learn.adafruit.com/mcp230xx-gpio-expander-on-the-raspberry-pi
 
* http://raspi.tv/2013/using-the-mcp23017-port-expander-with-wiringpi2-to-give-you-16-new-gpio-ports-part-3
== How to fix Youtube daily limit exceeded ==
[https://kodihome.blogspot.com/2017/08/how-to-fix-youtube-daily-limit-exceeded-error-on-kodi.html https://kodihome.blogspot.com/]
 
== How to Set Up a Kodi Remote Control ==
https://www.makeuseof.com/tag/set-up-kodi-remote-control/


== Serial Peripheral interface (SPI) ==
== 7 Essential Kodi Tips for New Users ==
http://www.brianhensley.net/2012/07/getting-spi-working-on-raspberry-pi.html
http://www.makeuseof.com/tag/essential-kodi-tips-new-users/


== [https://www.raspberrypi.org/documentation/usage/camera/raspicam/README.md Camera] ==
== 12 Ways to Make Kodi the Best Media Player for You ==
* [http://www.makeuseof.com/tag/raspberry-pi-camera-module-timelapse-photography/ 5 Ways to Use the Raspberry Pi Camera Module for Time-Lapse Photography]
http://www.makeuseof.com/tag/make-kodi-best-media-player/
* http://www.raspberrypi-spy.co.uk/2013/05/capturing-hd-video-with-the-pi-camera-module/
<pre>
raspivid -o myvid.h264 -t 60000 
# 60 seconds. Default is 6 seconds which generates 10MB for 1080p, 6.4MB for 720p.
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.


# convert h264 to mp4
== The 12 Best Kodi Add-Ons for Watching Live News ==
sudo apt-get install -y gpac
https://www.makeuseof.com/tag/best-kodi-add-ons-live-news/
MP4Box -fps 30 -add myvid.h264 myvid.mp4


# play the video
== [http://openelec.tv/home/what-is-openelec What is OpenElec] ==
omxplayer myvid.h264
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.
omxplayer myvid.mp4
</pre>
* http://elinux.org/Rpi_Camera_Module. There are several Android apps to control the camera (Pi or USB) on Raspberry Pi. For example, [https://play.google.com/store/apps/details?id=com.pibits.raspberrypiremotecam RaspiCam Remote].
* NoIR http://www.raspberrypi.org/learning/infrared-bird-box/
* [http://www.lavrsen.dk/foswiki/bin/view/Motion/MotionGuide Motion Guide]
* [http://www.codeproject.com/Articles/665518/Raspberry-Pi-as-low-cost-HD-surveillance-camera Surveillance camera] by codeproject.com. The same one is also hosted on [http://www.instructables.com/id/Raspberry-Pi-as-low-cost-HD-surveillance-camera/?ALLSTEPS instructables.com].
* http://www.home-automation-community.com/surveillance-with-raspberry-pi-noir-camera-howto/ (take care of user 'motion').
<pre>
sudo usermod -a -G motion pi
sudo chown motion:motion /home/pi/images
sudo service motion start
</pre>
To rotate the image, change 'rotate 0' to 'rotate 180' by sudo nano /etc/motion.conf (still not right).
* http://pingbin.com/2012/12/raspberry-pi-web-cam-server-motion/ (regular webcam is used)
* [http://www.opsactive.com/install-motion-on-a-raspberry-pi/ A post] from opsactive.com. Similar to the above.
* [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.


=== Dash Cam ===
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.
* http://pidashcam.blogspot.com/ (with mounting pictures) or http://pidashcam.blogspot.nl/
* http://www.raspberrypi-spy.co.uk/2014/11/how-to-create-a-raspberry-pi-video-capture-unit-part-1/ (with mounting pictures)
* https://programmaticponderings.wordpress.com/2013/06/30/low-cost-dashboard-camera-using-motion-ffmpeg-and-the-raspberry-pi/
* http://www.dreamgreenhouse.com/projects/2013/picar/index.php
* http://www.stuffaboutcode.com/2013/10/raspberry-pi-car-cam-gps-data-map.html
* [https://blog.adafruit.com/2014/08/15/build-a-raspberry-pi-gps-helmet-cam-piday-raspberrypi-raspberry_pi/ A RASPBERRY PI HELMET CAM WITH GPS LOGGING]
* [https://learn.adafruit.com/diy-wifi-raspberry-pi-touch-cam/overview DIY WiFi Raspberry Pi Touchscreen Camera]
* http://zachhuff386.github.io/dashcam/
* http://hackaday.com/2014/11/01/delicious-dash-pi-driving-data/


=== Create a button-operated camera ===
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.
https://www.raspberrypi.org/magpi-issues/MagPi45.pdf p27


=== Live stream and Cam Web Interface ===
== Default folders for OpenElec ==
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]
<pre>
 
OpenELEC:~ # ls
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.  
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
</pre>


[[File:RPi Cam Web.png|200px]]  [[File:RPi Cam Web2.png|180px]]
== Youtube plugin error ==
[http://www.howtogeek.com/273956/how-to-fix-kodis-youtube-quota-exceeded-problem/ How to Fix Kodi’s YouTube “Quota Exceeded” Problem]


=== Security Camera ===
== How to Cast YouTube and Other Web Videos to Kodi (Like the Chromecast) ==
* http://pimylifeup.com/raspberry-pi-security-camera/
* https://giverhell.com/2017/01/15/how-to-stream-from-iphone-ipad-or-android-to-kodi/
* http://www.techradar.com/us/news/computing/how-to-guard-your-home-with-the-raspberry-pi-1301336/1
* http://www.howtogeek.com/277116/how-to-cast-youtube-and-other-web-videos-to-kodi-like-the-chromecast/
* [http://www.instructables.com/id/Raspberry-Pi-as-low-cost-HD-surveillance-camera/step7/Installing-the-motion-detection-software/ Raspberry Pi as low-cost HD surveillance camera]. Some highlights includes installing the motion detection software, saving videos on Windows shared folder, and accessing the live stream.


=== Pan and tilt security camera controlled by Arduino ===
== No sound ==
http://www.makeuseof.com/tag/diy-pan-and-tilt-network-security-cam-raspberry-pi/
http://forum.kodi.tv/showthread.php?tid=130371


=== Slow motion ===
Click on the Volume icon and raise the volume from the default -60dB to a higher value.
http://www.averagemanvsraspberrypi.com/2015/07/raspberry-pi-camera-module-slow-motion-video.html


=== Motion triggered infrared wildlife camera ===
== Fix date/time in OpenElec ==
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.htpcbeginner.com/fix-openelec-incorrect-time-raspberry-pi/


[http://www.howtogeek.com/291282/how-do-night-vision-cameras-and-goggles-work/ How Do Night Vision Cameras Work?]
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
<pre>
#!/bin/sh
(sleep 30; \
/sbin/ntpd -p pool.ntp.org; \
)&
</pre>
Then chmod +x /storage/.config/autostart.sh. No need to reboot.


=== Baby monitor ===
== [http://kodi.wiki/view/UPnP UPnP] ==
* https://www.raspberrypi.org/blog/raspberry-pi-baby-monitor/
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, ....


=== Tiddlybot ===
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 [http://kodi.wiki/view/Adding_music_to_the_library 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!)
* https://www.kickstarter.com/projects/1320310506/tiddlybot-fun-and-simple-raspberry-pi-robot/comments
* https://www.shopstarter.com/s/Tiddlybot/
* http://www.pibot.org/tiddlybot/
* https://github.com/Agilic-Development
* https://github.com/discoverycode/discoverybot_api The Discovery Bot
* http://www.pibot.org/tiddlybot/images/ V1.1 image download link
* http://pibot.org/forum/index.php Forum
* Two recommended wifi adapters: Edimax EW-7811Un, and the TP link TL-WN725N
* http://pibot.org/forum/index.php?topic=45.0 Pin out with a nice graph
* http://pibot.org/forum/index.php?topic=50.0 Raspi A+ is better than V2 in terms of power consumption. See also [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).


[[File:Tiddlybot.jpg|200px]]
== Display Chinese characters ==
http://forum.kodi.tv/showthread.php?tid=81081
 
Go to System - Settings - Appearance - Font and choose 'Arial'.  


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].
== Add-ons ==
The [https://github.com/moneymaker365/repository.xbmcplus.xbmc-plugins/releases USTV VoD] and [https://code.google.com/p/navi-x/ Navi-X] and [http://www.ustvnow.com/ 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.


To turn off the robot, switch the slider to the buzzer.
* [http://lifehacker.com/5768174/power-up-your-xbmc-installation-with-these-new-add-ons Power Up Your XBMC Installation with These Awesome Add-Ons]
* [http://lifehacker.com/5908682/how-to-make-xbmc-easier-to-use-especially-for-non-geeks How to Make XBMC Easier to Use (Especially for Non-Geeks)]
* [http://kodi.wiki/view/Keyboard_controls Keyboard shortcut]. For example, backslash \ for toggle full-screen and windowed mode.
* [http://youtu.be/aTZvjv0_7ag xbmchub maintenance] and [http://youtu.be/ByCuuYqU-eU fix buffering problem].
* [http://beebom.com/2015/05/best-live-tv-addons-for-kodi-xbmc 5 Best Live TV Addons For Kodi]
* [http://addons.tvaddons.ag/ TVADDONS] - A Collection of Unofficial Addons for Kodi.
* [https://seo-michael.co.uk/how-to-install-exodus-for-kodi/ How to install Exodus for Kodi]
* [http://forum.kodi.tv/showthread.php?tid=200735&page=230 Youtube] Youtube addon included in Kodi is marked for deletion. Use this link to download the zip file (5.1.20.1) install the new it.


To run a small dhcp server, it uses [https://en.wikipedia.org/wiki/Udhcpc udhcpd].
== Take a screenshot ==
ssh and run
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
pi@raspberrypi ~ $ sudo service --status-all
kodi-send --action="TakeScreenshot"
[ ? ]  alsa-utils
</syntaxhighlight>
[ - ]  bootlogs
 
[ ? ]  bootmisc.sh
A new file <screenshot000.png> will be saved under screenshots folder.
[ ? ]  cgroup-bin
 
[ ? ]  checkfs.sh
= LXDE (same as Lubuntu) X11 desktop environment used by Raspbian OS =
[ ? ]  checkroot-bootclean.sh
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.  
[ - ]  checkroot.sh
 
[ - ]  console-setup
== Screenshots ==
[ + ]  cron
* https://www.flickr.com/photos/xmodulo/sets/ and [https://www.flickr.com/photos/xmodulo/sets/72157637787192624/ Raspbian specific].
[ + ] dbus
 
[ ? ]  dphys-swapfile
== Taking a screenshot ==
[ ? ]  fake-hwclock
[[Ubuntu#scrot|scrot]]
[ + ]  hostapd
 
[ - ] hostname.sh
== Quick launch bar ==
[ ? ] hwclock.sh
To add lxterminal to quick launch bar,
[ + ]  ifplugd
<pre>
[ - ]  kbd
Right click any empty space on taskbar
[ - ]  keyboard-setup
-> Panel Setting
[ ? ]  killprocs
-> Panel Preferences
[ ? ]  kmod
-> Panel Applets
[ - ]  lightdm
-> Application launch bar & Edit
[ - ]  motd
-> Accessories & lxterminal
[ ? ]  mountall-bootclean.sh
</pre>
[ ? ]  mountall.sh
We can use the same procedure to add Midori to the quick launch bar.
[ ? ]  mountdevsubfs.sh
 
[ ? ]  mountkernfs.sh
== Keyboard shortcut ==
[ ? ]  mountnfs-bootclean.sh
 
[ ? ]  mountnfs.sh
The shortcuts are defined in the file '''~/.config/openbox/lxde-rc.xml'''
[ ? ]  mtab.sh
 
[ ? ]  networking
For example,
[ - ]  nfs-common
* open the lxpanelctl menu, click Ctrl + ESC.
[ + ]  ntp
* open launch an application, click Windows + r.
[ ? ]  plymouth
* Toggle full screen, Alt + F11.
[ ? ]  plymouth-log
* Launch task manager, Ctrl + Alt + Del.
[ - ]  procps
 
[ ? ]  raspi-config
= Get internet by sharing the internet from another machine =
[ ? ]  rc.local
* https://wiki.archlinux.org/index.php/Internet_Share
[ - ]  rmnologin
* static iP. Set up host eth0 IP and then set up RPi IP:
[ - ]  rpcbind
** 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.
[ - ]  rsync
** 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.
[ + ]  rsyslog
** Other thoughts:
[ ? ]  screen-cleanup
<pre>
[ ? ]  sendsigs
sudo nano /etc/network/interfaces
[ + ]  ssh
[ - ]  sudo
[ + ]  triggerhappy
[ + ]  udev
[ ? ]  udev-mtab
[ ? ]  udhcpd
[ ? ]  umountfs
[ ? ]  umountnfs.sh
  [ ? ]  umountroot
[ - ]  urandom
[ - ]  x11-common
</syntaxhighlight>


=== Live stream to youtube ===
iface eth0 inet static
[http://www.makeuseof.com/tag/live-stream-youtube-raspberry-pi/ Live Stream to YouTube With a Raspberry Pi] from makeuseof.
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
</pre>
The gateway is important and in most cases will always point to your firewalls, switch or routers IP address.


== ESP8266 ==
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.
[http://www.instructables.com/id/Connect-an-ESP8266-to-your-RaspberryPi/?ALLSTEPS Connect an ESP8266 to your RaspberryPi]
<pre>
$ 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
</pre>


== IFTTT ==
And '''/etc/resolv.conf''' may be worth to be changed too. /etc/hostname and /etc/hosts are unnecessary.
See Fridge monitor (p41-45) of [http://www.raspberrypi.org/magpi-issues/MagPi37.pdf TheMagPi September 2015].


== Control a 12V lamp with GPIO ZERO ==
An example of '''/etc/resolv.conf''' (set up linux DNS) shown from my RPi is
http://raspi.tv/2015/gpio-zero-test-drive-making-light-of-security
<pre>
nameserver 10.42.0.1
</pre>
But maybe another choice is nameserver 8.8.8.8.


== Grandpa scarer & Laser cutter ==
Some tools for discovering the IPs in a network include Fing (iOS/Android) or Scapy (python).
https://www.raspberrypi.org/learning/grandpa-scarer/worksheet/


= Other cool stuff =
== Get internet from mobile tethering ==
== Home Automation ==
https://github.com/InitialState/rpi-gps/wiki/10%20Part%203.%20Mobile%20Data
* [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]


== Track Internet Dropouts ==
== IP scan tools ==
* http://makezine.com/projects/send-ticket-isp-when-your-internet-drops/. Keywords: speedtest-cli, cron, IFTTT, google spreadsheet.
<ul>
* [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]
<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'>
sudo apt install net-tools
arp -a
arp -a -i eth1      # if eth1 comes from a USB ethernet adapter
</syntaxhighlight>
<li>[[Linux#nmap_-_port_scanning_.26_IPs_in_local_network|nmap]] command
<li>[https://www.fing.io/fingkit-sdk-downloads/ fing] (ios, android, linux, windows). Command line usage
<syntaxhighlight lang='bash'>
sudo fing -n 192.168.1.1/24
</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.
<li>[http://angryip.org Angry ip scanner] cross platform. open source. It shows all instead of found ip's.
<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>


== GPS tracker ==
= Use Raspberry Pi as a Tunnel Gateway/Router =
http://blog.initialstate.com/new-python-gps-tracker/
* [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]


== Retro Game Console/Emulator ==
= Clustering =
* [https://retropie.org.uk/ RetroPie]
[https://www.raspberrypi.org/blog/five-years-of-raspberry-pi-clusters/ Five years of Raspberry Pi clusters] 2020. The [https://youtu.be/IaKRqBRq6CE Docker load-balanced LED cluster Raspberry Pi] is interesting!
** [http://lifehacker.com/how-to-turn-your-raspberry-pi-into-a-retro-game-console-498561192 How to transfer ROM from your primary computer]
* [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
** 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].
== with 2 Pis ==
<syntaxhighlight lang='bash'>
This [http://www.linuxjournal.com/content/two-pi-r 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.
$ ssh pi@retropie.local
pi@retropie.local's password:


The programs included with the Debian GNU/Linux system are free software;
== 4 Pis ==
the exact distribution terms for each program are described in the
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.
individual files in /usr/share/doc/*/copyright.


Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
== Hadoop ==
permitted by applicable law.
* http://www.nigelpond.com/uploads/How-to-build-a-7-node-Raspberry-Pi-Hadoop-Cluster.pdf
Last login: Wed May 11 17:35:37 2016 from 10.42.0.1
* [http://dqydj.com/raspberry-pi-hadoop-cluster-apache-spark-yarn/ A Raspberry Pi Hadoop Cluster with Apache Spark on YARN: Big Data 101]


  .~~.  .~~.    Wednesday, 11 May 2016,  5:36:53 pm UTC
= Qt on Raspberry Pi =
  '. \ ' ' / .'  Linux 4.1.19+ armv6l GNU/Linux
Check out https://qt-project.org/wiki/Qt-RaspberryPi
  .~ .~~~..~.
 
  : .~.'~'.~. :  Filesystem      Size  Used Avail Use% Mounted on
== Native build Qt ==
~ (  ) (  ) ~  /dev/root        15G  2.2G  12G  16% /
http://qt-project.org/wiki/Native_Build_of_Qt5_on_a_Raspberry_Pi
( : '~'.~.'~' : ) Uptime.............: 0 days, 00h04m04s
~ .~      ~. ~  Memory.............: 114884kB (Free) / 250692kB (Total)
  (  |  |  )  Running Processes..: 70
  '~        ~'  IP Address.........: 10.42.0.37
    *--~-~--*    Temperature........: CPU: 46°C/114°F GPU: 46°C/114°F
                  The RetroPie Project, http://www.petrockblock.com


pi@retropie:~ $ df -h
== Qt-Creator ==
Filesystem      Size  Used Avail Use% Mounted on
* http://www.raspberrypi.org/phpBB3/viewtopic.php?f=31&t=43545
/dev/root        15G  2.2G  12G  16% /
* [[Odroid#Qt_Creator|Odroid xu4]]
devtmpfs        119M    0  119M  0% /dev
tmpfs          123M    0  123M  0% /dev/shm
tmpfs          123M  8.5M  114M  7% /run
tmpfs          5.0M  4.0K  5.0M  1% /run/lock
tmpfs          123M    0  123M  0% /sys/fs/cgroup
/dev/mmcblk0p1  57M  20M  38M  35% /boot
</syntaxhighlight>


== Three great games from GameMaker: Studio ===
= Ubuntu Snappy =
https://www.raspberrypi.org/blog/three-great-gamemaker-games-raspberry-pi/
Some more information about ubuntu snappy (username/password is ubuntu/ubuntu):
* http://www.ubuntu.com/cloud/tools/snappy
* http://developer.ubuntu.com/en/snappy/
* http://www.ubuntu.com/things#try-beaglebone
* http://www.viclog.com/entry/snappy-raspberry-pi-2-snap-pi (this matches what I observe)
* https://darrenjw2.wordpress.com/2015/02/07/getting-started-with-snappy-ubuntu-core-on-the-raspberry-pi-2/


== Raspberry Pi Based Wireless FM Microphone ==
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
http://www.instructables.com/id/Raspberry-Pi-Based-Wireless-Microphone/?ALLSTEPS


== Dashboard/Kiosk by [http://dashing.io/ dashing.io] ==
[[File:SnappyRaspPi.png|200px]]
* 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


== Go to space ==
Note that the [http://www.raspberrypi.org/downloads/ SNAPPY UBUNTU CORE image] for RPi seems buggy. For example,
* [http://youtu.be/IM_DLgJEa0k Raspberry Pi in space (nearly) 35.5 km Pi balloon launch] and a [http://youtu.be/9CjjbauSvBE GoPro] version.
{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


== OpenCV ==
Current default time zone: 'America/New_York'
* [https://learn.adafruit.com/raspberry-pi-face-recognition-treasure-box?view=all Face recognition treasure box] from adafruit.
Local time is now:      Thu Jan  1 01:01:42 UTC 1970.
Universal Time is now:  Thu Jan  1 01:01:42 UTC 1970.


== Wii Remote, bluetooth ==
debconf: DbDriver "config": could not write /var/cache/debconf/config.dat-new: Read-only file system
* [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].
* [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 ===
root@localhost:/home/ubuntu# snappy info
* [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).
release: ubuntu-core/devel
* [https://www.mattcutts.com/blog/linux-wii-balanceboard/ Wii balance board] with GUI (tested it on UDOObuntu 2 beta2 based on Ubuntu 14.04.3 LTS, Nov 2015).
frameworks: webdm
[[File:WiiBalBoard.jpg|200px]]
apps:
<syntaxhighlight lang='bash'>
root@localhost:/home/ubuntu# snappy versions
sudo apt-get install autoconf autogen automake gcc bluetooth libbluetooth3-dev \
Traceback (most recent call last):
          libgtk2.0-dev pkg-config python2.7-dev flex bison git-core \
  File "/usr/bin/snappy", line 25, in <module>
          libbluetooth-dev python-pygame python-tk
    status = Main().__main__()
          # NOTE: libbluetooth2-dev becomes libbluetooth3-dev now
  File "/usr/lib/python3/dist-packages/snappy/main.py", line 195, in __main__
          #      python2.5-dev becomes python2.7-dev now
    return callback(args)
sudo apt-get install bluez
  File "/usr/lib/python3/dist-packages/snappy/main.py", line 334, in _do_versions
                                                  # no need to create wiibalance directory
    click_versions = ClickDataSource().versions(all)
git clone https://github.com/abstrakraft/cwiid.git # the svn method does not work
  File "/usr/lib/python3/dist-packages/snappy/click.py", line 189, in versions
                                                  # 131 commits. Last commit is Feb 21, 2010.
    all_updates_list = repo.get_upgradable()
cd cwiid
  File "/usr/lib/python3/dist-packages/click/repository.py", line 183, in get_upgradable
autoconf  # if something messed up, run 'autoreconf'
    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')
</pre>


# Follow http://wiki.labomedia.org/index.php/Blender:Wiimote_:_Compilation_de_cwiid_sur_Linux_Mint_12
= Docker =
#  to fix an error "wmdemo undefined reference to symbol str2ba" when running 'make'
* https://blog.hypriot.com/getting-started-with-docker-on-your-arm-device/
#  That is, edit wmdemo/Makefile.in line 11
* [http://blog.alexellis.io/docker-engine-in-your-pocket/ Is that a Docker Engine in your pocket??]
#  LDLIBS += -lcwiid -lbluetooth
 
# make clean
== Docker swarm ==
./configure        # no need of '--libdir=/usr/lib'
* [https://github.com/alexellis/docker-arm/blob/master/ZERO.md Docker Swarm on PI Zero]
make
* [http://collabnix.com/top-5-cool-projects-around-docker-raspberry-pi-blinkt-monitoring-docker-swarm-using-leds-part-i/ Top 5 Cool Projects around Docker, Raspberry Pi & Blinkt! ~ Monitoring Docker Swarm using LEDs – Part I]
sudo make install


# Test Wii remote with GUI
= Databases =
sudo wmgui/wmgui
[https://opensource.com/article/17/10/set-postgres-database-your-raspberry-pi How to set up a Postgres database on a Raspberry Pi]


cd python
= Coding =
sudo python setup.py install
https://code.org/
#  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
== Scratch ==
sudo apt-get install python-pycurl
[https://www.raspberrypi.org/blog/the-scratch-olympics/ THE SCRATCH OLYMPICS]
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
= Connect Arduino to Raspberry Pi =
wget http://abstrakraft.org/cwiid/raw-attachment/ticket/63/system.ini
* The Arduino, while not a full-fledged computer, has a few things it does better, like converting analog-to-digital with its built-in ADC chip. [https://www.tomshardware.com/how-to/use-raspberry-pi-with-arduino How to Use Raspberry Pi and Arduino Together]
chmod a+x scalesgui.py
* See [http://www.doctormonk.com/2012/04/raspberry-pi-and-arduino.html doctormonk.com] where python-serial module is used and ''/dev/ttyACM0'' is the serial port or the name for the USB interface to the Arduino Uno.
sudo python ./scalesgui.py  # no need to change the code
* [http://elinux.org/Serial_port_programming Serial port programming]
                            # <system.ini> and <scalesgui.py> are in the same dir
* 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.
                            # On my 800x480 display, I change <system.ini> file
 
                            # width=1200 -> 800, height=960 -> 420, size=300 -> 50
= Connect to cell network =
#  to exit the program you should press the “F12” key.
[https://www.makeuseof.com/connect-raspberry-pi-cell-network/ Connect Your Raspberry Pi to a Cell Network]
 
= [http://openframeworks.cc/about/ 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 =
 
* [https://www.raspberrypi.org/magpi-issues/Projects_Book_v1.pdf Official Raspberry Pi Projects Book]
* [http://www.pi-tutorials.co.uk/ Keith's Pi tutorial]
 
== RPi.GPIO & gpiozero python libraries ==
https://www.raspberrypi.org/magpi-issues/Essentials_GPIOZero_v1.pdf#page=10
<syntaxhighlight lang='python'>
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!")
</syntaxhighlight>
vs
<syntaxhighlight lang='python'>
from gpiozero import Button
btn = Button(4)
while not btn.is_pressed:
    pass
print("Button pushed!")
</syntaxhighlight>
</syntaxhighlight>


== Robot control ==
== Processing ==
* http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/robot_control/
* https://www.raspberrypi.org/blog/now-available-for-download-processing/
* [http://www.linuxuser.co.uk/tutorials/control-your-raspberry-pi-robot-from-a-web-connected-device Linux User & Developer 132]


== Compile R from source ==
== 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.


Tested on R 3.0.1
* 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


* cd R-3.0.1
== Power off and on ==
* ./configure --with-recommended-packages=no
http://raspi.tv/2012/making-a-reset-switch-for-your-rev-2-raspberry-pi
* sudo apt-get install openjdk-7-jdk
* '''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


== Google Coder ==
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:)
PS. Code is based on [[node.js]] (Early version of [[R#shiny_server|shiny-server]] also depends on [[node.js]]).


[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.
For model B+/Pi 2 model B, see [http://www.makeuseof.com/tag/add-reset-switch-raspberry-pi/ this post]. This post also provides another way (GPIO pins 5&6) to shut down RPi.


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
[http://www.doctormonk.com/2017/01/on-switch-for-raspberry-pi.html This has pictures] for all raspi models.
[https://github.com/googlecreativelab/coder/tree/99b70ee8e0722493eac3bf67558aa002713846c0 Sep-17-2013]; otherwise you'll get the following error when using 'nodejs server.js'
<pre>
$ nodejs server.js
no certificate found. generating self signed cert.


module.js:337
[https://www.makeuseof.com/tag/add-power-button-raspberry-pi/ How to Add a Power Button to Your Raspberry Pi], [https://www.lynda.com/Raspberry-Pi-tutorials/power-switch-Raspberry-Pi/5007872/2267849-4.html lynda.com].
    throw new Error("Cannot find module '" + request + "'");
          ^
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'.
== Power from GPIO pins ==
* [[#pi-top|Pi-top]]
* [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
* [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]


The password requirement for coder is at least 6 characters, at least one lower case and at least 2 upper cases or numbers.
== Connect to console using TTL/Serial cable ==
I purchased the TTL cable through [http://dx.com/p/usb-2-0-to-ttl-uart-5-pin-cp2102-module-serial-converter-blue-152317 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
<pre>
  RaspPi    TTL
  =========
  5V          5V
  GND      GND
  TX (14)  RX
  RX (15)  TX
</pre>
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 [http://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable?view=all adafruit] is helpful.


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).
[[File:Ftdi2ttlRaspPi.png|200px]]


'''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.
== C libraries ==
* [https://projects.drogon.net/raspberry-pi/wiringpi/ wiringPi] and [https://projects.drogon.net/raspberry-pi/gpio-examples/ GPIO examples]
* http://www.airspayce.com/mikem/bcm2835/
* http://elinux.org/RPi_Low-level_peripherals
* [http://www.raspberrypi.org/phpBB3/viewtopic.php?f=33&t=22640 C vs Python]


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]]/
== GPIO layout ==
* '''pinout''' command from [https://www.raspberrypi-spy.co.uk/2012/09/checking-your-raspberry-pi-board-version/ Checking Your Raspberry Pi Revision Number & Board Version]
* 40 pins https://pinout.xyz/  [[File:Raspberry-pi-pinout.png|250px]]
* 26 pins [http://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/ www.raspberrypi-spy.co.uk] [[File:Raspberry-Pi-GPIO-Layout-Revision-2.png|200px]],
* 26 pins [http://raspi.tv/wp-content/uploads/2013/04/raspberry-pi-gpio-cheat-sheet.jpg raspi.tv] [[File:raspberry-pi-gpio-cheat-sheet.jpg|200px]]
* Printable:
** [https://sander.grids.be/wp-content/uploads/2014/09/RasPiBplusPinout.pdf Printable PDF] pin layout from [https://sander.grids.be/raspberry-pi-b-printable-pinout/ here] (Colored, lots in one page)
** [https://fredfire1.files.wordpress.com/2015/10/r2-gpio_paper.pdf Another one] from [https://fredfire1.wordpress.com/2015/10/05/rpi2-gpio-names-printout-version-raspberrypi/ here] (Good detail, B/W)
** https://mikaelleven.files.wordpress.com/2015/11/rpi_b_gpio_card_mikael-leven.pdf (Colored, only 1)
** https://www.computerhilfen.de/info/wp-content/uploads/2016/04/computerhilfen_de-gpio-pdf-2.pdf (Cool)


== Wolframe Mathematica ==
== Node-RED ==
* http://www.wolfram.com/raspberry-pi/
[https://www.lynda.com/Raspberry-Pi-tutorials/Programming-Node-RED/5007872/2921941-4.html lynda.com]
* 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
== 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|Web.py]].
 
* https://code.google.com/p/webiopi/wiki/README
* http://magpi.finalart.hu/The-MagPi-issue-9-en.pdf
 
Run Python using webiopi module
<pre>
<pre>
/usr/bin/mathematica
sudo python -m webiopi 8000
</pre>
</pre>
We can try a 3D plot like seen in [http://www.youtube.com/watch?v=7J3I2iHmC0c youtube]
 
Start/stop the background service
<pre>
<pre>
Plot3D[Sin[x*y], {x,0,Pi}, {y,0,Pi}]
sudo /etc/init.d/webiopi start
sudo /etc/init.d/webiopi end
</pre>
</pre>


The following screenshot shows how to calculate the derivative of f(x)=sin(x)*exp(2x) using Wolfram.
Start webiopi at startup:
* Note that the language is case-sensitive. For example, sin[x] is not recognized and it should be Sin[x].  
<pre>
* Wolfram language uses square brackets instead of parentheses for function's arguments.
sudo update-rc.d webiopi defaults
* See [http://reference.wolfram.com/language/ this page] for Wolfram language & system documentation.
</pre>
* Another way is to type D[Sin[x] * Exp[2x], x]


[[File:WolframPi.png|150px]]
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".


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


== Use RaspPi as Media Center ==
== Web.py ==
http://www.packtpub.com/raspberry-pi-media-center/book
* http://webpy.org/


== Record TV ==
See the article The Python Pit - drive your Raspberry Pi with a mobile phone in http://www.themagpi.com/en/issue/9.
* http://www.redrobe.com/mike/record-tv-on-raspberry-pi-with-tvheadend/. This is from the same author of Raspicam Remote for Android.


== Bitcoin Miner ==
== Circuit and Electronics ==
* http://www.linuxuser.co.uk/tutorials/mine-bitcoins-with-raspberry-pi
* [http://www.scribd.com/doc/31582947/%E9%9B%BB%E8%B7%AF%E8%88%87%E9%9B%BB%E5%AD%90%E5%AD%B8-Electric-Circuits-and-Electronics 電路與電子學]
* https://learn.adafruit.com/piminer-raspberry-pi-bitcoin-miner/initial-setup-and-assembly
* [http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-002-circuits-and-electronics-spring-2007/ Circuits and Electronics] by MIT


== Turn Raspi into a wireless hotspot / access point ==
== Blink a single LED ==
I am using '''TP-LINK TP-WN722N''' wifi adapter.
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 [http://learn.adafruit.com/adafruit-pi-cobbler-kit/overview PI cobbler]: check out my video [https://youtu.be/xWJZRK4W13Q Raspberry Pi + single LED success].
* (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  
* 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.
** http://askubuntu.com/questions/699995/hotspot-created-and-connected-from-linux-but-no-internet-access-on-phone
: [[File:SingleLED.jpg|100px]]
** http://superuser.com/questions/1061849/connected-to-hostapd-hotspot-but-no-internet
* 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.
** 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.  
* [http://www.rpiblog.com/2012/09/using-gpio-of-raspberry-pi-to-blink-led.html 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. <syntaxhighlight lang='python'>
<pre>
import RPi.GPIO as GPIO 
pi@raspberrypi:~ $ route -n
import time 
Kernel IP routing table
# 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()
</syntaxhighlight>
* [https://gpiozero.readthedocs.io/en/stable/recipes.html 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.
 
[[File:RpyLCD.jpg|100px]]
 
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
 
[[File:MatrixLED.jpg |100px]]
 
Another more versatile output from the 8x8 matrix is by using C program. See [http://marks-space.com/2013/01/16/raspberry-pi-and-an-8x8-led-matrix-using-c/ Mark Williams blog].
 
I also create a version of launching LED using R. See my youtube video.
<youtube>TwoWrPp6_iw</youtube>
 
[https://blog.adafruit.com/2017/07/02/weather-matrix-display/ Weather Matrix Display]
 
== IR Remote with XBMC ==
http://learn.adafruit.com/using-an-ir-remote-with-a-raspberry-pi-media-center
 
== Stepper motor ==
* http://www.raspberrypi-spy.co.uk/2012/07/stepper-motor-control-in-python/
* [http://m.youtube.com/watch?v=rYKhGfZbj-0&feature=watch-vrec camera and step motter]
 
== Sound sensor ==
[http://www.piddlerintheroot.com/sound-sensor/ Set up a sound sensor with the Raspberry Pi]
 
I modify the code by
# adding a counter in the code for my own interest. See [https://stackoverflow.com/a/29825924 this post] for declaring a variable as ''global''.
# adding a timestamp to show when an event happened
 
Note I am connect OUT pin of the sensor to [https://pinout.xyz/ BCM26] on my pi zero.
 
If I install [[Linux#tmux.2A|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.
<syntaxhighlight lang='python'>
#!/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)
</syntaxhighlight>
 
== KOOKYE Smart Home Sensor Kit ==
* [http://kookye.com/?p=1573 KOOKYE Smart Home Sensor Kit for Arduino Raspberry Pi]
* [https://smile.amazon.com/KOOKYE-Modules-Arduino-Raspberry-Professional/ Amazon]
 
==  CamJam Edukit 3 Robotics Kit ==
* http://raspi.tv/2015/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 [http://docs.spacebrew.cc/ '''Spacebrew''']
 
== HummingBird robot ==
http://www.hummingbirdkit.com/learning/tutorials/raspberry-pi
 
== Add a push button ==
* https://learn.adafruit.com/playing-sounds-and-using-buttons-with-raspberry-pi?view=all Play sound
* https://sanje2v.wordpress.com/2014/02/16/adding-shutdownrestart-pushbutton-for-raspberry-pi/ shutdown
* https://embeddedcode.wordpress.com/2013/10/18/adding-a-shutdown-button-to-the-raspberry-pi/ shutdown
* http://www.raspberry-pi-geek.com/Archive/2013/01/Adding-an-On-Off-switch-to-your-Raspberry-Pi shutdown switch
* http://www.instructables.com/id/Raspberry-Pi-Internet-Monitor/?ALLSTEPS Internet monitor with a shutdown switch
 
== Speech synthesis and a push button ==
* https://learn.adafruit.com/speech-synthesis-on-the-raspberry-pi?view=all
 
Festival speech package
<syntaxhighlight lang='bash'>
sudo apt-get install festival
# Add voice file
sudo apt-get install festvox-rablpc16k # British English
sudo apt-get install festvox-kallpc16k # American English
</syntaxhighlight>
 
Speaking
<syntaxhighlight lang='bash'>
echo "Hello World!" | festival --tts
 
wget http://history.eserver.org/jefferson-inaugural.txt
festival --tts jefferson-inaugural.txt
</syntaxhighlight>
 
Speak Easier: Flite
<syntaxhighlight lang='bash'>
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!"
</syntaxhighlight>
 
Fun Uses for Speech
<syntaxhighlight lang='bash'>
sudo apt-get install fortune-mod
fortune | flite
</syntaxhighlight>
 
Wav output
<syntaxhighlight lang='bash'>
flite -t "Shall we play a game?" -o wargames1.wav
aplay wargames1.wav
</syntaxhighlight>
 
Reading the Weather
<syntaxhighlight lang='bash'>
sudo apt-get install weather-util
weather washington
weather -q fips1600190345 | flite
</syntaxhighlight>
 
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 ==
* http://learn.adafruit.com/adafruits-raspberry-pi-lesson-8-using-a-servo-motor?view=all
* [https://www.raspberrypi.org/blog/how-to-use-a-servo-motor-with-raspberry-pi/ How to use a servo motor with Raspberry Pi]
 
== LED dimming using software PWM (pulse-width modulation) ==
http://raspi.tv/2013/how-to-use-soft-pwm-in-rpi-gpio-pt-2-led-dimming-and-motor-speed-control
 
== Reading analog input using external ADC (analog to digital converter) MCP3008 ==
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)! [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'>
# CPU
vcgencmd measure_temp
# OR
cpu=$(</sys/class/thermal/thermal_zone0/temp)
echo "$((cpu/1000)) c"
</syntaxhighlight>
and putting them together
<syntaxhighlight lang='bash'>
#!/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"
</syntaxhighlight>
 
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.
 
[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) ==
* http://learn.adafruit.com/mcp230xx-gpio-expander-on-the-raspberry-pi
* http://raspi.tv/2013/using-the-mcp23017-port-expander-with-wiringpi2-to-give-you-16-new-gpio-ports-part-3
 
== Serial Peripheral interface (SPI) ==
* https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md
* https://learn.sparkfun.com/tutorials/raspberry-pi-spi-and-i2c-tutorial/all
* https://radiostud.io/understanding-spi-in-raspberry-pi/
* https://www.raspberrypi-spy.co.uk/category/hardware/interfaces/spi/
* http://www.brianhensley.net/2012/07/getting-spi-working-on-raspberry-pi.html
 
== MIDI port ==
* [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/linux/software/libcamera/csi-2-usage.md CSI-2 (Camera Serial Interface 2) "Unicam"]
* [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/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/
* 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
<syntaxhighlight lang='bash'>
# 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
</syntaxhighlight>
* http://elinux.org/Rpi_Camera_Module. There are several Android apps to control the camera (Pi or USB) on Raspberry Pi. For example, [https://play.google.com/store/apps/details?id=com.pibits.raspberrypiremotecam RaspiCam Remote].
* NoIR http://www.raspberrypi.org/learning/infrared-bird-box/
* [http://www.lavrsen.dk/foswiki/bin/view/Motion/MotionGuide Motion Guide]
* [http://www.codeproject.com/Articles/665518/Raspberry-Pi-as-low-cost-HD-surveillance-camera Surveillance camera] by codeproject.com. The same one is also hosted on [http://www.instructables.com/id/Raspberry-Pi-as-low-cost-HD-surveillance-camera/?ALLSTEPS instructables.com].
* http://www.home-automation-community.com/surveillance-with-raspberry-pi-noir-camera-howto/ (take care of user 'motion').
<syntaxhighlight lang='bash'>
sudo usermod -a -G motion pi
sudo chown motion:motion /home/pi/images
sudo service motion start
</syntaxhighlight>
To rotate the image, change 'rotate 0' to 'rotate 180' by sudo nano /etc/motion.conf (still not right).
* http://pingbin.com/2012/12/raspberry-pi-web-cam-server-motion/ (regular webcam is used)
* [http://www.opsactive.com/install-motion-on-a-raspberry-pi/ A post] from opsactive.com. Similar to the above.
* [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]
 
=== 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 ===
<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
* 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]
<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 ===
* 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.
 
[https://www.techcoil.com/blog/connect-raspberry-pi-camera-module-raspberry-pi-zero-w-official-case/ How to connect Raspberry Pi camera module to Raspberry Pi Zero W and the official case]
 
'''[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 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 ===
* [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]
 
=== 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'>
sudo apt-get install fswebcam
fswebcam -r 1280x720 image2.jpg
</syntaxhighlight>
* [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 ===
[https://www.ebay.com/itm/New-Wide-Angle-Camera-Module-5MP-160-Fish-Eye-Lenses-for-Raspberry-Pi-3-/301352863840?_trksid=p2349526.m4383.l4275.c10#viTabs_0 160° Fish Eye]
 
=== Dash Cam ===
* http://pidashcam.blogspot.com/ (with mounting pictures) or http://pidashcam.blogspot.nl/
* http://www.raspberrypi-spy.co.uk/2014/11/how-to-create-a-raspberry-pi-video-capture-unit-part-1/ (with mounting pictures)
* https://programmaticponderings.wordpress.com/2013/06/30/low-cost-dashboard-camera-using-motion-ffmpeg-and-the-raspberry-pi/
* http://www.dreamgreenhouse.com/projects/2013/picar/index.php
* http://www.stuffaboutcode.com/2013/10/raspberry-pi-car-cam-gps-data-map.html
* [https://blog.adafruit.com/2014/08/15/build-a-raspberry-pi-gps-helmet-cam-piday-raspberrypi-raspberry_pi/ A RASPBERRY PI HELMET CAM WITH GPS LOGGING]
* [https://learn.adafruit.com/diy-wifi-raspberry-pi-touch-cam/overview DIY WiFi Raspberry Pi Touchscreen Camera]
* http://zachhuff386.github.io/dashcam/
* http://hackaday.com/2014/11/01/delicious-dash-pi-driving-data/
 
=== Time-lapse ===
<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
 
# 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 &
</syntaxhighlight>
 
<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'>
LOCATION=NorthEast
for img in *.jpg; do
  convert "$img" -gravity $LOCATION -pointsize 24 -fill yellow \
          -annotate +10+10 "%[exif:DateTimeOriginal]" "$img"
done
</syntaxhighlight>
 
<li>Shell script 3: [https://superuser.com/questions/1499968/creating-timelapse-from-still-images-jpg-to-mp4-using-ffmpeg Convert images into a video]
<syntaxhighlight lang='bash'>
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
</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.
 
<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]
 
<li>[https://www.tomshardware.com/how-to/raspberry-pi-time-lapse-video How to Shoot Time-Lapse Videos with Raspberry Pi]
 
<li>[https://projects.raspberrypi.org/en/projects/timelapse-setup/7 Time-lapse animations with a Raspberry Pi]. Every 60 seconds takes a picture.
<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.
 
<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]
 
<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:
* 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>
 
=== Remote viewing ===
[https://makezine.com/projects/beginner-project-a-remote-viewing-camera-with-raspberry-pi/ A Remote Viewing Camera With Raspberry Pi]
 
=== Create a button-operated camera ===
https://www.raspberrypi.org/magpi-issues/MagPi45.pdf p27
 
=== Streaming ===
[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-*.
<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>
 
=== Live stream to youtube ===
* [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]
 
=== RTSP and ZoneMinder ===
<ul>
<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.
<li>Use '''mplayer rtsp://IP:8081/'''. But quite delay.
<li>Use '''ffplay rtsp://IP:8081/'''. Quite delay.
<li>[https://github.com/jacksonliam/mjpg-streamer mjpg-streamer]
<ul>
<li>Install dependencies
<pre>
sudo apt-get update
sudo apt-get upgrade
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
 
[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>
 
=== 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].
 
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.
<syntaxhighlight lang='bash'>
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
</syntaxhighlight>
 
[[File:RPi Cam Web.png|200px]]  [[File:RPi Cam Web2.png|180px]]
 
=== How to Use Raspberry Pi as a PC Webcam ===
[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 ===
See [[Motioneye|motionEye]].
 
=== Intruder detection ===
http://www.instructables.com/id/Intruder-Detector-With-Raspberry-Pi-and-Pushbullet/
 
=== Raspberry Pi dog detector ===
[https://www.raspberrypi.org/blog/raspberry-pi-dog-detector-and-dopamine-booster/ Raspberry Pi dog detector]
 
=== Chat Bot prevented a burglary ===
[https://medium.com/@mellican/how-a-home-automation-chat-bot-prevented-a-burglary-901301557c70 How a Chat Bot prevented a burglary]
 
=== Pan and tilt security camera controlled by Arduino ===
http://www.makeuseof.com/tag/diy-pan-and-tilt-network-security-cam-raspberry-pi/
 
=== Slow motion ===
http://www.averagemanvsraspberrypi.com/2015/07/raspberry-pi-camera-module-slow-motion-video.html
 
=== Motion triggered infrared wildlife camera, night version camera ===
* https://blog.adafruit.com/2015/09/04/how-to-make-a-motion-triggered-infrared-wildlife-camera-with-raspberry-pi-piday-raspberrypi-raspberry_pi/
* [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]
 
=== Solar powered nature camera ===
* 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]
 
=== Baby monitor ===
* https://www.raspberrypi.org/blog/raspberry-pi-baby-monitor/
 
=== SleePi sounds alarm when Raspberry Pi detects sleepiness ===
[https://www.raspberrypi.org/blog/sleepi-sounds-alarm-when-raspberry-pi-detects-sleepiness/ SleePi sounds alarm when Raspberry Pi detects sleepiness]
 
=== Tiddlybot ===
* https://www.kickstarter.com/projects/1320310506/tiddlybot-fun-and-simple-raspberry-pi-robot/comments
* https://www.shopstarter.com/s/Tiddlybot/
* http://www.pibot.org/tiddlybot/
* https://github.com/Agilic-Development
* https://github.com/discoverycode/discoverybot_api The Discovery Bot
* http://www.pibot.org/tiddlybot/images/ V1.1 image download link
* http://pibot.org/forum/index.php Forum
* Two recommended wifi adapters: Edimax EW-7811Un, and the TP link TL-WN725N
* http://pibot.org/forum/index.php?topic=45.0 Pin out with a nice graph
* http://pibot.org/forum/index.php?topic=50.0 Raspi A+ is better than V2 in terms of power consumption. See also [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).
 
[[File:Tiddlybot.jpg|200px]]
 
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].
 
To turn off the robot, switch the slider to the buzzer.
 
To run a small dhcp server, it uses [https://en.wikipedia.org/wiki/Udhcpc udhcpd].
<syntaxhighlight lang='bash'>
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
</syntaxhighlight>
 
=== Bird feed ===
[https://www.instructables.com/id/Bird-Feeder-Monitor-V20/ Raspberry Pi catches the early bird]
 
=== View Stonehenge in real time via Raspberry Pi ===
[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].
 
=== Unlock your PC with a pushup or two (Machine learning) ===
[https://www.raspberrypi.com/news/unlock-your-pc-with-a-pushup-or-two/ Unlock your PC with a pushup or two]
 
== ESP8266 ==
[http://www.instructables.com/id/Connect-an-ESP8266-to-your-RaspberryPi/?ALLSTEPS Connect an ESP8266 to your RaspberryPi]
 
== IFTTT ==
See Fridge monitor (p41-45) of [http://www.raspberrypi.org/magpi-issues/MagPi37.pdf 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 ==
* [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]
* [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 ==
http://www.instructables.com/id/How-to-Make-a-Smart-Suitcase-With-a-Raspberry-Pi/
 
== Identify Bird Sounds With BirdNET-Pi ==
[https://www.makeuseof.com/identify-bird-sounds-birdnet-raspberry-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|SSH > Awesome tunneling]]
 
== 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 ==
[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 ==
* See [[RetroPie|RetroPie]].
* [https://youtu.be/Jm8RiqAdHQE?t=525 Raspberry Pi Zero 2 W] from ETA prime
 
== pygame ==
* [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]
 
== 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 [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
 
== balenaCloud Dashboard ==
[https://www.makeuseof.com/build-raspberry-pi-desktop-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 ==
* [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 ==
* [https://learn.adafruit.com/raspberry-pi-face-recognition-treasure-box?view=all Face recognition treasure box] from adafruit.
 
== 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].
* [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 ===
* 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'
 
# 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.
</syntaxhighlight>
 
== Robot control ==
* http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/robot_control/
* [http://www.linuxuser.co.uk/tutorials/control-your-raspberry-pi-robot-from-a-web-connected-device Linux User & Developer 132]
 
== Compile R from source ==
Tested on R 3.0.1
 
* cd R-3.0.1
* ./configure --with-recommended-packages=no
* sudo apt-get install openjdk-7-jdk
* '''nano src/library/tools/R/install.R''' and pass "perl = TRUE" to sub()
<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 ==
[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]
 
== Google Coder ==
PS. Code is based on [[node.js]] (Early version of [[R#shiny_server|shiny-server]] also depends on [[node.js]]).
 
[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.
 
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
[https://github.com/googlecreativelab/coder/tree/99b70ee8e0722493eac3bf67558aa002713846c0 Sep-17-2013]; otherwise you'll get the following error when using 'nodejs server.js'
<pre>
$ 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'
</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'.
 
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 [http://www.raspberrypi.org/phpBB3/viewtopic.php?t=9984 Cloud9 IDE] on RPi. The Cloud 9 IDE was preinstalled on [[Beaglebone|Beaglebone black]]/
 
== Wolframe Mathematica ==
* http://www.wolfram.com/raspberry-pi/
* http://www.wolfram.com/broadcast/video.php?channel=105/?fp=left&video=1571 (Video)
* http://www.raspberrypi.org/archives/5282
* http://www.raspberrypi.org/phpBB3/viewtopic.php?t=61746&p=459159 (Download locally first)
 
For some reason, the '''Mathematica''' is not shown on the menu (it only happened on self-installed version). We can start ''Mathematica'' from the command line
<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>
 
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 [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]]
 
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 ==
* http://www.redrobe.com/mike/record-tv-on-raspberry-pi-with-tvheadend/. This is from the same author of Raspicam Remote for Android.
 
== Bitcoin Miner ==
* http://www.linuxuser.co.uk/tutorials/mine-bitcoins-with-raspberry-pi
* https://learn.adafruit.com/piminer-raspberry-pi-bitcoin-miner/initial-setup-and-assembly
 
== How to Track Satellite (ISS) Fly-Bys with Raspberry Pi ==
[https://www.tomshardware.com/news/how-to-track-satellite-fly-bys-with-raspberry-pi How to Track Satellite Fly-Bys with Raspberry Pi]
 
== Wifi extender ==
* [https://github.com/billz/raspap-webgui RaspAP] Web interface to control wifi, hostapd and related services
* [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]
* [https://pimylifeup.com/raspberry-pi-wifi-extender/ Simple Raspberry Pi WiFi Extender]
* [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
 
# 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
</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
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
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
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
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
192.168.42.0    0.0.0.0        255.255.255.0  U    0      0        0 wlan0
pi@raspberrypi:~ $ ifconfig
pi@raspberrypi:~ $ ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:24:6b:a0   
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
           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
 
== [http://octoprint.org/ 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 ==
* [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]


lo        Link encap:Local Loopback 
== DietPi ==
          inet addr:127.0.0.1  Mask:255.0.0.0
DietPi is an extremely lightweight Debian-based OS.  
          ...


wlan0    Link encap:Ethernet  HWaddr f8:d1:11:0b:52:6f 
* https://github.com/MichaIng/DietPi
          inet addr:192.168.42.1  Bcast:192.168.42.255  Mask:255.255.255.0
* [https://dietpi.com/stats.html Comparison]
          ...
* [https://raspberrytips.com/install-dietpi-raspberry-pi/ Complete Guide]
</pre>
* [https://dietpi.com/forum/t/password-explanation/14415 Password explaination]
* (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.
* Installation
<pre>
** 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.
sudo service hostapd status
** 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.
sudo service isc-dhcp-server status
** A serial/UART console .... would you like to disable it? Yes/No.
</pre>
* (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).
* http://raspberry-at-home.com/hotspot-wifi-access-point/
* [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.
* [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.
* [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.
 
== 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


== [http://octoprint.org/ OctoPrint] ==
* Memory is 20.9/477M according to htop (on my RPi 1B, armv6)
The snappy web interface for your 3D printer.
* 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: [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


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.
== other SBC ==
 
== Block Ads on All Your Devices at Home with Pi-hole ==
http://piboards.com/2017/01/07/block-ads-on-all-your-devices-at-home-with-pi-hole-and-an-orange-pi/
 
= 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.
* [http://www.hardkernel.com/main/main.php ODROID] (no built-in wifi or bluetooth)
* [https://ameridroid.com/products/odroid-h2 ODROID H2] Celeron J4105, M.2 PCIe 2.0 x4 slot for one NVMe storage, 2x SATA 3.0 ports, eMMC flash support
* [https://smile.amazon.com/Atomic-Pi-High-Speed-Peripherals/dp/B07N298F2B Atomic Pi] x386. [https://www.cpubenchmark.net/compare/Intel-Atom-x5-Z8350-vs-Intel-Atom-x5-Z8300/2774vs2585 Atom x5-Z8350 benchmark]: 1268.
* [http://rockpi.org/ Rock Pi] 4B: RK3399 cpu, M.2 NVME SSD & USB 3.0
* [https://www.pine64.org/rockpro64/ RockPro64] from pine64.org
* [http://www.orangepi.org/Orange%20Pi%203/ Orange Pi 3]. Not good. See the review by [https://explainingcomputers.com/sbc.html explainingcomputers.com].
* [https://www.makeuseof.com/tag/nanopi-neo4-raspberrypi/ NanoPi NEO4] supports PCIe. Rockchip RK3399.

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