Upgrading to more recent versions of Node.js on the Raspberry Pi

upgrading nodejs

I’ve received questions from readers of my Beginner’s Guide to Installing Node.js on a Raspberry Pi wanting to know how to upgrade to more recent versions of Node.js on the Raspberry Pi.  The steps are quite easy and can be adapted to other Debian variants as well including Ubuntu.  I’m assuming you followed the steps in my Beginners’ Guide, especially under the “Install Node.js” section where we update the Raspbian/Debian package repository to include the Node.js binaries provided by NodeSource.  Let’s get started! Continue reading

Share

Beginner’s Guide to Installing Node.js on a Raspberry Pi

Learning through Making (LTM) logo

This article has been updated to cover the installation of the latest version of Node at the time of this writing which is Node 7.x.

In this installment of our LTM (Learning through Making) series of Node.js tutorials, we’re going to get Node up and running on a Raspberry Pi 3 or Pi 2. With the Raspberry Pi 3, you won’t need to buy a separate USB Wi-Fi adapter. I’m focusing on the Raspberry Pi 3/Pi 2 rather than older versions such as the Raspberry Pi B+ since these are the latest models at the time of this writing.  The Raspberry Pi 3, for example, sports a 1.2 GHz quad-core ARMv8 chip with 1 GB of RAM versus the Raspberry Pi 1 Model B+’s 700 MHz single-core ARMv6 chip with 512 MB RAM.

The instructions provided here are for installing Node.js on a Pi 3 (ARMv8) or Pi 2 (ARMv7) rather than other models based on the ARMv6 chip such as the Raspberry Pi 1 Model B, Raspberry Pi Model B+ or the Raspberry Pi Zero.  A majority of this installation guide should still prove useful for other Raspberry Pi systems besides the Pi 3 and Pi 2; however, the final steps focused on the installation of Node.js will not work for these systems based on the older ARMv6 architecture.

This tutorial is useful for anyone wishing to successfully install a Raspberry Pi 3/Pi 2 system, even if they are not interested in Node.js since the Node.js installation happens in the final steps of the tutorial.  But, why would you not want to install Node.js? 🙂  Let’s get started! Continue reading

Share

How to Install or Upgrade to Node.js v7 on the Raspberry Pi

node.js logoIt’s here! The Node.js Foundation has released version 7 of Node.js, an open-source, cross platform JavaScript runtime environment. Node.js provides an event-driven architecture capable of asynchronous I/O and allows us to build a gamut of software from highly scalable networked applications to CLI (Command-line Interface) applications. It’s a great fit for building IoT systems, and there’s never been a better time to get in the Node game with the Raspberry Pi!

Our friends at NodeSource host a package repository that makes installing and maintaining Node on the Raspberry Pi easy.  Keep reading to learn how to get started. Continue reading

Share

Node.js: Sending Email Notifications Using Nodemailer and Gmail

Nodemailer

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 flow to our inbox! Continue reading

Share

Connecting a Raspberry Pi Using an Ethernet Crossover Cable and Internet Connection Sharing

raspi-crossover
I’m preparing for an upcoming speaking engagement around the topic of using Node.js and the Raspberry Pi for IoT applications. While at home, I enjoy the luxury of being the owner of my network which provides complete freedom in network configuration. On the road, I will not have this luxury whether it is at a hotel or when speaking at the conference.

Raspberry PiHere’s the problem I am trying to solve. While on the road, I want to be able to connect my laptop to the Wi-Fi hotspot on my phone rather than utilizing the wireless network at the conference location which might be fraught with both security and reliability issues. I also want to be able to get my Raspberry Pi system on the Internet. Additionally, I need my Raspberry Pi and my laptop to reside on the same network so I can easily connect and share files back and forth. Finally, I need this to be easy and foolproof so I’m not sweating on stage and trying to tweak Raspbian network configuration settings in order to establish network connectivity.

How about you? You might also have a similar need if you are seeking to get your Raspberry Pi on the Internet at a hotel, university, or other venue such as a conference. I’m going to show you how you can get your Raspberry Pi on the network when you are not connected to your home network using an Ethernet crossover cable.

I have read a lot of guides on the Internet, but they involve way too many steps. Surely there must be a better way that requires minimal fuss? Absolutely! Let’s get started! Continue reading

Share

Getting Started with YAML in Node.js using js-yaml

YAML

In this tutorial, we harness the power of YAML for use within Node.js. As described on the official YAML site, YAML (YAML Ain’t Markup Language) is a “human friendly data serialization standard for all programming languages”. YAML and JSON are closely related. In fact, all JSON syntax is valid YAML as of the YAML 1.2 spec, but not all YAML syntax is valid JSON. YAML is a superset of JSON. Continue reading

Share

Node.js IoT: Logging Data That Is Out of This World

IoT loggingThe ability to log data is an important capability in IoT applications. In this tutorial, we learn how to use Node.js to log data by utilizing built-in Node modules. There are certainly excellent logging modules available including pino and Winston (see my Winston tutorial here); however, our goal today is to deepen our knowledge of Node by implementing some simple logging code ourselves in order to become better Node developers. Continue reading

Share

Making Interactive Node.js Console Apps That Listen for Keypress Events

keypress

In preparing for an upcoming Node.js IoT tutorial focused on creating notifications based on sensor values (for example, audible alerts), I wave of brilliance came over me. 🙂  Wouldn’t it be awesome if these notifications could be interactively acknowledged and silenced from the console? Lo and behold, I discovered that Node.js CLI (console) applications can indeed respond to keystrokes, ushering in a whole new realm of possibilities.  In today’s tutorial, I will teach you how to build interactive Node.js console applications that listen for keypress events. We’ll build a simple stock quote application to bring this interactivity to life. Continue reading

Share

Node.js IoT: Tracking the ISS through the Sky

ISS

We’re back today to embark on another cool Node.js IoT project.  This time, we’re going to interact with the International Space Station (ISS) and track it as it flies through the sky.  We’ll eventually work with physical sensors that sit right on our desk, but at this stage we won’t need to buy parts or read resistor color codes in order to retrieve values from the ISS GPS “sensor” in the cloud—or actually 250 miles above the clouds.

While our tutorials are geared toward creating awesome Node.js IoT projects on the Raspberry Pi, any Node.js-capable machine will suffice for today’s tutorial.  Other useful articles to help you may include my Beginner’s Guide to Installing Node.js on a Raspberry Pi.  You can also see my article on Using Visual Studio Code with a Raspberry Pi if you are in need of a development environment.

Let’s get started and progressively build a solution so we can track the ISS and ultimately monitor its location relative to our location on earth. Continue reading

Share