72
@java #DV13 #iothackfest Tori Wieldt, Yara Senger, Yoland and Vinicius Oracle / OTN / Globalcode

Devoxx 2013 io t

Embed Size (px)

DESCRIPTION

KICKSTART YOUR RASPBERRY PI AND/OR LEAPMOTION PROJECT - Presentation about Java Embedded and Raspberry Pi

Citation preview

Page 1: Devoxx 2013  io t

@java#DV13 #iothackfest

Tori Wieldt, Yara Senger, Yoland and Vinicius

Oracle / OTN / Globalcode

Page 2: Devoxx 2013  io t

@java#DV13-#iothackfest

Thanks!Thanks!

Oracle Technology Network: Tori Wieldt, Senior Java Community Manager

Yolande Poirier, Java Community Manager

Devoxx Team

Thank YOU for being here!

Page 3: Devoxx 2013  io t

@java#DV13-#iothackfest

Vinicius SengerVinicius Senger

+20 years working with software development

Founder of Globalcode, training &consulting since 2001

Java EE developer profile

Started with electronics, Sun Spot, Arduino and Linux Embedded 5 years ago

Duke’s Choice Award 2011

JavaOne Rockstar 2012

Now I'm Maker!

Page 4: Devoxx 2013  io t

@java#DV13-#iothackfest

Yara SengerYara Senger

SouJava President

Java Champion

Duke’s Choice Award 2011

JavaOne Rock Start 2012

Director of The Developer’s Conference

and …

My wife!!!

Page 5: Devoxx 2013  io t

@java#DV13-#iothackfest

Page 6: Devoxx 2013  io t

@java#DV13-#iothackfest

Ubatuba = 86 different beaches!Ubatuba = 86 different beaches!

Come visit us!Come visit us!

Page 7: Devoxx 2013  io t

@java#DV13-#iothackfest

Devoxx IoT Hack FestDevoxx IoT Hack Fest

Promoted by Oracle and Devoxx;

Two days of IoT, Java and hacking!

Not a competition;

Educational content in the morning;

Hacking and hands-on in the afternoon;

Mentors and Experts for Java Embedded Platform

Sponsored by Oracle Technology Network (cwyat)

Page 8: Devoxx 2013  io t

@java#DV13-#iothackfest

3rd Java IoT / Embedded "Hack Fest"3rd Java IoT / Embedded "Hack Fest"

July, Brazil TDC: RPi Hackathon

October, US JavaOne: RPi Developer Challenge

November, BE Devoxx: IoT Hack Fest

Page 9: Devoxx 2013  io t

@java#DV13-#iothackfest

Devoxx Hack FestDevoxx Hack Fest

Learn: Raspberry Pi & Java / Leap Motion

Idea brainstorm: World Wide Cafe with Yara Senger

Team Development: Make a prototype during two days with mentors help

Publish: source code, OTN Blog and during Steve's talk tomorrow!

Page 10: Devoxx 2013  io t

@java#DV13-#iothackfest

The PrizesThe Prizes

Knowledge

Networking

FUN!!!!!!

Hugs for Free!!

Page 11: Devoxx 2013  io t

@java#DV13-#iothackfest

MondayMonday

9:30 – 11:00 - Vinicius Senger

• Introduction to Raspberry Pi and IoT

• Raspberry Pi + GPIO + Java

•Hands-on Lab with Oracle's Kit

11:00 – 11:45 - Introduction to Leap Motion

11:45 – 12:30 – Brainstorm and Team Formation

13:30 – 20:00 - Project Development

•Your team can use Oracle's Kit!

Page 12: Devoxx 2013  io t

@java#DV13-#iothackfest

TuesdayTuesday

9:30 – 11:00 - Vinicius Senger

•Raspberry GPIO with PI4J

•Raspberry Pi Camera

•Raspberry + Arduino Integration

11:00 – 12:00 – Show Cases

12:00 – 12:30 – Teams Meeting

13:30 – 18:00 – Development

18:00 – 19:00 – Project presentations

Page 13: Devoxx 2013  io t

@java#DV13-#iothackfest

Hacking Fest – Oracle's KitHacking Fest – Oracle's Kit

8 x Raspberry Pi

2 x Camera

4 LCD plate

3 Arduino

5 x LCD Display

2 x LED Matrix

1 x Home Automation Box

1 x Embedded Panel – "Intranet of Things"

Page 14: Devoxx 2013  io t

@java#DV13-#iothackfest

Let's start the fest?Let's start the fest?

Page 15: Devoxx 2013  io t

@java#DV13-#iothackfest

The moment…The moment…

+ Do it yourself

+ Open-source hardware and software

+ Entrepreneurship / Crowdfunding

+ Creativity

+ Cheaper Tiny Computer

+ Easy of Embedded Development

Page 16: Devoxx 2013  io t

@java#DV13-#iothackfest

Do it yourselfDo it yourself

Fix yourself use to be the first stimulus for d.i.y.

Learn different things & life-style

End-to-end developer: wood, firmware, hardware, soldering, mechanics and creativity

Not about paying less or cheaper devices

Exciting moment for D.I.Y communities!

Page 17: Devoxx 2013  io t

@java#DV13-#iothackfest

Do it your self in action!Do it your self in action!

Student Satellites

Page 18: Devoxx 2013  io t

@java#DV13-#iothackfest

Do it your selfDo it your self

• Horse Instrumentation

• Arduino

• Heart beat

• Accelerometer

• GPS

Page 19: Devoxx 2013  io t

@java#DV13-#iothackfest

Do it your self in action!Do it your self in action!

Neutrons Diffractmeter

Page 20: Devoxx 2013  io t

@java#DV13-#iothackfest

Do it your self in action!Do it your self in action!

Boat Automation

Page 21: Devoxx 2013  io t

@java#DV13-#iothackfest

Your idea, your business!Your idea, your business!

Page 22: Devoxx 2013  io t

@java#DV13-#iothackfest

Internet of Things - IoTInternet of Things - IoT

One computer per (relevant) thing as the new one computer per child?

Smart Things ecosystem

More than 40 billion devices by 2020;

Things…

Page 23: Devoxx 2013  io t

@java#DV13-#iothackfest

Internet of ThingsInternet of Things

Page 24: Devoxx 2013  io t

@java#DV13-#iothackfest

Internet of ThingsInternet of Things

Page 25: Devoxx 2013  io t

@java#DV13-#iothackfest

Internet of ThingsInternet of Things

Page 26: Devoxx 2013  io t

@java#DV13-#iothackfest

Java & IoTJava & IoT

Enterprise Data & Applications

Embedded-Cloud

Embedded-Cloud

Meters

Smart Appliances & electronics

Personal Devices

Med-Large Embedded / Multi-function Devices

VoIP Comm

Industrial controls / Network Appliances

Management / Monitoring / Operations

Sensors / Microcontrollers

Connected Vehicles

Page 27: Devoxx 2013  io t

@java#DV13-#iothackfest

Raspberry Pi: small, simple andcheaper computer!Raspberry Pi: small, simple andcheaper computer!

•U$ 25 / U$ 35 Tiny Computer

• Arm v6 ARM1176JZF-S 700mhz / 512MB

•SOC Broadcom BCM2835

•GPU Videocore 4

•HDMI Video

•Ethernet and 2 USBs

•GPIO: UART, I2C, SPI, digitais

•Audio / LCD / Camera

Page 28: Devoxx 2013  io t

@java#DV13-#iothackfest

Page 29: Devoxx 2013  io t

@java#DV13-#iothackfest

Raspberry PiRaspberry Pi

Do it yourself and industry projects!

Page 30: Devoxx 2013  io t

@java#DV13-#iothackfest

Raspberry PiRaspberry Pi

Common user

Page 31: Devoxx 2013  io t

@java#DV13-#iothackfest

Raspberry PiRaspberry Pi

Hacking

Page 32: Devoxx 2013  io t

@java#DV13-#iothackfest

Starting your PiStarting your Pi

•Download your choise of OS:

•Raspbian (most popular and used here)

•Pidora

•Archlinux

•RISC Os

•Media Server XBMC

Page 33: Devoxx 2013  io t

@java#DV13-#iothackfest

Image to CardImage to Card

•Linux Command

•dd if=<img.img> of=/dev/sdb

•Take CARE!

Page 34: Devoxx 2013  io t

@java#DV13-#iothackfest

Power SupplyPower Supply

•5volts 1amp recommended!

•Micro USB

•Use a good power supply, it's sensible

•Rebooting use to be a power supply problem

•UBEC for battery regulator

Page 35: Devoxx 2013  io t

@java#DV13-#iothackfest

Boot!Boot!

•user: pi

•password: raspberry

•xserver is not started by default!

•command: startx

Page 36: Devoxx 2013  io t

@java#DV13-#iothackfest

DemoDemo

•Starting Raspberry Pi!

•Booting Rpi

•startx

Page 37: Devoxx 2013  io t

@java#DV13-#iothackfest

/etc/interfaces/network

auto lo

iface lo inet loopbackiface eth0 inet dhcp

allow-hotplug wlan0iface wlan0 inet dhcpwpa-conf /etc/wpa_supplicant/wpa_supplicant.confiface default inet dhcp

Network Setup (DHCP)Network Setup (DHCP)

Page 38: Devoxx 2013  io t

@java#DV13-#iothackfest

/etc/interfaces/network

auto lo

iface lo inet loopbackiface eth0 inet dhcp

allow-hotplug wlan0iface wlan0 inet static address 192.168.1.118 gateway 192.168.1.1 netmask 255.255.255.0wpa-conf /etc/wpa_supplicant/wpa_supplicant.confiface default inet dhcp

Network Setup: Static IPNetwork Setup: Static IP

Page 39: Devoxx 2013  io t

@java#DV13-#iothackfest

/etc/wpa_suplicant/wpa_suplicant.confnetwork={ ssid="ssid name" psk="key"}

Network Setup: WIFINetwork Setup: WIFI

Page 40: Devoxx 2013  io t

@java#DV13-#iothackfest

sudo raspi-configsudo raspi-config

Page 41: Devoxx 2013  io t

@java#DV13-#iothackfest

vncvnc

Start the server: vncserver :1

Create a password

Using VNC Client ip address + :1

•ip address:1

Page 42: Devoxx 2013  io t

Demo

@java#DV13 #iothackfest

vnc, network setup and raspi-config

Page 43: Devoxx 2013  io t

@java#DV13-#iothackfest

Raspberry Pi GPIORaspberry Pi GPIO

P1-01

5V GND 18 23 24 25 8 711 (S

CLK

)

2227174

3.3V

5V GND GND

GND GND GND

Page 44: Devoxx 2013  io t

@java#DV13-#iothackfest

GPIOGPIO

•Digital, Analog, PWM, UART, I2C and SPI

•Digital vs Analog

•PWM

•UART: old but gold Serial

•I2C and SPI: component bus

Page 45: Devoxx 2013  io t

@java#DV13-#iothackfest

Raspberry Pi GPIORaspberry Pi GPIO

•where the fun lives!

•17 digital pins:

•7 general, 1 pwm, 2 I2C, 5 SPI, 2 UART

•CMOS (3.3 volts) and not TTL (5 volts) take care!

•MAX232 can convert 5 – 3 volts vice-versa

Page 46: Devoxx 2013  io t

@java#DV13-#iothackfest

where the fun lives!

https://www.modmypi.com/blog/raspberry-pi-gpio-cheat-sheet

Page 47: Devoxx 2013  io t

@java#DV13-#iothackfest

Relay Board ExampleRelay Board Example

•GND, 5 volts, relay1, relay2

Page 48: Devoxx 2013  io t

@java#DV13-#iothackfest

wiringPIwiringPI

GPIO Interface library

•Command line GPIO manipulation

•Setup digital 24 as output:

sudo gpio -g mode 24 output

•"Turn on" digital 24:

sudo gpio -g write 24 1

•Turn off digital 24:

sudo gpio -g write 24 0

Page 49: Devoxx 2013  io t

@java#DV13-#iothackfest

wiringPIwiringPI

•Reading port state script#!/bin/bashCMD=$(sudo gpio -g read 24)echo $CMDif [ $CMD == "0" ]; then CMD="sudo gpio -g write 24 1";else CMD="sudo gpio -g write 24 0";fiecho $CMD$CMD

Page 50: Devoxx 2013  io t

@java#DV13-#iothackfest

webioPIwebioPI

•GPIO over the web

•Listen to port 8000, ex 192.168.1.12:8000

•User: webiopi

•Password: raspberry

Page 51: Devoxx 2013  io t

Demo

@java#DV13 #iothackfest

GPIO, wiringPi and WebIOPI

Page 52: Devoxx 2013  io t

@java#DV13-#iothackfest

Java & RPi Hack "Fast Image"Java & RPi Hack "Fast Image"

Ready to use!

•/home/pi/java is the central Java directory

•Comes with JDK 1.8, JES 7 and Java ME 3.3

•Sample Apps Available:

•Things RESTFul Gateway – Java EE App

•PiFit – Java SE

•Tweet4Pi – Java SE

•AutomationFX – Java FX

Page 53: Devoxx 2013  io t

@java#DV13-#iothackfest

Java SE EmbeddedJava SE Embedded

Optimized for Raspberry Pi / ARM

•Hard-float support

•All the JVM facilities embedded: debug, GC, distribution, class loading, etc.

•GPIO Access using Pi4j

•Your Java SE knowledge now embedded!!!

Page 54: Devoxx 2013  io t

@java#DV13-#iothackfest

Java EE Embedded:Java EE Embedded:

Server-side just arrives in embedded side!

•Lightweight Java EE server for embedded

•Stack: Java SE Embedded, Glassfish, JavaDB

•Embedded-cloud as the new client-server?

•Gateway for infrared, zigbee, rfid, rs232, rs485, etc.

•Cache, persistence, processing, integration, security, etc.

•REST / JPA / Servlet

•"firmware" as server!

Page 55: Devoxx 2013  io t

@java#DV13-#iothackfest

Java FXJava FX

•Good performance inside Raspberry Pi (runs direct on GPU)

•Setup Required:

boot/config – uncomment:

#framebuffer_width=1280

#framebuffer_height=720

Overclock 1Gh recommended (raspi-config)

Video memory split to 128mb (raspi-config)

Very rich interface for embeddded projects

Page 56: Devoxx 2013  io t

@java#DV13-#iothackfest

Java ME EmbeddedJava ME Embedded

Java ME for Real Embedded Projects!

•Internet das Coisas com 3G + Java ME + GPIO

•Manutenção, debug, OTA, ferramentas

•Baixo custo no Brasil: U$ 5 para larga escala!

•Indústria, protótipos e "Do It Your Self"

•BubbleBoard Gemalto

Page 57: Devoxx 2013  io t

@java#DV13-#iothackfest

Oracle Event Processing EmbeddedOracle Event Processing Embedded

Embedded being smart

•Complex event arrives in your embedded project!

•Data + persistence = database

•Data + Complex Event = information

•Information Collection = Smart!

Page 58: Devoxx 2013  io t

Demo

@java#DV13 #iothackfest

Java + Raspberry Pi

Page 59: Devoxx 2013  io t

@java#DV13-#iothackfest

Embedded PanelEmbedded Panel

•You can consume via REST or deploy your app there!

•Shared sensors / devices:

•2 Raspberry Pi's + 2 Arduino Based Board

•8 relays

•Water Pump, Fan, Pop Corn Machine

•LED RGB Stripe

•Alcohol, distance, temperature, humidity, light sensors

•Polar heart Monitor

Page 60: Devoxx 2013  io t

@java#DV13-#iothackfest

Components & Toys Components & Toys

Embedded Panel

•You can consume via REST or deploy your app there!

•Shared sensors / devices:

•2 Raspberry Pi's + 2 Arduino Based Board

•8 relays

•Water Pump, Fan, Pop Corn Machine

•LED RGB Stripe

•Alcohol, distance, temperature, humidity, light sensors

•Polar heart Monitor

Page 61: Devoxx 2013  io t

@java#DV13-#iothackfest

DEMO: Raspberry Pi + JES + ArduinoDEMO: Raspberry Pi + JES + Arduino

Page 62: Devoxx 2013  io t

@java#DV13-#iothackfest

Page 63: Devoxx 2013  io t

@java#DV13-#iothackfest

Components & Toys Components & Toys

Embedded Panel

•192.168.1.11 – Raspberry Pi #1 (Embedded Panel)

•192.168.1.12 – Raspberry Pi #2 (Embedded Panel)

•192.168.1.41 – Raspberry Pi #3 (Home Automation Box)

Page 64: Devoxx 2013  io t

@java#DV13-#iothackfest

Components & Toys Components & Toys

Embedded Panel – Pi #1

•http://192.168.1.11:8080/things/relay1 = AC #1

•http://192.168.1.11:8080/things/relay3 = AC #2

•http://192.168.1.11:8080/things/temp_out = Temperature external

•http://192.168.1.11:8080/things/temp_in = Board Temperature

•http://192.168.1.11:8080/things/humidity

•http://192.168.1.11:8080/things/distance

Page 65: Devoxx 2013  io t

@java#DV13-#iothackfest

Components & Toys Components & Toys

Embedded Panel – Pi #2

•http://192.168.1.12:8080/things/relay2 = AC #3

•http://192.168.1.12:8080/things/relay4 = AC #4

•http://192.168.1.12:8080/things/alcohol

•http://192.168.1.12:8080/things/temp_in = Board Temperature

•http://192.168.1.12:8080/things/servo = Servo Camera

•http://192.168.1.12:8081 = Camera Image

Page 66: Devoxx 2013  io t

@java#DV13-#iothackfest

Components & Toys Components & Toys

Home Automation Box

•http://192.168.1.41:8080/things/temp_out = Temperature external

•http://192.168.1.41:8080/things/temp_in = Board Temperature

•http://192.168.1.41:8080/things/humidity

•http://192.168.1.41:8080/things/red/x = red color (x=0 to 255)

•http://192.168.1.41:8080/things/green/x = green color (x=0 to 255)

•http://192.168.1.41:8080/things/blue/x = blue color (x=0 to 255)

Page 67: Devoxx 2013  io t

@java#DV13-#iothackfest

Things Gateway EmbeddedThings Gateway Embedded

•RESTFul App that exposes sensors and actuators to the Web

•Uses Java Embedded Suite Stack + Things API

•Allows you to access RPi GPIO and Arduinos

Page 68: Devoxx 2013  io t

@java#DV13-#iothackfest

Things Gateway EmbeddedThings Gateway Embedded

•Pre-installed on all SDCard

•Ready to use:

pi@pi1 ~ $ cd java/pi@pi1 ~/java $ ./things-gateway.sh Deploying /home/pi/java/things.jar ...Press <Enter> to exit server.

http://ip:8080/things/lighthttp://ip:8080/things/red/200http://ip:8080/things/distancehttp://ip:8080/things/XXXXX

Page 69: Devoxx 2013  io t

@java#DV13-#iothackfest

Things Gateway EmbeddedThings Gateway Embedded

http://ip:8080/things/red/200http://ip:8080/things/lighthttp://ip:8080/things/distance

Raspberry Pi Server

Things API

Arduino

Page 70: Devoxx 2013  io t

@java#DV13-#iothackfest

Things API – SourceThings API – Source

Sample code to access Arduino sensors using Things API:

git clone https://github.com/vsenger/things-api

Page 71: Devoxx 2013  io t

@java#DV13-#iothackfest

Things API – more tomorrow!Things API – more tomorrow!

git clone https://github.com/vsenger/things-api

Page 72: Devoxx 2013  io t

@java#DV13-#iothackfest

Hands-on labHands-on lab

•Using Oracle's kit