12,285
edits
(19 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
The Raspberry Pi is an inexpensive Linux computer which you can for example use to play back videos (up to | The Raspberry Pi is an inexpensive Linux computer which you can for example use to play back videos (up to Full-HD). This page shows you how to set it up: | ||
== Making the RapberryPi run a video at startup == | == Making the RapberryPi run a video at startup == | ||
=== Prepare the system === | === Prepare the system === | ||
Install The Raspbian image (NOOBS is okay for the beginning, but it wastes a bit space on the SDcard for the recovery image which we don't need. [http://elinux.org/RPi_Easy_SD_Card_Setup Copy the raspbian on the card]. | Get a [http://elinux.org/RPi_SD_cards compatible and proven] SD Card (make sure it is not a knock-off). Install The Raspbian image (NOOBS is okay for the beginning, but it wastes a bit space on the SDcard for the recovery image which we don't need. [http://elinux.org/RPi_Easy_SD_Card_Setup Copy the raspbian on the card]. Read about [[#SD Card corruption issues]] to avoid those. | ||
Once that is done, connect to the Internet (Ethernet + DHCP) and bring the OS up to date: | Once that is done, connect to the Internet (Ethernet + DHCP) and bring the OS up to date: | ||
Line 11: | Line 11: | ||
sudo apt-get install raspberrypi-net-mods | sudo apt-get install raspberrypi-net-mods | ||
Then while we are at it we might want to check if the firmwarware is up to date too. "Firmware" is a bit confusing in this context as the raspberry apparently has no bios sitting on some chip, but all that "Firmware" is part of the stuff on the SD card. ([http://raspberrypiguide.de/howtos/raspberry-pi-firmware-update/ Source]) | |||
=== Setup | uname -a | ||
Will let us see the current version. Then there is a script we can run to update it. | |||
sudo apt-get install git | |||
wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update | |||
sudo rpi-update | |||
Optional: If you need every little bit of space of the memory card you may want to remove some software and example content to free some memory. | |||
sudo apt-get purge --auto-remove sonic-pi scratch squeak-vm idle idle3 timidity wolfram-engine python-pygame penguinspuzzle dillo pistore | |||
After all this we should re-boot | |||
sudo reboot | |||
=== Setup video playback === | |||
Test video playback: [http://www.raspberrypi.org/documentation/usage/video/README.md source] | Test video playback: [http://www.raspberrypi.org/documentation/usage/video/README.md source] | ||
Line 23: | Line 36: | ||
omxplayer -r /opt/vc/src/hello_pi/hello_video/test.h264 | omxplayer -r /opt/vc/src/hello_pi/hello_video/test.h264 | ||
make a file startup_script.sh (shell script) with the following content: | make a file startup_script.sh (shell script) | ||
touch startup_script.sh | |||
nano startup_script.sh | |||
with the following content: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 36: | Line 54: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
sudo shutdown -h +540 will shut the Raspberry down in 9 hours. You will have to make the file executable with | sudo shutdown -h +540 will shut the Raspberry down in 9 hours. | ||
You will have to make the file executable with | |||
sudo chmod 775 startup_script.sh | sudo chmod 775 startup_script.sh | ||
Line 67: | Line 87: | ||
Make it start the script automatically: | Make it start the script automatically: | ||
sudo nano .bashrc | sudo nano .bashrc | ||
and right at the end put: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
if [ $(tty) == /dev/tty1 ]; then | if [ $(tty) == /dev/tty1 ]; then | ||
./startup_script.sh | ./startup_script.sh | ||
Line 89: | Line 109: | ||
==Synchronizing multiple RaspberryPi== | ==Synchronizing multiple RaspberryPi== | ||
maybe you want to | maybe you want to give the different Pi different host names, so you don't get confused. Do it in the config utility: | ||
sudo raspi-config | sudo raspi-config | ||
Line 125: | Line 145: | ||
omxplayer-sync -lubv synctest.mp4 | omxplayer-sync -lubv synctest.mp4 | ||
-b flag to make screen background black | -b flag to make screen background black. (Remove -v for verbose mode later once everything works) | ||
Note: You can use the startup_script above to do this, just replace the omxplayer command with the omxplayer-sync command from here. | |||
==Timing== | ==Timing== | ||
Line 138: | Line 158: | ||
The shutdown command has a timer built in, so when it is called like this | The shutdown command has a timer built in, so when it is called like this | ||
sudo shutdown -h 15:00 | sudo shutdown -h 15:00 | ||
the system will shut down at three in the | the system will shut down at three in the afternoon. | ||
sudo shutdown -h +30 | sudo shutdown -h +30 | ||
will shut the system down in 30 minutes from now. | will shut the system down in 30 minutes from now. | ||
Line 150: | Line 170: | ||
[https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=59520 source] | [https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=59520 source] | ||
==SD Card corruption issues== | |||
It's a common problem when working with the Raspberry that the SD Card is getting corrupted and a boot fails. This is caused by not properly shutting down but cutting the power instead. When the raspberry is writing files to the scdard while the power is cut, the risk of SD Card corruption is high. | |||
===How to minimize the risk of SD Card corruption=== | |||
* Also read: [https://learn.adafruit.com/read-only-raspberry-pi read-only-raspberry-pi] | |||
* Make sure it is a proven, compatible and non-fake SD Card | |||
* A faster card may be more stable (shorter time to write - less times when it is dangerous when a power loss happens | |||
* Never plug the cable, leave Raspberry always on | |||
* Always shut down properly | |||
* Equip Raspberry with a battery pack | |||
* Use a read only file system | |||
* Consider AlpineLinux instead of Raspbian | |||
==Backup and copy== | ==Backup and copy== |