Probably almost every tech geek has a Raspberry Pi at home, and I dare to assume that many people have it, but just storing for vain in a box. But the Raspberry Pi is not only a toy for experiments but also a pretty powerful fanless Linux-based computer. I will show some ways of using the Raspberry Pi, for which there will be no need to write the code at all.
This tutorial is intended for beginners having at least basic concepts of what an IP address is, how to log in to Raspberry Pi console via SSH using putty or any other terminal, and how to edit files with the nano editor. There will be no programming needed at all, just the command line will be enough.
Before we install anything, an important tip: a good power supply (marked as having 2.5A current) and the CPU heatsink are extremely important for the stable operation of the Raspberry Pi. Without this, Raspbian can freeze, different glitches like file copying errors may appear. The insidiousness of such errors is that they occur only occasionally, for example, during the CPU peak load or when large files are being written to the SD card.
Before installing any components, we should update the system, otherwise, the apt-get command may not work:
sudo apt-get update
Now we are ready to use the Raspberry Pi. Let’s get started.
1. WiFi Access Point
It’s easy to turn the Raspberry Pi into a wireless access point, and we don’t have to buy anything, WiFi is already on board. To do this, we will install 2 components: hostapd (Host access point daemon) and dnsmasq (DNS/DHCP server).
sudo apt-get install dnsmasq hostapd
We should set the static IP address that the Raspberry Pi will have in the WiFi network. To do this, edit the dhcpcd.conf file by entering the command sudo nano /etc/dhcpcd.conf.
Add the following lines to the file:
As we can see, in the WiFi network Raspberry Pi will have the address 198.51.100.100 (it is important to remember it, if using some Raspberry Pi based server, this address will need to be entered in the browser).
Next, we must turn on the IP forwarding, for which we execute the sudo nano /etc/sysctl.conf command and uncomment the net.ipv4.ip_forward=1 line. It will allow the system to forward IP packets between Ethernet and WiFi controllers, that allows connected devices to have Internet access.
Now we need to configure a DHCP server — it will distribute IP addresses to connected devices. Enter the command sudo nano /etc/dnsmasq.conf and add the following lines:
As we can see, the connected devices will have IP addresses in the range 198.51.100.1 … 198.51.100.99.
Finally, it’s time to set up Wi-Fi. Let’s edit the /etc/default/hostapd file and enter the line DAEMON_CONF=“/etc/hostapd/hostapd.conf” there (pay attention to quotation marks — they should be not curly like here). Now edit the hostapd.conf file by running the command sudo nano /etc/hostapd/hostapd.conf.
We should enter the parameters of the access point:
It is important to pay attention to the parameters ssid (access point name), wpa_passphrase (password), channel (channel number) and hw_mode (operating mode, a = IEEE 802.11a, 5 GHz, b = IEEE 802.11 b, 2.4 GHz, g = IEEE 802.11g, 2.4 GHz). Unfortunately, there is no automatic channel selection, so we have to choose the least busy WiFi channel.
Important: in this test example, the password 12345678 is used, in a real access point it’s better to use something more complicated. Such a simple password easily can be cracked. Well, using the WiFi network with a too simple password can be dangerous.
Now everything is ready, we can activate all services.
sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd
sudo systemctl reload dnsmasq
Now we should get the new WiFi Access Point turned on. But for the Internet to appear on it, we need to activate the packet forwarding from Ethernet to WLAN, for which we enter the sudo nano /etc/rc.local command and add the iptables configuration line:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
That’s it. Let’s reboot the Raspberry Pi, and if everything was done correctly, we can see the access point and connect to it.
As we can see, the speed is not so bad, and this WiFi can be used.
By the way, a small hint: you can change the network name of the Raspberry Pi by running the sudo raspi-config command. By default, it is (surprise:) raspberrypi. This is probably well known. However, not everyone knows that this name is also available on the local network, you only need to add “.local” to it. For example, you can log in to Raspberry Pi via SSH by entering putty email@example.com. This works on Windows and Linux, but does not work on Android — you still have to enter the IP address manually there.
2. Media Server
There is a 1001 way to make a media server on the Raspberry Pi, I will consider only the simplest. Let’s say we have our favourite collection of MP3 files, and we want it to be available on the home network for all media devices. We will put a MiniDLNA server on the Raspberry Pi, which can do this for us.
To install the server, enter command sudo apt-get install minidlna. Then we need to configure the config by entering command sudo nano /etc/minidlna.conf. There we need to add only one line indicating the path to our files: media_dir = /home/pi/MP3 (the path itself, of course, can be different). After closing the file, restart the service using command sudo systemctl restart minidlna.
If we did everything right, we will get a ready-to-use media server on the local network, from which you can play music through the desktop WiFi radio or through the VLC-Player in Android:
The tip: downloading files to the Raspberry Pi is very convenient using WinSCP — this program makes working with Raspbian folders as easy as local ones.
3. SDR-based Radio Receiver
If we have an RTL-SDR or SDRPlay radio receiver, we can use it on the Raspberry Pi using the GQRX or CubicSDR program. This will allow having a standalone silent and fanless SDR receiver that can work even 24h per day.
My apologies for the quality of the screenshot from the TV screen:
Using RTL-SDR or SDRPlay, it is possible to receive various radio signals with a frequency of up to 1 GHz (even slightly higher). You can listen not only to ordinary FM radio, but also communication between pilots and ground services. Using CubicSDR, WSJT and virtual audio cable, ham radio enthusiasts can receive, decode and send WSPR and other digital mode signals statistics to the server.
4. Home Automation/Smart Home Server
Those who want to make their home “smarter” can use the free OpenHAB application.
Image source: https://community.openhab.org/
This is not even just an application, but a whole framework that has various plugins, scripts that allow controlling various devices (Z-Wave, Philips Hue, etc.). Those who interested can visit the https://www.openhab.org webpage.
By the way, since we are talking about a “smart home”, an MQTT server can also work on the Raspberry Pi.
5. FlightRadar24 Client
If you are an aviation enthusiast and live in a region where FlightRadar coverage is not perfect, you can help the community and all travellers by installing the FlightRadar24 receiver. All you need is an RTL-SDR receiver (price about 30$) and a Raspberry Pi. As a bonus, after installing the receiver you get free access to the FlightRadar24 Pro account and features.
The manual can be found on the FlightRadar24 website.
Of course, not all possible features are listed here. The Raspberry Pi has good computing power and can be used in completely different tasks — as a retro-game console, video surveillance device, VPN server, car license plates recognition service or even as an astronomical all-sky camera controller. By the way, what is written here is relevant not only for the Raspberry Pi but also for other SBC (Asus Tinkerboard, Nano Pi, etc.).
I wish all readers successful experiments.
If the article’s rating will be positive, the second part will be published.