Tutorial: Streaming Arduino Sensor Data to a Smoothie Chart

Posted by: Seth Lakowske

Published:

Requirements

First, install nodejs if you haven't already. Then create a directory to contain your project code. Inside the new directory, run


	  #Initialize your project
	  npm init
      

Next, add dependencies to your project. The json-streamer transform is written to buffer the basic json serial data coming from the Arduino Nano.


	  npm install serialport --save
	  npm install git://github.com/lakowske/json-streamer --save
	  npm install git://github.com/lakowske/websocket-express --save
      

Next, create a pipe using a series of stream transforms. We'll pipe the data into a smoothie chart.



	var SerialPort = require("serialport").SerialPort
	var JSONReader = require('json-streamer');

	var serialPort = new SerialPort("/dev/ttyUSB0", {
	   baudrate: 57600
	});