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.

How to build an effective IoT demo with OSGi - Derek Baum & Walt Bowers

419 views

Published on

OSGi Community Event 2016 Presentation by Derek Baum (Paremus) & Walt Bowers (Eurotech)

Physical IoT devices are more exciting than any software user interface and should be central to any demo. Initially attracted by the IoT device, visitors’ are naturally receptive to learn more about the software platform and/or products controlling the solution.

This is why the OSGi Alliance based their IoT demo on a LEGO® train. OSGi and the OSGi enRoute platform had no existing integrations for Lego® trains, but provided a great base for IoT development. The demo showcases how the OSGi ecosystem of open source and commercial products can be used together to build a compelling IoT solution.

This talk reviews the end to end architecture used to deliver the demo and describes how the custom actuators and sensors needed to operate the LEGO® train were constructed and controlled. It also explains the issues encountered and how they were resolved. It then describes how the demo has been evolved for this conference.

The OSGi IoT demo is on display in the exhibition area. Please visit the demo and try it out for yourself.

Published in: Technology
  • Be the first to comment

How to build an effective IoT demo with OSGi - Derek Baum & Walt Bowers

  1. 1. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 www.paremus.com OSGi Community Event 2016 co-located at EclipseCon Europe 2016 How to build an effective IoT demo with OSGi
  2. 2. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 2 about: me derek.baum@paremus.com • Studied Electronic Engineering • Only ever worked as a Software Engineer: - Unix - 1980- System III, System V, Solaris - C/C++ - 1982- - Linux - 1990- 0.9 - Java - 1995- 1.0 - OSGi - 2006- R4 • Until IoT came along.. - First time I’ve used a soldering iron for over 30 years!
  3. 3. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 www.paremus.com OSGi IoT Demo Brought to you by
  4. 4. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 4 about: presentation • What makes an effective IoT demo? • Bottom-up review of OSGi IoT demo: - Mechanical Engineering (Lego®) - Electronic Engineering (Things) - Software Engineering (OSGi) • Problems encountered • Resolutions & extensions • Questions?
  5. 5. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 5 What makes an effective IoT demo? • A cool UI?
  6. 6. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 6 A cool UI?
  7. 7. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 7 What makes an effective IoT demo? • A cool UI? • or some Things?
  8. 8. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 8 Some things?
  9. 9. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 9 What makes an effective IoT demo? • A cool UI? • or some Things? Things are more compelling as you can see them physically doing stuff. Things draw attention to your demo/product. You can then demonstrate your cool UI :-)
  10. 10. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 10 June 2015: Radio Controlled Cars?
  11. 11. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 11 July 2015: Remote Controlled Trains? • Goal – Demonstrate OSGi as a viable technology to control low level IO on the device and high level control in the cloud
  12. 12. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 12 Lego® Train
  13. 13. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 13 Lego® Train: Actuators & Sensors What actuators & sensors do we need? • Actuators - perform some action (write-only) - setSpeed(train#, speed) - setLight(train#, on_off) - setTrackSwitch(switch#, normal_alternate) - setSignal(signal#, colour) • Sensors - report some status (read-only) - getLocation(train#)
  14. 14. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 14 Lego® Train: What’s in the box? • Working system: • Infrared remote controlled battery-powered train - 4 channel, capable of controlling speed and lights of 4 trains ✓setSpeed() ✓setLight() • Track • Lego® bricks :-)
  15. 15. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 15 Lego® Train: What’s missing? • Track signals • Track switch actuators • Train location sensors
  16. 16. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 16 Hardware Engineering Lego® Engineering
  17. 17. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 17 Lego® Engineering
  18. 18. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 18 Lego® Engineering
  19. 19. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 19 Lego® Engineering
  20. 20. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 20 Lego® Engineering
  21. 21. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 21 Lego® Engineering
  22. 22. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 22 Lego® Engineering
  23. 23. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 23 Lego® Engineering
  24. 24. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 24 Lego® Engineering
  25. 25. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 25 Lego® VIP member
  26. 26. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 26 Lego® Train: What’s missing? ✓Track signals ✓Track switch actuators ✗Train location sensors
  27. 27. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 27 Electronic Engineering Thing Engineering
  28. 28. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 28 Train location sensors? • No Lego® location sensors available :-( • Mechanical or magnetic switches? - too low tech?; can’t distinguish multiple trains • Scan barcode on train? - TBD • Read RFID tag on train? - cheap RFID readers available - use 6 fixed readers and an RFID tag on each train
  29. 29. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 29 MF-RC522 RFID reader
  30. 30. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 30 MF-RC522 RFID reader - testing
  31. 31. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 31 Lego® Train: What’s missing? ✓Track signals ✓Track switch actuators ✓Train location sensors MF-RC522 RFID readers seem to work OK • supported on Raspberry PI using SPI bus • tested using Python RFID reader program • range not great, 1-2cm, but should be OK
  32. 32. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 32 Actuator & sensors • Train speed & lights - infrared • Track signals - high power LEDs • Track switch actuators - Lego® motors • Train location sensors - RFID
  33. 33. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 33 Lego® Infrared protocol?
  34. 34. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 34 Lego® Infrared protocol? Protocol consists of 38 kHz cycles: Low bit length = 16 x 1/38K = 421 us High bit length = 27 x 1/38K = 711 us Start bit length = 45 x 1/38K = 1184 us Stop bit length = 45 x 1/38K = 1184 us sub-ms timings require some real-time capability
  35. 35. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 35 LIRC - www.lirc.com
  36. 36. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 36 LIRC <-> Lego® RC • LIRC enables control of Lego® RC functions simply by writing the correct sequence of “pulses” to /dev/lirc0. • We converted an example C program into Java - http://www.nishioka.com/train/control.c
  37. 37. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 37 Actuator & sensor drivers? • Raspberry Pi GPIO cannot drive high- power LEDs or motors • We need to use “driver” chips Raspberry Pi GPIO connector
  38. 38. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 38 LED driver: ULN2003A €0.50
  39. 39. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 39 Motor driver: SN754410 €2.00
  40. 40. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 IoT Demo Dual Segment Controller Hardware 20-July-2015 2 x MF-RC522 RFID Reader connected to GPIO SPI Bus ULN2003A LED driver for signals Raspberry Pi 2 GPIO connector Motor driver for track switches 40 Dual segment driver
  41. 41. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 41 Attach to Raspberry Pi
  42. 42. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 42
  43. 43. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 43 Fritzing
  44. 44. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 44 Fritzing
  45. 45. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 45 Fabricate
  46. 46. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 46 Attach to Raspberry Pi
  47. 47. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 47 fritzing.org
  48. 48. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 48 Software Engineering OSGi Engineering
  49. 49. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 49 Service model Remote services
  50. 50. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 50 Deployment model
  51. 51. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 51 SignalSegmentImpl
  52. 52. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 52 Problems Problems?
  53. 53. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 53 Problems: RFID readers MF-RC522 RFID readers seem to work OK • range not great, 1-2cm, but should be OK Not OK! • unreliable, many not working at all • range insufficient for reliable train detection • help!
  54. 54. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 54 Problems: RFID readers •Use mechanical micro-switches instead of RFID •Detect micro- switches by creating code to read GPIO pin
  55. 55. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 55 Extensions Extensions?
  56. 56. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 56 RFID #2 Despite failure of RFID#1, it still seemed like the most viable detection mechanism. Previously, we did not research available RFID devices, and just used the cheapest, most readily available device. RFID#2 • use a better RFID reader • mount reader on train • use multiple passive RFID tags on track
  57. 57. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 57 RFID #2 - Better RFID Reader • use a better RFID reader • RMD6300 • works at 125kHz vs 13Mhz for old reader • provides serial output • still cheap: €5
  58. 58. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 58 RFID #2 - Expensive Tags - >€1.00 each
  59. 59. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 59 RFID #2 - Cheap Tags - €0.10 each
  60. 60. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 60 RFID #2 - Perfect Tags - <€0.50 each
  61. 61. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 61 RFID #2 - Better RFID Reader • Produces serial output • How to mount in train? • Use bluetooth!
  62. 62. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 62 RFID #2 - Mount on train
  63. 63. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 63 RFID #2 - Mount on train
  64. 64. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 64 RFID #2 - Mount on train
  65. 65. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 65 Service model Kura MQTT
  66. 66. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 66 Extensions - Hardware refactoring
  67. 67. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 67 Summary Summary
  68. 68. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 68 Summary • What makes an effective IoT demo? • Bottom-up review of OSGi IoT demo: - Mechanical Engineering (Lego®) - Electronic Engineering (Things) - Software Engineering (OSGi) • Problems encountered • Resolutions & extensions • Questions?
  69. 69. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 69 Q & A Questions?
  70. 70. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 70 Q & A
  71. 71. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 71 Q & A
  72. 72. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved. OSGi Community Event Nov 2016 Interim Title Slide
  73. 73. Copyright © 2005 - 2016 Paremus Ltd. May not be reproduced by any means without express permission. All rights reserved.October 2016 73 www.paremus.com @Paremus info@paremus.com derek.baum@paremus.com http://fritzing.org/projects/raspberry-pi-rfidmotorled-driver https://github.com/osgi/osgi.iot.contest.sdk

×