Thursday, January 14, 2016

Toggle CHIPs LED though REST via node.js

Thought I'd make a quick test running node.js on the chip and what better way than to blink the on-board LED which is accessible on the i2c-bus :)
Clone and cd into the repository folder, then make some binaries to toggle the LED:s (from
sudo apt-get update  # Repair things that that seem to be a little sick.
sudo apt-get upgrade
sudo apt-get install -f locales
sudo locale-gen en_US en_US.UTF-8
sudo dpkg-reconfigure locales    # Select "en_US" locales.
sudo apt-get install gcc make  # Get the C compiler

sudo gcc -o on on.c  # Compile
sudo gcc -o off off.c
sudo chmod +s on  # Allow executables to run with root privilage
sudo chmod +s off
Install node.js, npm and dependecies for the project
sudo apt-get install nodejs
sudo apt-get install npm
npm install
And start the server
nodejs chipled.js
You should now be able to toggle the white on-board LED using the following URLs:
Time to build something a bit more interesting with this CHIP :)

Read more about CHIP at the Next Thing Co (NTC) website:

CHIP benchmarks compared to Raspberry PI and others

Got my CHIPs from Next Thing Co (NTC) yesterday and just did some quick benchmarks with sysbench to compare the CHIP to these numbers:

In summary

* CPU 284s (about 1.8 times faster than RPi1, about 4 times slower than RPi2)
* Memory 1.76s (about 3.5 times faster than RPi1 and even faster than RPi2)
* Storage Random Write 2.76s (about twice as fast as RPi1, about the same as RPi2)
* Storage Random Read 0.65s (about twice as fast as RPi1, three times slower than RPi2)

Raw output: