An Android Things story

Manuel Vivo
Jul 21, 2017 · 5 min read

The other day, without expecting it, I ended up participating in a Firebase + IoT hackathon sponsored by Google at AnDevCon 2017. I was supposed to go with Sam Edwards and volunteer to help with the Capital One hackathon that took place at the same time at AnDevCon.

Firebase + IoT hackathon at AnDevCon 2017

I arrived to the event and Sam told me: “Hey, we’re not longer needed in the Capital One hackathon, you fancy joining the Firebase + IoT one?” I knew nothing about Firebase, just heard of it but never actually used it apart from Firebase Analytics. In terms of IoT, what I know is thanks to Nick Capurso that had the patience to go through some IoT 101 concepts with me. He’s the IoT to-go person in the team. He’s awesome! With Nick Capurso, I learned basic electronics and how not to blow up the boards when connecting stuff together and wiring up components.

Google provided us a Pico Android Things device, with a Rainbow HAT and some other components such as buttons, rotors, etc. The Kit came with a display, WiFi antenna and camera as well.

Kit provided

In the hackathon, after flashing the image to the device and connecting it to the Internet and to the display, the next step was creating a simple “Hello World” Android Things app to show on the screen… I know… It’s cheating, there’s no IoT there but we wanted to make sure we had something working before starting building more difficult things.

Hello World application

The team

We formed a multi-talented team! I had the pleasure of meeting Aaron Preston and Lucy Monahan that did an awesome job; Lucy was our Firebase expert and Aaron by the end of the session got the-IoT-guy title. And then there was Sam, we all know Sam Edwards and how good he is! He did an awesome job at coordinating and wrote some Kotlin code! We all had the chance of contributing to the Kotlin IoT and smartphone apps and learning a lot about Firebase :)

The team
With Sam and Lucy
With Aaron

We were amazed by the Lottie library and we thought of integrating it to our project. There were some points for awesomeness in the project, and Lottie animations fit in perfectly!

After some minutes brainstorming, we came up with the idea of how great would it be to have a system in which designers could show off their animations using the Android Things device as the main controller. The buttons on the Rainbow HAT would make it easier to rewind the animation, pause it, etc. Then, the rest of the team could vote if they like the animation or not. Because that might cause issues between members of the team, we wanted it to be anonymous.

Anonymous voting

After splitting up the work in different parts so we could work in parallel, we ended up having a working prototype that was evaluated and made us win the first price in the competition.

We didn’t have time to achieve our original end goal and vision, but we created a real-time voting system that works.

  • The alphanumeric display in the Rainbow HAT shows the number of positive votes in the left, and negative votes in the right.
  • The LEDs forming the rainbow show the percentile of positive and negative votes. All lights green means that everyone voted YES!
  • The 3 capacitive touch buttons were supposed to go through different animations/questions when voting but we didn’t have time to finish that part.
  • The Android Things display was showing animations that changed after X seconds.

We also had a side app for Android smartphones in which we displayed some debugging information such as the “title” of the question, what you have voted and the total count of positive and negative votes. The main usage is for voting “YES” or “NO”. We could also create a new voting round from this side app.

How does it work?

Under the hood, everything is powered by Firebase Database. The client (side app) can vote yes or no to the question that is currently displayed. All those changes are propagated to the rest of devices as well as to the main Android Things controller.

Then, the controller would update the counter and the lights accordingly.

You want to check out the code? Take a look at the following link:

Pretty cool!

You want to see a live demo and learn more about it?

Demo of our 1st price at the conference

Wrapping up

Hackathons are great! And as developers, we need more of those. Great chance of meeting nice people, working with stuff you’ve never done before, learning new things, … I recommend everyone to attend them as often as they can! The more, the better :)

Hope you enjoy this article,

Thanks for reading,

Manuel Vicente Vivo

)

Manuel Vivo

Written by

Android DevRel @ Google