raspiLast update: Tue Nov 28 13:33:18 2023
Official documentation : http://elinux.org/R-Pi_Hub
- Lots of tutorials : http://elinux.org/RPi_Tutorials
- Troubleshooting commands : http://elinux.org/RPI_vcgencmd_usage
Projects and tips
Startup setup
- With the config tool: expand the disk size, set 16MB for the GPU, set the locale to something en_US.UTF8, change pi default password
- Minimal tools:
- sudo apt-get install emacs-nox
- Change machine name : see here
- Change SSH port: see here and here
- Router:
- IP reservation to the Pi mac
Install the OS image on SD card from Linux
Get it at https://www.raspberrypi.org/downloads/raspbian/ and then:
sudo dd bs=4M if=retropie-xxxxxxxxxxx.img of=/dev/sde conv=fsync status=progress
To enable the SSH from first boot (meaning working directly headless), do that:
After copying, got to the /boot partition
Create an empty file named 'ssh'
Done, the file will be used as a flag for the first boot and enable ssh.
Since release of 2022-04-04 the "pi" default user is gone so you have to add it yourself! RTFM here.
To setup wifi on first boot, do that:
In the SD card /boot
Make a 'wpa_supplicant.conf' file with contents:
country=JP
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="YOUR WIFI SSID"
psk="YOUR PASSWORD"
key_mgmt=WPA-PSK
}
Change hostname
Edit the 2 files /etc/hostname and /etc/hosts .
Raspi web server with Flask
Use Flask
install with sudo pip install flask
Very good manual http://mattrichardson.com/Raspberry-Pi-Flask/
Raspi as a cloud [DONE!]
Raspi as DLNA server [DONE!]
#edit
sudo vim /etc/minidlna.conf
#restart the service after changes
sudo service minidlna force-reload
Raspi file share SAMBA [DONE!]
http://pihomeserver.wordpress.com/2012/12/09/raspberry-pi-home-server-etape-10-installer-samba/ ← the one I used
https://eltechs.com/raspberry-pi-nas-guide/
#edit
sudo vim /etc/samba/smb.conf
#restart the service after changes
sudo /etc/init.d/samba restart
Raspi mount a USB drive [DONE!]
Edit /etc/fstab
/dev/sda1 /media/usbhdd ntfs-3g rw,defaults,uid=smbuser,gid=smbuser 0 0
Or on the command line:
$ sudo mount -t ntfs-3g -o "rw,defaults,uid=smbuser,gid=smbuser" /dev/sdb1 /mnt/usbdrive02
Stop the HDD
Is used hdparm and it works though with my Japanese Buffalo 1TB USB HDD I get an error when running the command. So for the next time I check and I wonder (like today): it's normal, just ignore the error, it works.
How to:
Install hdparm sudo apt-get install hdparm
You can use 2 ways: ① change the spindown timeout with the -S xxx (with timeout = 5sec * xxx) or ② change the power management settings with -B 127 (or whatever value, just use man)
For my part I use the -S 180 to put the spindown timeout every 15 mins (more tricky than that but in my case), which so far is a good compromise for me
Make it permanent by editing /etc/rc.local
#start the command to stop the USB drive after x-minutes
#-S 180 = 180 x 5sec = 15 min of inactivity and drive stops motor
#see man hdparm for that parameter, it's tricky
#AVI20170219 Juste un reminder: ca lance des erreurs mais ca marche quand meme
/sbin/hdparm -S 180 /dev/sda1
Links:
Raspi as VLC server
Transform a Raspi in an arcade cabinet
Setup DNS cache service
See DNS server at home.
Extend the SD life : use a /tmp in RAM
Plenty of sources but in a nutshell:
In /etc/fstab add the below ↓ line and reboot to get a maximum 150MB /tmp in RAM (only the really used amount of mem is consumed, not a reservation like a malloc):
tmpfs /tmp tmpfs defaults,noatime,nosuid,nodev,noexec,mode=1777,size=150M 0 0
Pygame and Graphics without X
Install with sudo apt-get install python-pygame
Cours:
http://betteros.org/tut/graphics1.php
http://inventwithpython.com/pygame/chapters/
Raspberry Pi Hardware
Hardware details
List of test points and usage
http://www.raspberrypi.org/forums/viewtopic.php?f=28&t=89522
PP1 5V from micro-USB
PP2 5V from micro-USB
PP3 GND
PP4 GND
PP5 GND
PP6 GND
PP7 5V after polyfuse
PP8 3V3
PP9 1V8
PP10 Goes from 3V3 to 2V on brownout
PP11 DAC_2V5 (for composite video DAC)
PP12 AUD_2V5 (for PWM audio drivers)
PP13 Goes from 3V3 to 2V on ACT activity
PP14 SD_CLK
PP15 SD_CMD
PP16 SD_DAT0
PP17 SD_DAT1
PP18 SD_DAT2
PP19 SD_DAT13
PP20 H5V
|
PP21 RUN signal (reset)
PP22 Goes from 3V3 to 2V on activity of green (link) ethernet jack LED
PP23 Goes from 3V3 to 2V on activity of yellow (speed) ethernet jack LED
PP24 COMPVID
PP25 AUDIO_L
PP26 AUDI_R
PP27 VBUS (USB 5V power)
PP28 ETH_CLK (25.000 MHz)
PP29 VC_TMS
PP30 VC_TRST_N
PP31 VC_CLK
PP32 VC_TDI
PP33 VC_TDO
PP34 GND
PP35 GPIO6 of LAN9514
PP36 GPIO7 of LAN9514
PP37 CAM_GPIO0
PP38 CAM_GPIO1
PP39 SCL0
PP40 SDA0
|
Raspberry Pi and a 3.5 Inch LCD screen
Setup of 3.5 Inch LCD
Ok all pages disappeared (June2020), so after a small seach it's a Waveshare 3.5 inches.
- git clone https://github.com/waveshare/LCD-show.git
- sudo ./LCD35-show
- Thats all (it might fail on the xinput calibrator but ignore this)
Things to remember
- Device is a Framebuffer at /dev/fb1
- "To change the blanking of the screen on console just append the line consoleblank=0 to the /boot/cmdline.txt and restart!" (source)
- fbset tool for getting details
- There's a python lib named FbPy, and she doesn't work from the start so:
- sudo apt-get install python-dev libffi-dev
- sudo pip install cython
- sudo pip install numpy
- export CFLAGS=-I/usr/local/lib/python2.7/dist-packages/numpy/core/include/
- sudo pip install cffi
- sudo pip install JACK-client
- pip install fbpy
Other resources
One how to setup. Is it the good one? http://www.circuitbasics.com/setup-lcd-touchscreen-raspberry-pi/
http://www.circuitbasics.com/setup-lcd-touchscreen-raspberry-pi/
http://en.kedei.net/raspberry/raspberry.html
Typical touchscreen chip that Raspi knows: ads7846
another driver that looks like the official in fact :/ : https://github.com/notro/fbtft
Raspberry Pi 3
Bought April 2016, here's the different steps I used to set it up.
sudo raspi-config : extand the disk space, change hostname, make graphic memory 16 (min), change local, wifi country
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install emacs-nox htop python-setuptools
⇒ install emacs without X modules, htop, python's easy_install so you can get pip tool
sudo easy_install pip
⇒ install python's pip tool
setup the wifi https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md
Turn a Raspi in a Jukebox
http://lifehacker.com/how-to-build-a-raspberry-pi-jukebox-any-non-geek-can-us-1712107103
|