Skip to content

Raspberry Pi

Detect hardware model

dmesg |grep Raspberry

Write image

sudo dd bs=4M if=2016-05-27-raspbian-jessie.img of=/dev/mmcblk0; sudo sync

Raspberry pi imager

Install:

sudo pacman -S rpi-imager

Config is stored at ~/.config/Raspberry\ Pi/Imager.conf

Login

with user:pi, pw:raspberry

enable ssh

systemctl start  ssh
systemctl enable ssh

login via ssh

ssh-copy-id raspberry.local
ssh raspberry.local

Change keyboard layout and locales

sudo dpkg-reconfigure keyboard-configuration

Generic 105 kb, US, no options

sudo dpkg-reconfigure locales
  • en_US.UTF-8 UTF-8
  • No default locale

Change pw for pi user

tmux
passwd

Only for GUI versions

Disable Screensaver

Disable screensaver

 sudo apt-get install xscreensaver

Go to preference ---> screensaver. You will see a screen saver main menu. In mode : section, select "disable screensaver" and close, reboot.

Autostart

How can I add new autostart programs in Lubuntu?

mkdir ~/.config/autostart
ln -s /usr/share/applications/firefox-esr.desktop ~/.config/autostart/firefox-esr.desktop

Issues

Stream Webcam

./mjpg_streamer -i "./input_uvc.so -m 2  -f 6 -r VGA" -o "./output_http.so -w ./www"

keyboard-setup

for console

dpkg-reconfigure keyboard-configuration
setupcon

WLAN

ad-hoc

Use connman

Permanent

raspi-config

Works with raspi-config as well.

Manual

WPA-PSK and WPA2-PSK

chmod 0600 /etc/network/interfaces
wpa_passphrase Hangtheking PW

edit /etc/network/interfaces:

auto wlan0
iface wlan0 inet dhcp
  wpa-ssid myssid
  wpa-psk ...

ifdown wlan0
ifup   wlan0

GPIO

RPi2 GPIO Header Pins

echo 4 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio4/direction # set it as an output pin
echo 1 > /sys/class/gpio/gpio4/value # set the value to ON
echo 0 > /sys/class/gpio/gpio4/value # set the value to OFF
echo in > /sys/class/gpio/gpio4/direction # set it as input
cat /sys/class/gpio/gpio4/value # get the value
echo 4 > /sys/class/gpio/unexport # disables pin 4 and removes the gpio4 directory

Video

What is the difference between CEA and DMT?

Show preferred resolution:

/opt/vc/bin/tvservice -d /tmp/edid.dat; /opt/vc/bin/edidparser /tmp/edid.dat

Set icon size and font for large screens

Settings -> Appearance Settings -> Defaults -> For large screens

Disable screen blanking

Use raspi-config:

  • Display Options
    • Disable screen blankking

Increase GPU mem

Use raspi-config:

  • Performance options
    • GPU Mem: 256

DRM

Enable sound over HDMI

How to enable sound on HDMI?

Add this to config.boot:

hdmi_group=1
hdmi_drive=2

No HDMI output after a while

How do I force the Raspberry Pi to turn on HDMI?

Add these two lines to /boot/config.txt and reboot Raspbmc:

hdmi_force_hotplug=1
hdmi_drive=2

config.txt docs