SlideShare a Scribd company logo
1 of 17
Micro & Mobile
Java8 on the Raspberry Pi

22 Dec 2013, JavaDay, Pance Cavkovski
The Device

- Raspberry Pi + Arduino
- Basic multimeter: AC/DC
voltage, frequency spectrum,
resistance
- Results shown in a mobile web
application
Netcetera | 2
The hardware

- Raspberry Pi
- Arduino Mega 2560
- Custom adapter and
interface board

Netcetera | 3
The software
Browser app

- Arduino readings
- Java8 SE Embedded
server
- D3.js animated SVG
graphs

d3js

JSON

Java
Java8

WebSocket

lighttpd

pi4j
Serial communication

Analog read + FFT

Netcetera | 4
The software
Arduino read
void loop() {
val1 = analogRead(A1); //AC input
val2 = analogRead(A2); //DC input
val3 = analogRead(A3); //Resistance input
for (i = 0; i < 128; i++) {
val1 = analogRead(A1);
data[i] = val1/2 - 256;
im[0] = 0;
}
//Fast Forward Fourier Transformation
fix_fft(data, im, 7, 0);
for (i = 0; i < 64; i++) {
data[i]= sqrt(data[i]*data[i]+im[i]*im[i]);
lastpass[i] = ylim – data[i];
}

Serial1.print(“ S “);
Serial1.print(val1, HEX);
Serial1.print(“ “);
Serial1.print(val2, HEX);
Serial1.print(“ “);
Serial1.print(val3, HEX);
Serial1.print(“ “);
for (i = 1; i < 21; i++) {
Serial1.print(“ “);
//take the max out of 4 readings
Serial1.print(max(max(max(data[i*4],
data[i*4 + 1]), data[i*4 + 2]),
data[i*4 + 3]),HEX);
}
Serial1.flush();
}
Netcetera | 5
The software
Java server
final Serial serial = SerialFactory.
createInstance();
Serial.addListener(new SerialDataListener() {
private ReadValues readValue =
new ReadValues();
@Override
public void dataReceived(
SerialDataEvent event) {
String received = event.getData();
String[] parts = received.split(“s+”);
//parse the output here.
//reset on each „S‟ received
}
}

serial.open(Serial.DEFAULT_COM_PORT, 115200);
while (true) {
Thread.sleep(10);
if (currentData != null) {
//ReadValues has overriden toString method
//which renders JSON object
String toSend = currentData.toString();
webSocket.send(toSend);
}
}

Netcetera | 6
The software
D3 graphs
//Define the scale and axis
x = d3.scale.linear().range([0, width]);
y = d3.scale.linear().range([0, height]);
yAxis = d3.svg.axis().scale(y).orient("left");
...
//init the svg
svg = d3.select("body").append("svg")...
...
//define d3 enter sequence
selector = svg.selectAll(".bar").data(data);
selector.enter().append("rect")
.attr("class", "bar")
.attr("x", function(d) { return d.x; })
.attr("width", width/50 - 1);
...

//Define d3 update sequence on 100ms interval
selector
.attr("x", function(d) { return d.x; })
.attr("height", function(d) {
return height - y(d.y);
})
.attr("y", function(d) { return y(d.y);})
...
//Start the WebSocket
var socket = new WebSocket("ws://" +
document.domain + ":8887/");
socket.onmessage = function(a) {
lastReceivedValue = a.data;
}

Netcetera | 7
The homepage

Netcetera | 8
The graphs

Netcetera | 9
The demo – DC Voltage

Netcetera | 10
The demo – AC waveline

Netcetera | 11
The demo - Spectrum

Netcetera | 12
The demo - Resistance

Netcetera | 13
The mobile reason

- Mobile is not just responsive
- Mobile browsers are getting lot faster
- JavaScript applications can run smoothly

Netcetera | 14
The micro reason

- Micro devices are catching on and improving
- Raspberry Pi B 2: 700MHz ARM, 512MB SDRAM
Rumored Model C: Dual Core, 1GB RAM?

- Arduino TRE: Intel 1GHz ARM, 512GB DDR3l RAM
- Lots of sensors and shields available

Netcetera | 15
The Java reason

- Java8 improves the embedded editions
- Java8 SE Embedded:
mid-high range, Full OS, general functions, limited I/O integration

- Java8 ME Embedded (v.3.3):
low-mid range, Full/min OS, I/O integrated, optimized, available tools

- Developer versions available

Netcetera | 16
- Source code at https://github.com/hsilomedus/pi4jmultimeter
- Blog post / instructions at http://hsilomedus.me/index.php/pi4jmultimete/
- Questions?
- https://twitter.com/hsilomedus, http://hsilomedus.me/

Netcetera | 17

More Related Content

What's hot

Accelerometer and Open GL
Accelerometer and Open GLAccelerometer and Open GL
Accelerometer and Open GLJohn Wilker
 
Landset 8 的雲層去除技巧實作
Landset 8 的雲層去除技巧實作Landset 8 的雲層去除技巧實作
Landset 8 的雲層去除技巧實作鈵斯 倪
 
Model-based GUI testing using UPPAAL
Model-based GUI testing using UPPAALModel-based GUI testing using UPPAAL
Model-based GUI testing using UPPAALUlrik Hørlyk Hjort
 
Computer graphics practical(jainam)
Computer graphics practical(jainam)Computer graphics practical(jainam)
Computer graphics practical(jainam)JAINAM KAPADIYA
 
Sprint - Exciting Insights from Translating a Classic Car Racing Game to Java...
Sprint - Exciting Insights from Translating a Classic Car Racing Game to Java...Sprint - Exciting Insights from Translating a Classic Car Racing Game to Java...
Sprint - Exciting Insights from Translating a Classic Car Racing Game to Java...norbert_kehrer
 
Introduction to Game Programming Tutorial
Introduction to Game Programming TutorialIntroduction to Game Programming Tutorial
Introduction to Game Programming TutorialRichard Jones
 
Image Processing TARUS: a FARMBOT
Image Processing TARUS: a FARMBOTImage Processing TARUS: a FARMBOT
Image Processing TARUS: a FARMBOTShivang Rana
 
Introduction of 3D Development
Introduction of 3D DevelopmentIntroduction of 3D Development
Introduction of 3D Developmentsiufu
 
To Swift 2...and Beyond!
To Swift 2...and Beyond!To Swift 2...and Beyond!
To Swift 2...and Beyond!Scott Gardner
 
Pytorch and Machine Learning for the Math Impaired
Pytorch and Machine Learning for the Math ImpairedPytorch and Machine Learning for the Math Impaired
Pytorch and Machine Learning for the Math ImpairedTyrel Denison
 
Javascript Arrays
Javascript ArraysJavascript Arrays
Javascript Arraysshaheenakv
 

What's hot (15)

d3 is cool
d3 is coold3 is cool
d3 is cool
 
Accelerometer and Open GL
Accelerometer and Open GLAccelerometer and Open GL
Accelerometer and Open GL
 
Real life XNA
Real life XNAReal life XNA
Real life XNA
 
Ch1 2 (2)
Ch1 2 (2)Ch1 2 (2)
Ch1 2 (2)
 
Landset 8 的雲層去除技巧實作
Landset 8 的雲層去除技巧實作Landset 8 的雲層去除技巧實作
Landset 8 的雲層去除技巧實作
 
Model-based GUI testing using UPPAAL
Model-based GUI testing using UPPAALModel-based GUI testing using UPPAAL
Model-based GUI testing using UPPAAL
 
Computer graphics practical(jainam)
Computer graphics practical(jainam)Computer graphics practical(jainam)
Computer graphics practical(jainam)
 
Sprint - Exciting Insights from Translating a Classic Car Racing Game to Java...
Sprint - Exciting Insights from Translating a Classic Car Racing Game to Java...Sprint - Exciting Insights from Translating a Classic Car Racing Game to Java...
Sprint - Exciting Insights from Translating a Classic Car Racing Game to Java...
 
Introduction to Game Programming Tutorial
Introduction to Game Programming TutorialIntroduction to Game Programming Tutorial
Introduction to Game Programming Tutorial
 
Image Processing TARUS: a FARMBOT
Image Processing TARUS: a FARMBOTImage Processing TARUS: a FARMBOT
Image Processing TARUS: a FARMBOT
 
Introduction of 3D Development
Introduction of 3D DevelopmentIntroduction of 3D Development
Introduction of 3D Development
 
PyData Paris 2015 - Track 1.1 Alexandre Gramfort
PyData Paris 2015 - Track 1.1 Alexandre GramfortPyData Paris 2015 - Track 1.1 Alexandre Gramfort
PyData Paris 2015 - Track 1.1 Alexandre Gramfort
 
To Swift 2...and Beyond!
To Swift 2...and Beyond!To Swift 2...and Beyond!
To Swift 2...and Beyond!
 
Pytorch and Machine Learning for the Math Impaired
Pytorch and Machine Learning for the Math ImpairedPytorch and Machine Learning for the Math Impaired
Pytorch and Machine Learning for the Math Impaired
 
Javascript Arrays
Javascript ArraysJavascript Arrays
Javascript Arrays
 

Similar to Micro and moblile: Java on the Raspberry Pi

SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)Oswald Campesato
 
D3.js 30-minute intro
D3.js   30-minute introD3.js   30-minute intro
D3.js 30-minute introFelipe
 
Professional reports with SVG
Professional reports with SVGProfessional reports with SVG
Professional reports with SVGSpeedPartner GmbH
 
Visual Exploration of Large Data sets with D3, crossfilter and dc.js
Visual Exploration of Large Data sets with D3, crossfilter and dc.jsVisual Exploration of Large Data sets with D3, crossfilter and dc.js
Visual Exploration of Large Data sets with D3, crossfilter and dc.jsFlorian Georg
 
Learn D3.js in 90 minutes
Learn D3.js in 90 minutesLearn D3.js in 90 minutes
Learn D3.js in 90 minutesJos Dirksen
 
Example R usage for oracle DBA UKOUG 2013
Example R usage for oracle DBA UKOUG 2013Example R usage for oracle DBA UKOUG 2013
Example R usage for oracle DBA UKOUG 2013BertrandDrouvot
 
Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghStuart Roebuck
 
Arduino and the real time web
Arduino and the real time webArduino and the real time web
Arduino and the real time webAndrew Fisher
 
Visualization of Big Data in Web Apps
Visualization of Big Data in Web AppsVisualization of Big Data in Web Apps
Visualization of Big Data in Web AppsEPAM
 
Forge - DevCon 2016: Visual Reporting with Connected Design Data
Forge - DevCon 2016: Visual Reporting with Connected Design DataForge - DevCon 2016: Visual Reporting with Connected Design Data
Forge - DevCon 2016: Visual Reporting with Connected Design DataAutodesk
 
Android Wear 2.0 - Great Changes Upcoming This Fall - GDG DevFest Ukraine 2016
Android Wear 2.0 - Great Changes Upcoming This Fall - GDG DevFest Ukraine 2016Android Wear 2.0 - Great Changes Upcoming This Fall - GDG DevFest Ukraine 2016
Android Wear 2.0 - Great Changes Upcoming This Fall - GDG DevFest Ukraine 2016Constantine Mars
 
C++ AMP 실천 및 적용 전략
C++ AMP 실천 및 적용 전략 C++ AMP 실천 및 적용 전략
C++ AMP 실천 및 적용 전략 명신 김
 
Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017 Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017 pramode_ce
 
The Web map stack on Django
The Web map stack on DjangoThe Web map stack on Django
The Web map stack on DjangoPaul Smith
 
How to Hack a Road Trip with a Webcam, a GSP and Some Fun with Node
How to Hack a Road Trip  with a Webcam, a GSP and Some Fun with NodeHow to Hack a Road Trip  with a Webcam, a GSP and Some Fun with Node
How to Hack a Road Trip with a Webcam, a GSP and Some Fun with Nodepdeschen
 

Similar to Micro and moblile: Java on the Raspberry Pi (20)

SVGD3Angular2React
SVGD3Angular2ReactSVGD3Angular2React
SVGD3Angular2React
 
Svcc 2013-d3
Svcc 2013-d3Svcc 2013-d3
Svcc 2013-d3
 
SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)
 
D3.js 30-minute intro
D3.js   30-minute introD3.js   30-minute intro
D3.js 30-minute intro
 
Professional reports with SVG
Professional reports with SVGProfessional reports with SVG
Professional reports with SVG
 
Visual Exploration of Large Data sets with D3, crossfilter and dc.js
Visual Exploration of Large Data sets with D3, crossfilter and dc.jsVisual Exploration of Large Data sets with D3, crossfilter and dc.js
Visual Exploration of Large Data sets with D3, crossfilter and dc.js
 
Learn D3.js in 90 minutes
Learn D3.js in 90 minutesLearn D3.js in 90 minutes
Learn D3.js in 90 minutes
 
Example R usage for oracle DBA UKOUG 2013
Example R usage for oracle DBA UKOUG 2013Example R usage for oracle DBA UKOUG 2013
Example R usage for oracle DBA UKOUG 2013
 
Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup Edinburgh
 
Analytics with Spark
Analytics with SparkAnalytics with Spark
Analytics with Spark
 
Arduino and the real time web
Arduino and the real time webArduino and the real time web
Arduino and the real time web
 
Visualization of Big Data in Web Apps
Visualization of Big Data in Web AppsVisualization of Big Data in Web Apps
Visualization of Big Data in Web Apps
 
Forge - DevCon 2016: Visual Reporting with Connected Design Data
Forge - DevCon 2016: Visual Reporting with Connected Design DataForge - DevCon 2016: Visual Reporting with Connected Design Data
Forge - DevCon 2016: Visual Reporting with Connected Design Data
 
Scrollytelling
ScrollytellingScrollytelling
Scrollytelling
 
Android Wear 2.0 - Great Changes Upcoming This Fall - GDG DevFest Ukraine 2016
Android Wear 2.0 - Great Changes Upcoming This Fall - GDG DevFest Ukraine 2016Android Wear 2.0 - Great Changes Upcoming This Fall - GDG DevFest Ukraine 2016
Android Wear 2.0 - Great Changes Upcoming This Fall - GDG DevFest Ukraine 2016
 
C++ AMP 실천 및 적용 전략
C++ AMP 실천 및 적용 전략 C++ AMP 실천 및 적용 전략
C++ AMP 실천 및 적용 전략
 
Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017 Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017
 
First fare 2010 java-beta-2011
First fare 2010 java-beta-2011First fare 2010 java-beta-2011
First fare 2010 java-beta-2011
 
The Web map stack on Django
The Web map stack on DjangoThe Web map stack on Django
The Web map stack on Django
 
How to Hack a Road Trip with a Webcam, a GSP and Some Fun with Node
How to Hack a Road Trip  with a Webcam, a GSP and Some Fun with NodeHow to Hack a Road Trip  with a Webcam, a GSP and Some Fun with Node
How to Hack a Road Trip with a Webcam, a GSP and Some Fun with Node
 

More from Pance Cavkovski

Jprofessionals co create the future of your city
Jprofessionals co create the future of your cityJprofessionals co create the future of your city
Jprofessionals co create the future of your cityPance Cavkovski
 
Gluing the IoT world with Java and LoRaWAN (Jfokus 2018)
Gluing the IoT world with Java and LoRaWAN (Jfokus 2018)Gluing the IoT world with Java and LoRaWAN (Jfokus 2018)
Gluing the IoT world with Java and LoRaWAN (Jfokus 2018)Pance Cavkovski
 
Gluing the iot world (ICT)
Gluing the iot world (ICT)Gluing the iot world (ICT)
Gluing the iot world (ICT)Pance Cavkovski
 
Gluing the IoT world with Java and LoRaWAN
Gluing the IoT world with Java and LoRaWANGluing the IoT world with Java and LoRaWAN
Gluing the IoT world with Java and LoRaWANPance Cavkovski
 
VDB16 - DIY Java & Kubernetes
VDB16 - DIY Java & KubernetesVDB16 - DIY Java & Kubernetes
VDB16 - DIY Java & KubernetesPance Cavkovski
 
Connected hardware for Software Engineers 101
Connected hardware for Software Engineers 101Connected hardware for Software Engineers 101
Connected hardware for Software Engineers 101Pance Cavkovski
 
Hands on Java8 and RaspberryPi
Hands on Java8 and RaspberryPiHands on Java8 and RaspberryPi
Hands on Java8 and RaspberryPiPance Cavkovski
 

More from Pance Cavkovski (9)

Jprofessionals co create the future of your city
Jprofessionals co create the future of your cityJprofessionals co create the future of your city
Jprofessionals co create the future of your city
 
Gluing the IoT world with Java and LoRaWAN (Jfokus 2018)
Gluing the IoT world with Java and LoRaWAN (Jfokus 2018)Gluing the IoT world with Java and LoRaWAN (Jfokus 2018)
Gluing the IoT world with Java and LoRaWAN (Jfokus 2018)
 
Gluing the iot world (ICT)
Gluing the iot world (ICT)Gluing the iot world (ICT)
Gluing the iot world (ICT)
 
Gluing the IoT world with Java and LoRaWAN
Gluing the IoT world with Java and LoRaWANGluing the IoT world with Java and LoRaWAN
Gluing the IoT world with Java and LoRaWAN
 
VDB16 - DIY Java & Kubernetes
VDB16 - DIY Java & KubernetesVDB16 - DIY Java & Kubernetes
VDB16 - DIY Java & Kubernetes
 
DIY Java & Kubernetes
DIY Java & KubernetesDIY Java & Kubernetes
DIY Java & Kubernetes
 
Connected hardware for Software Engineers 101
Connected hardware for Software Engineers 101Connected hardware for Software Engineers 101
Connected hardware for Software Engineers 101
 
Hands on Java8 and RaspberryPi
Hands on Java8 and RaspberryPiHands on Java8 and RaspberryPi
Hands on Java8 and RaspberryPi
 
Web sockets in Java
Web sockets in JavaWeb sockets in Java
Web sockets in Java
 

Recently uploaded

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 

Recently uploaded (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

Micro and moblile: Java on the Raspberry Pi

  • 1. Micro & Mobile Java8 on the Raspberry Pi 22 Dec 2013, JavaDay, Pance Cavkovski
  • 2. The Device - Raspberry Pi + Arduino - Basic multimeter: AC/DC voltage, frequency spectrum, resistance - Results shown in a mobile web application Netcetera | 2
  • 3. The hardware - Raspberry Pi - Arduino Mega 2560 - Custom adapter and interface board Netcetera | 3
  • 4. The software Browser app - Arduino readings - Java8 SE Embedded server - D3.js animated SVG graphs d3js JSON Java Java8 WebSocket lighttpd pi4j Serial communication Analog read + FFT Netcetera | 4
  • 5. The software Arduino read void loop() { val1 = analogRead(A1); //AC input val2 = analogRead(A2); //DC input val3 = analogRead(A3); //Resistance input for (i = 0; i < 128; i++) { val1 = analogRead(A1); data[i] = val1/2 - 256; im[0] = 0; } //Fast Forward Fourier Transformation fix_fft(data, im, 7, 0); for (i = 0; i < 64; i++) { data[i]= sqrt(data[i]*data[i]+im[i]*im[i]); lastpass[i] = ylim – data[i]; } Serial1.print(“ S “); Serial1.print(val1, HEX); Serial1.print(“ “); Serial1.print(val2, HEX); Serial1.print(“ “); Serial1.print(val3, HEX); Serial1.print(“ “); for (i = 1; i < 21; i++) { Serial1.print(“ “); //take the max out of 4 readings Serial1.print(max(max(max(data[i*4], data[i*4 + 1]), data[i*4 + 2]), data[i*4 + 3]),HEX); } Serial1.flush(); } Netcetera | 5
  • 6. The software Java server final Serial serial = SerialFactory. createInstance(); Serial.addListener(new SerialDataListener() { private ReadValues readValue = new ReadValues(); @Override public void dataReceived( SerialDataEvent event) { String received = event.getData(); String[] parts = received.split(“s+”); //parse the output here. //reset on each „S‟ received } } serial.open(Serial.DEFAULT_COM_PORT, 115200); while (true) { Thread.sleep(10); if (currentData != null) { //ReadValues has overriden toString method //which renders JSON object String toSend = currentData.toString(); webSocket.send(toSend); } } Netcetera | 6
  • 7. The software D3 graphs //Define the scale and axis x = d3.scale.linear().range([0, width]); y = d3.scale.linear().range([0, height]); yAxis = d3.svg.axis().scale(y).orient("left"); ... //init the svg svg = d3.select("body").append("svg")... ... //define d3 enter sequence selector = svg.selectAll(".bar").data(data); selector.enter().append("rect") .attr("class", "bar") .attr("x", function(d) { return d.x; }) .attr("width", width/50 - 1); ... //Define d3 update sequence on 100ms interval selector .attr("x", function(d) { return d.x; }) .attr("height", function(d) { return height - y(d.y); }) .attr("y", function(d) { return y(d.y);}) ... //Start the WebSocket var socket = new WebSocket("ws://" + document.domain + ":8887/"); socket.onmessage = function(a) { lastReceivedValue = a.data; } Netcetera | 7
  • 10. The demo – DC Voltage Netcetera | 10
  • 11. The demo – AC waveline Netcetera | 11
  • 12. The demo - Spectrum Netcetera | 12
  • 13. The demo - Resistance Netcetera | 13
  • 14. The mobile reason - Mobile is not just responsive - Mobile browsers are getting lot faster - JavaScript applications can run smoothly Netcetera | 14
  • 15. The micro reason - Micro devices are catching on and improving - Raspberry Pi B 2: 700MHz ARM, 512MB SDRAM Rumored Model C: Dual Core, 1GB RAM? - Arduino TRE: Intel 1GHz ARM, 512GB DDR3l RAM - Lots of sensors and shields available Netcetera | 15
  • 16. The Java reason - Java8 improves the embedded editions - Java8 SE Embedded: mid-high range, Full OS, general functions, limited I/O integration - Java8 ME Embedded (v.3.3): low-mid range, Full/min OS, I/O integrated, optimized, available tools - Developer versions available Netcetera | 16
  • 17. - Source code at https://github.com/hsilomedus/pi4jmultimeter - Blog post / instructions at http://hsilomedus.me/index.php/pi4jmultimete/ - Questions? - https://twitter.com/hsilomedus, http://hsilomedus.me/ Netcetera | 17