Anda di halaman 1dari 19

Raspberry Pi and NodeRED

in the Internet of Things


@BorisAdryan
University of Cambridge
What the Raspberry Pi
gets used for

Google searches for Raspberry Pi


+robot, +Scratch, +home automation
The Raspberry Pi can be
an IoT centre piece
Measure and receive
GPIO, USB, LAN

Process and decide

Actuate and send


GPIO, USB, LAN
Even simple processing
requires programming
Python for a wireless
temperature sensor:
Communicate via GPIO with
serial radio

Create plot of recent


temperatures

Upload plot to webserver

If above a certain threshold,


send an email including the plot
NodeRED
Thinking about a good
workflow is hard enough.
!
By avoiding unnecessary
coding, IoT development
can be accelerated.
What is NodeRED
A Node.js based web service on your platform of
interest (e.g. the Pi)
Presents a website with a graphical user interface to
control data flow bet ween modules
Modules are based on Javascript can comprise all I/O
and processing steps

NodeRED comes with a large library of


complementary modules, e.g. for hardware
communication (the Pis GPIO), interaction with social
media and visualisation frame works.
Javascript?
It was a slow and limited scripting
language in the mid-1990s.
(this is where I left it behind)

Modern Javascript is fast and


runs in the background of many
client-sided web applications.
Widely used libraries are e.g.
jQuery and Google Web Toolkit

Javascript engines can nowadays


run outside the web browser and
are embedded in other soft ware.
Node.js
Node.js is a powerful HTTP
server that can be modified
with the programmers
wanted functionality.

A basic server is implemented


in 5 lines of code.

The npm (Node Packaged


Modules) library has 50k+
packages, most of which are
written in pure Javascript.
Installing NodeRED on a Pi
Install git (via apt-get)
Install wiringPi (via git)

Install Node.js (via dpkg)


Install NodeRED (via git)
Install modules (via npm)

http://c-mobberley.com/wordpress/index.php/2013/10/03/raspberry-pi-hosting-node-red-take-the-crap-out-of-developing-automation-the-internet-of-things-iot/
Running NodeRED on a Pi
$ sudo node red.js
Running NodeRED on a Pi
connect to 127.0.0.1:1880 on the Pi
Standard Nodes
Lab Temp Monitor
Information Flow
Topic []
Payload aT1BATT2.68-

T1BATT
2.68
Boris now
- shows streams on Xively
- demos NodeRED
Getting Help
NodeRED documentation.

NodeRED Google Group

@NodeRED, @ceejay, @knolleary

#nodered on IRC

Many how-to pages on the web.


Further Information
NodeRED: http://nodered.org
Adafruit Learning System: http://learn.adafruit.com/raspberry-pi-
hosting-node-red/what-is-node-red
@Hardware_Hacks Blog: http://c-mobberley.com/wordpress/
index.php/2013/10/03/raspberry-pi-hosting-node-red-take-the-
crap-out-of-developing-automation-the-internet-of-things-iot/
Andys Life Blog: http://blog.thiseldo.co.uk/?p=944
!

Follow @BorisAdryan or download this presentation from http://


logic.sysbiol.cam.ac.uk/teaching/jamred.pdf

Anda mungkin juga menyukai