Winston

Using Winston, a versatile logging library for Node.js

Today, we will explore Winston, a versatile logging library for Node.js. Winston can be used in numerous contexts including in Node web frameworks such as Express, and Node CLI apps. We will also dive into features that make Winston a good fit for IoT applications such as logging timestamped entries to files. This article has been updated to reflect the latest generation of Winston at the time of this writing which is Winston 3.x.

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

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

It’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.

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

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

The 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.

Share

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

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.

Share

Node.js IoT: Tracking the ISS through the Sky

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 Read More

Share

Node.js IoT – Data Visualization of Sensor Values

In today’s article, we’re moving beyond printing numbers in the console and creating some data visualization plots in both the terminal and in a graphical window. We’re also going to have fun!  😀 Today, I’m going to make the inductive leap that you’re making all of this happen using a Raspberry Pi. You may be able to implement these amazing ASCII terminal plots in the Windows world using Bash on Windows, but I have not tested in that context.  In addition to Raspbian, these steps will also generally work for other Linux distros as well as OS X.  If you are not running Node.js on your Raspberry Pi, please see my Beginner’s Guide to Installing Node.js Read More

Share

Node.js IoT – Create Local Module for CPU Sensor

We’re back and ready to do some refactoring of our CPU sensor so we can learn about Node.js modules and how to create them.  Building small, focused modules is one of the key tenets of the Node.js philosophy as summarized in The Node Way: Building small, single-purpose modules is at the heart of the Node.js philosophy. Borrowing from Unix, Node.js encourages composing the complex and powerful out of smaller, simpler pieces. This idea trickles down from entire applications (using the best tool for the job vs. a full suite) to how the tools themselves are built.

Share

Node.js IoT – Build a Cross Platform CPU Sensor

I took a little hiatus in our series to take my family on a trip to Japan with layovers on each end of the trip in China which included a ride on the Shanghai Maglev Train, the fastest train in the world.  We had a fantastic time, and it was a great educational experience for the kids.  It is also good to be back home! We are back again with our Node.js IoT tutorial series and ready to continue developing our “CPU sensor” as CPU loading/utilization is a “sensor” we can measure, record, and ultimately stream to other locations.  Today, we will expand our CPU sensor and make it cross platform—and learn more about Node.js in Read More

Share