Scott Penrose

Linux Serial via Websockets

Scott is an expert software developer with over 30 years experience, specialising in education, automation and remote data.

The intel Edison doesn't actual have 'screen' or other serial monitoring on board. But even if it did, this is a useful tool for monitoring serial real time.

HTML / CSS / Javascript

<!doctype html>
    <title>Serial Port</title>
    <ul id="messages"></ul>
    <form action="">
      <input id="m" autocomplete="off" /><button>Send</button>
    <script src=""></script>
    <script src=""></script>
      var socket = io();
        socket.emit('serialio', $('#m').val());
        return false;
      socket.on('serialio', function(msg){

Node JS Serial

var app = require('express')();
var http = require('http').Server(app);
var io = require('')(http);
var mraa = require('mraa');
var SerialPort = require("serialport").SerialPort;

u = new mraa.Uart(0); 
var serialPath = u.getDevicePath(); 
var serialPort = new SerialPort(serialPath, {baudrate: 9600});

function convertArrayBufferToString(buf){
	var bufView = new Uint8Array(buf);
	var encodedString = String.fromCharCode.apply(null, bufView);
	return decodeURIComponent(encodedString);

io.sockets.on('connection', function (socket) { 
	serialPort.on("data", function(data) { 
		var str = convertArrayBufferToString(data);
		socket.emit('serialio', { data: str });

	socket.on('serialio', function(data) {

  • Edison
  • RaspberryPi
  • Serial