SlideShare a Scribd company logo
Carjacking 
With 
Java 
(Or 
Building 
A 
Java 
Carputer) 
Simon 
Ri>er 
Head 
of 
Java 
Evangelism, 
Oracle 
Twi>er: 
@speakjava 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved.
Safe 
Harbor 
Statement 
The 
following 
is 
intended 
to 
outline 
our 
general 
product 
direcRon. 
It 
is 
intended 
for 
informaRon 
purposes 
only, 
and 
may 
not 
be 
incorporated 
into 
any 
contract. 
It 
is 
not 
a 
commitment 
to 
deliver 
any 
material, 
code, 
or 
funcRonality, 
and 
should 
not 
be 
relied 
upon 
in 
making 
purchasing 
decisions. 
The 
development, 
release, 
and 
Rming 
of 
any 
features 
or 
funcRonality 
described 
for 
Oracle’s 
products 
remains 
at 
the 
sole 
discreRon 
of 
Oracle. 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
2
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Program 
Agenda 
Cars 
And 
Computers 
The 
Java 
Carputer 
(Mark 
1) 
The 
Java 
Carputer 
(Mark 
2) 
Heads 
Up 
Display/TelemaRcs 
Data 
Recording/Analysis 
Conclusions, 
Resources 
and 
Demos 
1 
2 
3 
4 
5 
6
Cars 
And 
Computers 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved.
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
My 
First 
Car: 
1981 
1971 
Mini 
Clubman 
1000 
• No 
electronics 
– Well, 
it 
had 
a 
radio 
• Purely 
electromechanical 
– Points/Distributor 
– Carbure>or/Manual 
choke 
– Drum 
brakes 
– Dynamo 
– Lights, 
horn, 
wipers, 
fan, 
igniRon 
switch
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Car 
Wiring: 
1970s 
Image 
coutesy 
of 
Haynes 
manuals
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
My 
Current 
Car 
• Lots 
of 
electronics 
– Engine 
Control 
Unit 
(ECU) 
– Fuel 
InjecRon/Electronic 
Rming 
– “Fly-­‐by-­‐wire” 
thro>le 
– AnR-­‐lock 
Braking 
System 
(ABS) 
– Electronic 
Stability 
Program 
(ESP) 
– Magnetorheological 
Suspension 
– Satellite 
navigaRon 
– Auto-­‐sensing 
wipers 
and 
lights 
2011 
Audi 
S3
Bus 
architecture 
means 
substan>ally 
less 
wiring 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Car 
Wiring: 
2011 
Convenience 
Bus 
Infotainment 
Bus 
Powertrain 
Bus
The 
Java 
Carputer 
(Mark 
1) 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved.
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Carputer 
Design 
ObjecRves 
• Display 
realRme 
data 
• Engine 
performance 
(Power, 
Torque, 
Load) 
• Driver 
data 
(Thro>le 
posiRon, 
steering 
angle, 
braking 
force, 
etc) 
• G-­‐Forces 
on 
car 
• Graphed 
data 
for 
Rme-­‐based 
analysis
Carputer 
Hardware 
Architecture 
USB 
WiFi 
Dongle 
Touch 
Screen 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
HDMI 
Accelerometer 
USB 
I2C 
12V 
Car 
Converter 
ELM327 
Car 
Service 
Port 
5V 
USB
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
ELM327 
Cheap 
way 
to 
hack 
your 
car 
• WiFi 
or 
Bluetooth 
connecRon 
to 
OBD-­‐II 
• Fixed 
IP 
address, 
Ad-­‐hoc 
networking 
• Need 
to 
configure 
Raspberry 
Pi 
– /etc/network/interfaces 
• AT 
style 
commands 
for 
control 
• Non-­‐AT 
commands 
are 
assumed 
to 
be 
OBD-­‐II 
– Simple 
request-­‐response 
interacRon 
– Easy 
to 
write 
Java 
code 
to 
handle 
this
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Touchscreen 
Lots 
of 
things 
available 
on 
eBay 
• 2 
DIN 
fiing 
size 
– Ideal 
for 
centre 
console 
• HDMI 
input 
– Specifically 
marketed 
for 
Raspberry 
Pi 
• USB 
connecRon 
for 
touch 
screen
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Touchscreen 
Hardware 
FiJng 
Challenges
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Accelerometer 
• Sparkfun 
breakout 
board 
MPU 
9150 
– 9 
DoF 
sensor 
(accelerometer, 
gyroscope, 
compass) 
• CommunicaRons 
via 
I2C 
– Configure 
Raspberry 
Pi 
/etc/modules 
• i2c-­‐bcm2708, 
i2c-­‐dev 
• i2c-­‐detect 
-­‐y 
1 
to 
get 
address 
– Compass 
communicaRon 
is 
a 
bit 
more 
complicated 
• Second 
I2C 
bus
Accelerometer 
Code 
Using 
Pi4J 
Library 
on 
Java 
SE 
Embedded 
I2CBus 
bus 
= 
I2CFactory.getInstance(I2CBus.BUS_1); 
I2CDevice 
device 
= 
bus.getDevice(0x68); 
/* 
Start 
sensing 
*/ 
device.write(0x6B, 
(byte)0b00000000); 
device.write(0x6C, 
(byte)0b00000000); 
/* 
Set 
configuration 
*/ 
device.write(0x1B, 
(byte)0b00011000); 
// 
Gyroscope 
device.write(0x1C, 
(byte)0b00000100); 
// 
Accelerometer 
device.read(0x3B, 
accelData, 
0, 
ACCEL_PACKET_SIZE); 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved.
CalculaRng 
Power 
And 
Torque 
Torque 
(Nm) 
= 
Mass 
x 
Wheel 
Radius 
x 
AcceleraRon 
(in 
G) 
Torque 
(lb/l) 
= 
Torque 
in 
Nm 
x 
0.73756 
Power 
(BHP) 
= 
Torque 
(lb/l) 
x 
engine 
RPM 
/ 
5252 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
• Results 
will 
not 
have 
high 
accuracy 
– Values 
in 
red 
are 
not 
precise 
• Dynamometer 
is 
the 
only 
way 
to 
get 
accurate 
figures 
• InteresRng 
to 
see 
values 
v. 
manufacturers 
figures
Carputer 
Solware 
Architecture 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
• Screens 
based 
– Splash 
screen 
– Basic 
and 
advanced 
car 
data 
– G 
forces 
on 
car 
– Graphed 
results 
of 
different 
parameters 
• Simple 
UI 
– Can’t 
read 
numbers 
when 
driving 
• Touchscreen 
to 
switch 
screens 
– Repurpose 
exisRng 
car 
controls 
to 
change 
screen? 
Real>me 
Data
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
UI 
Design 
Ideas 
Take 
Inspira>on 
From 
Others 
Renault 
Megane 
Sport
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
UI 
Design 
Ideas 
Take 
Inspira>on 
From 
Others 
Tesla
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
UI 
Design 
Ideas 
Take 
Inspira>on 
From 
Others 
Lamborghini 
Reveton
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Simple 
Data 
Display 
Control 
• Only 
uses 
3 
nodes 
– Polygon 
– Rectangle 
– Line 
– Labels 
are 
opRonal 
• Displays 
– Current 
value 
– Maximum 
value 
since 
start 
(resetable) 
• Simple 
to 
understand 
from 
a 
glance
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
UI 
Screens 
Splash 
Screen
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
UI 
Screens
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
UI 
Screens
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
UI 
Screens
Graph 
Plots 
Of 
Thro>le 
PosiRon 
And 
Power 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved.
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
JavaFX 
Charts 
And 
Colours 
Can 
Only 
Be 
Changed 
Using 
CSS 
.axis 
{ 
-­‐fx-­‐tick-­‐label: 
#FFFFFF; 
} 
.axis-­‐tick-­‐mark 
{ 
-­‐fx-­‐stroke: 
#FFFFFF; 
} 
.axis-­‐minor-­‐tick-­‐mark 
{ 
-­‐fx-­‐stroke: 
#000000; 
} 
.chart-­‐plot-­‐background 
{ 
-­‐fx-­‐background-­‐color: 
#000000; 
} 
.chart-­‐alternative-­‐row-­‐fill 
{ 
-­‐fx-­‐fill: 
#000000; 
} 
.default-­‐color0.chart-­‐series-­‐line 
{ 
-­‐fx-­‐stroke: 
#FFFF33; 
}
The 
Java 
Carputer 
(Mark 
2) 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved.
Carputer 
Hardware 
Architecture 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
30 
Crossover 
ethernet 
USB 
via 
FTDI 
Infra 
red 
Thermal 
sensor 
CAN 
High 
CAN 
Low 
OBD2 
Service 
Port 
Wi-­‐Fi 
Accelerometer/ 
Gyro/Compass 
I2C 
USB 
UART 
Serial 
Heart 
Rate 
Monitor 
GPS 
USB 
Video 
Camera 
Raspberry 
Pi 
Model 
B+ 
7” 
Touch 
secreen 
USB 
CAN 
Bus 
SDR/TPMS
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Tracking 
PosiRon 
With 
GPS 
• AdaFruit 
UlRmate 
GPS 
breakout 
– 10Hz 
read 
rate 
– Serial 
interface 
• Very 
simple 
configuraRon 
– Disable 
/dev/ttyAMA0 
on 
Pi 
as 
console 
– 9600 
8N1 
– Read 
data 
using 
librxtx-­‐java 
– Comma 
separated 
values 
$GPGGA 
and 
$GPVTG 
– Need 
to 
handle 
frequent 
data 
corrupRon
Heart 
Rate 
Monitoring 
of 
the 
Driver 
• Sparkfun 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
board 
– USB 
interface, 
serial 
connecRon 
• Similar 
to 
GPS 
– Use 
librxtx-­‐java 
– 9600, 
8N1 
• More 
complicated 
coding 
– Actually 
need 
to 
send 
a 
read 
request! 
• Some 
issues 
with 
wireless 
connecRon 
– 80cm 
max, 
doesn’t 
work 
well 
through 
a 
Rapsberry 
Pi
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
In-­‐car 
Video 
• Becoming 
very 
common 
to 
avoid 
insurance 
issues 
• Transcend 
DrivePro 
200 
– Built-­‐in 
Wi-­‐Fi 
– iPhone 
app 
• How 
to 
get 
video 
stream? 
– Approached 
Transcend 
tech 
support 
– Found 
VLC 
code 
– Wireshark 
– SYN/ACK, 
Yuck! 
33 
Camera 
Applica>on 
192.168.0.1 
192.168.0.2 
Port 
9000 
Port 
43229 
Port 
9001 
Port 
42719 
Port 
9002 
Port 
58105 
Port 
8554 
(RTSP) 
Port 
60583
The 
Simplest 
SoluRon 
Is 
Olen 
The 
Best 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
34 
Push 
bu>on 
using 
GPIO 
lines 
and 
Pi4J
Thermal 
Sensors 
For 
Brakes 
and 
Tyres 
The 
Goal 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved.
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Infra-­‐Red 
Thermometer 
• MLX90614 
breakout 
board 
– I2C 
interface 
seemed 
problemaRc 
on 
the 
Pi 
– Also 
has 
serial 
interface 
– Use 
FTDI 
breakout 
board 
– 4 
wires 
becomes 
simple 
serial 
interface 
36 
The 
Reality
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Thermal 
Sensor 
Data 
• Provides 
conRnuous 
reading 
as 
lines 
of 
text 
(e.g. 
73.2F) 
– Don’t 
like 
Fahrenheit, 
wanted 
Celcius 
– Lambdas 
and 
Streams! 
37 
private 
double 
currentTemperature; 
public 
void 
run() 
{ 
thermalReader.lines() 
.mapToDouble(s 
-­‐> 
Double.parseDouble(s.substring(0, 
s.length() 
-­‐ 
1))) 
.map(t 
-­‐> 
((t 
-­‐ 
32) 
* 
5 
/ 
9)) 
.filter(t 
-­‐> 
t 
!= 
currentTemperature) 
.peek(t 
-­‐> 
listener.ifPresent(l 
-­‐> 
l.temperatureChange(t))) 
.forEach(t 
-­‐> 
currentTemperature 
= 
t); 
}
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Thermal 
Sensor 
Data 
• Provides 
conRnuous 
reading 
as 
lines 
of 
text 
(e.g. 
73.2F) 
– Don’t 
like 
Fahrenheit, 
wanted 
Celcius 
– Lambdas 
and 
Streams! 
38 
private 
double 
currentTemperature; 
public 
void 
run() 
{ 
thermalReader.lines() 
.mapToDouble(s 
-­‐> 
Double.parseDouble(s.substring(0, 
s.length() 
-­‐ 
1))) 
.map(t 
-­‐> 
((t 
-­‐ 
32) 
* 
5 
/ 
9)) 
.filter(t 
-­‐> 
t 
!= 
this.currentTemperature) 
.peek(t 
-­‐> 
listener.ifPresent(l 
-­‐> 
l.temperatureChange(t))) 
.forEach(t 
-­‐> 
this.currentTemperature 
= 
t); 
}
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
39 
Fiing 
The 
Thermal 
Sensors 
Tyre 
Sensor
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
40 
Fiing 
The 
Thermal 
Sensors 
Brake 
Disk 
Sensor
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
41 
Fiing 
The 
Thermal 
Sensors 
Separate 
Pi 
in 
Engine 
Bay
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Fiing 
The 
Thermal 
Sensors 
• Simple 
server 
listens 
on 
port 
• Carputer 
requests 
data 
• Couple 
of 
issues 
– Server 
needed 
reset 
for 
new 
connecRon 
(bug 
to 
be 
fixed) 
– How 
to 
tell 
which 
sensor 
is 
which 
(>yUSB0/>yUSB1) 
42 
The 
Networked 
Car
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Fiing 
The 
Thermal 
Sensors 
• Rasperry 
Pi 
at 
over 
50C 
– Aler 
10 
minute 
drive 
• New 
approach 
required 
– Longer 
USB 
cables 
– Put 
the 
Pi 
in 
the 
car 
43 
Internal 
Combus>on 
Produces 
Heat
Geing 
Data 
From 
The 
CAN 
Bus 
• Controller 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Area 
Network 
• Used 
to 
connect 
many 
sensors, 
actuators 
and 
devices 
– Without 
huge 
amounts 
of 
wiring 
• Conveniently 
the 
CAN 
bus 
is 
connected 
to 
the 
OBD2 
port 
– Yes, 
the 
wiring 
is 
there 
– No, 
the 
signals 
are 
not 
– Presumably 
security 
measure 
from 
car 
manufacturers 
– Boo!
Geing 
Data 
From 
The 
CAN 
Bus 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Where 
There’s 
A 
Will 
There’s 
A 
Way
Geing 
Data 
From 
The 
CAN 
Bus 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Where 
There’s 
A 
Will 
There’s 
A 
Way 
Success! 
(And 
the 
car 
sRll 
works)
Geing 
Data 
From 
The 
CAN 
Bus 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
• Lawicel 
CAN 
bus 
to 
USB 
• Serial 
device 
• Sends 
decoded 
data 
• Need 
to 
write 
a 
Java 
library 
– CAN 
id 
– Message 
data 
• Then 
the 
hard 
part 
starts 
– Figuring 
it 
all 
out 
47 
Electrical 
Connec>vity 
Is 
Only 
The 
Start
Finished 
Data 
Capture 
System 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
48
Heads 
Up 
Display/ 
TelemaRcs 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved.
In 
Car 
Heads 
Up 
Displays 
Are 
Becoming 
A 
Reality 
Jaguar 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
ConRnental 
Virtual 
Windscreen 
Mini 
Cooper 
NavTy
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Build 
Your 
Own 
HUD 
• Turns 
out 
it’s 
not 
that 
simple 
• First 
iteraRon 
– 3M 
MPro110 
Micro 
Projector, 
half 
silvered 
film 
(from 
a 
cheap 
in-­‐car 
HUD) 
• Didn’t 
really 
work 
– Too 
much 
reflecRon 
of 
projector 
lamp, 
not 
image
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
52 
Build 
Your 
Own 
HUD 
Second 
AWempt
Raspberry 
Pi 
Heads 
Up 
Display 
• Cheap 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
screen 
for 
the 
Pi 
• Use 
teleprompter 
glass 
rather 
than 
half-­‐silvered 
perspex 
– 70% 
transmission, 
30% 
refecRon 
much 
be>er 
• Issue: 
How 
to 
produce 
an 
inverted 
image? 
• Answer: 
Use 
a 
refecRon 
effect 
53 
Reflection 
ref 
= 
new 
Reflection(); 
ref.setFraction(1.0); 
ref.setBottomOpacity(1.0); 
ref.setTopOpacity(1.0);
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Data 
Display 
On 
HUD 
• Speed 
and 
engine 
RPM 
– Use 
OBD2 
data 
– Wi-­‐Fi 
dongle 
to 
access 
ELM327 
• Convert 
posiRon 
(from 
GPS) 
into 
current 
speed 
limit 
– Bluetooth 
dongle 
for 
pairing 
with 
mobile 
phone 
– Configure 
Linux 
to 
provide 
network 
access 
via 
TCP/IP 
– Transmit 
posiRon 
obtained 
from 
GPS 
– Write 
servlet 
to 
run 
on 
home 
Linux 
box 
(open 
port 
on 
firewall) 
– Servlet 
uses 
posiRon 
and 
Ordanance 
Survey 
data 
to 
determine 
speed 
limit 
– (Future 
project) 
54
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Hardware 
In 
Place 
55
Data 
Recording 
and 
Analysis 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved.
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Display 
Collected 
Data 
• JavaFX 
applicaRon 
• Video 
stream 
– Synchronised 
to 
data 
streams 
• Data 
recorded 
as 
sequence 
of 
text 
records 
– Comma 
separated 
values 
– One 
line 
per 
sensor 
– Time 
stamp 
• Read 
all 
data 
in 
at 
start 
of 
applicaRon 
– 15 
minutes 
of 
data 
takes 
about 
100ms 
57
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
• Video 
(with 
controls) 
• G-­‐forces 
• GPS 
co-­‐ordinates/alRtude 
• Map 
of 
current 
posiRon 
• Speed 
(compare 
car 
and 
GPS) 
• Bearing 
• Engine 
load 
• Fuel 
pressure 
• Air 
intake 
temperature 
• Coolant 
temperature 
• Catalyst/exhaust 
temperature 
• Tyre 
temperature 
• Brake 
temperature 
• Thro>le 
posiRon 
• Engine 
RPM 
• Heart 
rate 
58 
Data 
To 
Display
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
User 
Interface 
Design 
• Use 
JFXtras 
library 
(Gerrit 
Grunwald’s 
dials 
and 
LEDs) 
• Formula 
1 
style 
– Thro>le/brake/engine/gear 
display 
– LED 
tachometer 
• Heart 
rate 
number 
is 
not 
too 
exciRng 
– AnimaRons 
– ConRnuous 
pulses 
was 
a 
bit 
of 
a 
challenge 
(several 
parallel, 
offset 
transiRons) 
59 
JavaFX
Conclusions 
& 
Resources 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved.
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Conclusions 
• Cars 
produce 
lots 
of 
data 
• Use 
of 
sensors 
with 
Java 
is 
simple 
to 
collect 
(most) 
data 
• Playback 
of 
data 
useful 
for 
insurance, 
fleet 
management, 
training 
• Java 
and 
JavaFX 
make 
UI 
design 
simple
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Resources 
and 
Links 
• www.sparkfun.com 
• www.adafruit.com 
• www.raspberrypi.org 
• blogs.oracle.com/speakjava 
• Twi>er: 
@speakjava
Demos 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved.
Carjacking 
With 
Java 
(Or 
Building 
A 
Java 
Carputer) 
Simon 
Ri>er 
Head 
of 
Java 
Evangelism, 
Oracle 
Twi>er: 
@speakjava 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved.

More Related Content

What's hot (19)

PPTX
55 New Features in Java SE 8
Simon Ritter
 
PPTX
Functional Programming With Lambdas and Streams in JDK8
IndicThreads
 
PDF
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
JAXLondon2014
 
PPTX
Java 8 Features
Trung Nguyen
 
PDF
Apouc 2014-java-8-create-the-future
OUGTH Oracle User Group in Thailand
 
PDF
Java SE 8 library design
Stephen Colebourne
 
PDF
Java 8
jclingan
 
PPTX
Oracle REST Data Services
Chris Muir
 
PPTX
Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013)
DevelopIntelligence
 
PDF
Native REST Web Services with Oracle 11g
Marcelo Ochoa
 
PPTX
Oracle REST Data Services Best Practices/ Overview
Kris Rice
 
PPTX
Oracle REST Data Services: Options for your Web Services
Jeff Smith
 
PDF
How to Thrive on REST/WebSocket-Based Microservices
Pavel Bucek
 
PDF
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
Marco Antonio Maciel
 
PPT
Apache Harmony: An Open Innovation
Tim Ellison
 
PDF
JSONB introduction and comparison with other frameworks
Dmitry Kornilov
 
PDF
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
C4Media
 
PPTX
Debugging PL/SQL with Oracle SQL Developer
Jeff Smith
 
PDF
Oracle SQLcl
Barry McGillin
 
55 New Features in Java SE 8
Simon Ritter
 
Functional Programming With Lambdas and Streams in JDK8
IndicThreads
 
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
JAXLondon2014
 
Java 8 Features
Trung Nguyen
 
Apouc 2014-java-8-create-the-future
OUGTH Oracle User Group in Thailand
 
Java SE 8 library design
Stephen Colebourne
 
Java 8
jclingan
 
Oracle REST Data Services
Chris Muir
 
Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013)
DevelopIntelligence
 
Native REST Web Services with Oracle 11g
Marcelo Ochoa
 
Oracle REST Data Services Best Practices/ Overview
Kris Rice
 
Oracle REST Data Services: Options for your Web Services
Jeff Smith
 
How to Thrive on REST/WebSocket-Based Microservices
Pavel Bucek
 
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
Marco Antonio Maciel
 
Apache Harmony: An Open Innovation
Tim Ellison
 
JSONB introduction and comparison with other frameworks
Dmitry Kornilov
 
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
C4Media
 
Debugging PL/SQL with Oracle SQL Developer
Jeff Smith
 
Oracle SQLcl
Barry McGillin
 

Viewers also liked (11)

PPTX
The Raspberry Pi JavaFX Carputer
Simon Ritter
 
PPTX
Playing with Java Classes and Bytecode
Yoav Avrahami
 
PDF
Oracle Keynote from JMagghreb 2014
Simon Ritter
 
PPTX
Lambdas And Streams Hands On Lab, JavaOne 2014
Simon Ritter
 
PPTX
Lessons Learnt With Lambdas and Streams in JDK 8
Simon Ritter
 
PPTX
JDK 9: Big Changes To Make Java Smaller
Simon Ritter
 
PPTX
Raspberry Pi with Java 8
javafxpert
 
PPTX
It's Java Jim, But Not As We Know It!
Simon Ritter
 
PPTX
JDK 9: Big Changes To Make Java Smaller
Simon Ritter
 
PPTX
Is An Agile Standard Possible For Java?
Simon Ritter
 
PPTX
55 New Features in JDK 9
Simon Ritter
 
The Raspberry Pi JavaFX Carputer
Simon Ritter
 
Playing with Java Classes and Bytecode
Yoav Avrahami
 
Oracle Keynote from JMagghreb 2014
Simon Ritter
 
Lambdas And Streams Hands On Lab, JavaOne 2014
Simon Ritter
 
Lessons Learnt With Lambdas and Streams in JDK 8
Simon Ritter
 
JDK 9: Big Changes To Make Java Smaller
Simon Ritter
 
Raspberry Pi with Java 8
javafxpert
 
It's Java Jim, But Not As We Know It!
Simon Ritter
 
JDK 9: Big Changes To Make Java Smaller
Simon Ritter
 
Is An Agile Standard Possible For Java?
Simon Ritter
 
55 New Features in JDK 9
Simon Ritter
 
Ad

Similar to The Java Carputer (20)

PDF
Cars and Computers: Building a Java Carputer
IndicThreads
 
PDF
Tweet4Beer - Beertap powered by Java goes IoT and JavaFX
Bruno Borges
 
PPTX
J-Fall 2014 Community Keynote by Oracle
javafxpert
 
PDF
Konsolidace Oracle DB na systémech s procesory M7
MarketingArrowECS_CZ
 
PDF
Increased Developer Productivity for IoT with Java and Reactive Blocks (Oracl...
Bart Jonkers
 
PDF
Pushing Java EE outside of the Enterprise - Home Automation
David Delabassee
 
PPTX
Mobile Mumbo Jumbo - Demystifying the World of Enterprise Mobility with Oracle
Chris Muir
 
PPTX
Autonomous Drone Development with Java and IoT
javafxpert
 
PDF
Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...
JAXLondon2014
 
PDF
Security a SPARC M7 CPU
MarketingArrowECS_CZ
 
PDF
WebRTC Customer Experience Optimizations - Kranky Geek Presentation
amithap07
 
PDF
WebRTC Summit November 2013 - WebRTC Interoperability (and why it is important)
Crocodile WebRTC SDK and Cloud Signalling Network
 
PDF
CON5898 What Servlet 4.0 Means To You
Edward Burns
 
PPTX
Spansion Traveo Automotive Microcontroller Family
Spansion
 
PDF
NTTs Journey with Openstack-final
shintaro mizuno
 
PPTX
Can $0.08 Change your View of Storage?
DataCore Software
 
PPT
TN104_Rutenberg_Sinai_090805
Orna Zadok Rutenberg
 
PDF
Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...
Codemotion Tel Aviv
 
PDF
Plataforma Java Embedded & Internet of Things (IoT)
Marco Antonio Maciel
 
PPTX
Achieving Network Deployment Flexibility with Mirantis OpenStack
Eric Zhaohui Ji
 
Cars and Computers: Building a Java Carputer
IndicThreads
 
Tweet4Beer - Beertap powered by Java goes IoT and JavaFX
Bruno Borges
 
J-Fall 2014 Community Keynote by Oracle
javafxpert
 
Konsolidace Oracle DB na systémech s procesory M7
MarketingArrowECS_CZ
 
Increased Developer Productivity for IoT with Java and Reactive Blocks (Oracl...
Bart Jonkers
 
Pushing Java EE outside of the Enterprise - Home Automation
David Delabassee
 
Mobile Mumbo Jumbo - Demystifying the World of Enterprise Mobility with Oracle
Chris Muir
 
Autonomous Drone Development with Java and IoT
javafxpert
 
Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...
JAXLondon2014
 
Security a SPARC M7 CPU
MarketingArrowECS_CZ
 
WebRTC Customer Experience Optimizations - Kranky Geek Presentation
amithap07
 
WebRTC Summit November 2013 - WebRTC Interoperability (and why it is important)
Crocodile WebRTC SDK and Cloud Signalling Network
 
CON5898 What Servlet 4.0 Means To You
Edward Burns
 
Spansion Traveo Automotive Microcontroller Family
Spansion
 
NTTs Journey with Openstack-final
shintaro mizuno
 
Can $0.08 Change your View of Storage?
DataCore Software
 
TN104_Rutenberg_Sinai_090805
Orna Zadok Rutenberg
 
Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...
Codemotion Tel Aviv
 
Plataforma Java Embedded & Internet of Things (IoT)
Marco Antonio Maciel
 
Achieving Network Deployment Flexibility with Mirantis OpenStack
Eric Zhaohui Ji
 
Ad

More from Simon Ritter (20)

PPTX
Java Pattern Puzzles Java Pattern Puzzles
Simon Ritter
 
PPTX
Keeping Your Java Hot by Solving the JVM Warmup Problem
Simon Ritter
 
PPTX
Cloud Native Compiler
Simon Ritter
 
PPTX
Java On CRaC
Simon Ritter
 
PPTX
The Art of Java Type Patterns
Simon Ritter
 
PPTX
Modern Java Workshop
Simon Ritter
 
PPTX
Java performance monitoring
Simon Ritter
 
PPTX
Modern Java Workshop
Simon Ritter
 
PPTX
Getting the Most From Modern Java
Simon Ritter
 
PPTX
Building a Better JVM
Simon Ritter
 
PPTX
JDK 14 Lots of New Features
Simon Ritter
 
PPTX
Java after 8
Simon Ritter
 
PPTX
How to Choose a JDK
Simon Ritter
 
PPTX
Java Programming
Simon Ritter
 
PPTX
The Latest in Enterprise JavaBeans Technology
Simon Ritter
 
PPTX
Developing Enterprise Applications Using Java Technology
Simon Ritter
 
PPTX
Is Java Still Free?
Simon Ritter
 
PPTX
Moving Towards JDK 12
Simon Ritter
 
PPTX
JDK 9, 10, 11 and Beyond
Simon Ritter
 
PPTX
Java Is Still Free
Simon Ritter
 
Java Pattern Puzzles Java Pattern Puzzles
Simon Ritter
 
Keeping Your Java Hot by Solving the JVM Warmup Problem
Simon Ritter
 
Cloud Native Compiler
Simon Ritter
 
Java On CRaC
Simon Ritter
 
The Art of Java Type Patterns
Simon Ritter
 
Modern Java Workshop
Simon Ritter
 
Java performance monitoring
Simon Ritter
 
Modern Java Workshop
Simon Ritter
 
Getting the Most From Modern Java
Simon Ritter
 
Building a Better JVM
Simon Ritter
 
JDK 14 Lots of New Features
Simon Ritter
 
Java after 8
Simon Ritter
 
How to Choose a JDK
Simon Ritter
 
Java Programming
Simon Ritter
 
The Latest in Enterprise JavaBeans Technology
Simon Ritter
 
Developing Enterprise Applications Using Java Technology
Simon Ritter
 
Is Java Still Free?
Simon Ritter
 
Moving Towards JDK 12
Simon Ritter
 
JDK 9, 10, 11 and Beyond
Simon Ritter
 
Java Is Still Free
Simon Ritter
 

Recently uploaded (20)

PPTX
Meeting 1 Electrical Engineering Project Design-1.pptx
sitompulvictoryland2
 
PDF
Business Model You A One-Page Method For Reinventing Your Career (Tim Clark, ...
JesperElenga
 
PDF
Volvo L90D Wheel Loader Service Repair Manual Download.pdf
Service Repair Manual
 
PPTX
What to compare when choosing a roof box for cars?
Edward TIAN
 
PDF
Fan drive and pulley Volvo EC360B LC Excavator Service Manual.pdf
Service Repair Manual
 
PPT
Daily work management Daily work management.PPT
design163212
 
PDF
Arctic Cat 700 H1 Efi 2008 Service Repair Manual.pdf
Service Repair Manual
 
PPTX
Online Safety, Security, Ethics, and Etiquette EMPOTECH (1).pptx
ArmelyNiedo
 
PPTX
Is fuel injector cleaning service necessary in a Mercedes car
Fifth Gear Automotive
 
PDF
Daewoo Doosan 430 440 450 Plus Operator Manual.pdf
Service Repair Manual
 
PPTX
5 Why Training Presentation for Industry
aoberoi874
 
PPTX
JusticeAND LAW AND ____Presentation.pptx
sahatanmay391
 
PDF
Kansas tr702B lost automobile title form
servicerepair2013
 
PPTX
APQP_Training_Content_APQP_PPAP_DevR1.pptx
happysurya45
 
PPTX
What is a car rooftop cargo carrier? Cargo bag or roof boxes?
Edward TIAN
 
PDF
352F caterpillar excavator service repair manual
Heavy Equipment Manual
 
PDF
Engine oil filter Volvo EC360B LC Excavator Service Manual.pdf
Service Repair Manual
 
PPTX
定制学历UEX在读证明信西班牙埃斯特雷马杜拉大学毕业证明,UEX录取通知书
Taqyea
 
PDF
Volvo BM L150 Wheel Loader Service PDF Repair Manual.pdf
Service Repair Manual
 
PDF
Oil cooler Volvo EC360B LC Service Manual.pdf
Service Repair Manual
 
Meeting 1 Electrical Engineering Project Design-1.pptx
sitompulvictoryland2
 
Business Model You A One-Page Method For Reinventing Your Career (Tim Clark, ...
JesperElenga
 
Volvo L90D Wheel Loader Service Repair Manual Download.pdf
Service Repair Manual
 
What to compare when choosing a roof box for cars?
Edward TIAN
 
Fan drive and pulley Volvo EC360B LC Excavator Service Manual.pdf
Service Repair Manual
 
Daily work management Daily work management.PPT
design163212
 
Arctic Cat 700 H1 Efi 2008 Service Repair Manual.pdf
Service Repair Manual
 
Online Safety, Security, Ethics, and Etiquette EMPOTECH (1).pptx
ArmelyNiedo
 
Is fuel injector cleaning service necessary in a Mercedes car
Fifth Gear Automotive
 
Daewoo Doosan 430 440 450 Plus Operator Manual.pdf
Service Repair Manual
 
5 Why Training Presentation for Industry
aoberoi874
 
JusticeAND LAW AND ____Presentation.pptx
sahatanmay391
 
Kansas tr702B lost automobile title form
servicerepair2013
 
APQP_Training_Content_APQP_PPAP_DevR1.pptx
happysurya45
 
What is a car rooftop cargo carrier? Cargo bag or roof boxes?
Edward TIAN
 
352F caterpillar excavator service repair manual
Heavy Equipment Manual
 
Engine oil filter Volvo EC360B LC Excavator Service Manual.pdf
Service Repair Manual
 
定制学历UEX在读证明信西班牙埃斯特雷马杜拉大学毕业证明,UEX录取通知书
Taqyea
 
Volvo BM L150 Wheel Loader Service PDF Repair Manual.pdf
Service Repair Manual
 
Oil cooler Volvo EC360B LC Service Manual.pdf
Service Repair Manual
 

The Java Carputer

  • 1. Carjacking With Java (Or Building A Java Carputer) Simon Ri>er Head of Java Evangelism, Oracle Twi>er: @speakjava Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
  • 2. Safe Harbor Statement The following is intended to outline our general product direcRon. It is intended for informaRon purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or funcRonality, and should not be relied upon in making purchasing decisions. The development, release, and Rming of any features or funcRonality described for Oracle’s products remains at the sole discreRon of Oracle. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 2
  • 3. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Program Agenda Cars And Computers The Java Carputer (Mark 1) The Java Carputer (Mark 2) Heads Up Display/TelemaRcs Data Recording/Analysis Conclusions, Resources and Demos 1 2 3 4 5 6
  • 4. Cars And Computers Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
  • 5. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. My First Car: 1981 1971 Mini Clubman 1000 • No electronics – Well, it had a radio • Purely electromechanical – Points/Distributor – Carbure>or/Manual choke – Drum brakes – Dynamo – Lights, horn, wipers, fan, igniRon switch
  • 6. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Car Wiring: 1970s Image coutesy of Haynes manuals
  • 7. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. My Current Car • Lots of electronics – Engine Control Unit (ECU) – Fuel InjecRon/Electronic Rming – “Fly-­‐by-­‐wire” thro>le – AnR-­‐lock Braking System (ABS) – Electronic Stability Program (ESP) – Magnetorheological Suspension – Satellite navigaRon – Auto-­‐sensing wipers and lights 2011 Audi S3
  • 8. Bus architecture means substan>ally less wiring Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Car Wiring: 2011 Convenience Bus Infotainment Bus Powertrain Bus
  • 9. The Java Carputer (Mark 1) Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
  • 10. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Carputer Design ObjecRves • Display realRme data • Engine performance (Power, Torque, Load) • Driver data (Thro>le posiRon, steering angle, braking force, etc) • G-­‐Forces on car • Graphed data for Rme-­‐based analysis
  • 11. Carputer Hardware Architecture USB WiFi Dongle Touch Screen Copyright © 2014, Oracle and/or its affiliates. All rights reserved. HDMI Accelerometer USB I2C 12V Car Converter ELM327 Car Service Port 5V USB
  • 12. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ELM327 Cheap way to hack your car • WiFi or Bluetooth connecRon to OBD-­‐II • Fixed IP address, Ad-­‐hoc networking • Need to configure Raspberry Pi – /etc/network/interfaces • AT style commands for control • Non-­‐AT commands are assumed to be OBD-­‐II – Simple request-­‐response interacRon – Easy to write Java code to handle this
  • 13. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Touchscreen Lots of things available on eBay • 2 DIN fiing size – Ideal for centre console • HDMI input – Specifically marketed for Raspberry Pi • USB connecRon for touch screen
  • 14. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Touchscreen Hardware FiJng Challenges
  • 15. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Accelerometer • Sparkfun breakout board MPU 9150 – 9 DoF sensor (accelerometer, gyroscope, compass) • CommunicaRons via I2C – Configure Raspberry Pi /etc/modules • i2c-­‐bcm2708, i2c-­‐dev • i2c-­‐detect -­‐y 1 to get address – Compass communicaRon is a bit more complicated • Second I2C bus
  • 16. Accelerometer Code Using Pi4J Library on Java SE Embedded I2CBus bus = I2CFactory.getInstance(I2CBus.BUS_1); I2CDevice device = bus.getDevice(0x68); /* Start sensing */ device.write(0x6B, (byte)0b00000000); device.write(0x6C, (byte)0b00000000); /* Set configuration */ device.write(0x1B, (byte)0b00011000); // Gyroscope device.write(0x1C, (byte)0b00000100); // Accelerometer device.read(0x3B, accelData, 0, ACCEL_PACKET_SIZE); Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
  • 17. CalculaRng Power And Torque Torque (Nm) = Mass x Wheel Radius x AcceleraRon (in G) Torque (lb/l) = Torque in Nm x 0.73756 Power (BHP) = Torque (lb/l) x engine RPM / 5252 Copyright © 2014, Oracle and/or its affiliates. All rights reserved. • Results will not have high accuracy – Values in red are not precise • Dynamometer is the only way to get accurate figures • InteresRng to see values v. manufacturers figures
  • 18. Carputer Solware Architecture Copyright © 2014, Oracle and/or its affiliates. All rights reserved. • Screens based – Splash screen – Basic and advanced car data – G forces on car – Graphed results of different parameters • Simple UI – Can’t read numbers when driving • Touchscreen to switch screens – Repurpose exisRng car controls to change screen? Real>me Data
  • 19. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. UI Design Ideas Take Inspira>on From Others Renault Megane Sport
  • 20. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. UI Design Ideas Take Inspira>on From Others Tesla
  • 21. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. UI Design Ideas Take Inspira>on From Others Lamborghini Reveton
  • 22. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Simple Data Display Control • Only uses 3 nodes – Polygon – Rectangle – Line – Labels are opRonal • Displays – Current value – Maximum value since start (resetable) • Simple to understand from a glance
  • 23. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. UI Screens Splash Screen
  • 24. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. UI Screens
  • 25. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. UI Screens
  • 26. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. UI Screens
  • 27. Graph Plots Of Thro>le PosiRon And Power Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
  • 28. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. JavaFX Charts And Colours Can Only Be Changed Using CSS .axis { -­‐fx-­‐tick-­‐label: #FFFFFF; } .axis-­‐tick-­‐mark { -­‐fx-­‐stroke: #FFFFFF; } .axis-­‐minor-­‐tick-­‐mark { -­‐fx-­‐stroke: #000000; } .chart-­‐plot-­‐background { -­‐fx-­‐background-­‐color: #000000; } .chart-­‐alternative-­‐row-­‐fill { -­‐fx-­‐fill: #000000; } .default-­‐color0.chart-­‐series-­‐line { -­‐fx-­‐stroke: #FFFF33; }
  • 29. The Java Carputer (Mark 2) Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
  • 30. Carputer Hardware Architecture Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 30 Crossover ethernet USB via FTDI Infra red Thermal sensor CAN High CAN Low OBD2 Service Port Wi-­‐Fi Accelerometer/ Gyro/Compass I2C USB UART Serial Heart Rate Monitor GPS USB Video Camera Raspberry Pi Model B+ 7” Touch secreen USB CAN Bus SDR/TPMS
  • 31. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Tracking PosiRon With GPS • AdaFruit UlRmate GPS breakout – 10Hz read rate – Serial interface • Very simple configuraRon – Disable /dev/ttyAMA0 on Pi as console – 9600 8N1 – Read data using librxtx-­‐java – Comma separated values $GPGGA and $GPVTG – Need to handle frequent data corrupRon
  • 32. Heart Rate Monitoring of the Driver • Sparkfun Copyright © 2014, Oracle and/or its affiliates. All rights reserved. board – USB interface, serial connecRon • Similar to GPS – Use librxtx-­‐java – 9600, 8N1 • More complicated coding – Actually need to send a read request! • Some issues with wireless connecRon – 80cm max, doesn’t work well through a Rapsberry Pi
  • 33. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. In-­‐car Video • Becoming very common to avoid insurance issues • Transcend DrivePro 200 – Built-­‐in Wi-­‐Fi – iPhone app • How to get video stream? – Approached Transcend tech support – Found VLC code – Wireshark – SYN/ACK, Yuck! 33 Camera Applica>on 192.168.0.1 192.168.0.2 Port 9000 Port 43229 Port 9001 Port 42719 Port 9002 Port 58105 Port 8554 (RTSP) Port 60583
  • 34. The Simplest SoluRon Is Olen The Best Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 34 Push bu>on using GPIO lines and Pi4J
  • 35. Thermal Sensors For Brakes and Tyres The Goal Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
  • 36. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Infra-­‐Red Thermometer • MLX90614 breakout board – I2C interface seemed problemaRc on the Pi – Also has serial interface – Use FTDI breakout board – 4 wires becomes simple serial interface 36 The Reality
  • 37. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Thermal Sensor Data • Provides conRnuous reading as lines of text (e.g. 73.2F) – Don’t like Fahrenheit, wanted Celcius – Lambdas and Streams! 37 private double currentTemperature; public void run() { thermalReader.lines() .mapToDouble(s -­‐> Double.parseDouble(s.substring(0, s.length() -­‐ 1))) .map(t -­‐> ((t -­‐ 32) * 5 / 9)) .filter(t -­‐> t != currentTemperature) .peek(t -­‐> listener.ifPresent(l -­‐> l.temperatureChange(t))) .forEach(t -­‐> currentTemperature = t); }
  • 38. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Thermal Sensor Data • Provides conRnuous reading as lines of text (e.g. 73.2F) – Don’t like Fahrenheit, wanted Celcius – Lambdas and Streams! 38 private double currentTemperature; public void run() { thermalReader.lines() .mapToDouble(s -­‐> Double.parseDouble(s.substring(0, s.length() -­‐ 1))) .map(t -­‐> ((t -­‐ 32) * 5 / 9)) .filter(t -­‐> t != this.currentTemperature) .peek(t -­‐> listener.ifPresent(l -­‐> l.temperatureChange(t))) .forEach(t -­‐> this.currentTemperature = t); }
  • 39. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 39 Fiing The Thermal Sensors Tyre Sensor
  • 40. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 40 Fiing The Thermal Sensors Brake Disk Sensor
  • 41. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 41 Fiing The Thermal Sensors Separate Pi in Engine Bay
  • 42. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Fiing The Thermal Sensors • Simple server listens on port • Carputer requests data • Couple of issues – Server needed reset for new connecRon (bug to be fixed) – How to tell which sensor is which (>yUSB0/>yUSB1) 42 The Networked Car
  • 43. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Fiing The Thermal Sensors • Rasperry Pi at over 50C – Aler 10 minute drive • New approach required – Longer USB cables – Put the Pi in the car 43 Internal Combus>on Produces Heat
  • 44. Geing Data From The CAN Bus • Controller Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Area Network • Used to connect many sensors, actuators and devices – Without huge amounts of wiring • Conveniently the CAN bus is connected to the OBD2 port – Yes, the wiring is there – No, the signals are not – Presumably security measure from car manufacturers – Boo!
  • 45. Geing Data From The CAN Bus Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Where There’s A Will There’s A Way
  • 46. Geing Data From The CAN Bus Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Where There’s A Will There’s A Way Success! (And the car sRll works)
  • 47. Geing Data From The CAN Bus Copyright © 2014, Oracle and/or its affiliates. All rights reserved. • Lawicel CAN bus to USB • Serial device • Sends decoded data • Need to write a Java library – CAN id – Message data • Then the hard part starts – Figuring it all out 47 Electrical Connec>vity Is Only The Start
  • 48. Finished Data Capture System Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 48
  • 49. Heads Up Display/ TelemaRcs Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
  • 50. In Car Heads Up Displays Are Becoming A Reality Jaguar Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ConRnental Virtual Windscreen Mini Cooper NavTy
  • 51. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Build Your Own HUD • Turns out it’s not that simple • First iteraRon – 3M MPro110 Micro Projector, half silvered film (from a cheap in-­‐car HUD) • Didn’t really work – Too much reflecRon of projector lamp, not image
  • 52. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 52 Build Your Own HUD Second AWempt
  • 53. Raspberry Pi Heads Up Display • Cheap Copyright © 2014, Oracle and/or its affiliates. All rights reserved. screen for the Pi • Use teleprompter glass rather than half-­‐silvered perspex – 70% transmission, 30% refecRon much be>er • Issue: How to produce an inverted image? • Answer: Use a refecRon effect 53 Reflection ref = new Reflection(); ref.setFraction(1.0); ref.setBottomOpacity(1.0); ref.setTopOpacity(1.0);
  • 54. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Data Display On HUD • Speed and engine RPM – Use OBD2 data – Wi-­‐Fi dongle to access ELM327 • Convert posiRon (from GPS) into current speed limit – Bluetooth dongle for pairing with mobile phone – Configure Linux to provide network access via TCP/IP – Transmit posiRon obtained from GPS – Write servlet to run on home Linux box (open port on firewall) – Servlet uses posiRon and Ordanance Survey data to determine speed limit – (Future project) 54
  • 55. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Hardware In Place 55
  • 56. Data Recording and Analysis Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
  • 57. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Display Collected Data • JavaFX applicaRon • Video stream – Synchronised to data streams • Data recorded as sequence of text records – Comma separated values – One line per sensor – Time stamp • Read all data in at start of applicaRon – 15 minutes of data takes about 100ms 57
  • 58. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. • Video (with controls) • G-­‐forces • GPS co-­‐ordinates/alRtude • Map of current posiRon • Speed (compare car and GPS) • Bearing • Engine load • Fuel pressure • Air intake temperature • Coolant temperature • Catalyst/exhaust temperature • Tyre temperature • Brake temperature • Thro>le posiRon • Engine RPM • Heart rate 58 Data To Display
  • 59. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. User Interface Design • Use JFXtras library (Gerrit Grunwald’s dials and LEDs) • Formula 1 style – Thro>le/brake/engine/gear display – LED tachometer • Heart rate number is not too exciRng – AnimaRons – ConRnuous pulses was a bit of a challenge (several parallel, offset transiRons) 59 JavaFX
  • 60. Conclusions & Resources Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
  • 61. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Conclusions • Cars produce lots of data • Use of sensors with Java is simple to collect (most) data • Playback of data useful for insurance, fleet management, training • Java and JavaFX make UI design simple
  • 62. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Resources and Links • www.sparkfun.com • www.adafruit.com • www.raspberrypi.org • blogs.oracle.com/speakjava • Twi>er: @speakjava
  • 63. Demos Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
  • 64. Carjacking With Java (Or Building A Java Carputer) Simon Ri>er Head of Java Evangelism, Oracle Twi>er: @speakjava Copyright © 2014, Oracle and/or its affiliates. All rights reserved.