Skip to main content
  • Log in
  • Manage Cookies
Eclipse Foundation
Download
  • Projects
  • Working Groups
  • Members
  • Community
    • Marketplace
    • Events
    • Planet Eclipse
    • Newsletter
    • Videos
    • Blogs
  • Participate
    • Report a Bug
    • Forums
    • Mailing Lists
    • Wiki
    • IRC
    • Research
  • Eclipse IDE
    • Download
    • Learn More
    • Documentation
    • Getting Started / Support
    • How to Contribute
    • IDE and Tools
    • Newcomer Forum
  • More
      • Community

      • Marketplace
      • Events
      • Planet Eclipse
      • Newsletter
      • Videos
      • Blogs
      • Participate

      • Report a Bug
      • Forums
      • Mailing Lists
      • Wiki
      • IRC
      • Research
      • Eclipse IDE

      • Download
      • Learn More
      • Documentation
      • Getting Started / Support
      • How to Contribute
      • IDE and Tools
      • Newcomer Forum
  1. Home
  2. Blogs
  3. Benjamin Cabé's blog
  4. Using MQTT and Eclipse Paho in Android Things

Using MQTT and Eclipse Paho in Android Things

Friday, December 16, 2016 - 13:41 by Benjamin Cabé

A couple of days ago, Google announced that they were essentially rebranding Brillo to Android Things (I do love that name, by the way!), and finally opening it for a Developer Preview.

There are a few things I already like very much in Android Things:

  • It is already supported on Intel Edison, NXP Pico and Raspberry Pi 3, and there are ready to use filesystem images that you can just flash to get going with Android Things in just minutes.
  • The Rainbow HAT sensor kit that’s available for Raspberry Pi is very cool, and includes a 4-digit LED display, 7 RGB LEDs, a temperature and barometric sensor, a piezzo buzzer for basic PWM-based audio, and three capacitive touch buttons. Sparkfun has a kit that’s targeting the Edison, while Adafruit’s kit is general purpose and meant for breadboard enthusiasts.

Rainbow HAT for Raspberry Pi (Photo credit: Pimoroni)

  • Anyone who’s tried to manipulate low-level peripherals using Java will be pretty happy to see that Android Things’ Peripheral I/O APIs provide nice wrappers for GPIOs, PWM, I2C, SPI and UART.
  • Implementing IoT sensor drivers taps into the existing sensor framework you may already be familiar with if you’ve already tried to access the gyroscope or light sensor of an Android device in your app, and the same SensorManager API you’re already used to can be used with your new devices (for which a driver may already exist, and if not adding a new one does not seem overly complex)
  • Finding good development tools for building IoT solutions is always a challenge. It’s great to be able to leverage the Android SDK tools and Android Studio for things like device emulation, debugging, etc.

I just received my Rainbow HAT today and thought I would use the opportunity to do a quick tutorial on how to use MQTT with Android Things, using Eclipse Paho. What’s more, I’ll also show you a cool feature in mqtt-spy that will allow us to easily display the live temperature on a chart.

I used the Weather Station example from Android Things as a starting point, as it is already including code to publish data to the cloud using Google Pub/Sub. My fork is available on Github, and as you can see the changes to the original example are very limited!

Check out the video, and let me know if you have any questions!

The article Using MQTT and Eclipse Paho in Android Things appeared on Benjamin Cabé first.

Tags: 
eclipse
IoT
android
android things
MQTT
Source: 
https://blog.benjamin-cabe.com/2016/12/16/using-mqtt-and-eclipse-paho-in-android-things
  • Benjamin Cabé's blog
  • Sign in to post comments.

Eclipse Foundation Blogs

  • Ian Skerrett (857 posts)
  • Wayne Beaton (796 posts)
  • Mike Milinkovich (290 posts)
  • Benjamin Cabé (131 posts)
  • Ivar Grimstad (103 posts)
  • Tanja Obradovic (39 posts)
  • Thabang Mashologu (32 posts)
  • Christopher Guindon (15 posts)
  • Roxanne Joncas (14 posts)
  • Paul Buck (11 posts)
  • Frédéric Desbiens (11 posts)
  • Mikaël Barbero (9 posts)
  • Jameka Woodberry (9 posts)
  • Brian King (8 posts)
  • Hudson Kelly (8 posts)
  • Denis Roy (5 posts)
  • Gabriela Motroc (4 posts)
  • Shabnam Mayel (3 posts)
  • Gael Blondelle (3 posts)
  • Jacob Harris (1 posts)
  • Stephanie Swart (1 posts)
  • Michael Plagge (1 posts)
  • Sharon Corbett (1 posts)
  • Shanda Giacomoni (1 posts)
  • Paul White (1 posts)

Recent blog posts

  • Three Good Reasons to Complete the Jakarta EE Developer Survey
  • Hashtag Jakarta EE #66
  • Why Java Developers Continue to Rely on Jakarta EE
  • Open VSX: A Vendor-Neutral Home for VS Code Extensions
  • Hashtag Jakarta EE #65
  • Introducing New Che Workspaces on OpenShift
  • Eclipse Jetty 11 Supports the Big Bang
  • Meet Adoptium: Open Source Java Runtimes for Enterprises
  • Support for Asian Communities from the Eclipse Foundation
  • Hashtag Jakarta EE #64
More

Eclipse Foundation

  • About Us
  • Contact Us
  • Donate
  • Members
  • Governance
  • Code of Conduct
  • Logo and Artwork
  • Board of Directors

Legal

  • Privacy Policy
  • Terms of Use
  • Copyright Agent
  • Eclipse Public License
  • Legal Resources

Useful Links

  • Report a Bug
  • Documentation
  • How to Contribute
  • Mailing Lists
  • Forums
  • Marketplace

Other

  • IDE and Tools
  • Projects
  • Working Groups
  • Research@Eclipse
  • Report a Vulnerability
  • Service Status

Copyright © Eclipse Foundation. All Rights Reserved.

Back to the top