Setting up Node-RED for use with Arduino and MacOS

From GlassTTY
Jump to: navigation, search

Installing Node-Red

Download and install the npm package manager from http://nodejs.org/

Once npm is installed, use it to install node-red e.g.

   sudo npm install -g --unsafe-perm node-red

Node-Red can then be run e.g.

   node-red

Navigate to http://127.0.0.1:1880 and the Node-RED pallet should be visible.

Configure the Arduino

To prepare the Arduino the default Firmata sketch needs to be deployed to the Arduino, using the standard Arduino software download tools. This is usually found in the Arduino IDE under the menu:

   Files/Examples/Firmata/Standard Firmata

Once this is complete, install the Node-RED Arduino nodes into the palette e.g.

   cd ~/.node-red
   npm install node-red-node-arduino

Restart Node-RED and two new Arduino nodes should appear in the palette. Set these new Input and Output nodes to use the serial port of the Arduino device.

From this point forward, as long as Node-RED is running on the Mac and is connected to the serial port of the Arduino, the Arduino can be controlled using Node-RED in a browser.