SlideShare a Scribd company logo
1 of 8
Download to read offline
CamJam! Workshop: Node-RED and getting started on the Internet of Things
	
   - 1 -
	
  
	
  
http://nodered.org
Tinamous	
  
.com	
   	
  
http://shop.ciseco.co.uk
	
  
! Node-­RED	
   is	
   a	
   visual	
   tool	
   for	
   wiring	
   the	
   Internet	
   of	
   Things	
   (IoT).	
   Node-­‐RED	
   is	
  
platform-­‐independent,	
   but	
   has	
   been	
   developed	
   with	
   small	
   computers	
   such	
   as	
   the	
  
Raspberry	
  Pi	
  in	
  mind.	
  
	
  
! Traditional	
   IoT	
   development	
   can	
   be	
   very	
   technical:	
   Access	
   to	
   the	
   GPIO	
   and	
   other	
  
hardware	
  requires	
  skills	
  in	
  C	
  or	
  assembler,	
  output	
  of	
  data	
  to	
  web	
  services	
  or	
  sending	
  
tweets	
   and	
   emails	
   requires	
   the	
   use	
   of	
   complex	
   APIs.	
   Node-­RED	
   takes	
   care	
   of	
   the	
  
technicalities	
  and	
  lets	
  you	
  concentrate	
  on	
  the	
  logic	
  of	
  your	
  workflow.	
  
	
  
! While	
   most	
   programming	
   in	
   Node-­‐RED	
   is	
   done	
   visually	
   using	
   pre-­‐defined	
   functions	
  
(“nodes”),	
  any	
  additional	
  functionality	
  can	
  be	
  added	
  in	
  JavaScript.	
  
	
  
	
  
WORKSHOP	
  CONTENT:	
  In	
  this	
  workshop,	
  we’re	
  going	
  to	
  use	
  Node-­‐RED	
  to	
  interact	
  with	
  a	
  
Ciseco	
  Slice	
  of	
  Radio.	
  This	
  is	
  a	
  low-­‐cost	
  radio	
  shield	
  that	
  enables	
  the	
  Raspberry	
  Pi	
  to	
  receive	
  
messages	
  from	
  wireless	
  sensors	
  (such	
  as	
  temperature	
  or	
  light	
  level)	
  and	
  send	
  messages	
  to	
  
change	
  wireless	
  actuators	
  (such	
  as	
  a	
  relay	
  or	
  light).	
  We	
  will	
  also	
  discuss	
  how	
  to	
  send	
  sensor	
  
data	
  to	
  IoT	
  platforms	
  on	
  the	
  Internet.	
  
CamJam! Workshop: Node-RED and getting started on the Internet of Things
	
   - 2 -
Technical	
  background:	
  For	
  this	
  workshop,	
  you	
  will	
  find	
  a	
  Raspberry	
  Pi	
  with	
  a	
  Slice	
  of	
  Radio	
  and	
  Node-­‐RED	
  already	
  installed.	
  While	
  the	
  
installation	
  of	
  both	
  hardware	
  and	
  software	
  is	
  relatively	
  easy,	
  it	
  would	
  be	
  difficult	
  to	
  include	
  this	
  step	
  within	
  the	
  time	
  constraints	
  of	
  the	
  
exercise.	
  For	
  completeness,	
  this	
  is	
  what’s	
  happened	
  to	
  a	
  fresh	
  and	
  up-­‐to-­‐date	
  Raspian	
  installation	
  on	
  your	
  SD	
  card:	
  
1. Remove	
   any	
   system	
   I/O	
   through	
   the	
   serial	
   port	
   (/dev/ttyAMA0)	
   from	
   /etc/inittab	
   and	
   /boot/cmdline.txt.	
   See	
   e.g.	
  
http://openmicros.org/index.php/articles/94-­ciseco-­product-­documentation/raspberry-­pi/283-­setting-­up-­my-­raspberry-­pi	
  
2. Install	
  node.js	
  and	
  npm	
  (e.g.	
  by	
  sudo	
  apt-­get	
  install	
  nodejs	
  npm)	
  
3. Clone	
  Node-­‐RED	
  from	
  Github	
  and	
  install	
  as	
  described	
  here:	
  http://nodered.org/docs/getting-­started/installation.html	
  
4. Install	
  the	
  node	
  that	
  encapsulates	
  communication	
  with	
  the	
  serial	
  port	
  by	
  issuing:	
  sudo	
  npm	
  install	
  serialport	
  
5. The	
  default	
  Midori	
  browser	
  has	
  its	
  quirks.	
  We’re	
  using	
  Chromium,	
  installed	
  by:	
  sudo	
  apt-­get	
  install	
  chromium	
  
Note:	
   To	
   leverage	
   the	
   power	
   of	
   Node-­‐RED,	
   consider	
   installing	
   nodes	
   for	
   email	
   or	
   raw	
   GPIO	
   access	
   as	
   well.	
   The	
   latter	
   is	
   described	
   here:	
  
http://nodered.org/docs/hardware/raspberrypi.html	
  
	
  
1)	
  Exercise:	
  Starting	
  Node-­RED	
  as	
  Raspberry	
  Pi	
  user	
  
Node-­‐RED	
  can	
  be	
  installed	
  as	
  a	
  service	
  on	
  the	
  Raspberry	
  Pi,	
  i.e.	
  as	
  a	
  program	
  that’s	
  always	
  
executed	
  when	
  your	
  Pi	
  is	
  running.	
  However,	
  this	
  is	
  only	
  useful	
  if	
  you	
  want	
  to	
  commit	
  your	
  Pi	
  
for	
   this	
   particular	
   use	
   as	
   it	
   can	
   consume	
   considerable	
   resources.	
   For	
   everyone	
   else,	
   it’s	
  
recommended	
  to	
  start	
  Node-­‐RED	
  only	
  when	
  needed:	
  
1. Open	
  the	
  LXTerminal	
   	
  to	
  see	
  a	
  console	
  that	
  allows	
  you	
  to	
  enter	
  Linux	
  commands.	
  
2. Change	
  into	
  the	
  Node-­‐RED	
  directory	
  by	
  issuing	
  “cd	
  node-­‐red”.	
  
3. Start	
  Node-­‐RED	
  by	
  typing	
  “node	
  red.js”.	
  
	
  
You	
  should	
  now	
  see	
  Node-­‐RED	
  starting	
  up	
  –	
  that	
  may	
  take	
  a	
  few	
  seconds:	
  
	
  
Congratulations.	
  You’re	
  now	
  ready	
  for	
  the	
  exercises.	
  
CamJam! Workshop: Node-RED and getting started on the Internet of Things
	
   - 3 -
Node-­‐RED	
  represents	
  a	
  server	
  on	
  the	
  basis	
  of	
  node.js	
  and	
  interacts	
  with	
  the	
  user	
  through	
  a	
  
graphical	
   user	
   interface.	
   It	
   can	
   be	
   reached	
   on	
   port	
   1880.	
   To	
   use	
   Node-­RED,	
   open	
   a	
   web	
  
browser	
  and	
  direct	
  it	
  to	
  http://localhost:1880	
  
It’s	
  useful	
  to	
  remember	
  that	
  Node-­‐RED	
  acts	
  as	
  a	
  server	
  in	
  your	
  entire	
  network.	
  That	
  is,	
  if	
  your	
  Raspberry	
  Pi’s	
  internal	
  IP	
  address	
  is	
  something	
  
like	
  192.x.x.x,	
  every	
  computer	
  in	
  your	
  network	
  can	
  open	
  the	
  Node-­‐RED	
  GUI	
  through	
  http://192.x.x.x:1880.	
  You	
  can	
  make	
  your	
  system	
  more	
  
restricted/secure	
  by	
  following	
  the	
  configuration	
  advice	
  on	
  http://nodered.org/docs/configuration.html.	
  
	
  
2)	
  Exercise:	
  Your	
  first	
  flow	
  
The	
  best	
  way	
  to	
  explain	
  “a	
  flow”	
  is	
  by	
  creating	
  one.	
  In	
  this	
  mini	
  flow,	
  we’re	
  going	
  to	
  inject	
  a	
  
value	
  into	
  our	
  debug	
  window	
  (refer	
  to	
  page	
  1	
  for	
  what	
  the	
  GUI	
  elements	
  are	
  called).	
  
1. Open	
   the	
   Chromium	
   Web	
   Browser.	
   It	
   supports	
   JavaScript	
   better	
   than	
   the	
   default	
  
Midori	
  browser.	
  
2. In	
  the	
  address	
  line,	
  enter	
  localhost:1880.	
  You	
  will	
  then	
  see	
  the	
  Node-­‐RED	
  GUI.	
  
3. Drag	
   and	
   drop	
   an	
   “inject”	
   node	
   from	
   the	
   nodes	
   library	
   into	
   the	
   flow	
   editor	
   (once	
  
you’ve	
   chosen	
   the	
   inject	
   node,	
   you	
   should	
   see	
   some	
   general	
   explanation	
   about	
   its	
  
functionality	
  in	
  the	
  info	
  pane	
  –	
  no	
  need	
  to	
  read	
  that	
  now).	
  
4. Drag	
  and	
  drop	
  a	
  “debug”	
  node	
  from	
  the	
  nodes	
  library	
  into	
  the	
  flow	
  editor.	
  
5. Create	
  a	
  pipe	
  between	
  the	
  inject	
  and	
  debug	
  nodes	
  by	
  drawing	
  a	
  connection	
  between	
  
their	
  small	
  grey	
  rounded	
  rectangles.	
  
6. Change	
  from	
  the	
  info	
  pane	
  to	
  the	
  debug	
  pane	
  (upper	
  right).	
  
7. Deploy	
  (=start)	
  your	
  flow.	
  
8. Once	
  deployed,	
  press	
  the	
  left	
  blue	
  rectangle	
  that’s	
  attached	
  to	
  the	
  inject	
  node.	
  Check	
  
what’s	
  happening	
  in	
  the	
  debug	
  pane.	
  
	
  
3)	
  Exercise:	
  Topics	
  and	
  payloads	
  
While	
   it	
   is	
   possible	
   to	
   push	
   complicated	
   data	
   structures	
   through	
   pipes	
   in	
   Node-­‐RED,	
   the	
  
default	
   is	
   a	
   (topic	
   /	
   payload)	
   tuple,	
   which	
   could	
   be	
   interpreted	
   as	
   subject	
   and	
   body	
   of	
   an	
  
email.	
  
1. Double-­‐click	
  your	
  inject	
  node.	
  
2. Change	
  the	
  properties	
  of	
  your	
  inject	
  node	
  so	
  
that	
  it	
  sends	
  a	
  string	
  “the	
  message”	
  as	
  payload	
  
and	
  “the	
  envelope”	
  as	
  topic.	
  
3. Deploy	
  your	
  flow	
  and	
  check	
  for	
  the	
  outcome	
  
in	
  the	
  debug	
  window.	
  
CamJam! Workshop: Node-RED and getting started on the Internet of Things
	
   - 4 -
4)	
  Exercise:	
  	
  Receiving	
  data	
  from	
  the	
  serial	
  port	
  
Triggering	
   a	
   flow	
   through	
   the	
   inject	
   node	
   is	
   obviously	
   of	
   limited	
   utility.	
  
Let’s	
  interact	
  with	
  the	
  real	
  world!	
  The	
  Slice	
  of	
  Radio	
  is	
  a	
  small	
  module	
  
that	
   enables	
   the	
   Raspberry	
   Pi	
   to	
   send	
   and	
   receive	
   radio	
   frequency	
  
messages.	
  Once	
  connected	
  to	
  the	
  GPIO,	
  the	
  radio	
  communicates	
  with	
  the	
  
serial	
  (tx,	
  rx)	
  pins.	
  
In	
   our	
   workshop,	
   you	
   will	
   receive	
   wireless	
   radio	
   messages	
   from	
   a	
   temperature	
   sensor.	
   In	
  
Node-­‐RED,	
  the	
  “serial”	
  node	
  facilitates	
  serial	
  communication	
  with	
  the	
  sensor.	
  
1. Drag	
  and	
  drop	
  a	
  serial	
  node	
  into	
  the	
  flow	
  editor.	
  You	
  can	
  call	
  it	
  “radio”.	
  
2. Connect	
  the	
  serial	
  node	
  to	
  your	
  debug	
  node	
  you’ve	
  used	
  in	
  the	
  last	
  script.	
  
3. Configure	
   the	
   serial	
   node	
   to	
   talk	
   to	
   serial	
   port	
   /dev/ttyAMA0	
   (the	
   standard	
   Linux	
  
name	
  of	
  the	
  serial	
  port	
  on	
  the	
  Raspberry	
  Pi),	
  expect	
  9600	
  baud	
  8N1	
  communication	
  
(“how	
  a	
  character	
  is	
  encoded”)	
  and	
  split	
  your	
  input	
  after	
  50	
  milliseconds.	
  
	
  
4. Deploy	
  your	
  flow	
  and	
  wait	
  for	
  your	
  first	
  radio	
  message	
  (up	
  to	
  30	
  sec).	
  
	
  
5)	
  Exercise:	
  Use	
  JavaScript	
  to	
  extract	
  what’s	
  useful	
  from	
  LLAP	
  messages	
  
Take	
  a	
  deep	
  breath.	
  Now	
  you’re	
  going	
  learn	
  exciting	
  technical	
  stuff	
  and	
  JavaScript!	
  
	
  
A	
  radio	
  has	
  no	
  notion	
  of	
  the	
  physical	
  beginning	
  or	
  end	
  of	
  a	
  transmission.	
  
However,	
  we	
  know	
  that	
  our	
  Ciseco	
  temperature	
  sensor	
  speaks	
  LLAP,	
  or	
  
Lightweight	
   Logical	
   Application	
   Protocol1.	
   Every	
   LLAP	
   sentence	
   is	
   12	
  
characters	
  long.	
  That	
  means,	
  unless	
  there	
  is	
  a	
  lot	
  of	
  radio	
  chatter	
  about,	
  
every	
   burst	
   of	
   12	
   characters	
   should	
   be	
   a	
   complete	
   LLAP	
   message.	
   An	
  
exemplary	
   message	
   we’re	
   looking	
   out	
   for	
   is	
   following	
   the	
   convention	
  
aT1TMPA23.5-­,	
   meaning	
   the	
   message	
   has	
   started	
   (“a”),	
   it	
   comes	
   from	
  
sensor	
  T1,	
  and	
  the	
  temperature	
  (“TMPA”)	
  is	
  23.5,	
  plus	
  a	
  spacer	
  (“-­‐“):	
  12	
  bytes.	
  While	
  Ciseco	
  
radios	
  can	
  send	
  any	
  length	
  of	
  information	
  (yes,	
  even	
  the	
  transcript	
  of	
  Miles’	
  recent	
  speech	
  at	
  
the	
  IoT	
  14	
  Meeting),	
  for	
  their	
  own	
  sensor	
  line	
  they’ve	
  chosen	
  to	
  encode	
  the	
  output	
  in	
  LLAP.	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  
1	
  http://shop.ciseco.co.uk/llap/	
  &	
  http://openmicros.org/index.php/articles/85-­‐llap-­‐
lightweight-­‐local-­‐automation-­‐protocol/297	
  
CamJam! Workshop: Node-RED and getting started on the Internet of Things
	
   - 5 -
In	
  this	
  workshop,	
  we	
  are	
  going	
  to	
  store	
  our	
  most	
  recent	
  temperature	
  readings	
  to	
  a	
  
platform	
   called	
   Tinamous	
   (https://tinamous.com).	
   There	
   are	
   also	
   other	
   platforms,	
  
all	
  for	
  slightly	
  different	
  use	
  cases2.	
  A	
  common	
  format	
  for	
  sensor	
  data	
  transmission	
  to	
  
these	
  platforms	
  is	
  MQTT,	
  which	
  follows	
  a	
  topic	
  /	
  payload	
  convention.	
  
1. Drag	
  and	
  drop	
  a	
  “switch”	
  node	
  into	
  the	
  flow	
  editor.	
  Configure	
  it	
  in	
  a	
  way	
  that	
  only	
  
messages	
  with	
  a	
  TMPA	
  statement	
  get	
  forwarded	
  and	
  other	
  messages	
  are	
  disregarded:	
  
	
  
2. Drag	
  and	
  drop	
  a	
  “function”	
  node	
  into	
  the	
  flow	
  editor.	
  
3. Connect	
  the	
  switch	
  node	
  to	
  your	
  radio,	
  and	
  the	
  function	
  node	
  to	
  the	
  switch	
  node	
  so	
  
that	
  it	
  sits	
  in	
  between	
  the	
  switch	
  and	
  the	
  debug	
  node.	
  
	
  
4. Open	
  the	
  function	
  node	
  and	
  write	
  some	
  JavaScript	
  code	
  that	
  separates	
  the	
  LLAP	
  
message	
  into	
  the	
  sensor	
  name	
  (for	
  topic)	
  and	
  the	
  temperature	
  (as	
  payload).	
  
	
  
(Note:	
  You	
  don’t	
  have	
  to	
  type	
  all	
  the	
  green	
  things.	
  These	
  are	
  just	
  comments	
  to	
  explain	
  a	
  
little	
  bit	
  what’s	
  going	
  on	
  in	
  the	
  code.	
  Concentrate	
  on	
  the	
  things	
  that	
  are	
  not	
  green.)	
  
5. Deploy	
  your	
  workflow	
  and	
  check	
  what’s	
  going	
  on	
  in	
  your	
  debug	
  pane.	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  
2	
  See	
  http://logic.sysbiol.cam.ac.uk/?p=1473	
  for	
  a	
  review	
  for	
  some	
  working	
  with	
  Node-­‐RED	
  
CamJam! Workshop: Node-RED and getting started on the Internet of Things
	
   - 6 -
Comments	
  and	
  further	
  experiments:	
  
msg.payload	
  and	
  msg.topic	
  are	
  available	
  at	
  the	
  start	
  of	
  every	
  function	
  node!	
  
You	
   may,	
   by	
   now,	
   have	
   realised	
   that	
   there	
   are	
   not	
   only	
   TMPA	
   messages,	
   but	
   also	
   AWAKE,	
  
SLEEPING	
  and	
  BATT…	
  If	
  you’re	
  a	
  keen	
  JavaScript	
  programmer,	
  write	
  some	
  code	
  that	
  avoids	
  
the	
  switch	
  node	
  and	
  does	
  all	
  the	
  filtering	
  in	
  the	
  function	
  node.	
  
	
  
6)	
  Exercise:	
  Connect	
  to	
  Tinamous	
  through	
  MQTT	
  
1. Drag	
  and	
  drop	
  a	
  “MQTT”	
  output	
  node	
  into	
  the	
  flow	
  editor.	
  
2. Connect	
  the	
  MQTT	
  node	
  to	
  the	
  extract	
  function	
  node.	
  	
  
3. Configure	
  the	
  MQTT	
  node.	
  We	
  have	
  previously	
  set	
  up	
  a	
  camjam	
  account	
  on	
  Tinamous	
  
and	
  defined	
  “PiXX”	
  devices	
  (where	
  XX	
  is	
  your	
  table	
  number;	
  here:	
  13).	
  These	
  are	
  the	
  
details	
  you	
  will	
  need	
  to	
  enter	
  in	
  the	
  configuration	
  of	
  your	
  MQTT	
  broker:	
  
	
  
	
   (Our	
  very	
  creative	
  password	
  is	
  camjam2camjam,	
  username:	
  PiXX	
  “dot”	
  camjam).	
  
	
  
	
   In	
  the	
  MQTT	
  node	
  itself	
  you	
  specificy	
  as	
  topic	
  /Tinamous/V1/Measurements/0/Field1	
  
	
  
(most	
  of	
  this	
  is	
  Tinamous	
  nomenclature	
  –	
  look	
  at	
  their	
  MQTT	
  online	
  help	
  for	
  details).	
  
4. Deploy	
  your	
  workflow	
  and	
  visit	
  https://camjam.tinamous.com	
  in	
  your	
  web	
  browser.	
  
	
  
Quick	
  Excursion:	
  Viewing	
  your	
  data	
  on	
  Tinamous	
  
1. Point	
  your	
  browser	
  to	
  https://camjam.tinamous.com	
  (camjam	
  /	
  camjam2camjam).	
  
2. Click	
  on	
  the	
  small	
  line	
  chart	
  icon	
  next	
  to	
  your	
  device	
  (e.g.	
  Pi13).	
  	
  
CamJam! Workshop: Node-RED and getting started on the Internet of Things
	
   - 7 -
	
  
3. Click	
  on	
  the	
  Field1	
  that	
  we’ve	
  designated	
  as	
  temperature.	
  
4. Voila!	
  
	
  
	
  
7)	
  Exercise:	
  Control	
  stuff	
  through	
  Node-­RED	
  
In	
   the	
   next	
   step,	
   we’re	
   going	
   to	
   control	
   an	
   actuator.	
   That’s	
   the	
   smart	
  
word	
  for	
  a	
  thing	
  that	
  does	
  something	
  in	
  response.	
  Actuators	
  are:	
  lights,	
  
relays,	
  switches,	
  etc.	
  In	
  our	
  example,	
  every	
  Raspberry	
  Pi	
  in	
  the	
  workshop	
  
is	
   going	
   to	
   have	
   a	
   number	
   assigned.	
   Your	
   number	
   translates	
   into	
   a	
  
position	
  in	
  an	
  Adafruit	
  NeoPixel	
  Ring.	
  The	
  NeoPixel	
  Ring	
  is	
  connected	
  to	
  a	
  
XinoRF	
  wireless	
  Arduino-­‐clone	
  (it’s	
  the	
  same	
  microcontroller	
  that’s	
  part	
  
of	
  the	
  Ciseco	
  RasWik	
  Wireless	
  Inventor	
  Kit),	
  which	
  runs	
  some	
  code	
  to	
  
listen	
  to	
  your	
  radio	
  messages	
  and	
  trigger	
  a	
  response.	
  
We’ve	
   set	
   up	
   the	
   XinoRF	
   so	
   that	
   it	
   responds	
   to	
   your	
   LLAP	
   messages	
   of	
   the	
   format	
  
aRFttrrggbb-­,	
  where	
  tt	
  is	
  your	
  table	
  number	
  (01..12),	
  and	
  rrggbb	
  is	
  the	
  hexadecimal	
  code	
  of	
  
your	
  desired	
  colour.	
  So	
  FF0000	
  is	
  “red”,	
  00FF00	
  is	
  “green”	
  and	
  0000FF	
  is	
  “blue”.	
  
	
  
1. 	
  Drag	
  an	
  outgoing	
  “serial”	
  node	
  into	
  your	
  project	
  and	
  connect	
  it	
  to	
  an	
  inject	
  node.	
  
2. Configure	
  the	
  inject	
  node	
  so	
  that	
  it	
  injects	
  a	
  payload	
  in	
  aRFttrrggbb-­‐	
  format.	
  
3. Deploy	
  your	
  workflow	
  and	
  try	
  to	
  identify	
  your	
  position	
  in	
  the	
  NeoPixel	
  Ring.	
  
	
  
	
  
	
  
CamJam! Workshop: Node-RED and getting started on the Internet of Things
	
   - 8 -
	
  
Would	
  it	
  not	
  be	
  wonderful	
  to	
  translate	
  the	
  temperature	
  into	
  a	
  colour	
  tone?	
  
	
  
You	
  can	
  do	
  it!	
  
1. Write	
  yourself	
  some	
  code	
  (or	
  use	
  a	
  switch	
  node!)	
  that	
  sends	
  a	
  different	
  colour	
  code	
  for	
  
different	
  temperatures.	
  
	
  
Note:	
   As	
   soon	
   as	
   many	
   groups	
   start	
   to	
   automate	
   this	
   step,	
   we’re	
   going	
   to	
   have	
   a	
   dozen	
  
Raspberry	
  Pis	
  fire	
  a	
  radio	
  message	
  once	
  the	
  temperature	
  sensor	
  has	
  triggered	
  their	
  flow.	
  You	
  
can	
  prevent	
  the	
  XinoRF	
  from	
  being	
  overrun	
  by	
  inserting	
  a	
  “delay”	
  node	
  with	
  a	
  random	
  delay	
  
(say,	
  between	
  0	
  and	
  1000	
  milliseconds)	
  before	
  the	
  outgoing	
  radio	
  node.	
  
	
  
8)	
  Additional	
  Exercises…	
  …in	
  your	
  own	
  time	
  
Node-­‐RED	
  is	
  an	
  incredibly	
  powerful	
  framework	
  that	
  allows	
  you	
  to	
  do	
  things	
  in	
  very	
  little	
  time.	
  
The	
  official	
  directory	
  of	
  flows	
  donated	
  to	
  the	
  community	
  is	
  here	
  http://flows.nodered.org	
  
and	
  they	
  can	
  easily	
  be	
  imported	
  by	
  copying	
  &	
  pasting	
  the	
  JSON-­‐formatted	
  code.	
  
	
  
A	
  few	
  suggestions	
  and	
  examples	
  that	
  I	
  have	
  described	
  over	
  the	
  past	
  months	
  are	
  here:	
  
! Triggering	
   Node-­RED	
   with	
   drawings:	
   The	
   Aestheticodes	
  
project	
   uses	
   a	
   QR	
   code	
   like	
   method	
   to	
   encode	
   information	
   in	
  
beautiful	
  drawings.	
  Draw	
  a	
  picture,	
  take	
  a	
  photograph	
  with	
  your	
  
mobile	
   and	
   trigger	
   the	
   debug	
   node	
   doing	
   that:	
  
http://logic.sysbiol.cam.ac.uk/?p=1514	
  
	
  
! Control	
  Minecraft	
  with	
  Node-­RED:	
  The	
  Minecraft	
  Pi	
  Edition	
  can	
  be	
  controlled	
  through	
  
Python,	
  but	
  that	
  may	
  not	
  be	
  easily	
  accessible	
  for	
  everyone.	
  With	
  a	
  MQTT-­‐to-­‐Minecraft	
  
bridge,	
   the	
   Node-­‐RED	
   inject	
   nodes	
   can	
   be	
   used	
   to	
   control	
   Steve:	
  
http://logic.sysbiol.cam.ac.uk/?p=1499	
  
	
  
! Got	
   an	
   AirPi	
   shield?	
   Monitor	
   your	
   room	
   climate	
   with	
   AirPi	
   and	
   Node-­RED:	
  
http://logic.sysbiol.cam.ac.uk/?p=1423	
  

More Related Content

What's hot

AT&T Hack Dallas Node-RED Tutorial
AT&T Hack Dallas Node-RED TutorialAT&T Hack Dallas Node-RED Tutorial
AT&T Hack Dallas Node-RED TutorialStefania Kaczmarczyk
 
CCNA-Open-Platform-IoT
CCNA-Open-Platform-IoTCCNA-Open-Platform-IoT
CCNA-Open-Platform-IoTMichael Koster
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3Adam Dunkels
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1Adam Dunkels
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 2
Building the Internet of Things with Thingsquare and Contiki - day 1, part 2Building the Internet of Things with Thingsquare and Contiki - day 1, part 2
Building the Internet of Things with Thingsquare and Contiki - day 1, part 2Adam Dunkels
 
Evolving Virtual Networking with IO Visor
Evolving Virtual Networking with IO VisorEvolving Virtual Networking with IO Visor
Evolving Virtual Networking with IO VisorLarry Lang
 
Using IO Visor to Secure Microservices Running on CloudFoundry [OpenStack Sum...
Using IO Visor to Secure Microservices Running on CloudFoundry [OpenStack Sum...Using IO Visor to Secure Microservices Running on CloudFoundry [OpenStack Sum...
Using IO Visor to Secure Microservices Running on CloudFoundry [OpenStack Sum...IO Visor Project
 
Virtual IoT Meetup: Connecting Sensor Networks
Virtual IoT Meetup: Connecting Sensor NetworksVirtual IoT Meetup: Connecting Sensor Networks
Virtual IoT Meetup: Connecting Sensor NetworksMatthias Kovatsch
 
Snabb, a toolkit for building user-space network functions (ES.NOG 20)
Snabb, a toolkit for building user-space network functions (ES.NOG 20)Snabb, a toolkit for building user-space network functions (ES.NOG 20)
Snabb, a toolkit for building user-space network functions (ES.NOG 20)Igalia
 
Mininet: Moving Forward
Mininet: Moving ForwardMininet: Moving Forward
Mininet: Moving ForwardON.Lab
 
Banog meetup August 30th, network device property as code
Banog meetup August 30th, network device property as codeBanog meetup August 30th, network device property as code
Banog meetup August 30th, network device property as codeDamien Garros
 
Californium: Scalable Cloud Services for the Internet of Things with CoAP
Californium: Scalable Cloud Services for the Internet of Things with CoAPCalifornium: Scalable Cloud Services for the Internet of Things with CoAP
Californium: Scalable Cloud Services for the Internet of Things with CoAPMatthias Kovatsch
 
IPSN 2009 Contiki / uIP tutorial
IPSN 2009 Contiki / uIP tutorialIPSN 2009 Contiki / uIP tutorial
IPSN 2009 Contiki / uIP tutorialadamdunkels
 
Network address translation
Network address translationNetwork address translation
Network address translationMohak Kaushik
 
The Datacenter Network You Wish You Had
The Datacenter Network You Wish You HadThe Datacenter Network You Wish You Had
The Datacenter Network You Wish You HadJeremy Schulman
 
SDN and Mininet: Some Basic Concepts
SDN and Mininet: Some Basic ConceptsSDN and Mininet: Some Basic Concepts
SDN and Mininet: Some Basic ConceptsEswar Publications
 
如何用k8s打造國產5G NFV平臺? 剖析經濟部5G核網技術的關鍵
如何用k8s打造國產5G NFV平臺?剖析經濟部5G核網技術的關鍵如何用k8s打造國產5G NFV平臺?剖析經濟部5G核網技術的關鍵
如何用k8s打造國產5G NFV平臺? 剖析經濟部5G核網技術的關鍵Jace Liang
 

What's hot (20)

AT&T Hack Dallas Node-RED Tutorial
AT&T Hack Dallas Node-RED TutorialAT&T Hack Dallas Node-RED Tutorial
AT&T Hack Dallas Node-RED Tutorial
 
CCNA-Open-Platform-IoT
CCNA-Open-Platform-IoTCCNA-Open-Platform-IoT
CCNA-Open-Platform-IoT
 
03 Make Things Talk
03 Make Things Talk03 Make Things Talk
03 Make Things Talk
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 2
Building the Internet of Things with Thingsquare and Contiki - day 1, part 2Building the Internet of Things with Thingsquare and Contiki - day 1, part 2
Building the Internet of Things with Thingsquare and Contiki - day 1, part 2
 
Evolving Virtual Networking with IO Visor
Evolving Virtual Networking with IO VisorEvolving Virtual Networking with IO Visor
Evolving Virtual Networking with IO Visor
 
Using IO Visor to Secure Microservices Running on CloudFoundry [OpenStack Sum...
Using IO Visor to Secure Microservices Running on CloudFoundry [OpenStack Sum...Using IO Visor to Secure Microservices Running on CloudFoundry [OpenStack Sum...
Using IO Visor to Secure Microservices Running on CloudFoundry [OpenStack Sum...
 
Virtual IoT Meetup: Connecting Sensor Networks
Virtual IoT Meetup: Connecting Sensor NetworksVirtual IoT Meetup: Connecting Sensor Networks
Virtual IoT Meetup: Connecting Sensor Networks
 
Snabb, a toolkit for building user-space network functions (ES.NOG 20)
Snabb, a toolkit for building user-space network functions (ES.NOG 20)Snabb, a toolkit for building user-space network functions (ES.NOG 20)
Snabb, a toolkit for building user-space network functions (ES.NOG 20)
 
Mininet: Moving Forward
Mininet: Moving ForwardMininet: Moving Forward
Mininet: Moving Forward
 
Banog meetup August 30th, network device property as code
Banog meetup August 30th, network device property as codeBanog meetup August 30th, network device property as code
Banog meetup August 30th, network device property as code
 
Californium: Scalable Cloud Services for the Internet of Things with CoAP
Californium: Scalable Cloud Services for the Internet of Things with CoAPCalifornium: Scalable Cloud Services for the Internet of Things with CoAP
Californium: Scalable Cloud Services for the Internet of Things with CoAP
 
IPSN 2009 Contiki / uIP tutorial
IPSN 2009 Contiki / uIP tutorialIPSN 2009 Contiki / uIP tutorial
IPSN 2009 Contiki / uIP tutorial
 
The Universal Dataplane
The Universal DataplaneThe Universal Dataplane
The Universal Dataplane
 
Network address translation
Network address translationNetwork address translation
Network address translation
 
Nat
NatNat
Nat
 
The Datacenter Network You Wish You Had
The Datacenter Network You Wish You HadThe Datacenter Network You Wish You Had
The Datacenter Network You Wish You Had
 
SDN and Mininet: Some Basic Concepts
SDN and Mininet: Some Basic ConceptsSDN and Mininet: Some Basic Concepts
SDN and Mininet: Some Basic Concepts
 
如何用k8s打造國產5G NFV平臺? 剖析經濟部5G核網技術的關鍵
如何用k8s打造國產5G NFV平臺?剖析經濟部5G核網技術的關鍵如何用k8s打造國產5G NFV平臺?剖析經濟部5G核網技術的關鍵
如何用k8s打造國產5G NFV平臺? 剖析經濟部5G核網技術的關鍵
 

Viewers also liked

An introduction to workflow-based programming with Node-RED
An introduction to workflow-based programming with Node-REDAn introduction to workflow-based programming with Node-RED
An introduction to workflow-based programming with Node-REDBoris Adryan
 
Using Node-RED for building IoT workflows
Using Node-RED for building IoT workflowsUsing Node-RED for building IoT workflows
Using Node-RED for building IoT workflowsAniruddha Chakrabarti
 
Wiring the Internet of Things with Node-RED, @IoTConf talk, September '14
Wiring the Internet of Things with Node-RED, @IoTConf talk, September '14Wiring the Internet of Things with Node-RED, @IoTConf talk, September '14
Wiring the Internet of Things with Node-RED, @IoTConf talk, September '14Boris Adryan
 
Hands-on, Build an IoT app using IBM Bluemix, NodeRED and Simulated Sensor - ...
Hands-on, Build an IoT app using IBM Bluemix, NodeRED and Simulated Sensor - ...Hands-on, Build an IoT app using IBM Bluemix, NodeRED and Simulated Sensor - ...
Hands-on, Build an IoT app using IBM Bluemix, NodeRED and Simulated Sensor - ...WithTheBest
 
Node-RED workshop at IoT Toulouse
Node-RED workshop at IoT ToulouseNode-RED workshop at IoT Toulouse
Node-RED workshop at IoT ToulouseBoris Adryan
 
Mehr und schneller ist nicht automatisch besser - data2day, 06.10.16
Mehr und schneller ist nicht automatisch besser - data2day, 06.10.16Mehr und schneller ist nicht automatisch besser - data2day, 06.10.16
Mehr und schneller ist nicht automatisch besser - data2day, 06.10.16Boris Adryan
 
02 Raspberry Pi GPIO Interface on Node-RED (Some correction)
02 Raspberry Pi GPIO Interface on Node-RED (Some correction)02 Raspberry Pi GPIO Interface on Node-RED (Some correction)
02 Raspberry Pi GPIO Interface on Node-RED (Some correction)Mr.Nukoon Phimsen
 
Flow Base Programming with Node-RED and Functional Reactive Programming with ...
Flow Base Programming with Node-RED and Functional Reactive Programming with ...Flow Base Programming with Node-RED and Functional Reactive Programming with ...
Flow Base Programming with Node-RED and Functional Reactive Programming with ...Sven Beauprez
 

Viewers also liked (8)

An introduction to workflow-based programming with Node-RED
An introduction to workflow-based programming with Node-REDAn introduction to workflow-based programming with Node-RED
An introduction to workflow-based programming with Node-RED
 
Using Node-RED for building IoT workflows
Using Node-RED for building IoT workflowsUsing Node-RED for building IoT workflows
Using Node-RED for building IoT workflows
 
Wiring the Internet of Things with Node-RED, @IoTConf talk, September '14
Wiring the Internet of Things with Node-RED, @IoTConf talk, September '14Wiring the Internet of Things with Node-RED, @IoTConf talk, September '14
Wiring the Internet of Things with Node-RED, @IoTConf talk, September '14
 
Hands-on, Build an IoT app using IBM Bluemix, NodeRED and Simulated Sensor - ...
Hands-on, Build an IoT app using IBM Bluemix, NodeRED and Simulated Sensor - ...Hands-on, Build an IoT app using IBM Bluemix, NodeRED and Simulated Sensor - ...
Hands-on, Build an IoT app using IBM Bluemix, NodeRED and Simulated Sensor - ...
 
Node-RED workshop at IoT Toulouse
Node-RED workshop at IoT ToulouseNode-RED workshop at IoT Toulouse
Node-RED workshop at IoT Toulouse
 
Mehr und schneller ist nicht automatisch besser - data2day, 06.10.16
Mehr und schneller ist nicht automatisch besser - data2day, 06.10.16Mehr und schneller ist nicht automatisch besser - data2day, 06.10.16
Mehr und schneller ist nicht automatisch besser - data2day, 06.10.16
 
02 Raspberry Pi GPIO Interface on Node-RED (Some correction)
02 Raspberry Pi GPIO Interface on Node-RED (Some correction)02 Raspberry Pi GPIO Interface on Node-RED (Some correction)
02 Raspberry Pi GPIO Interface on Node-RED (Some correction)
 
Flow Base Programming with Node-RED and Functional Reactive Programming with ...
Flow Base Programming with Node-RED and Functional Reactive Programming with ...Flow Base Programming with Node-RED and Functional Reactive Programming with ...
Flow Base Programming with Node-RED and Functional Reactive Programming with ...
 

Similar to Node-RED and getting started on the Internet of Things

Node-RED and Minecraft - CamJam September 2015
Node-RED and Minecraft - CamJam September 2015Node-RED and Minecraft - CamJam September 2015
Node-RED and Minecraft - CamJam September 2015Boris Adryan
 
maXbox_Arduino_Pascal_Magazine
maXbox_Arduino_Pascal_MagazinemaXbox_Arduino_Pascal_Magazine
maXbox_Arduino_Pascal_MagazineMax Kleiner
 
Node red & IoT - IEDC Hardware Club, April 8th 2016
Node red & IoT - IEDC Hardware Club, April 8th 2016Node red & IoT - IEDC Hardware Club, April 8th 2016
Node red & IoT - IEDC Hardware Club, April 8th 2016Sebin Benjamin
 
maXbox starter30 Web of Things
maXbox starter30 Web of ThingsmaXbox starter30 Web of Things
maXbox starter30 Web of ThingsMax Kleiner
 
Arduino Teaching Program
Arduino Teaching ProgramArduino Teaching Program
Arduino Teaching ProgramMax Kleiner
 
Maxbox starter18
Maxbox starter18Maxbox starter18
Maxbox starter18Max Kleiner
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Codemotion
 
Arduino LED maXbox starter18_3
Arduino LED maXbox starter18_3Arduino LED maXbox starter18_3
Arduino LED maXbox starter18_3Max Kleiner
 
maXbox Arduino Tutorial
maXbox Arduino TutorialmaXbox Arduino Tutorial
maXbox Arduino TutorialMax Kleiner
 
Build your own discovery index of scholary e-resources
Build your own discovery index of scholary e-resourcesBuild your own discovery index of scholary e-resources
Build your own discovery index of scholary e-resourcesMartin Czygan
 
Raspberry pi Board Hardware & Software Setup
Raspberry pi Board Hardware & Software SetupRaspberry pi Board Hardware & Software Setup
Raspberry pi Board Hardware & Software SetupRANAALIMAJEEDRAJPUT
 
Node red with Arduino
Node red with ArduinoNode red with Arduino
Node red with ArduinoAnshu Pandey
 
Analyzing Twitter with Node-RED
Analyzing Twitter with Node-RED Analyzing Twitter with Node-RED
Analyzing Twitter with Node-RED Pooja Mistry
 
Hardwear.io 2018 BLE Security Essentials workshop
Hardwear.io 2018 BLE Security Essentials workshopHardwear.io 2018 BLE Security Essentials workshop
Hardwear.io 2018 BLE Security Essentials workshopSlawomir Jasek
 
DeviceHub - First steps using Intel Edison
DeviceHub - First steps using Intel EdisonDeviceHub - First steps using Intel Edison
DeviceHub - First steps using Intel EdisonGabriel Arnautu
 
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP ProtocolSerial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP ProtocolSanjay Kumar
 
Linux Format - Get Into Linux Today
Linux Format - Get Into Linux TodayLinux Format - Get Into Linux Today
Linux Format - Get Into Linux TodayHeart Disk
 
Tac Presentation October 72014- Raspberry PI
Tac Presentation October 72014- Raspberry PITac Presentation October 72014- Raspberry PI
Tac Presentation October 72014- Raspberry PICliff Samuels Jr.
 

Similar to Node-RED and getting started on the Internet of Things (20)

Node-RED and Minecraft - CamJam September 2015
Node-RED and Minecraft - CamJam September 2015Node-RED and Minecraft - CamJam September 2015
Node-RED and Minecraft - CamJam September 2015
 
maXbox_Arduino_Pascal_Magazine
maXbox_Arduino_Pascal_MagazinemaXbox_Arduino_Pascal_Magazine
maXbox_Arduino_Pascal_Magazine
 
Node red & IoT - IEDC Hardware Club, April 8th 2016
Node red & IoT - IEDC Hardware Club, April 8th 2016Node red & IoT - IEDC Hardware Club, April 8th 2016
Node red & IoT - IEDC Hardware Club, April 8th 2016
 
maXbox starter30 Web of Things
maXbox starter30 Web of ThingsmaXbox starter30 Web of Things
maXbox starter30 Web of Things
 
Arduino Teaching Program
Arduino Teaching ProgramArduino Teaching Program
Arduino Teaching Program
 
INET for Starters
INET for StartersINET for Starters
INET for Starters
 
Maxbox starter18
Maxbox starter18Maxbox starter18
Maxbox starter18
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!
 
Arduino LED maXbox starter18_3
Arduino LED maXbox starter18_3Arduino LED maXbox starter18_3
Arduino LED maXbox starter18_3
 
maXbox Arduino Tutorial
maXbox Arduino TutorialmaXbox Arduino Tutorial
maXbox Arduino Tutorial
 
opnet lab report
opnet lab reportopnet lab report
opnet lab report
 
Build your own discovery index of scholary e-resources
Build your own discovery index of scholary e-resourcesBuild your own discovery index of scholary e-resources
Build your own discovery index of scholary e-resources
 
Raspberry pi Board Hardware & Software Setup
Raspberry pi Board Hardware & Software SetupRaspberry pi Board Hardware & Software Setup
Raspberry pi Board Hardware & Software Setup
 
Node red with Arduino
Node red with ArduinoNode red with Arduino
Node red with Arduino
 
Analyzing Twitter with Node-RED
Analyzing Twitter with Node-RED Analyzing Twitter with Node-RED
Analyzing Twitter with Node-RED
 
Hardwear.io 2018 BLE Security Essentials workshop
Hardwear.io 2018 BLE Security Essentials workshopHardwear.io 2018 BLE Security Essentials workshop
Hardwear.io 2018 BLE Security Essentials workshop
 
DeviceHub - First steps using Intel Edison
DeviceHub - First steps using Intel EdisonDeviceHub - First steps using Intel Edison
DeviceHub - First steps using Intel Edison
 
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP ProtocolSerial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
 
Linux Format - Get Into Linux Today
Linux Format - Get Into Linux TodayLinux Format - Get Into Linux Today
Linux Format - Get Into Linux Today
 
Tac Presentation October 72014- Raspberry PI
Tac Presentation October 72014- Raspberry PITac Presentation October 72014- Raspberry PI
Tac Presentation October 72014- Raspberry PI
 

More from Boris Adryan

Computational decision making
Computational decision makingComputational decision making
Computational decision makingBoris Adryan
 
Development and Deployment: The Human Factor
Development and Deployment: The Human FactorDevelopment and Deployment: The Human Factor
Development and Deployment: The Human FactorBoris Adryan
 
Zühlke Meetup - Mai 2017
Zühlke Meetup - Mai 2017Zühlke Meetup - Mai 2017
Zühlke Meetup - Mai 2017Boris Adryan
 
Industry of Things World - Berlin 19-09-16
Industry of Things World - Berlin 19-09-16Industry of Things World - Berlin 19-09-16
Industry of Things World - Berlin 19-09-16Boris Adryan
 
Just because you can doesn't mean that you should - thingmonk 2016
Just because you can doesn't mean that you should - thingmonk 2016Just because you can doesn't mean that you should - thingmonk 2016
Just because you can doesn't mean that you should - thingmonk 2016Boris Adryan
 
Plattformen für das Internet der Dinge, solutions.hamburg, 05.09.16
Plattformen für das Internet der Dinge, solutions.hamburg, 05.09.16Plattformen für das Internet der Dinge, solutions.hamburg, 05.09.16
Plattformen für das Internet der Dinge, solutions.hamburg, 05.09.16Boris Adryan
 
Eclipse IoT - Day 0 of thingmonk 2016
Eclipse IoT - Day 0 of  thingmonk 2016Eclipse IoT - Day 0 of  thingmonk 2016
Eclipse IoT - Day 0 of thingmonk 2016Boris Adryan
 
Geo-IoT World, 25/05/16
Geo-IoT World, 25/05/16Geo-IoT World, 25/05/16
Geo-IoT World, 25/05/16Boris Adryan
 
Smart IoT London, 13th April 2016
Smart IoT London, 13th April 2016Smart IoT London, 13th April 2016
Smart IoT London, 13th April 2016Boris Adryan
 
Eclipse IoT - ecosystem
Eclipse IoT - ecosystemEclipse IoT - ecosystem
Eclipse IoT - ecosystemBoris Adryan
 
TopConf Linz, 02/02/2016
TopConf Linz, 02/02/2016TopConf Linz, 02/02/2016
TopConf Linz, 02/02/2016Boris Adryan
 
IoT - Be Open or Miss Out
IoT - Be Open or Miss OutIoT - Be Open or Miss Out
IoT - Be Open or Miss OutBoris Adryan
 
EclipseCon France 2015 - Science Track
EclipseCon France 2015 - Science TrackEclipseCon France 2015 - Science Track
EclipseCon France 2015 - Science TrackBoris Adryan
 
Data Science London - Meetup, 28/05/15
Data Science London - Meetup, 28/05/15Data Science London - Meetup, 28/05/15
Data Science London - Meetup, 28/05/15Boris Adryan
 
O'Reilly Webcast: Organizing the Internet of Things - Actionable Insight Thro...
O'Reilly Webcast: Organizing the Internet of Things - Actionable Insight Thro...O'Reilly Webcast: Organizing the Internet of Things - Actionable Insight Thro...
O'Reilly Webcast: Organizing the Internet of Things - Actionable Insight Thro...Boris Adryan
 
What the IoT should learn from the life sciences
What the IoT should learn from the life sciencesWhat the IoT should learn from the life sciences
What the IoT should learn from the life sciencesBoris Adryan
 

More from Boris Adryan (17)

Computational decision making
Computational decision makingComputational decision making
Computational decision making
 
Development and Deployment: The Human Factor
Development and Deployment: The Human FactorDevelopment and Deployment: The Human Factor
Development and Deployment: The Human Factor
 
Zühlke Meetup - Mai 2017
Zühlke Meetup - Mai 2017Zühlke Meetup - Mai 2017
Zühlke Meetup - Mai 2017
 
Industry of Things World - Berlin 19-09-16
Industry of Things World - Berlin 19-09-16Industry of Things World - Berlin 19-09-16
Industry of Things World - Berlin 19-09-16
 
Just because you can doesn't mean that you should - thingmonk 2016
Just because you can doesn't mean that you should - thingmonk 2016Just because you can doesn't mean that you should - thingmonk 2016
Just because you can doesn't mean that you should - thingmonk 2016
 
Plattformen für das Internet der Dinge, solutions.hamburg, 05.09.16
Plattformen für das Internet der Dinge, solutions.hamburg, 05.09.16Plattformen für das Internet der Dinge, solutions.hamburg, 05.09.16
Plattformen für das Internet der Dinge, solutions.hamburg, 05.09.16
 
Eclipse IoT - Day 0 of thingmonk 2016
Eclipse IoT - Day 0 of  thingmonk 2016Eclipse IoT - Day 0 of  thingmonk 2016
Eclipse IoT - Day 0 of thingmonk 2016
 
Geo-IoT World, 25/05/16
Geo-IoT World, 25/05/16Geo-IoT World, 25/05/16
Geo-IoT World, 25/05/16
 
Smart IoT London, 13th April 2016
Smart IoT London, 13th April 2016Smart IoT London, 13th April 2016
Smart IoT London, 13th April 2016
 
Eclipse IoT - ecosystem
Eclipse IoT - ecosystemEclipse IoT - ecosystem
Eclipse IoT - ecosystem
 
TopConf Linz, 02/02/2016
TopConf Linz, 02/02/2016TopConf Linz, 02/02/2016
TopConf Linz, 02/02/2016
 
IoT - Be Open or Miss Out
IoT - Be Open or Miss OutIoT - Be Open or Miss Out
IoT - Be Open or Miss Out
 
Thingmonk 2015
Thingmonk 2015Thingmonk 2015
Thingmonk 2015
 
EclipseCon France 2015 - Science Track
EclipseCon France 2015 - Science TrackEclipseCon France 2015 - Science Track
EclipseCon France 2015 - Science Track
 
Data Science London - Meetup, 28/05/15
Data Science London - Meetup, 28/05/15Data Science London - Meetup, 28/05/15
Data Science London - Meetup, 28/05/15
 
O'Reilly Webcast: Organizing the Internet of Things - Actionable Insight Thro...
O'Reilly Webcast: Organizing the Internet of Things - Actionable Insight Thro...O'Reilly Webcast: Organizing the Internet of Things - Actionable Insight Thro...
O'Reilly Webcast: Organizing the Internet of Things - Actionable Insight Thro...
 
What the IoT should learn from the life sciences
What the IoT should learn from the life sciencesWhat the IoT should learn from the life sciences
What the IoT should learn from the life sciences
 

Recently uploaded

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 

Recently uploaded (20)

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 

Node-RED and getting started on the Internet of Things

  • 1. CamJam! Workshop: Node-RED and getting started on the Internet of Things   - 1 -     http://nodered.org Tinamous   .com     http://shop.ciseco.co.uk   ! Node-­RED   is   a   visual   tool   for   wiring   the   Internet   of   Things   (IoT).   Node-­‐RED   is   platform-­‐independent,   but   has   been   developed   with   small   computers   such   as   the   Raspberry  Pi  in  mind.     ! Traditional   IoT   development   can   be   very   technical:   Access   to   the   GPIO   and   other   hardware  requires  skills  in  C  or  assembler,  output  of  data  to  web  services  or  sending   tweets   and   emails   requires   the   use   of   complex   APIs.   Node-­RED   takes   care   of   the   technicalities  and  lets  you  concentrate  on  the  logic  of  your  workflow.     ! While   most   programming   in   Node-­‐RED   is   done   visually   using   pre-­‐defined   functions   (“nodes”),  any  additional  functionality  can  be  added  in  JavaScript.       WORKSHOP  CONTENT:  In  this  workshop,  we’re  going  to  use  Node-­‐RED  to  interact  with  a   Ciseco  Slice  of  Radio.  This  is  a  low-­‐cost  radio  shield  that  enables  the  Raspberry  Pi  to  receive   messages  from  wireless  sensors  (such  as  temperature  or  light  level)  and  send  messages  to   change  wireless  actuators  (such  as  a  relay  or  light).  We  will  also  discuss  how  to  send  sensor   data  to  IoT  platforms  on  the  Internet.  
  • 2. CamJam! Workshop: Node-RED and getting started on the Internet of Things   - 2 - Technical  background:  For  this  workshop,  you  will  find  a  Raspberry  Pi  with  a  Slice  of  Radio  and  Node-­‐RED  already  installed.  While  the   installation  of  both  hardware  and  software  is  relatively  easy,  it  would  be  difficult  to  include  this  step  within  the  time  constraints  of  the   exercise.  For  completeness,  this  is  what’s  happened  to  a  fresh  and  up-­‐to-­‐date  Raspian  installation  on  your  SD  card:   1. Remove   any   system   I/O   through   the   serial   port   (/dev/ttyAMA0)   from   /etc/inittab   and   /boot/cmdline.txt.   See   e.g.   http://openmicros.org/index.php/articles/94-­ciseco-­product-­documentation/raspberry-­pi/283-­setting-­up-­my-­raspberry-­pi   2. Install  node.js  and  npm  (e.g.  by  sudo  apt-­get  install  nodejs  npm)   3. Clone  Node-­‐RED  from  Github  and  install  as  described  here:  http://nodered.org/docs/getting-­started/installation.html   4. Install  the  node  that  encapsulates  communication  with  the  serial  port  by  issuing:  sudo  npm  install  serialport   5. The  default  Midori  browser  has  its  quirks.  We’re  using  Chromium,  installed  by:  sudo  apt-­get  install  chromium   Note:   To   leverage   the   power   of   Node-­‐RED,   consider   installing   nodes   for   email   or   raw   GPIO   access   as   well.   The   latter   is   described   here:   http://nodered.org/docs/hardware/raspberrypi.html     1)  Exercise:  Starting  Node-­RED  as  Raspberry  Pi  user   Node-­‐RED  can  be  installed  as  a  service  on  the  Raspberry  Pi,  i.e.  as  a  program  that’s  always   executed  when  your  Pi  is  running.  However,  this  is  only  useful  if  you  want  to  commit  your  Pi   for   this   particular   use   as   it   can   consume   considerable   resources.   For   everyone   else,   it’s   recommended  to  start  Node-­‐RED  only  when  needed:   1. Open  the  LXTerminal    to  see  a  console  that  allows  you  to  enter  Linux  commands.   2. Change  into  the  Node-­‐RED  directory  by  issuing  “cd  node-­‐red”.   3. Start  Node-­‐RED  by  typing  “node  red.js”.     You  should  now  see  Node-­‐RED  starting  up  –  that  may  take  a  few  seconds:     Congratulations.  You’re  now  ready  for  the  exercises.  
  • 3. CamJam! Workshop: Node-RED and getting started on the Internet of Things   - 3 - Node-­‐RED  represents  a  server  on  the  basis  of  node.js  and  interacts  with  the  user  through  a   graphical   user   interface.   It   can   be   reached   on   port   1880.   To   use   Node-­RED,   open   a   web   browser  and  direct  it  to  http://localhost:1880   It’s  useful  to  remember  that  Node-­‐RED  acts  as  a  server  in  your  entire  network.  That  is,  if  your  Raspberry  Pi’s  internal  IP  address  is  something   like  192.x.x.x,  every  computer  in  your  network  can  open  the  Node-­‐RED  GUI  through  http://192.x.x.x:1880.  You  can  make  your  system  more   restricted/secure  by  following  the  configuration  advice  on  http://nodered.org/docs/configuration.html.     2)  Exercise:  Your  first  flow   The  best  way  to  explain  “a  flow”  is  by  creating  one.  In  this  mini  flow,  we’re  going  to  inject  a   value  into  our  debug  window  (refer  to  page  1  for  what  the  GUI  elements  are  called).   1. Open   the   Chromium   Web   Browser.   It   supports   JavaScript   better   than   the   default   Midori  browser.   2. In  the  address  line,  enter  localhost:1880.  You  will  then  see  the  Node-­‐RED  GUI.   3. Drag   and   drop   an   “inject”   node   from   the   nodes   library   into   the   flow   editor   (once   you’ve   chosen   the   inject   node,   you   should   see   some   general   explanation   about   its   functionality  in  the  info  pane  –  no  need  to  read  that  now).   4. Drag  and  drop  a  “debug”  node  from  the  nodes  library  into  the  flow  editor.   5. Create  a  pipe  between  the  inject  and  debug  nodes  by  drawing  a  connection  between   their  small  grey  rounded  rectangles.   6. Change  from  the  info  pane  to  the  debug  pane  (upper  right).   7. Deploy  (=start)  your  flow.   8. Once  deployed,  press  the  left  blue  rectangle  that’s  attached  to  the  inject  node.  Check   what’s  happening  in  the  debug  pane.     3)  Exercise:  Topics  and  payloads   While   it   is   possible   to   push   complicated   data   structures   through   pipes   in   Node-­‐RED,   the   default   is   a   (topic   /   payload)   tuple,   which   could   be   interpreted   as   subject   and   body   of   an   email.   1. Double-­‐click  your  inject  node.   2. Change  the  properties  of  your  inject  node  so   that  it  sends  a  string  “the  message”  as  payload   and  “the  envelope”  as  topic.   3. Deploy  your  flow  and  check  for  the  outcome   in  the  debug  window.  
  • 4. CamJam! Workshop: Node-RED and getting started on the Internet of Things   - 4 - 4)  Exercise:    Receiving  data  from  the  serial  port   Triggering   a   flow   through   the   inject   node   is   obviously   of   limited   utility.   Let’s  interact  with  the  real  world!  The  Slice  of  Radio  is  a  small  module   that   enables   the   Raspberry   Pi   to   send   and   receive   radio   frequency   messages.  Once  connected  to  the  GPIO,  the  radio  communicates  with  the   serial  (tx,  rx)  pins.   In   our   workshop,   you   will   receive   wireless   radio   messages   from   a   temperature   sensor.   In   Node-­‐RED,  the  “serial”  node  facilitates  serial  communication  with  the  sensor.   1. Drag  and  drop  a  serial  node  into  the  flow  editor.  You  can  call  it  “radio”.   2. Connect  the  serial  node  to  your  debug  node  you’ve  used  in  the  last  script.   3. Configure   the   serial   node   to   talk   to   serial   port   /dev/ttyAMA0   (the   standard   Linux   name  of  the  serial  port  on  the  Raspberry  Pi),  expect  9600  baud  8N1  communication   (“how  a  character  is  encoded”)  and  split  your  input  after  50  milliseconds.     4. Deploy  your  flow  and  wait  for  your  first  radio  message  (up  to  30  sec).     5)  Exercise:  Use  JavaScript  to  extract  what’s  useful  from  LLAP  messages   Take  a  deep  breath.  Now  you’re  going  learn  exciting  technical  stuff  and  JavaScript!     A  radio  has  no  notion  of  the  physical  beginning  or  end  of  a  transmission.   However,  we  know  that  our  Ciseco  temperature  sensor  speaks  LLAP,  or   Lightweight   Logical   Application   Protocol1.   Every   LLAP   sentence   is   12   characters  long.  That  means,  unless  there  is  a  lot  of  radio  chatter  about,   every   burst   of   12   characters   should   be   a   complete   LLAP   message.   An   exemplary   message   we’re   looking   out   for   is   following   the   convention   aT1TMPA23.5-­,   meaning   the   message   has   started   (“a”),   it   comes   from   sensor  T1,  and  the  temperature  (“TMPA”)  is  23.5,  plus  a  spacer  (“-­‐“):  12  bytes.  While  Ciseco   radios  can  send  any  length  of  information  (yes,  even  the  transcript  of  Miles’  recent  speech  at   the  IoT  14  Meeting),  for  their  own  sensor  line  they’ve  chosen  to  encode  the  output  in  LLAP.                                                                                                                   1  http://shop.ciseco.co.uk/llap/  &  http://openmicros.org/index.php/articles/85-­‐llap-­‐ lightweight-­‐local-­‐automation-­‐protocol/297  
  • 5. CamJam! Workshop: Node-RED and getting started on the Internet of Things   - 5 - In  this  workshop,  we  are  going  to  store  our  most  recent  temperature  readings  to  a   platform   called   Tinamous   (https://tinamous.com).   There   are   also   other   platforms,   all  for  slightly  different  use  cases2.  A  common  format  for  sensor  data  transmission  to   these  platforms  is  MQTT,  which  follows  a  topic  /  payload  convention.   1. Drag  and  drop  a  “switch”  node  into  the  flow  editor.  Configure  it  in  a  way  that  only   messages  with  a  TMPA  statement  get  forwarded  and  other  messages  are  disregarded:     2. Drag  and  drop  a  “function”  node  into  the  flow  editor.   3. Connect  the  switch  node  to  your  radio,  and  the  function  node  to  the  switch  node  so   that  it  sits  in  between  the  switch  and  the  debug  node.     4. Open  the  function  node  and  write  some  JavaScript  code  that  separates  the  LLAP   message  into  the  sensor  name  (for  topic)  and  the  temperature  (as  payload).     (Note:  You  don’t  have  to  type  all  the  green  things.  These  are  just  comments  to  explain  a   little  bit  what’s  going  on  in  the  code.  Concentrate  on  the  things  that  are  not  green.)   5. Deploy  your  workflow  and  check  what’s  going  on  in  your  debug  pane.                                                                                                                   2  See  http://logic.sysbiol.cam.ac.uk/?p=1473  for  a  review  for  some  working  with  Node-­‐RED  
  • 6. CamJam! Workshop: Node-RED and getting started on the Internet of Things   - 6 - Comments  and  further  experiments:   msg.payload  and  msg.topic  are  available  at  the  start  of  every  function  node!   You   may,   by   now,   have   realised   that   there   are   not   only   TMPA   messages,   but   also   AWAKE,   SLEEPING  and  BATT…  If  you’re  a  keen  JavaScript  programmer,  write  some  code  that  avoids   the  switch  node  and  does  all  the  filtering  in  the  function  node.     6)  Exercise:  Connect  to  Tinamous  through  MQTT   1. Drag  and  drop  a  “MQTT”  output  node  into  the  flow  editor.   2. Connect  the  MQTT  node  to  the  extract  function  node.     3. Configure  the  MQTT  node.  We  have  previously  set  up  a  camjam  account  on  Tinamous   and  defined  “PiXX”  devices  (where  XX  is  your  table  number;  here:  13).  These  are  the   details  you  will  need  to  enter  in  the  configuration  of  your  MQTT  broker:       (Our  very  creative  password  is  camjam2camjam,  username:  PiXX  “dot”  camjam).       In  the  MQTT  node  itself  you  specificy  as  topic  /Tinamous/V1/Measurements/0/Field1     (most  of  this  is  Tinamous  nomenclature  –  look  at  their  MQTT  online  help  for  details).   4. Deploy  your  workflow  and  visit  https://camjam.tinamous.com  in  your  web  browser.     Quick  Excursion:  Viewing  your  data  on  Tinamous   1. Point  your  browser  to  https://camjam.tinamous.com  (camjam  /  camjam2camjam).   2. Click  on  the  small  line  chart  icon  next  to  your  device  (e.g.  Pi13).    
  • 7. CamJam! Workshop: Node-RED and getting started on the Internet of Things   - 7 -   3. Click  on  the  Field1  that  we’ve  designated  as  temperature.   4. Voila!       7)  Exercise:  Control  stuff  through  Node-­RED   In   the   next   step,   we’re   going   to   control   an   actuator.   That’s   the   smart   word  for  a  thing  that  does  something  in  response.  Actuators  are:  lights,   relays,  switches,  etc.  In  our  example,  every  Raspberry  Pi  in  the  workshop   is   going   to   have   a   number   assigned.   Your   number   translates   into   a   position  in  an  Adafruit  NeoPixel  Ring.  The  NeoPixel  Ring  is  connected  to  a   XinoRF  wireless  Arduino-­‐clone  (it’s  the  same  microcontroller  that’s  part   of  the  Ciseco  RasWik  Wireless  Inventor  Kit),  which  runs  some  code  to   listen  to  your  radio  messages  and  trigger  a  response.   We’ve   set   up   the   XinoRF   so   that   it   responds   to   your   LLAP   messages   of   the   format   aRFttrrggbb-­,  where  tt  is  your  table  number  (01..12),  and  rrggbb  is  the  hexadecimal  code  of   your  desired  colour.  So  FF0000  is  “red”,  00FF00  is  “green”  and  0000FF  is  “blue”.     1.  Drag  an  outgoing  “serial”  node  into  your  project  and  connect  it  to  an  inject  node.   2. Configure  the  inject  node  so  that  it  injects  a  payload  in  aRFttrrggbb-­‐  format.   3. Deploy  your  workflow  and  try  to  identify  your  position  in  the  NeoPixel  Ring.        
  • 8. CamJam! Workshop: Node-RED and getting started on the Internet of Things   - 8 -   Would  it  not  be  wonderful  to  translate  the  temperature  into  a  colour  tone?     You  can  do  it!   1. Write  yourself  some  code  (or  use  a  switch  node!)  that  sends  a  different  colour  code  for   different  temperatures.     Note:   As   soon   as   many   groups   start   to   automate   this   step,   we’re   going   to   have   a   dozen   Raspberry  Pis  fire  a  radio  message  once  the  temperature  sensor  has  triggered  their  flow.  You   can  prevent  the  XinoRF  from  being  overrun  by  inserting  a  “delay”  node  with  a  random  delay   (say,  between  0  and  1000  milliseconds)  before  the  outgoing  radio  node.     8)  Additional  Exercises…  …in  your  own  time   Node-­‐RED  is  an  incredibly  powerful  framework  that  allows  you  to  do  things  in  very  little  time.   The  official  directory  of  flows  donated  to  the  community  is  here  http://flows.nodered.org   and  they  can  easily  be  imported  by  copying  &  pasting  the  JSON-­‐formatted  code.     A  few  suggestions  and  examples  that  I  have  described  over  the  past  months  are  here:   ! Triggering   Node-­RED   with   drawings:   The   Aestheticodes   project   uses   a   QR   code   like   method   to   encode   information   in   beautiful  drawings.  Draw  a  picture,  take  a  photograph  with  your   mobile   and   trigger   the   debug   node   doing   that:   http://logic.sysbiol.cam.ac.uk/?p=1514     ! Control  Minecraft  with  Node-­RED:  The  Minecraft  Pi  Edition  can  be  controlled  through   Python,  but  that  may  not  be  easily  accessible  for  everyone.  With  a  MQTT-­‐to-­‐Minecraft   bridge,   the   Node-­‐RED   inject   nodes   can   be   used   to   control   Steve:   http://logic.sysbiol.cam.ac.uk/?p=1499     ! Got   an   AirPi   shield?   Monitor   your   room   climate   with   AirPi   and   Node-­RED:   http://logic.sysbiol.cam.ac.uk/?p=1423