In the spirit of making hardware more accessible, we’ve had our noses to the grindstone building new functionality for our favorite IoT UI, Node-Red. If you’ve never heard of it, check it out here. If you haven’t used this amazing tool yet, get ready for a treat! Node-Red is a flow-based programming tool that lends itself extremely well to IoT, and comes preloaded with enough functionality to play with that you can easily burn an entire day experimenting.
If you are already familiar with Node-Red and how to get it up and running, you can skip this tutorial, just know that depending on your platform you will require the SerialPort library or the i2c-bus library to start using the new nodes. You can see a list of available repos here. Otherwise, we will walk you through the basics below for:
The dashboard you see here is provided via the node-red-dashboard. This dashboard offers some great UI control for nodes. The nodes it provides are flexible, the theme is clean, and the colors are configurable. We definitely recommend checking it out so you can get from the drawing board to manual control ASAP.
Set Up Environment
Setting up node-red is relatively simple, and since it is built on NodeJS, it’s cross-platform. There are a couple of extra requirements here since we are working with I2C devices, if your device has native I2C support (like a Raspberry Pi), that means enabling I2C. If not, you can use one of our USB to I2C adapters, but will need access to the USB ports, which will require the SerialPort library to build on your local machine. There is also a dependency on a configuration node we provide, while this can be manually included, it is much easier to ensure you have the LTS releases of NodeJS and Node-Red.
There are a few specific requirement to get this up and running, we aren’t going to re-invent the wheel, so here are the relevant links to get your platform setup:
Node-Red has a great page with the simple instructions for getting up and running, be sure to take note of the links for special cases like the Raspberry Pi:
The NodeJS library i2c-bus is the dependency that allows us to communicate with your native I2C port. You do not need to install this library as that will be handled during installation of the NCD nodes, but some platforms require special configuration to get the I2C bus up and running. The Github page provides these configuration instructions:
The SerialPort library gives us access to the USB ports on your computer, this library is well supported, and cross platform. Like the I2C Bus library, this library will be included as a dependency, however some platforms do require some special setup instructions. They are explained on the GitHub page:
Now that you have everything installed, all that remains is for you to build the next big thing! We are actively expanding our node offerings to include some of our most popular products, and hope to continue at a good pace for quite awhile (we have nearly 1000 products to support after all!). If you have a product you’d like to see supported, be sure to let us know in our community. Check out the posts below to see what we’ve been building lately!