Rails and the internet of things


Published on

The internet of thing is hot. This talk describes the trends that led to this phenomenon.
Augmented reality links online content to physical object - i talk about the different ways this can happen.
Then i talk about physical computing: making things talk, using Arduino, mainly.

Published in: Technology, Business
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Hi Everybody
    I’m going to talk about Rails and the Internet of things.
    Well, more accurately, I’m going to talk about the Internet of Things and Rails. It’s a vast subject. There’s so much to say - I’m going to attempt to give you a feel of what’s going on.
    Hopefully this will make you want to pull up your sleeves, and start experimenting.
  • My name is Elise Huard. I’m a Belgian freelancer in Ruby on Rails.
    I love the framework, but it’s not the first I’ve used: I’ve been in software for about 8-9 years. Before this I’ve done C, C++, Java.I like to keep up with what’s happening. I’m a big science fiction fan.
  • The internet of things is not a new phenomenon. It’s been in the air, and in the dreams of people, for a long time.
    See this article from BBC news, where the UN predicts the internet of things.When the UN notices a trend, you can be sure it has been around for a while.
    It was mostly linked with the brief hype around RFID tags. I’m going to talk about RFID tags as well, as they are part of the ecosystem.
    The wikipedia entry was only created in 2008.
  • So if this subject has been warming up for a while, why are we hearing so much about it ?
    What are the trends that cause this subject to be hot right now ?
  • It’s very simple: wireless networking.
    Commoditizing of wireless networking. Everyone and his neighbour has a wireless network at home, and many pubs, cafés, airports are starting to see it as a selling point. Public free wifi is not yet a reality, but it’s already fairly common.
    The IEEE 802.11 protocols on 2.4GHz band.
  • Mobile internet. Here in Europe, we were stuck with GPRS for a long time - 52kb/s.
    3G (or UMTS) is actually fairly recent in Belgium, although it has been around for a while, since they were developed in 2001 in Japan, and used in Asia in 2002. The speeds of 3G are around 380 Kb/s. This gives more possibilities, like VOIP, teleconferencing.
    3.5G, or High-Speed Downlink Packet Access is already used in the Netherlands - up to 14Mb/s
    3 and 3 quarters G HSPA+ (evolved high-speed packet access) up to 42MBits/s
    4G or International Mobile Telecommunication Advanced is being developed to acommodate better Quality of Service requirements for multimedia, and higher rates.

    There have been talks about wireless mesh networks, and wimax, but in the end, the successful model is to use what’s there, and that is the existing mobile phone network.
  • Or almost.
    Ubiquitous connection is a reality. Information is everywhere - around us, on the waves. We’re traversed by invisible waves of information.
  • But that’s not going to do us a fat lot of good, because we’re not equipped to work with it. It would be nice if we could just capture those waves to work with it.
  • although there are prototypes. If you look for it on internet, there’s for instance drawings for a phone implant.
  • We need external hardware to make use of this information.
    And enter the second reason why the internet of things is coming up now.Who here has a smartphone ?
  • And there’s the second piece of the puzzle: the rise of smartphones.
    Who here has a smartphone ?
    Who had a smartphone 2 years ago ?
    2 years ago, smartphones were fairly rare - mainly in possession of business men and a few geeks who had money.
    I had one or two friends with palms, but that was about it.
    I believe that Apple changed the game with the iPhone, by bringing it into the public consciousness, and making it a desirable object.
    The other smartphones benefited indirectly, because now, suddenly, you had to have a smartphone, and you could make a statement with your choice. By for instance not buying an iPhone, or something else.You chose a blackberry because you’re more about messaging, an HTC with windows mobile because you need to sync with your windows computer, a Nokia because it’s a decent, stable environment, etc etc.
  • These are projections.In 2009, we’re feeling the recession, so the sales of phones go down - but the sales of smartphones are still expected to increase !
    And this trend is expected to continue.
  • We looked at the trends that brought about the sudden emergence of the internet of things. Now we can start to look at the internet of things itself.
    I’m not talking about fancy graphics or virtual worldsThe first step is augmented reality. We have loads of information about the world around us. Now we have the devices to bring the internet and real life together, there are lots of new possibilities.
  • Augmented reality is the final aim, where we would get something like this.
    Although i do hope the colors will be better. The least we can ask for is full-color, HD image, i think.
  • There’s lots happening in this space: an example is the Dutch startup Layar, which appeared on techcrunch at the end of june.
  • This kind of augmented reality is mostly based on geocoordinates.
  • The level that interests me, is the level of actual things.The geotagging will help you find out information about a place, a shop, the nearest pharmacy, things like that.Once you’re in a building, geotagging won’t be enough anymore (assuming it works). If you want information about a particular object.
  • One way to label objects is with barcodes. There are many types of barcodes, most commonly proprietary.
  • Until now, barcodes have been used on most products for supply chain management.
    From the moment they’re packaged. The moment they pass the cash registry, they cease to be useful.But this doesn’t have to be the case.
  • To look at what’s in store, sometimes it pays to look around.In Japan, they have 3G speed since 2002, and they have a real mobile culture - which they call the keitai culture.Part of the success may be that in public transport there’s strong peer pressure to remain silent, so people usually entertain themselves with books or mobile devices.
  • QR (quick-response) code is one of the most successful types of barcodes in japan. QR codes has been developed by the Japanese corporation Denso-Wave in 1994.
    It is by no means the only 2D barcode, but it is the most successful one.
    You can encode up to 4300 characters in a QR code. (and in the case of japan - about 1800 kanji/kana)It’s success is partly due to the fact that
    1. you can encode a URL with it
    2. it has a lot of duplication, which means that it errors have relatively little consequence, and the code can be read better.
    The phone operators , like NTT Docomo, have made sure that phones are equipped with a bar code reader.This means that if you vaguely point your phone towards such a barcode, the page corresponding to the opened URL is opened automatically.
  • examples of the use of qr code:
    you come to a busstop, and you want to know when your bus will arrive.
    So you point your phone to the QR code, and it opens a list of the next buses that are going to arrive, with their current position.
  • It’s starting to having more and more success over here.
  • This kind of labeling can lead to new models, or new ways to sell.
  • I’m not sure you can call this internet of things anymore -
    but another example of the use of barcodes.
  • There are many plugins to produce bar codes with Rails - QR codes and other types.
    barby does many types of barcodes, and is quite flexible in the output.
    RQR only does QR code, but in a very user-friendly way.

    Think of how powerful it could be: impulse buy ‘on the object’
  • Then there’s the other angle, which is barcode interpretation.

    If you want to implement a phone client yourself that interacts with your Rails app, you can have a look at ZXing. It does a good number of the most common barcodes.

    It allows you to check a barcode of a product in a shop, and see the corresponding product information.
    One of the coolest projects I’ve read about in this context was 2 years ago in IEEE spectrum i think. It was a help to the blind: combination of barcode reading and voice generation, as a cheap way to help a blind person to shop on their own.
  • The main advantage of barcodes is clear: you just need to print it and stick it on corresponding object, and that’s your object tagged.
  • Since we’re not in Japan, you need to open your phone application, photograph the barcode, and you get the corresponding page.
    It’s not exactly snappy, and some people may find this difficult, especially if the barcodes are small, damaged or folded.
  • RFID - Radio Frequency Identification.The idea is that you can just approach your reader to your RFID tag, and a signal will be transmitted.
    There are many kinds of RFID. And their prices vary accordingly.You have passive RFIDs, which have no energy sources, and use the energy of incoming signal to respond.You have semi-active RFIDs, which have their energy source, but only respond when activated.Then you have active RFIDs, which send out a signal at regular intervals.Also, there’s a wide range of frequencies, from 125kHz to 2,45GHz. The higher the frequency, the longer the range (but also the more energy required).
    Data content of a tag can also vary from a few bits to 1megabit.
    The cheapest kind can be made with transformed inkjet printers - you print onto metal sheets with an acid solution.
  • Tracking where your products go - for instance Walmart does it.
    The most effective is when you and your suppliers have an agreement and implement a common system.
  • use of RFID in hospitals
    they’re used to track expensive equipment, supplies, and patients.
  • A B2C example we all know: public transport cards.

    RFID is all very well and handy, but you and I usually don’t walk around with a reader.
  • NFC is Near Field Communication.It’s basically devices being a reader and a tag all at the same time.
    These are the NFC enabled phones i could find on the market. As you can guess from the look, they’re not that recent - there have been phones since 2004 - but somehow they never caught.I think this is going to change, because there are more and more initiatives using NFC for mobile payments.
    You might remember that there was talk of payments over bluetooth, but these were abandoned because they were not safe.The same worry might apply to NFC - but the advantage of NFC is that the range can be made much smaller.
    So we might see them appear again soon.
  • You might ask: but what does this have to do with me, the Rails developer.
    Well, there are more solutions for RFID that make it really easy to combine them with web applications. One of them is a Belgian spin-off, touchatag.
    What they do is to offer a client that converts the identifier of the RFID tag into whatever action you want. For instance, into an URL.I was asked to develop a prototype for the VUB (free university of brussels). This prototype is aimed in the first place at students going around on a campus.If the WIFI works i can even make a small demo.
  • The holy grail for augmented reality, of course, is object recognition.
    This is an extremely difficult problem universities have been working on for ages, throwing all kinds of self-learning or statistical algorithms at the problem.
  • Image recognition is a difficult problem.It works within constraints - if a certain type of object is expected, it works.
    Facial recognition, for instance, is used in modern digital comeras.
  • Just when i was preparing this presentation, this article appeared on Mashable.Apparently Apple deposed a patent for iphone object recognition.
    This patent, on something called Apple ID, recognizes an object based on a combination of visuals, an RFID reader or geocoordinates, and then fetches data from related databases.
    Another patent would use facial recognition to give you information about a person, just by pointing the camera at him.
  • That was augmented reality.When it starts to get really interesting, is when objects talk back.
    With the trends we talked about, smartphones and ubiquitous networking, there are many new possibilities in this area too.
  • You’ve probably heard of this one - a twittering plant.A home made humidity sensor with two galvanized nails planted in the earth, arduino, and an internet connection.The plant tweets when
  • Or a twittering bridge ... twittering abouts opening, closing and the boats which are passing.I would imagine this one is connected to the systems managing the bridge.

    These are examples of what the press, in 2006, called “blogjects” - objects that blog. You see, this is also an idea that has been around for a while.
  • So a new world is opening, and the good news is, we can be part of it very easily.
    Arduino is very special: it’s an I/O board with both open source hardware and software. What is meant by open hardware is that the hardware designs are distributed under a creative commons license. This means that there are several producers making them, and even improving them: the designs are out there.
    The Arduino project started in Italy in 2005, aiming to make student-built interaction design less expensive.
    The software is really easy to program, using a variant of C or C++, and it’s own IDE.
    <show interface>
    It communicates via a serial connection, but there’s an USB to serial adapter chip, which allows you to just plug it into a modern laptop.
    You can buy a decent starter kit, arduino included, for about 60€.
    You’ll have enough to start playing: some pushbuttons, some basic sensors, a bunch of resistors and some capacitors. And of course a few LEDs.
  • I’ve never had the training to actually work with electronics.We had some theoretical courses, involving differential equations, and some talk about semiconductors, but we never actually learned to build something. So i was a little bit worried before starting.I bought this book, but i don’t really recommend it, except the chapter about soldering: it’s a little too basics if you know anything.
    I’m told the art of electronics is a must-read, the other end of the spectrum as it were.
    But actually, it turned out that you don’t really need a lot of theory to get started.
  • A possible source of inspiration is this booklet. It’s from 2007, so it’s not completely up-to-date, but it contains some examples.
  • There are many, many kinds of sensors: pressure, temperature, distance, accellerometers, image, movement, infrared, color, compas, GPS, light, magnetic field, rotation, time, vibrations, ultrasound, humidity, RFID
    you can process the signal, and you can even initiate some kind of action with a servo motor.There are many resources online (Arduino Playground, LadyAda).
    It’s a space where artists, designers, tech people can come together and create, you don’t have to do it alone.
    In this context, or to catch the spirit of the thing, i would also recommend Cory Doctorow’s novel Makers, which is now being published online.
  • The data generated by sensors can then directly be used in web applications: an example is the interesting service Pachube.
    It’s been started by architects. They have a fairly ambitious vision of making a globally connected architecture - a sort of living environment. They’re developing a markup language, in XML, the Extended Environments Markup Language.
    Interestingly, it’s also built in Rails. It’s a kind of hub for all kinds of sensor data. You can push your own, if you have a web server.It’s full of fairly useless data, like the temperature in a room somewhere in Kuala Lumpur.
    The main point of this site is to have a common API, and the possibility to get data in XML, JSON, CSV.
  • Once objects are connected, you can start imagining other scenarios.Objects being aware of eachother, and interacting.The scenario of the fridge checking its contents and their freshness.
    after all, once objects start communicating with the network, the interaction can be managed partly in the object and partly online.
  • Rails and the internet of things

    1. 1. RAILS AND THE INTERNET OF THINGS Rails Underground 24/07/2009 Elise Huard
    2. 2. WHOAMI Elise Huard Science Fiction fan Software developer since 2000 Freelance Ruby on Rails iPhone blog: http://www.elisehuard.be twitter: @elise_huard irc: spacebug Rails Underground 24/07/2009 @elise_huard
    3. 3. Rails Underground 24/07/2009 @elise_huard
    4. 4. WHY NOW ? Rails Underground 24/07/2009 @elise_huard
    5. 5. WIFI Rails Underground 24/07/2009 @elise_huard
    6. 6. Mobile internet 3G, 3.5G, 4G ... Rails Underground 24/07/2009 @elise_huard
    7. 7. Internet is everywhere Rails Underground 24/07/2009 @elise_huard
    8. 8. Rails Underground 24/07/2009 @elise_huard
    9. 9. Rails Underground 24/07/2009 @elise_huard
    10. 10. We need external hardware Rails Underground 24/07/2009 @elise_huard
    11. 11. The rise of the smartphones Recession-proof Rails Underground 24/07/2009 @elise_huard
    12. 12. slide from Justin Lee http://www.slideshare.net/lis186/smartphone-market-trends Rails Underground 24/07/2009 @elise_huard
    13. 13. Augmented reality Rails Underground 24/07/2009 @elise_huard
    14. 14. Rails Underground 24/07/2009 @elise_huard
    15. 15. Layar (dutch startup), Techcrunched on 21/06/2009 Rails Underground 24/07/2009 @elise_huard
    16. 16. Low definition: Geotagging add info to geospatial coordinates Rails Underground 24/07/2009 @elise_huard
    17. 17. Higher definition: things Rails Underground 24/07/2009 @elise_huard
    18. 18. Start making link with online content: Barcodes Rails Underground 24/07/2009 @elise_huard
    19. 19. Rails Underground 24/07/2009 @elise_huard
    20. 20. “The future is already there, it’s just unevenly distributed” - William Gibson Rails Underground 24/07/2009 @elise_huard
    21. 21. QR Code Rails Underground 24/07/2009 @elise_huard
    22. 22. Example: Public transport: Real time timetable Rails Underground 24/07/2009 @elise_huard
    23. 23. Example: film trailer Rails Underground 24/07/2009 @elise_huard
    24. 24. Example: Street Art Dealer Imagine: impulse buying on the object Rails Underground 24/07/2009 @elise_huard
    25. 25. Example: Facebook Rails Underground 24/07/2009 @elise_huard
    26. 26. RAILS AND BARCODES Plugins: barby (dependencies depend on outputter) http://github.com/ toretore/barby/tree/master - different types of barcodes rqr (dependencies libjpeg, libpng, libtiff) http:// rqr.rubyforge.org/ Rails Underground 24/07/2009 @elise_huard
    27. 27. ZXING • Open-source, multi-format 1D/2D barcode image processing library in Java • ports to several languages and phone libraries Rails Underground 24/07/2009 @elise_huard
    28. 28. Main advantage of barcodes: cheap Rails Underground 24/07/2009 @elise_huard
    29. 29. Main disadvantage: not very convenient Rails Underground 24/07/2009 @elise_huard
    30. 30. Enter RFID And NFC-enabled phones Rails Underground 24/07/2009 @elise_huard
    31. 31. B2B Example: Supply Chain Rails Underground 24/07/2009 @elise_huard
    32. 32. B2B Example: hospitals Rails Underground 24/07/2009 @elise_huard
    33. 33. Rails Underground 24/07/2009 @elise_huard
    34. 34. NFC enabled phones (ECMA-340 and ISO/IEC 18092.)‫‏‬ Rails Underground 24/07/2009 @elise_huard
    35. 35. Wayfinding Rails Underground 24/07/2009 @elise_huard
    36. 36. The holy grail: computer vision Rails Underground 24/07/2009 @elise_huard
    37. 37. Rails Underground 24/07/2009 @elise_huard
    38. 38. http://mashable.com/2009/07/10/iphone-object-recognition/ Rails Underground 24/07/2009 @elise_huard
    39. 39. Things talk back Rails Underground 24/07/2009 @elise_huard
    40. 40. http://www.botanicalls.com/archived_kits/twitter/ Rails Underground 24/07/2009 @elise_huard
    41. 41. Rails Underground 24/07/2009 @elise_huard
    42. 42. Arduino Wiring “Physical computing” Rails Underground 24/07/2009 @elise_huard
    43. 43. Rails Underground 24/07/2009 @elise_huard
    44. 44. Rails Underground 24/07/2009 @elise_huard
    45. 45. Use your imagination sensor - controller - actuator inspirational reading: Cory Doctorow “Makers” on Tor.com Rails Underground 24/07/2009 @elise_huard
    46. 46. http://www.pachube.com/ http://www.ugotrade.com/2009/01/28/pachube-patching-the-planet-interview-with-usman-haque/ Rails Underground 24/07/2009 @elise_huard
    47. 47. Objects talking to each other Rails Underground 24/07/2009 @elise_huard
    48. 48. http://www.percussa.com/demos/ http://www.percussa.com/ Rails Underground 24/07/2009 @elise_huard
    49. 49. http://www.percussa.com/demos/ http://www.percussa.com/ Rails Underground 24/07/2009 @elise_huard
    50. 50. Rails: Labeling objects Interacting with native Mobile clients receiving sensor input through API Rails Underground 24/07/2009 @elise_huard
    51. 51. Rails Underground 24/07/2009 @elise_huard
    52. 52. http://www.techcrunch.com/2009/06/21/layars-augmented-reality-browser-literally- more-than-meets-the-eye/ http://2d-code.co.uk/ http://www.rfidsolutionsonline.com/article.mvc/NFC-Enabled-Phones- Contactless-Smart-Card-0001?VNETCOOKIE=NO http://mashable.com/2009/07/10/iphone-object-recognition/ http://www.arduino.cc/ http://www.arduino.cc/playground/ http://oreilly.com/catalog/9780596510510/ http://www.pachube.com/ http://community.pachube.com/what_can_i_use_pachube_for http://www.tor.com/index.php?option=com_content&view=blog&id=38507 Rails Underground 24/07/2009 @elise_huard