Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
RASPBERRY PI CAR
BOGDAN CRACIUN
SIVECO ROMANIA
Build, Code, Deploy and Run
Agenda
 Introduction
 Requirements
 Hardware platform
 Software platform & Application code
 Q&A
 Running Mode Demo
About me
 Software Architect @ SIVECO Romania from 2003
 Oracle Certified Master, Java EE Enterprise Architect
 Foundin...
Requirements
 Wireless control - no wires
 Wi-Fi based
 Smartphone and Car only setup
 No external Wi-Fi access point ...
Main actor
Secondary roles
Prop
Victim
Result
v1 v2
Running environment
Development environment
Operating system setup
 Operating system
 Rasbian “Wheezy” – Debian based Raspberry Pi distribution
 Access point
 Hos...
Service integration
 Java Application
 Java Service Wrapper
 Node Application
 Nodejitsu Forever
 Linux native progra...
JeeNode integration
 Using serial communication
 RXTX Java library with native support
Car engine
 Java SE Application
 Spring Framework
 IoC container
 Spring Integration
 Redis Channel Adapter
 Custom ...
Control component - Client
 Client
 JQuery Mobile
 User interface and
interactions
 Socket.io
 Client <> Server
commu...
Control component - Server
 Server
 Node.js Server
 Server components (request
handlers and queue
management)
 Redis S...
Image streaming
 mjpg-streamer
 With Raspberry Pi Camera support – 11 fps @ 640x480
Software challenges
 No AP mode support in EW-7811Un
 Action: Custom hostapd compatible RTL8188CUS was installed
 Readi...
Software challenges – cont.
 Compiling the following on Raspberry Pi:
 redis server
 node.js
 RXTX native library
 mj...
Hardware challenges
 Differences between Raspberry Pi and HC-SR04
Ultrasonic Sensor - 3.3v vs 5v
 Action: Used a basic v...
High level Architecture
Detailed Diagram
Detailed Diagram
Lessons learned
 Automate as much as possible
 Build automation
 Test automation
 Use mocks for development and testin...
Final thoughts
 Be a problem solver, not just a programmer.
 Use the best tool for the job
 Does the language really ma...
Testing Team
Next projects
 Raspberry Pi assisted
quad-copter
 Raspberry Pi controlled
Tank
Q&A
 Demo car connection data:
 SID: orange
 Password: 12345678
Upcoming SlideShare
Loading in …5
×

Raspberry Pi Car with Java

4,369 views

Published on

jQuery Mobile, Socket.io, Node.js, Redis, Java, Spring Integration, Arduino, RXTX, Pi4J

Published in: Technology, Education
  • my address is bogdan dot craciun at siveco dot ro
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Raspberry Pi Car with Java

  1. 1. RASPBERRY PI CAR BOGDAN CRACIUN SIVECO ROMANIA Build, Code, Deploy and Run
  2. 2. Agenda  Introduction  Requirements  Hardware platform  Software platform & Application code  Q&A  Running Mode Demo
  3. 3. About me  Software Architect @ SIVECO Romania from 2003  Oracle Certified Master, Java EE Enterprise Architect  Founding member of Oracle Architects Club – Romania chapter
  4. 4. Requirements  Wireless control - no wires  Wi-Fi based  Smartphone and Car only setup  No external Wi-Fi access point needed  No additional administration system  Automatic startup of services on power on  Queue base control  Automatic impact detection and reaction  Front lights control  Status lights for Impact Mode and Commands
  5. 5. Main actor
  6. 6. Secondary roles
  7. 7. Prop
  8. 8. Victim
  9. 9. Result v1 v2
  10. 10. Running environment
  11. 11. Development environment
  12. 12. Operating system setup  Operating system  Rasbian “Wheezy” – Debian based Raspberry Pi distribution  Access point  Hostapd  EW-7811Un with custom drivers to support AP mode  DNS & DHCP  Dnsmasq  Remove serial console support from standard Raspbian distribution
  13. 13. Service integration  Java Application  Java Service Wrapper  Node Application  Nodejitsu Forever  Linux native program  Scripting
  14. 14. JeeNode integration  Using serial communication  RXTX Java library with native support
  15. 15. Car engine  Java SE Application  Spring Framework  IoC container  Spring Integration  Redis Channel Adapter  Custom Serial Channel Adapter  Using RXTX Serial library
  16. 16. Control component - Client  Client  JQuery Mobile  User interface and interactions  Socket.io  Client <> Server communication  Virtualjoystick.js  Dual virtual joystick support
  17. 17. Control component - Server  Server  Node.js Server  Server components (request handlers and queue management)  Redis Server  Node <> Java integration using Redis Pub/Sub  Queue persistence using Redis sorted sets
  18. 18. Image streaming  mjpg-streamer  With Raspberry Pi Camera support – 11 fps @ 640x480
  19. 19. Software challenges  No AP mode support in EW-7811Un  Action: Custom hostapd compatible RTL8188CUS was installed  Reading HC-SR04 sensor data using Java  Works fine if it is the only process on Raspberry Pi  Bad choice to use the sensor with a non real-time SO  Action: Added a Jeenode (Arduino Uno clone) to run the reading loop and push data to a serial Raspberry Pi port
  20. 20. Software challenges – cont.  Compiling the following on Raspberry Pi:  redis server  node.js  RXTX native library  mjpg-streamer – custom module to support image streaming  Image streaming speed optimization
  21. 21. Hardware challenges  Differences between Raspberry Pi and HC-SR04 Ultrasonic Sensor - 3.3v vs 5v  Action: Used a basic voltage divider between the Echo port and the GPIO pin of the Raspberry Pi  Reuse the dual H-bridge from the toy car PCB (Printed Circuit Board) or integrate the L298N board  v1 reuse car PCB  v2 is connected to motors using L298N board
  22. 22. High level Architecture
  23. 23. Detailed Diagram
  24. 24. Detailed Diagram
  25. 25. Lessons learned  Automate as much as possible  Build automation  Test automation  Use mocks for development and testing  Development without the real car  Design a component based system for easy refactoring  Switch between implementations easy  Prototype before develop  It is harder to change something already developed and fully integrated  Switch log levels to error/fatal/off  Use versioning and release management for code and hardware designs  Don’t use / break children toys !
  26. 26. Final thoughts  Be a problem solver, not just a programmer.  Use the best tool for the job  Does the language really matter?  Keep your mind open.
  27. 27. Testing Team
  28. 28. Next projects  Raspberry Pi assisted quad-copter  Raspberry Pi controlled Tank
  29. 29. Q&A  Demo car connection data:  SID: orange  Password: 12345678

×