DEV Community

Thomas K for Solace Developers

Posted on • Originally published at on

Build a Proximity Detection System with a Raspberry Pi, Solace PubSub+, and JavaScript

Have you ever wanted to tinker around with a Raspberry Pi and IoT but felt that it was too daunting? We’ve developed a set of instructions for you to build a proximity detection system using a Raspberry Pi with an ultra-sonic proximity sensor. The instructions include the materials you need to purchase, how to wire everything together, and the code required to build an application on top of it.

What You Will Build

In the codelab, it runs you through step by step instructions of setting up your Raspberry Pi, wiring it to a proximity sensor, building an application in Javascript that reads the events from the proximity sensor, and publishing it to a Solace PubSub+ Event Broker: Cloud.

You can now build microservices over proximity events triggered when someone comes close to the device!

JavaScript and IoT – Not Your Typical Combination

JavaScript is typically not a language you would associate with IoT, but with the advent of NodeJs, it is being used for more and more use cases outside of traditional web development. One of the frameworks that builds on Node is Johnny-Five – a general purpose IoT framework that works across multiple processor architectures such as SparkFun, Arduino, and Raspberry Pi. The codelab makes use of this framework to gather events from the sensor.

Exposing IoT Events Over Solace PubSub+

Once you’ve detected an object within a certain proximity, what if you wanted to stream this as an event so that it can be picked up by microservices or a dashboard? That’s where Solace PubSub+ Event Broker: Cloud comes into play, a polyglot event broker that allows you to publish IoT events from your Raspberry Pi and subscribe to it with different applications and languages.

Building a proximity detection system

Take a look at the codelab here and start building!

The post Build a Proximity Detection System with a Raspberry Pi, Solace PubSub+, and JavaScript appeared first on Solace.

Top comments (0)