Project Sharing_Raspberry Pi - Disco time


I would like to share our project we did last month. It was fun creating it, and I hope it inspires! We organized an internal hackathon with the theme Internet of Things. We thought, what is a great demo to create and with what device? There are so many devices out there with lots of features, among them the Pi is really interesting, as it is capable of running almost everything.

My colleague already had a Raspberry Pi and was figuring out how to switch on-off electronics using pimatic. I was working on integration components and was looking for a great way to involve the audience during a demo. We wanted to create a scenario where the Pi was controlled by the audience, in a fun way.

We came up with the following scenario;
a. Raspberry Pi: The Raspberry Pi controls a disco ball which will go off, when a certain ‘code’ is guessed
b. Website: Users in the audience can open up a website and chat with each other

The entire diagram is more complex, this post describes the right part;

Raspberry Pi Model B+
We installed the Raspian distribution on the Pi as it comes with a lot of packages perfect for home automation. We installed pimatic as it can be used to control hardware.

For the Pi we connected the GPIO pins with a relay. The Raspberry was set up with the relay as shown in the example below;

We had little time to create a nice box housing the entire solution, so we had to improvise. Hereby some of the steps;

  1. Soldering

  2. Connecting

  3. The do not touch sign

While waiting for my tires to be changed at the car dealer, I used my phone to deploy a Node.js chat application on Cloud9 (online development environment). We tested it at that moment with 4 members of our team which was prepping for the demo. Node.js is event-driven, non-blocking I/O open source cross-platform runtime environment, it is awesome! The best thing is that it is ideal for prototyping scenarios in the context of IOT as it is easy to understand.
Below the website in use;

Back home I extended the code so that each chat message is published to a cloud message broker (Azure).

The cloud platform consists of;

  • ‘topic’ where the messages are stored
  • ‘subscribers’ which are interested in information, and are subscribed to certain information

The nice thing about this approach is, that Node.js is used as a front-end, which communicates with a backend in Node.js. The processing logic after this can be done in any other language.

The final result
We gave several presentations, where the code was guessed….we had some demo disco time!

And now?
We used this scenario to involve the audience, the concepts however can be applied in several types of projects. The idea that you ‘subscribe’ to information relevant, could be easily translated to a an electric car which is charged when the electricity rate is the cheapest (with a filter in a timeframe – upper-lower price), household equipment such as fridge which is empty and needs to send an order to the grocery store.

We had a lot of fun doing this demo, and I hope this shows that even simple ideas can be realized with the technology that is out there today.

Links (I will add these later as I cannot add these right now):
Raspberry Downloads:
Raspberry GPIO and relay: … sing-gpio/

Kind regards,

Sander, Bahto, Johan, Jordi