Creating a Raspberry Pi Pandora Player with Remote Web Control

In our last article, we learned how to control a Raspberry Pi from a mobile device and, as a bonus, we created a menu to make it even easier to issue commands and control our Pi. We’re back today to put that remote menu to good use because we’re building an amazing Pandora music player we can connect to a stereo in our living room, for example, without a monitor, keyboard, or mouse. Our system will include a web interface served through Node.js so we can control our Pandora player remotely from a mobile phone—all from the comfort of our couch. 🙂 Follow along with me and let’s make this happen! Read More

Share
Install Redis on a Raspberry Pi using Docker

How to install Redis on a Raspberry Pi using Docker

I’m a big fan of Redis, a fast in-memory database that persists on disk, and I’ve previously written a Guide to Using Redis with Node.js which provides a fairly comprehensive overview of using Redis from the command line and using it in conjunction with Node.js.
With the introduction of the new Stream data type in Redis 5.0, I decided it was time to get the new Redis 5.0 bits up and running on my Raspberry Pi as Redis Streams looked like it could be useful in a number of IoT scenarios.

I updated my Raspbian package list using “sudo apt update” and, much to my chagrin, the most recent version of Redis available was Redis 3.2.6 which was almost two years old. Since the Raspbian package repository follows the LTS (long term support) Debian releases, the packages available are conservative and stable, but often dated.

How did I solve this dilemma and install the latest version of Redis given the obsolescing packages housed in Raspbian repository? My ship ⛵️ came in with Docker!😀 In this article, we learn how to install Redis on a Raspberry Pi using Docker. Using Docker provides many benefits including the ability to install the latest releases of Redis long before they are available in the Raspbian package repository—without the need to compile the Redis source code ourselves.

Share
Node file watching

How to Watch for Files Changes in Node.js

In a previous article on counting unique items in a JavaScript array, I introduced you to the system I am creating that enables our family to log when the fish 🐟 in our aquarium have been fed. The feeding times are logged to a file by pressing a push-button on a circuit board connected to a Raspberry Pi, pressing an Amazon Dash button, or clicking a button through a web interface. The resulting log file looks like this: 2018-5-21 19:06:48|circuit board 2018-5-21 10:11:22|dash button 2018-5-20 11:46:54|web Our next challenge is to watch this log file for changes as button pushes are streamed in from one of our three sources (Amazon Read More

Share
Node.js Handlebars

Learn Handlebars with Node.js and Help Freddy’s Fish Too

Our friend Freddy Fishman needs our help. He recently launched an aquaponics business to raise fish 🐟 and cultivate underwater plants, and he needs a real-time report to ensure the environmental conditions of his fish tanks are optimized so both his fish and plants can thrive. Another friend of his wired up some Arduino-based fish tank sensors and created a data stream that flows to a local JSON file; therefore, the data foundation is already in place. Can we help Freddy and his fish farm? I think we’re up for the task! We’ll help Freddy and we’ll help ourselves as we learn how to use Handlebars, a templating library that Read More

Share
toml files

Using TOML Config Files in Your Node.js Applications

In this article, we’ll learn how to use TOML, a rising star ⭐in the configuration file world, with Node.js. After reading this article, you will understand the TOML syntax including how to use it to model JavaScript objects in your Node applications. After recently finishing my tutorial on Using INI Files with Node.js, I stumbled across the TOML configuration file format when conducting some focused learning on Rust. It turns out that Cargo, Rust’s package manager, uses TOML for its Cargo.toml configuration file, which serves in a similar capacity to the package.json file used by npm with Node. I excitedly delved into TOML and to learn more, and emerged quite Read More

Share
Raspbian Lite

Create a Lightweight Raspberry Pi System with Raspbian Lite

In this tutorial, we’re going to build a highly optimized Raspberry Pi system that runs very lean on resources with the help of Raspbian Lite.  Whereas a baseline Raspbian system consumes around 158 MB of RAM, Raspbian Lite runs at a mere 34 MB.  To achieve this lighter weight footprint, we must give up the graphical user interface (GUI); however, we’ll include steps in the build (and tips) to help us work productively without a GUI. This guide follows the same flow as my popular Beginner’s Guide to Installing Node.js on a Raspberry Pi, and I recommend that you use that guide if you are a beginner or if you simply Read More

Share
VS Code Syntax Highlighting

How to Copy Visual Studio Code with Syntax Highlighting to Other Applications

In this article, we learn how to copy from Visual Studio Code with color syntax highlighting to various other applications including Word, PowerPoint, Outlook, OneNote, and Gmail to achieve beautiful, clear code samples for documentation, presentations, and general communication. This will prove useful whether you are using JavaScript, JSON, HTML, CSS, TypeScript, Markdown, C++, Java, PHP, Python, Go, T-SQL, XML, C# or a host of other languages and data formats that Visual Studio Code supports. How is this accomplished? It’s very simple! When you are in VS Code copy your selected code to the clipboard, VS Code brings the color syntax formatting along for the ride so the formatted text Read More

Share

Controlling a Raspberry Pi from a Mobile Device with Bonus Menu Too

In my Beginner’s Guide to Installing Node.js on a Raspberry Pi, I equipped you with the knowledge needed to build an awesome Raspberry Pi system that could also run in a headless mode. We’re able to avoid a dedicated monitor, keyboard, and mouse, and this opens a whole new world of possibilities! This brings us to today’s scenario: you’ve deployed your headless Raspberry Pi in the living room and connected it to your speaker system, soaking in the full stereo sound of your favorite music using pianobar, the console-based Pandora player. It’s eventually time for bed and you’re tired. Should you yank the power cord on your Raspberry Pi and Read More

Share

Node.js: Playing Sounds to Provide Notifications

In a previous tutorial, we learned how to send email notifications Using Nodemailer and Gmail. In today’s session, we will learn how to play sounds using Node.js. As a bonus, we will learn how to continue to play a sound until our notification has been acknowledged by pressing a key on the keyboard. How does that sound? 🙂 Enough bad puns! 🙂 Let’s get started!

Share

Node.js: Sending Email Notifications Using Nodemailer and Gmail

We all want to be in the loop and notified when certain events occur within our Node.js programs. For example, email notifications can be very important for creating situational awareness with IoT systems we develop that interact with our physical world. Email communication can be used to deliver messages to our inboxes as well as to deliver text messages in order to enable us to take more immediate action. In today’s tutorial, we’ll walk through the steps of using the amazing Nodemailer package which has become the de facto standard for sending email messages in the Node.js world. Let’s get started so we can start seeing our own custom messages Read More

Share