Booting IoT with Grails

By Colin Harrington

@ColinHarrington

whoami

  • Colin Harrington
  • Grails Developer/Consultant @ OCI
  • harringtonc@ociweb.com
  • @ColinHarrington
  • colin.harrington@gmail.com

Web Scale

Application Architecture

  • One App to Rule them all
  • Redundant, scaling out
  • Clustering
  • SOA/ESB
  • Microservices
  • Nanoservices

Where is exactly is your cloud?

  • Metal!     \m/
  • Virtual Metal (Virtual Machines)
  • Virtual Clouds
  • Virtual Private Computing
  • IIAS
  • PAAS
  • Containerization
  • {xen, docker, photon, coreOs, Snappy Core}

(Tomcat + app )*nodes = memory hog

  • Fault tolerance
  • Load balancers
  • Clustered sessions/resources
  • RAM is cheap (on servers)

Microservices?

  • Splitting concerns
  • extra latency between nodes
  • death by 1000 JVMs?
  • ..if you don't do it well.

500MB != micro

  • Microservices present a problem for the memory intensive JVM
  • Problems for Spring boot
  • Demo on stage for the keynote was provisioned at 1GB and the apps used 500-700MB regularly

JDK7 & JDK8

Devices

AVR

  • 8bit atmega328 chips
  • 5v, 16mhz
  • some are 3.3 & 8mhz
  • Arduino UNO!
  • Pro Mini's 

PIC32

  • 32bit!! 
  • floating point!
  • 80Mhz - 200mhz
  • some are 3.3 & 8mhz
  • Chipkit UNO!

32 bit

  • Intel?

ARM processors

  • Phones
  • Mini computers
  • Apple Watch is ARM7 compat

Embedded Linux

Other higher-end options

  • Raspberry Pi
  • Raspberry Pi 2
  • Beagle bone Black
  • ODROID
  • Intel NUC

Internet
of
Things

Devices

  • Thermostats
  • Sprinkler Systems
  • TV systems
  • ChromeCast
  • Wink Devices
  • Smart Things
  • Amazon Echo
  • Tweeting coffee pots

IoT :: Scale

Comm

Protocols

HTTP

  • HTTP 1.0
  • HTTP 1.1
  • HTTP/2

HTTP Request

GET / HTTP/1.1
Host: whatever-name:1234
Accept: */*

Response

HTTP/1.1 200 OK

netcat to inspect?  nc -l 4444

802.11 ?

  • mesh?  
  • spectrum
  • network layer
  • zigbee
  • zwave
  • xbee
  • bpl

MQTT

Websockets

TCP transports?

Grails on Pi2

  • jdk8 out of the box (Raspbian)
  • ARM7
  • 1GB of mem
  • Quad core @ 900Mhz
  • HDMI, Video chipset
  • Ethernet
  • 4 USB 2.0
  • micro SDIO

Empty Grails app

  • ~200MB of RAM + Some PermGen

Grails Profiles

Grails Roadmap

  • https://github.com/grails/grails-core/wiki/Roadmap
  • Grails 3.2
    • Non-blocking, lightweight, lower memory Netty profile

Downloading the internet

  • Maven?  
  • Dependencies
  • grails dependency-report

Build vs runtime

  • build, test, compile time
  • Different JVM dependencies

Demo Time

Components

  • Raspberry Pi 2
  • Grails 3 / jdk8 / h2 / runnable jar
  • Phillips Hue
  • Custom circuit-bent XBee Keypad (Arduino)
  • XBee Explorer + Simple Serial protocol
  • Fadecandy + NeoPixel 8x8 Matrix (LEDs!)
  • Processing App (generating LED data)
  • SMS (Twilio)

IoT Hub

  • Grails 3
  • RESTful Services
  • RestClient
  • Serial USB device (PureJavaComm)
  • TCP clients (Fadecandy)
  • H2 Database
  • Runnable jar

Raspberry Pi 2

https://www.raspberrypi.org/products/raspberry-pi-2-model-b/

Phillips Hue

  • 2 Bulbs (Zigbee)
  • Base Station (Ethernet, Zigbee)
  • Phllips Hue API
    • RESTful
    • Local

 

 

Garage Door Keypad

XBee

Circuit bending

Arduino

Serial Protocol

https://twitter.com/iothackday/status/523556799644176384

Fadecandy

 

 

 

https://www.adafruit.com/products/1689

NeoPixel Matrix 8x8 grid

https://www.adafruit.com/product/1487

Processing Sketch

  • Processing 3
  • 7 Modes
  • HTTP Server (1 Socket)
  • Controlled via HTTP
  • JSON response
  • OpenPixelControl

 

https://github.com/ColinHarrington/s2gx-2015-iot-demo-hub

@ColinHarrington hacking on iot and embedded devices with Grails. Awesome! #s2gx #springone2gx  -- @RyanVanderwerf

 

FIN

Thank you!

Booting IoT with Grails

By Colin Harrington

Booting IoT with Grails

A look at what it means to use a web-framework in the world of connected IoT devices

  • 3,887

More from Colin Harrington