SlideShare a Scribd company logo
Cars and Computers: Building a Java Carputer
Simon Ritter
Head of Java Technology Evangelism
Oracle Corp.
Twitter: @speakjava
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole discretion of Oracle.
2
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Cars And Computers
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
My First Car: 1981
• No electronics
– Well, it had a radio
• Purely electromechanical
– Points/Distributor
– Carburettor/Manual choke
– Drum brakes
– Dynamo
– Lights, horn, wipers, fan, ignition switch
1971 Mini Clubman 1000
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 Injection/Electronic timing
– “Fly-by-wire” throttle
– Anti-lock Braking System (ABS)
– Electronic Stability Program (ESP)
– Magnetorheological Suspension
– Satellite navigation
– Auto-sensing wipers and lights
2011 Audi S3
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Bus architecture means substantially less wiring
Car Wiring: 2011
Convenience Bus Infotainment Bus Powertrain Bus
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
The Java Carputer
(Mark 1)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Carputer Design Objectives
• Display realtime data
• Engine performance (Power, Torque, Load)
• Driver data (Throttle position, steering angle, braking force, etc)
• G-Forces on car
• Graphed data for time-based analysis
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Carputer Hardware Architecture
USB WiFi Dongle
Touch Screen
Accelerometer
HDMI USB
I2C
12V Car
Converter
ELM327
Car
Service
Port
5V USB
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
ELM327
• WiFi or Bluetooth connection 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 interaction
– Easy to write Java code to handle this
Cheap way to hack your car
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Touchscreen
• 2 DIN fitting size
– Ideal for centre console
• HDMI input
– Specifically marketed for Raspberry Pi
• USB connection for touch screen
Lots of things available on eBay
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Hardware Fitting Challenges
Touchscreen
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Accelerometer
• Sparkfun breakout board MPU 9150
– 9 DoF sensor (accelerometer, gyroscope, compass)
• Communications via I2C
– Configure Raspberry Pi /etc/modules
• i2c-bcm2708, i2c-dev
• i2c-detect -y 1 to get address
– Compass communication is a bit more complicated
• Second I2C bus
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
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.
Carputer Software Architecture
• 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 existing car controls to change screen?
Realtime Data
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Take Inspiration From Others
UI Design Ideas
Renault Megane Sport
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Take Inspiration From Others
UI Design Ideas
Tesla
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Take Inspiration From Others
UI Design Ideas
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 optional
• Displays
– Current value
– Maximum value since start (resetable)
• Simple to understand from a glance
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Splash Screen
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
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
The Java Carputer
(Mark 2)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Carputer Hardware Architecture
25
USB via FTDICrossover ethernet
Infra red
Thermal sensor
CAN High
CAN Low
OBD2 Service Port
Wi-Fi
Accelerometer/
Gyro/Compass
I2C
USB
UART
Serial
GPSHeart Rate Monitor
USB
Video Camera
Raspberry Pi Model B+
7” Touch secreen
USB
SDR/TPMS
CAN Bus
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Tracking Position With GPS
• AdaFruit Ultimate GPS breakout
– 10Hz read rate
– Serial interface
• Very simple configuration
– 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 corruption
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Heart Rate Monitoring of the Driver
• Sparkfun board
– USB interface, serial connection
• Similar to GPS
– Use librxtx-java
– 9600, 8N1
• More complicated coding
– Actually need to send a read request!
• Some issues with wireless connection
– 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!
28
Camera Application
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
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
The Simplest Solution Is Often The Best
29
Push button using GPIO lines and Pi4J
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Thermal Sensors For Brakes and Tyres
The Goal
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Infra-Red Thermometer
• MLX90614 breakout board
– I2C interface seemed problematic on the Pi
– Also has serial interface
– Use FTDI breakout board
– 4 wires becomes simple serial interface
31
The Reality
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Thermal Sensor Data
• Provides continuous reading as lines of text (e.g. 73.2F)
– Don’t like Fahrenheit, wanted Celcius
– Lambdas and Streams!
32
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 continuous reading as lines of text (e.g. 73.2F)
– Don’t like Fahrenheit, wanted Celcius
– Lambdas and Streams!
33
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. 34
Tyre Sensor
Fitting The Thermal Sensors
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 35
Brake Disk Sensor
Fitting The Thermal Sensors
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 36
Separate Pi in Engine Bay
Fitting The Thermal Sensors
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Fitting The Thermal Sensors
• Simple server listens on port
• Carputer requests data
• Couple of issues
– Server needed reset for new
connection (bug to be fixed)
– How to tell which sensor is which
(ttyUSB0/ttyUSB1)
37
The Networked Car
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Fitting The Thermal Sensors
• Rasperry Pi at over 50C
– After 10 minute drive
• New approach required
– Longer USB cables
– Put the Pi in the car
38
Internal Combustion Produces Heat
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Getting Data From The CAN Bus
• Controller 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!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Where There’s A Will There’s A Way
Getting Data From The CAN Bus
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Where There’s A Will There’s A Way
Getting Data From The CAN Bus
Success! (And the car still works)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Getting Data From The CAN Bus
• 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
42
Electrical Connectivity Is Only The Start
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 43
Finished Data Capture System
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Data Recording and Analysis
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Display Collected Data
• JavaFX application
• 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 application
– 15 minutes of data takes about 100ms
45
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
• Video (with controls)
• G-forces
• GPS co-ordinates/altitude
• Map of current position
• Speed (compare car and GPS)
• Bearing
• Engine load
• Fuel pressure
• Air intake temperature
• Coolant temperature
• Catalyst/exhaust temperature
• Tyre temperature
• Brake temperature
• Throttle position
• Engine RPM
• Heart rate
46
Data To Display
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Conclusions & Resources
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
• Twitter: @speakjava
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Demos

More Related Content

PPTX
The Raspberry Pi JavaFX Carputer
Simon Ritter
 
PDF
Java fx on raspberry pi gerrit grunwald
NLJUG
 
PPTX
Building your own RC Car with Raspberry Pi
Jeff Prestes
 
DOC
work experience in movon
Sang-Je(John) Lee
 
PDF
Heterogeneous Systems Architecture: The Next Area of Computing Innovation
AMD
 
PPTX
Final presentation [dissertation project], 20192 esv0002
MOHAMMED FURQHAN
 
PPTX
A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS
MOHAMMED FURQHAN
 
PDF
Addressing the hard problems of automotive Linux: networking and IPC
Alison Chaiken
 
The Raspberry Pi JavaFX Carputer
Simon Ritter
 
Java fx on raspberry pi gerrit grunwald
NLJUG
 
Building your own RC Car with Raspberry Pi
Jeff Prestes
 
work experience in movon
Sang-Je(John) Lee
 
Heterogeneous Systems Architecture: The Next Area of Computing Innovation
AMD
 
Final presentation [dissertation project], 20192 esv0002
MOHAMMED FURQHAN
 
A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS
MOHAMMED FURQHAN
 
Addressing the hard problems of automotive Linux: networking and IPC
Alison Chaiken
 

What's hot (20)

PDF
CE-4030, Optimizing Photo Editing Application with HSA Technology, by Stanley...
AMD Developer Central
 
PDF
Delivering Great WebRTC on Mobile Devices
Weemo, Inc.
 
PPTX
KaiSemi - FPGA to ASIC Conversions
kaisemi
 
PDF
Qualcomm Snapdragon Processors: A Super Gaming Platform
Qualcomm Developer Network
 
PDF
MM-4085, Designing a game audio engine for HSA, by Laurent Betbeder
AMD Developer Central
 
PPT
Powerp Sveto 2 Eng
Svetozar Jovanovic
 
PDF
Ultra HD Video Scaling: Low-Power HW FF vs. CNN-based Super-Resolution
Intel® Software
 
PDF
Service Scenarios and Learnings from the Belgacom EasyHome Lab - Bernard Boël...
mfrancis
 
PDF
Apple A Series Application Processor Device 2015
JJ Wu
 
PDF
More explosions, more chaos, and definitely more blowing stuff up
Intel® Software
 
PDF
802.11-2012 Update
Savvius, Inc
 
PDF
HSA-4146, Creating Smarter Applications and Systems Through Visual Intelligen...
AMD Developer Central
 
PDF
GS-4151, Developing Thief with new AMD technology, by Jurjen Katsman
AMD Developer Central
 
PPTX
FPGA MeetUp
Moya Brannan
 
PDF
Device Abstraction in OSGi Based Embedded Systems - Dimitar Valtchev
mfrancis
 
PDF
Curriculum Vitae ganesh with photo-1
Ganesh Sankar
 
PDF
Qualcomm Hexagon SDK: Optimize Your Multimedia Solutions
Qualcomm Developer Network
 
PDF
Apple A8 Series Application Processor
JJ Wu
 
PDF
Aruba utilities on mobile devices v30
Marcello Marchesini
 
PDF
CE-4114, Screen Mirror, a unified screen mirroring solution that utilizes AMD...
AMD Developer Central
 
CE-4030, Optimizing Photo Editing Application with HSA Technology, by Stanley...
AMD Developer Central
 
Delivering Great WebRTC on Mobile Devices
Weemo, Inc.
 
KaiSemi - FPGA to ASIC Conversions
kaisemi
 
Qualcomm Snapdragon Processors: A Super Gaming Platform
Qualcomm Developer Network
 
MM-4085, Designing a game audio engine for HSA, by Laurent Betbeder
AMD Developer Central
 
Powerp Sveto 2 Eng
Svetozar Jovanovic
 
Ultra HD Video Scaling: Low-Power HW FF vs. CNN-based Super-Resolution
Intel® Software
 
Service Scenarios and Learnings from the Belgacom EasyHome Lab - Bernard Boël...
mfrancis
 
Apple A Series Application Processor Device 2015
JJ Wu
 
More explosions, more chaos, and definitely more blowing stuff up
Intel® Software
 
802.11-2012 Update
Savvius, Inc
 
HSA-4146, Creating Smarter Applications and Systems Through Visual Intelligen...
AMD Developer Central
 
GS-4151, Developing Thief with new AMD technology, by Jurjen Katsman
AMD Developer Central
 
FPGA MeetUp
Moya Brannan
 
Device Abstraction in OSGi Based Embedded Systems - Dimitar Valtchev
mfrancis
 
Curriculum Vitae ganesh with photo-1
Ganesh Sankar
 
Qualcomm Hexagon SDK: Optimize Your Multimedia Solutions
Qualcomm Developer Network
 
Apple A8 Series Application Processor
JJ Wu
 
Aruba utilities on mobile devices v30
Marcello Marchesini
 
CE-4114, Screen Mirror, a unified screen mirroring solution that utilizes AMD...
AMD Developer Central
 
Ad

Similar to Cars and Computers: Building a Java Carputer (20)

PDF
The Java Carputer
Simon Ritter
 
PDF
The next frontier: open source in the car
Alison Chaiken
 
PDF
Arduino-based-diag OBD-II_programação.pdf
Jcradio Vw
 
PDF
SCALE 2012: Automotive: new frontier for mobile Linux
Alison Chaiken
 
ODP
Car automation OHM2013
Marian Marinov
 
ODP
Home and Car automation DORS/CLUC 2013
Marian Marinov
 
PDF
The Advent of Automotive Linux
Alison Chaiken
 
PDF
Really fast Android
Droidcon Berlin
 
PDF
Suns Out Guns Out: Hacking without a Vehicle by Charlie Miller & Chris Valasek
Shakacon
 
PDF
Building Beautiful High Performance Connected Car Applications
Jason Wiener
 
PDF
Edmunds presentation
Alison Chaiken
 
PPTX
CAN Bus and OBD-II
roadster43
 
PDF
TFT LCD Module Display Manufacturer
KeatonParker2
 
PDF
F2012 expo electrical
PhoenixRacing
 
PDF
Automotive Electronics - Internals and Security Implications
Aanjhan Ranganathan
 
PDF
Automotive: the Next Hot Mobile Platform for Linux
Alison Chaiken
 
PPTX
Cariot
Ram Lanka
 
PDF
From Driver Distraction to Driver Augmentation: Open Source in Cars
Alison Chaiken
 
PDF
Developing for the Connected Car
Qualcomm Developer Network
 
PPTX
UNIT-3 PROGRAMMING MODELING – CASE STUDIES.pptx
MeenavalliUdayVenkat
 
The Java Carputer
Simon Ritter
 
The next frontier: open source in the car
Alison Chaiken
 
Arduino-based-diag OBD-II_programação.pdf
Jcradio Vw
 
SCALE 2012: Automotive: new frontier for mobile Linux
Alison Chaiken
 
Car automation OHM2013
Marian Marinov
 
Home and Car automation DORS/CLUC 2013
Marian Marinov
 
The Advent of Automotive Linux
Alison Chaiken
 
Really fast Android
Droidcon Berlin
 
Suns Out Guns Out: Hacking without a Vehicle by Charlie Miller & Chris Valasek
Shakacon
 
Building Beautiful High Performance Connected Car Applications
Jason Wiener
 
Edmunds presentation
Alison Chaiken
 
CAN Bus and OBD-II
roadster43
 
TFT LCD Module Display Manufacturer
KeatonParker2
 
F2012 expo electrical
PhoenixRacing
 
Automotive Electronics - Internals and Security Implications
Aanjhan Ranganathan
 
Automotive: the Next Hot Mobile Platform for Linux
Alison Chaiken
 
Cariot
Ram Lanka
 
From Driver Distraction to Driver Augmentation: Open Source in Cars
Alison Chaiken
 
Developing for the Connected Car
Qualcomm Developer Network
 
UNIT-3 PROGRAMMING MODELING – CASE STUDIES.pptx
MeenavalliUdayVenkat
 
Ad

More from IndicThreads (20)

PPTX
Http2 is here! And why the web needs it
IndicThreads
 
ODP
Understanding Bitcoin (Blockchain) and its Potential for Disruptive Applications
IndicThreads
 
PPT
Go Programming Language - Learning The Go Lang way
IndicThreads
 
PPT
Building Resilient Microservices
IndicThreads
 
PPT
App using golang indicthreads
IndicThreads
 
PDF
Building on quicksand microservices indicthreads
IndicThreads
 
PDF
How to Think in RxJava Before Reacting
IndicThreads
 
PPT
Iot secure connected devices indicthreads
IndicThreads
 
PDF
Real world IoT for enterprises
IndicThreads
 
PPT
IoT testing and quality assurance indicthreads
IndicThreads
 
PPT
Functional Programming Past Present Future
IndicThreads
 
PDF
Harnessing the Power of Java 8 Streams
IndicThreads
 
PDF
Building & scaling a live streaming mobile platform - Gr8 road to fame
IndicThreads
 
PPTX
Internet of things architecture perspective - IndicThreads Conference
IndicThreads
 
PPTX
Scrap Your MapReduce - Apache Spark
IndicThreads
 
PPT
Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker
IndicThreads
 
PPTX
Speed up your build pipeline for faster feedback
IndicThreads
 
PPT
Unraveling OpenStack Clouds
IndicThreads
 
PPTX
Digital Transformation of the Enterprise. What IT leaders need to know!
IndicThreads
 
PDF
Architectural Considerations For Complex Mobile And Web Applications
IndicThreads
 
Http2 is here! And why the web needs it
IndicThreads
 
Understanding Bitcoin (Blockchain) and its Potential for Disruptive Applications
IndicThreads
 
Go Programming Language - Learning The Go Lang way
IndicThreads
 
Building Resilient Microservices
IndicThreads
 
App using golang indicthreads
IndicThreads
 
Building on quicksand microservices indicthreads
IndicThreads
 
How to Think in RxJava Before Reacting
IndicThreads
 
Iot secure connected devices indicthreads
IndicThreads
 
Real world IoT for enterprises
IndicThreads
 
IoT testing and quality assurance indicthreads
IndicThreads
 
Functional Programming Past Present Future
IndicThreads
 
Harnessing the Power of Java 8 Streams
IndicThreads
 
Building & scaling a live streaming mobile platform - Gr8 road to fame
IndicThreads
 
Internet of things architecture perspective - IndicThreads Conference
IndicThreads
 
Scrap Your MapReduce - Apache Spark
IndicThreads
 
Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker
IndicThreads
 
Speed up your build pipeline for faster feedback
IndicThreads
 
Unraveling OpenStack Clouds
IndicThreads
 
Digital Transformation of the Enterprise. What IT leaders need to know!
IndicThreads
 
Architectural Considerations For Complex Mobile And Web Applications
IndicThreads
 

Recently uploaded (20)

PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
PPTX
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 
PPT
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
PDF
Microsoft Teams Essentials; The pricing and the versions_PDF.pdf
Q-Advise
 
PPTX
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
PPTX
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PDF
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
PPTX
TestNG for Java Testing and Automation testing
ssuser0213cb
 
PPTX
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
PDF
Protecting the Digital World Cyber Securit
dnthakkar16
 
PPTX
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
PPTX
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
PPTX
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
DOCX
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
PDF
Build Multi-agent using Agent Development Kit
FadyIbrahim23
 
PDF
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
PDF
Bandai Playdia The Book - David Glotz
BluePanther6
 
PPTX
Presentation about variables and constant.pptx
kr2589474
 
PDF
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
Microsoft Teams Essentials; The pricing and the versions_PDF.pdf
Q-Advise
 
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
TestNG for Java Testing and Automation testing
ssuser0213cb
 
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
Protecting the Digital World Cyber Securit
dnthakkar16
 
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
Build Multi-agent using Agent Development Kit
FadyIbrahim23
 
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
Bandai Playdia The Book - David Glotz
BluePanther6
 
Presentation about variables and constant.pptx
kr2589474
 
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 

Cars and Computers: Building a Java Carputer

  • 1. Cars and Computers: Building a Java Carputer Simon Ritter Head of Java Technology Evangelism Oracle Corp. Twitter: @speakjava
  • 2. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2
  • 3. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Cars And Computers
  • 4. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. My First Car: 1981 • No electronics – Well, it had a radio • Purely electromechanical – Points/Distributor – Carburettor/Manual choke – Drum brakes – Dynamo – Lights, horn, wipers, fan, ignition switch 1971 Mini Clubman 1000
  • 5. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Car Wiring: 1970s Image coutesy of Haynes manuals
  • 6. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. My Current Car • Lots of electronics – Engine Control Unit (ECU) – Fuel Injection/Electronic timing – “Fly-by-wire” throttle – Anti-lock Braking System (ABS) – Electronic Stability Program (ESP) – Magnetorheological Suspension – Satellite navigation – Auto-sensing wipers and lights 2011 Audi S3
  • 7. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Bus architecture means substantially less wiring Car Wiring: 2011 Convenience Bus Infotainment Bus Powertrain Bus
  • 8. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. The Java Carputer (Mark 1)
  • 9. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Carputer Design Objectives • Display realtime data • Engine performance (Power, Torque, Load) • Driver data (Throttle position, steering angle, braking force, etc) • G-Forces on car • Graphed data for time-based analysis
  • 10. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Carputer Hardware Architecture USB WiFi Dongle Touch Screen Accelerometer HDMI USB I2C 12V Car Converter ELM327 Car Service Port 5V USB
  • 11. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ELM327 • WiFi or Bluetooth connection 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 interaction – Easy to write Java code to handle this Cheap way to hack your car
  • 12. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Touchscreen • 2 DIN fitting size – Ideal for centre console • HDMI input – Specifically marketed for Raspberry Pi • USB connection for touch screen Lots of things available on eBay
  • 13. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Hardware Fitting Challenges Touchscreen
  • 14. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Accelerometer • Sparkfun breakout board MPU 9150 – 9 DoF sensor (accelerometer, gyroscope, compass) • Communications via I2C – Configure Raspberry Pi /etc/modules • i2c-bcm2708, i2c-dev • i2c-detect -y 1 to get address – Compass communication is a bit more complicated • Second I2C bus
  • 15. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 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);
  • 16. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Carputer Software Architecture • 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 existing car controls to change screen? Realtime Data
  • 17. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Take Inspiration From Others UI Design Ideas Renault Megane Sport
  • 18. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Take Inspiration From Others UI Design Ideas Tesla
  • 19. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Take Inspiration From Others UI Design Ideas Lamborghini Reveton
  • 20. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Simple Data Display Control • Only uses 3 nodes – Polygon – Rectangle – Line – Labels are optional • Displays – Current value – Maximum value since start (resetable) • Simple to understand from a glance
  • 21. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Splash Screen UI Screens
  • 22. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. UI Screens
  • 23. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. UI Screens
  • 24. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. The Java Carputer (Mark 2)
  • 25. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Carputer Hardware Architecture 25 USB via FTDICrossover ethernet Infra red Thermal sensor CAN High CAN Low OBD2 Service Port Wi-Fi Accelerometer/ Gyro/Compass I2C USB UART Serial GPSHeart Rate Monitor USB Video Camera Raspberry Pi Model B+ 7” Touch secreen USB SDR/TPMS CAN Bus
  • 26. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Tracking Position With GPS • AdaFruit Ultimate GPS breakout – 10Hz read rate – Serial interface • Very simple configuration – 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 corruption
  • 27. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Heart Rate Monitoring of the Driver • Sparkfun board – USB interface, serial connection • Similar to GPS – Use librxtx-java – 9600, 8N1 • More complicated coding – Actually need to send a read request! • Some issues with wireless connection – 80cm max, doesn’t work well through a Rapsberry Pi
  • 28. 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! 28 Camera Application 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
  • 29. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. The Simplest Solution Is Often The Best 29 Push button using GPIO lines and Pi4J
  • 30. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Thermal Sensors For Brakes and Tyres The Goal
  • 31. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Infra-Red Thermometer • MLX90614 breakout board – I2C interface seemed problematic on the Pi – Also has serial interface – Use FTDI breakout board – 4 wires becomes simple serial interface 31 The Reality
  • 32. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Thermal Sensor Data • Provides continuous reading as lines of text (e.g. 73.2F) – Don’t like Fahrenheit, wanted Celcius – Lambdas and Streams! 32 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); }
  • 33. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Thermal Sensor Data • Provides continuous reading as lines of text (e.g. 73.2F) – Don’t like Fahrenheit, wanted Celcius – Lambdas and Streams! 33 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); }
  • 34. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 34 Tyre Sensor Fitting The Thermal Sensors
  • 35. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 35 Brake Disk Sensor Fitting The Thermal Sensors
  • 36. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 36 Separate Pi in Engine Bay Fitting The Thermal Sensors
  • 37. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Fitting The Thermal Sensors • Simple server listens on port • Carputer requests data • Couple of issues – Server needed reset for new connection (bug to be fixed) – How to tell which sensor is which (ttyUSB0/ttyUSB1) 37 The Networked Car
  • 38. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Fitting The Thermal Sensors • Rasperry Pi at over 50C – After 10 minute drive • New approach required – Longer USB cables – Put the Pi in the car 38 Internal Combustion Produces Heat
  • 39. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Getting Data From The CAN Bus • Controller 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!
  • 40. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Where There’s A Will There’s A Way Getting Data From The CAN Bus
  • 41. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Where There’s A Will There’s A Way Getting Data From The CAN Bus Success! (And the car still works)
  • 42. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Getting Data From The CAN Bus • 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 42 Electrical Connectivity Is Only The Start
  • 43. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 43 Finished Data Capture System
  • 44. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Data Recording and Analysis
  • 45. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Display Collected Data • JavaFX application • 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 application – 15 minutes of data takes about 100ms 45
  • 46. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. • Video (with controls) • G-forces • GPS co-ordinates/altitude • Map of current position • Speed (compare car and GPS) • Bearing • Engine load • Fuel pressure • Air intake temperature • Coolant temperature • Catalyst/exhaust temperature • Tyre temperature • Brake temperature • Throttle position • Engine RPM • Heart rate 46 Data To Display
  • 47. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Conclusions & Resources
  • 48. 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
  • 49. 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 • Twitter: @speakjava
  • 50. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Demos