Exploring 9 Interesting Applications of Raspberry Pi

Exploring 9 Interesting Applications of Raspberry Pi

Today, people from technical teams around the world will celebrate a very special holiday – Pi Day (π节). March 14 (written as 3/14 in the US) is known as Pi Day, a holiday spent eating pies, having pizza parties, and enjoying math puns. March 14 is also the birthday of Albert Einstein and the anniversary of the release of Linux kernel 1.0.0, and it is also the day Eli Whitney applied for a patent for cotton gin.

Today marks the 30th anniversary of Pi Day. The first celebration was held in 1988 by physicist Larry Shaw at the Exploratorium in San Francisco. “At the first Pi Day, staff brought in fruit pies and teapots for the celebration, and at 1:59 – following the digits of pi – Shaw led a circular parade around the museum, his loudspeaker roaring out the digits of pi to the tune of ‘Pomp and Circumstance.’ It wasn’t until 21 years later, in March 2009, that Pi Day became an official national holiday in the United States.

Although it originated in San Francisco, one of the largest Pi Day celebrations can be found at Princeton University. The town hosts many events during a five-day celebration, including Einstein look-alike contests, a pie-throwing contest, and a pi recitation contest. Some events even offer cash prizes of $314.15 for winners.

Exploring 9 Interesting Applications of Raspberry Pi

It is known that the MIT Sloan School of Management (Twitter @MITSloan) is celebrating Pi Day. Embedded engineers also have a magical tool in pi – the Raspberry Pi. Let’s take a look at some interesting uses of Raspberry Pi.

Exploring 9 Interesting Applications of Raspberry Pi

Media Center

One of the most common uses of the Raspberry Pi at home is running media center software that supports multimedia files on the TV. Setting it up is easy, and the Raspberry Pi offers a lot of GPU (graphics processing unit) capabilities to deliver HD TV shows and movies to your big screen. Kodi (formerly known as XBMC) on Raspberry Pi is a great way to play any media on a hard drive or network-attached storage. You can also install plugins to play YouTube videos.

There are several different options, the most prominent being OSMC (Open Source Media Center) and LibreELEC, both based on Kodi. They perform well in playing media content, but OSMC has a more visually appealing user interface, while LibreElec is lighter. All you need 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’re ready to go.

Exploring 9 Interesting Applications of Raspberry Pi

Exploring 9 Interesting Applications of Raspberry Pi

Exploring 9 Interesting Applications of Raspberry Pi

SSH Gateway

If you want to access computers and devices on your home network from the outside via the Internet, you must open ports on these devices to allow external traffic. Opening internet ports poses security risks, meaning you are always at risk of attacks, abuse, or any unauthorized access. However, if you install a Raspberry Pi on your network and set up port forwarding to allow only SSH access to that Pi, you can use it as a secure gateway to jump to other Pis and PCs on the network.

Most routers allow you to configure port forwarding rules. You need to give your Pi a fixed internal IP address and set port 22 on the router to map to port 22 on the Raspberry Pi. If your ISP provides you with a static IP address, you will be able to use this as the host address for SSH connections (e.g., ssh [email protected]). 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 (e.g., ssh [email protected]).

Exploring 9 Interesting Applications of Raspberry Pi

However, if you expose the Raspberry Pi to the internet, you should be very careful not to put your network at risk. You can follow some simple procedures to ensure it is secure enough:

1. It is recommended to change your login password (this makes sense since the default password ‘raspberry’ is well known), but this won’t prevent brute force attacks. You can change the password and add two-factor authentication (so you need a password and a time-based password generated by your phone) for extra security. However, I think the best way to protect the Raspberry Pi from intruders is to disable ‘password authentication’ in the SSH configuration, so you only allow SSH key access. This means that anyone trying to guess the password to access SSH won’t succeed. Only your private SSH key can gain access. Similarly, most people recommend changing the SSH port from the default 22 to an unexpected one, but a simple Nmap on the IP address will reveal your actual SSH port.

2. Ideally, this Pi won’t have too much impact on other software, so you won’t accidentally expose anything else. If you want to run other software, it may be best to run it on another Pi that is not exposed to the internet. Ensure packages are kept up to date through regular upgrades (especially the openssh-server package) to patch any security vulnerabilities.

3. Install sshblack or fail2ban to blacklist any users that seem to behave maliciously, such as trying to brute force your SSH password.

Once you have secured the Raspberry Pi and put it online, you can log into your network from anywhere in the world. After using the Raspberry Pi, you can connect to other devices on the network using its local IP address (e.g., 192.168.1.31). If you have passwords on these devices, just use the password. If they also only have SSH keys, you need to ensure to forward your keys using the -A flag via SSH: ssh -A [email protected].

Exploring 9 Interesting Applications of Raspberry Pi

Pet Camera

Another interesting project is to set up a camera module to take photos or stream video, capturing and saving files, or streaming internally or uploading to the internet. There are many reasons you might want to do this, but two common use cases are a homemade security camera or monitoring pets.

This Raspberry Pi camera module is a fantastic accessory. It offers full HD photos and video, many advanced configurations, and is easy to program. The infrared camera is suitable for this purpose and includes infrared LEDs, plus night vision capabilities.

If you want to take static images regularly to keep an eye on things, you can write a short Python script or use the command line tool raspistill and schedule it to repeat in Cron. You may want to save them to Dropbox or other web services, upload them to a web server, or even create a web application to display them.

If you want to stream video internally or externally, that’s easy too. A simple MJPEG (Motion JPEG) example is provided in the picamera documentation (under ‘web streaming’). Just download or copy that code into a file, run it, and access the Pi’s IP address on port 8000, and you’ll see the camera output displayed normally.

More advanced streaming projects, like pistreaming, are available, using JSMpeg with a web server and WebSocket for standalone camera stream (a JavaScript video player). This method has higher performance and is just as easy to run as the previous example, but involves more code, and if set up for streaming on the internet, requires opening two ports.

Once you have set up network streaming, you can place the camera wherever you want. I have a setup to keep an eye on my pet turtle:

Exploring 9 Interesting Applications of Raspberry Pi

If you want to control the actual direction the camera points, you can use a servo for control. A neat solution is to use Pimoroni’s Pan-Tilt HAT, which allows you to easily move the camera in two dimensions.

Exploring 9 Interesting Applications of Raspberry Pi

If you want to place your Raspberry Pi outside, you need a waterproof case and some way to get power to the Pi. Power over Ethernet (PoE) cables are a great way to achieve this.

Exploring 9 Interesting Applications of Raspberry Pi

Home Automation and IoT

It’s 2017, and there are internet devices everywhere, especially at home. Our light bulbs have Wi-Fi, our toasters are smarter than ever, and our kettles are at risk of being hacked by Russians. As long as you keep the devices secure, or if you don’t need to connect them to the internet, you can take full advantage of IoT devices to automate tasks in your home.

You can buy or order many services, like the Nest Thermostat or Philips Hue bulbs, which you can control separately via your phone whether you’re at home or away for heating or lighting. You can use Raspberry Pi to enhance the functionality of these types of devices by automating interactions with them based on a set of rules involving timing or even sensors. One thing Philips Hue can’t do is turn on the lights when you enter a room, but using Raspberry Pi and a motion sensor, you can use the Python API to turn on the lights. Similarly, you can configure your Nest to turn on the heating at home, but what if you only want to turn it on if at least two people are home? Write some Python code to check which phones are on the network and if at least two are present; if not, you can do more things without integrating with existing IoT devices and just using simple components. Homemade burglar alarms, automatic chicken coop doors, night lights, music boxes, timed heat lamps, automatic backup servers, print servers, or anything else you can imagine.

Exploring 9 Interesting Applications of Raspberry Pi

Tor Proxy and Ad Blocker

Adafruit’s Onion Pi is a Tor proxy that anonymizes your network traffic, allowing you to browse the internet free from prying eyes and any form of surveillance. Follow Adafruit’s tutorial on setting up Onion Pi for a peaceful anonymous browsing experience.

You can install Raspberry Pi on your network to intercept all network traffic and filter out any ads. Simply download the Pi-hole software onto the Pi, and all devices on your network will be ad-free (it can even block in-app ads on mobile devices).

Exploring 9 Interesting Applications of Raspberry Pi

Brewing Beer with Linux, Python, and Raspberry Pi

Over a decade ago, I started brewing my own beer. Like most homebrewers, I began making extract-based beer in my kitchen. This required minimal equipment and still produced very tasty beer. Eventually, I enhanced my all-grain brewing with a large cooler for my mash tun. For years, I brewed 5 gallons at a time, but brewing 10 gallons takes the same time and effort (and just a bit larger equipment), so I upgraded a few years ago. After moving to 10 gallons, I stumbled upon StrangeBrew Elsinore and realized what I really needed to do was convert the entire system to all-electric and run it with Raspberry Pi.

There is a lot of good information available for building your own all-electric homebrewing system, and most brewers start at TheElectricBrewery.com. Putting together the control panel can get quite complex, although the simplest method is well outlined there. Of course, you can also take a cheaper route and end up with the same results – a boiling kettle and hot water tank powered by heating elements and managed by a PID controller. I think that’s a bit boring (and it also means you don’t get a neat chart of your brewing process).

Hardware

Before I talked about my project, I decided to start buying parts. My basic design is a hot liquor tank (HLT) and a boiling kettle with a 5500w heating element, along with a mash tun with a false bottom. I will use a pump to recirculate the mash through a 50′ stainless steel coil in the HLT (the ‘Heat Exchange Recirculating Mash System’, known as HERMS). I will need a second pump to circulate water in the HLT and help transfer water to the mixing tank. All electrical components will be controlled by Raspberry Pi.

Building my electric brewing system and automating it as much as possible means I will need the following:

  • HLT with 5500w electric heating element

  • HERMS coil (50 feet of 1/2 inch stainless steel) in the HLT

  • Boiling kettle with 5500w electric heating element

  • Multiple solid-state relays to turn heating elements on and off

  • 2 high-temperature food-grade pumps

  • Relays to turn the pumps on and off

  • Fittings and high-temperature silicone tubing

  • Stainless steel ball valves

  • 1-wire temperature probes

  • A lot of wiring

  • Electrical box to house everything

Exploring 9 Interesting Applications of Raspberry Pi

The details of building the electrical system have actually been covered by The Electric Brewery, so I won’t repeat their details. When planning to replace the PID controller with Raspberry Pi, you can read through and follow their advice.

One important thing to note is the signal voltage of solid-state relays (SSR). Many tutorials suggest using SSRs that require a 12-volt signal to turn off the circuit. However, Raspberry Pi GPIO pins only output 3v. Be sure to purchase relays that will trigger at 3 volts.

Exploring 9 Interesting Applications of Raspberry Pi

To run your brewing system, your Pi needs to do two things: sense temperature from several different locations and turn relays on and off to control heating elements. Raspberry Pi can easily handle these tasks.

There are several different ways to connect temperature sensors to the Pi, but I found the most convenient method is to use the 1-Wire bus. This allows multiple sensors to share the same wire (actually three wires), making it a convenient way to detect multiple components in the brew system. If you search online for waterproof DS18B20 temperature sensors, you’ll find many options. I used Hilitchi DS18B20 waterproof temperature sensors in my project.

To control heating elements, Raspberry Pi includes several GPIO (General Purpose Input/Output) pins that can be addressed via software. This allows you to send 3.3v to a relay simply by placing a 1 or 0 in a file. When I first learned how all this worked, the Raspberry Pi-Driving a Relay tutorial was the most helpful to me. GPIO controls multiple solid-state relays to turn heating elements on and off as directed by brewing software.

I first started working on a box to house all the components. Since this will all be on a rolling cart, I wanted it to be relatively portable rather than permanently installed. If I had a place (like in a garage, utility room, or basement), I would install a larger electrical box on the wall. Instead, I found a decent waterproof project box that I expected I could fit everything into. In the end, it turned out to be a bit tight, but it worked out well. In the lower left corner is the Pi with a breakout board to connect the GPIO to the 1-Wire temperature probes and solid-state relays.

To keep the 240v SSR cool, I cut holes in the enclosure and stacked copper washers between them, CPU cooling grease, and mounted heat sinks outside the box. It worked great, and there were no cooling issues inside the box. On the lid, I put two switches for the 120v outlet, plus two 240v LEDs to indicate which heating element is powered. I used dryer plugs and outlets for all connections, so it was easy to disconnect the kettle from all connections. Everything worked perfectly on the first try. (Sketching out a wiring diagram first definitely pays off.)

These images are from the ‘proof of concept’ version – the final production system should have more than two SSRs to switch two legs of the 240v circuit. Another thing I want to switch through software is the pumps. Right now, they are controlled by physical switches on the front of the box, but they could be easily controlled via relays.

Exploring 9 Interesting Applications of Raspberry Pi

Another thing I needed was a bit tricky to find was the compression fittings for the temperature probes. The probes are installed in a T-fitting, just before the valve on the lowest wall of the HLT and mash tun. As long as liquid flows over the temperature sensor, it will be accurate. I wanted to add a thermocouple well in the kettle, but I realized it wouldn’t be useful for my brewing process. Anyway, I bought 1/4″ compression fittings, and they worked perfectly.

Software

Once the hardware was sorted out, I had time to play with the software. I ran the latest Raspbian release on the Pi; there was nothing special about the operating system.

I started using Strangebrew Elsinore brewing software, and when a friend asked if I had heard of Hosehead (a Raspberry Pi-based brewing controller), I discovered this software. I thought Hosehead looked great, but I didn’t want to buy a brewing controller; I wanted to build my own challenge.

Setting up Strangebrew Elsinore was straightforward – the documentation is thorough, and I didn’t run into any issues. Even though Strangebrew Elsinore works great, Java seemed to bog down my first-generation Pi at times, and it crashed on me more than once. I was also disappointed to see development stall, and it seems there aren’t many contributors from a large community (although there are – and many people are still using it).

CraftBeerPi

Then I stumbled upon CraftBeerPI, which is written in Python and has an active community of contributors supporting it. The original author (and current maintainer) Manuel Fritsch is very good at handling contributions and providing feedback on people’s open issues. Cloning the repo and getting started took me just a few minutes. The README has a great example of connecting DS1820 temperature sensors and notes on connecting hardware to the Pi or CHIP computer.

When it starts up, CraftBeerPi guides users through a configuration process that detects available temperature probes and allows you to specify which GPIO pins manage which devices.

Exploring 9 Interesting Applications of Raspberry Pi

Running brew with this system is easy. I can count on it to reliably maintain temperature, and I can input steps for multi-temperature mashing. Using CraftBeerPi made my brewing times a bit boring, but I gladly traded the ‘excitement’ of manually managing a propane burner for the efficiency and consistency of this system.

The user-friendliness of CraftBeerPI inspired me to set up another controller to run a ‘fermentation chamber.’ In my case, this was a second-hand fridge I found for $50 plus a $25 heater inside. CraftBeerPI easily controls cooling and heating elements, and allows me to set multiple temperature steps. For example, the figure shows the fermentation temperature of an IPA I brewed recently. The fermentation chamber keeps the fermenting wort at 67°F for four days, then raises it one degree every 12 hours until it reaches 72°F. This temperature is for a two-day diacetyl rest. After that, it is set to drop to 65F for five days, during which I ‘dry hop’ the beer. Finally, the beer is cold crashed to 38F. CraftBeerPI adds each step, making it easy for the software to manage fermentation.

Exploring 9 Interesting Applications of Raspberry Pi

I have also been experimenting with TILT hydrometers, which monitor the gravity of fermenting beer with a Bluetooth-connected floating sensor. There are some integration plans to allow it to work with CraftBeerPI, but for now, it logs gravity to Google Sheets. Once this hydrometer can communicate with the fermentation controller, it will be easy to set up automatic fermentation profiles that take action based on yeast activity – instead of finishing primary fermentation in four days, you could set a temperature ramp to start when gravity stabilizes for 24 hours.

Like any project of this nature, imaging and planning improvements and other components are easy. Nevertheless, I’m happy with where it stands today. I have brewed a lot of beer with this setup, and each time it has achieved the expected wort efficiency, and the beer has always been delicious. My most important customers – I’m very satisfied with what I have in my kitchen.

Exploring 9 Interesting Applications of Raspberry Pi

Exploring 9 Interesting Applications of Raspberry Pi

Deploying Kubernetes on Raspberry Pi

Exploring 9 Interesting Applications of Raspberry Pi

When I became interested in ARM devices, especially Raspberry Pi, my first project was an OpenVPN server.

By using Raspberry Pi as a secure gateway for my home network, I could control my desktop with my phone and remotely play Spotify, open documents, and other fun things. I used existing tutorials from my first project because I was afraid to type anything in my own command line.

Months later, that fear faded. I expanded my original project and isolated the OpenVPN server with a Samba server. This was my first project where I didn’t follow the tutorial word for word. Unfortunately, at the end of my Samba project, I realized I hadn’t documented anything, so I couldn’t replicate it. To recreate it, I had to reread all the separate guides I used for reference and reassemble the project.

I learned valuable lessons about developer workflows – tracking all changes. I set up a small git repo locally and documented all the commands I entered in the command line.

Discovering Kubernetes

In May 2015, I discovered Linux containers and Kubernetes. With Kubernetes, I thought I could get involved in a concept that was still in development, which was fascinating – I could actually access it. The platform itself and the possibilities it presented were exciting. Until then, I had only run a program on a Raspberry Pi device. With Kubernetes, I could create more advanced configurations than ever before.

At that time, Docker on ARM (v1.6, if I remember correctly) had a bug that made it nearly impossible to run Kubernetes on Raspberry Pi devices. Kubernetes changed rapidly in the early 0.x versions. Whenever I found a guide on setting up Kubernetes on AMD64, it was an old version that was completely incompatible with the version I was using at the time.

Anyway, I tried to create a Kubernetes node on Raspberry Pi, and with the v1.0.1 Kubernetes release, I was able to get it working with Docker v1.7.1. This was the first fully functional way to deploy Kubernetes on ARM.

The advantage of running Kubernetes on Raspberry Pi is that because ARM devices are very small, they don’t consume a lot of power. If built the right way, you can use the same commands for the same program on AMD64. Having a small IoT board creates good opportunities for education. This is also useful for setting up demonstrations you need to travel with, like conferences. Using Raspberry Pi is much easier than dragging (usually) large Intel machines.

ARM binaries are automatically released with Kubernetes. While we don’t yet have an automated CI (Continuous Integration) system for ARM, it automatically ensures that it runs on ARM before PRs are merged, but it runs well currently.

Distributed Networking on Raspberry Pi

I discovered Weave Net through kubeadm. Weave Mesh is an interesting distributed networking solution, so I started reading more about it. In December 2016, I received my first contracting job with Weaveworks. I was part of the internal team supporting Weave Net on ARM.

I was excited about the industrial use cases of running Weave Net on Raspberry Pi, such as factories needing more mobility for their devices. Currently, it may not be possible to deploy Weave Scope or Weave Cloud on Raspberry Pi (although it could be imagined on other ARM devices), as I guess this software requires more available memory to run well. Ideally, with the Raspberry Pi upgrade to 2GB, I think I would be able to successfully launch Weave Cloud.

With the release of Weave Net 1.9, Weave Net supports ARM. Kubeadm (and Kubernetes in general) works across multiple platforms. You can deploy Kubernetes on ARM just like you would on any AMD64 device, installing Docker, kubeadm, kubectl, and kubelet on all machines. Then, use the following command to initialize the host that will run the control plane components:

kubeadm init

Next, use the following command to install the pod network:

kubectl apply -f https://git.io/weave-kube

Previously, you could only install a pod network with Flannel when running on ARM, but since the release of Weave Net 1.9, this version has changed and now officially supports ARM.

Finally, join your nodes:

kubeadm join --token <token> <master-ip>

That’s it! Kubernetes is deployed on your Raspberry Pi device. You don’t need to do anything special compared to running on Intel/AMD64; Weave Net works great on ARM.

Exploring 9 Interesting Applications of Raspberry Pi

Building a Raspberry Pi Voice-Controlled Assistant with Google Accessories

Exploring 9 Interesting Applications of Raspberry Pi

If you want to talk to Raspberry Pi, one of Google’s kits will make that dream come true. Last year, Google launched an accessory that allows Raspberry Pi to use the Google Assistant SDK and Google’s Cloud Speech API to turn Raspberry Pi 3 into a voice-driven digital assistant, adding voice interaction to your projects.

Voice assistants like Google Home (and Amazon’s Echo) are the hottest tech trend, and tech companies are trying to adopt their specific technologies as widely as possible. Considering that over ten million devices have already been sold, encouraging Raspberry Pi tinkerers to adopt Google’s technology would be a huge win, and they are used as the computing power behind many gadgets.

Additionally, the Raspberry Pi Foundation had hinted that Google was planning something for Raspberry Pi, stating that the AI and machine learning technologies of the search and advertising giant could enable makers to build more powerful projects. It is understood that this accessory has now shipped 250,000 units and has added multiple new distributors, “so this accessory will be readily available in the future.”

Exploring 9 Interesting Applications of Raspberry Pi

Google’s New Accessory: AI Vision Kit for Raspberry Pi to Detect Cats, People, and Even Emotions

Exploring 9 Interesting Applications of Raspberry Pi

In addition to launching AI voice accessories, Google has also launched an accessory that gives Raspberry Pi machine vision capabilities. This kit is powered by Google’s TensorFlow machine learning model and will soon come with an Android app to control the device.

According to Google, the Vision Kit features “on-device neural network acceleration” that allows Raspberry Pi-based boxes to perform computer vision without cloud processing. The AIY Voice Kit relies on the cloud for natural language processing.

Makers need to provide their own Raspberry Pi Zero W, Raspberry Pi camera, 4GB SD card, and power supply. The Vision Kit itself includes the VisionBonnet accessory board, cables, cardboard box and frame, lens apparatus, and privacy LEDs to let others know when the camera is on.

The VisionBonnet board was developed by Google and features the Intel Movidius MA2450 vision processing chip. This chip is the secret behind the Vision Kit.

Project team members say the chip is 60 times faster than Raspberry Pi 3 at performing computer vision tasks. The vision kit allows makers to use several neural network programs, the first of which can detect people, cats, and dogs. Another neural network will detect happiness, sadness, and other emotions. There’s also another program based on MobileNets that can detect 1,000 different objects, such as chairs, oranges, or cups.

Google hopes developers can build on these neural networks and apply them to new tasks, such as making the cat/dog/person detector recognize rabbits. To help achieve this, it provides a tool for using TensorFlow to compile and retrain models.

Google suggests using the Vision Kit box to identify various plant and animal species, see when the dog is at the back door, or when a car leaves the driveway, analyze guests’ emotions, or even build a custom home security system.

Exploring 9 Interesting Applications of Raspberry Pi

Conclusion

After seeing so many interesting applications of Raspberry Pi, have you sparked any creative ideas? With machine vision and voice recognition technologies becoming more sophisticated, Raspberry Pi can also play with ‘flowers’. Previously, Embedded ARM also pushed an article on Raspberry Pi 3A+ (Raspberry Pi 3 Model A+): Rise or End? What are your thoughts on Raspberry Pi?

References:

1.Pi Day: 12 fun facts and ways to celebrate

https://enterprisersproject.com/article/2018/3/pi-day-12-fun-facts-and-ways-celebrate

2.Brewing beer with Linux, Python, and Raspberry Pi

https://opensource.com/article/17/7/brewing-beer-python-and-raspberry-pi

3.How to deploy Kubernetes on the Raspberry Pi

https://opensource.com/article/17/3/kubernetes-raspberry-pi

4.Raspberry Pi: This Google kit will turn your Pi into a voice-controlled digital assistant

https://www.zdnet.com/article/raspberry-pi-this-google-kit-will-turn-your-pi-into-a-voice-controlled-digital-assistant/

5.Google offers Raspberry Pi owners this new AI vision kit to spot cats, people, emotions

https://www.zdnet.com/article/google-offers-raspberry-pi-owners-this-new-ai-vision-kit-to-spot-cats-people-emotions/

6.Brewing beer with Linux, Python, and Raspberry Pi

https://opensource.com/article/17/7/brewing-beer-python-and-raspberry-pi

Exploring 9 Interesting Applications of Raspberry Pi

Happy Pi Day!

Leave a Comment