
The Raspberry Pi computer can be used for various setups for different purposes. It clearly has a place in the educational market, helping students learn programming and maker skills in classrooms and maker spaces, and it has numerous industrial applications in workplaces and factories. I intend to introduce five projects you might want to build at home.
Media Center
People often use the Raspberry Pi as a media center to serve multimedia files at home. It is easy to set up, and the Raspberry Pi provides a lot of GPU (graphics processing unit) power to render your HD TV shows and movies on a large screen TV. Running Kodi (formerly XBMC) on the Raspberry Pi is a great way to play any media on your hard drive or network storage. You can also install a plugin to play YouTube videos.
There are several slightly different options, the most common being OSMC (Open Source Media Center) and LibreELEC, both based on Kodi. They perform very well in streaming media content, but OSMC has a cooler user interface while LibreElec is more lightweight. All you have to do is choose a distribution, download the image, and install it on an SD card (or just use NOOBS), boot it up, and you are ready to go.
LibreElec; Raspberry Pi Foundation, CC BY-SA
OSMC.tv, Copyright, Used by Permission
Before proceeding, you need to decide which Raspberry Pi to use. These distributions can run on any Raspberry Pi (1, 2, 3, or Zero), and video playback is capable on any of these Raspberry Pis. The only noticeable difference is the responsiveness of the user interface, which is faster on the Pi 3 (and Zero W) due to its built-in Wi-Fi. The Pi 2 is also not too slow, so if you don’t need Wi-Fi, it will suffice, but you will notice that the Pi 3 performs better than the Pi 1 and Zero when switching menus.
SSH Gateway
If you want to access your home network’s computers and devices from an external network, you must open the ports on these devices to allow external access. Opening these ports on the internet poses security risks, meaning you are always at risk of being attacked, abused, or subjected to various unauthorized accesses. However, if you install a Raspberry Pi on your network and set up port mapping to only allow access to the Raspberry Pi via SSH, you can use it as a secure gateway to jump to other Raspberry Pis and PCs on the network.
Most routers allow you to configure port mapping rules. You need to give your Raspberry Pi a static internal IP address to set your router to map port 22 to your Raspberry Pi’s port 22. If your internet service provider gives you a static IP address, you can access it via SSH using the host’s IP address (for example, ssh pi@123.45.56.78
). If you have a domain name, you can configure a subdomain to point to this IP address, so you don’t have to remember it (for example, ssh pi@home.mydomain.com
).
However, if you do not want to expose the Raspberry Pi to the internet, you should be very careful not to put your network at risk. If you follow some simple steps to make it more secure:
openssh-server
package, so your security vulnerabilities are patched.Once you make the Raspberry Pi secure and bring it online, you will be able to log into your network from anywhere in the world. Once you log into your Raspberry Pi, you can access local network addresses (e.g., 192.168.1.31) of other devices using SSH. If you have passwords on these devices, use those passwords. If they also only allow SSH keys, you need to ensure your keys are forwarded via SSH, using the -A
parameter: ssh -A pi@123.45.67.89
.
CCTV / Pet Camera
Another great home project is to install a camera module to take pictures and record videos, saving files and streaming them over the internal or external network. There are many reasons to do this, but two common scenarios are a home security camera or monitoring your pets.
The Raspberry Pi camera module is an excellent accessory. It provides full HD photos and videos, including many advanced configurations, and is easy to program. An infrared camera is ideal for this purpose, allowing you to see in the dark through an infrared LED (which the Raspberry Pi can control).
If you want to take static images at certain intervals to keep an eye on something, you can simply write a short Python script or use the command line tool raspistill, scheduling it to run multiple times in Cron. You might want to save them to Dropbox or another online service, upload them to a web server, or even create a web application to display them.
If you want to stream video over the internal or external network, that is quite simple as well. In the picamera documentation (in the “web streaming” section), there is a simple MJPEG (Motion JPEG) example. Just download or copy the code into a file, run it, and access port 8000 on the Raspberry Pi’s IP address to see your camera’s live output.
A more advanced streaming project, pistreaming, can also be used, which utilizes JSMpeg (a JavaScript video player) and a separate running websocket for camera streaming in the web server. This method performs better and is just as simple as the previous example, but it requires more code to stream over the internet and you need to open two ports.
Once your network stream is established, you can place your camera wherever you want. I use one to watch my pet turtle:
Ben Nuttall, CC BY-SA
If you want to control the camera’s position, you can use a servo. An elegant solution is to use Pimoroni’s Pan-Tilt HAT, which allows you to easily move the camera in two-dimensional directions. To integrate with pistreaming, check out the pantilthat branch of the project.
Pimoroni.com, Copyright, Used by Permission
If you want to place your Raspberry Pi outdoors, you will need a waterproof enclosure and a way to power the Raspberry Pi. POE (Power Over Ethernet) cables are a good implementation.
Home Automation or IoT
Now in 2017 (LCTT note: this article was published at this time), there are many IoT devices everywhere, especially in homes. Our lights have Wi-Fi, our toasters are smarter than ever, and our kettles are at risk of Russian attacks. Unless you ensure your devices are secure, don’t connect unnecessary devices to the internet, and then you can fully utilize IoT devices at home to accomplish automation tasks.
There are many services on the market that you can buy or subscribe to, like Nest Thermostats or Philips Hue light bulbs, allowing you to control your temperature or brightness from your phone, whether you are home or not. You can use a Raspberry Pi to power these devices through a series of rules including time or even sensors for automated interactions. With Philips Hue, you cannot turn on the lights when you enter the room, but with a Raspberry Pi and a motion sensor, you can use the Python API to turn on the lights. Similarly, while you can configure your Nest to turn on the heating when you are home, what if you want it to turn on only when at least two people are in the room? Write some Python code to check which phones are on the network, and if at least two are present, tell Nest to turn on the heater.
You don’t have to choose to integrate existing IoT devices; you can do more with simple components. A homemade burglar alarm, an automated chicken coop door, a night light, a music box, a timed heating lamp, an automated backup server, a print server, or anything else you can think of.
Tor Protocol and Ad Blocking
Adafruit’s Onion Pi is a Tor protocol to anonymize your network communications, allowing you to use the internet without worrying about prying eyes and various forms of surveillance. Follow Adafruit’s guide to set up Onion Pi, and you will find a comfortable anonymous browsing experience.
Onion-pi from Adafruit, Copyright, Used by Permission
Pi-hole
You can install a Raspberry Pi on your network to intercept all network traffic and filter out all ads. Simply download the Pi-hole software to the Pi, and all devices on your network will be ad-free (even blocking ads in your mobile device applications).
The Raspberry Pi has many uses at home. What do you use your Raspberry Pi for at home? What do you want to do with it?
Let us know in the comments below.
via: https://opensource.com/article/17/4/5-projects-raspberry-pi-home
Author: Ben Nuttall Topic: lujun9972 Translator: warmfrog Proofreader: wxy
This article is a LCTT original translation, proudly presented by Linux China
