Azure Badge ble Blog Bluetooth Espruino Hardware iot IoT Hub javascript MQTT Node.js nodeconf NodeConfEU Open Source Technology

Sending 1.24 million MQTT messages from NodeConf EU to Azure (and lots more digital badge details)


The NodeConf EU 2018 digital badge was a shocking success that far exceeded each expectation we had and eclipsed our beloved 2017 badge.

On this submit, I’ll stroll you thru the a number of days of the occasion, clarify at a excessive degree how the badge platform labored and in addition present you the stunning methods through which the attendees interacted with it. In a number of follow-up posts, coming very shortly, we’ll deep dive into the structure and the element of our use of providers like Azure IOT Hub and Databricks.


Sunday was setup day for us and registration day for a lot of the attendees. This meant we had 20 Raspberry Pis which wanted last configuration and deployment across the convention centre and lodge.

NodeConfEU-digital-badgeRaspberry Pis able to be arrange across the convention

Ultimate meeting and flashing of the manufacturing firmware to 300 badges introduced us proper to start out of registration. We have been each thrilled and just a little shocked when all 300 badges began flashing and buzzing concurrently as a consequence of a check alert from the App staff. That one message confirmed that every little thing was working rather well!



The response from the attendees as they acquired their badges made all the work of the previous few months worthwhile. Preliminary hesitancy turned to large grins as we defined what the badges have been and the way they might use them.

NodeConf EU 2018. Kilkenny, Eire.

Everybody adored how lovely the badge seemed with its laser-etched encompass. The truth is they’re so pretty, many people in NearForm at the moment are utilizing our badges as a desktop clock.

Testing had gone so properly within the run as much as the occasion that we didn’t want too many code modifications all through the occasion. Monday morning noticed some Raspberry Pi and Azure updates however one in every of our massive takeaways was how extremely dependable every little thing was for low-cost hardware and light-weight software program. This isn’t your conventional massive iron IOT setup.


We had a heatmap web-app displayed on a big TV, powered by one other Raspberry Pi, displaying how busy every space was in realtime. This was carried out by every badge broadcasting a easy alive sign for a couple of seconds each minute (to protect battery life). These broadcasts have been picked up by a number of Pis operating our Node.js code with the Noble library. The code acquired an RSSI worth which is principally the facility of the sign from every badge. This could perform as a crude distance measure from badge to Pi. The Pis despatched the info over MQTT to IOT Hub and onwards to CosmosDB for persistence. Word that the Bluetooth Mac addresses have been hashed in all messages despatched to Azure so as to add an additional layer of obfuscation.

An essential advantage of the heatmap for us was the realisation that the badge counts in particular rooms appeared very low on Monday. We got here to the conclusion that a number of the Pis have been just too low-down and have been being blocked from scanning the badges correctly by all of the individuals and chairs within the greater rooms. On Monday night time I moved all of them a minimum of 2 metres off the bottom and the counts for Tuesday/Wednesday have been a lot better.

Clap-o-meter and Temperature

Together with the heatmap, we had the realtime clap-o-meter for every room. This was only a little bit of enjoyable and was not meant to be taken significantly or seen as extremely correct. This labored through the use of the on-badge accelerometer to detect giant modifications and the badges then broadcast an estimated clap quantity. The Pis collected these broadcasts and despatched them over MQTT to IOT Hub and onwards to CosmosDB for persistence. .

The badges additionally despatched their present detected temperature in the identical JSON because the claps. We didn’t use this knowledge in the course of the occasion however endured it for post-processing later (see under).

One of many follow-up posts will clarify what occurred to all the info as soon as it received to IOT Hub.

Alerts and Schedule Information

All of the alert and schedule info got here from the NodeConf PWA back-end. An Azure useful app monitored the back-end by way of its API and despatched any alerts or Now/Subsequent schedule information by way of IOT Hub to the Raspberry Pis. The Node.js code operating there then used the Bleno library to broadcast to the badges for a number of minutes as a way to guarantee reception. When every badge awoke, it might scan for these broadcasts and replace the badge accordingly. Clearly it ignored repeated messages from the identical or a number of Pis. A important level is that the Pis have been all utterly unbiased and unaware of one another. This made implementation simpler and the general system extra strong to failures. We operated a whitelist of Pi Bluetooth Mac addresses on the badge firmware to keep away from any naughty individual sending their very own “alerts” to the badges.

Lunch alert! #NodeconfEU

— Andrey Melikhov (@amel_true) November 5, 2018


Monday’s workshop confirmed everybody how to hook up with their badge over Bluetooth utilizing the Chrome-based Net IDE. Quickly everybody was operating their very own JavaScript instantly on the badge and having enjoyable with the REPL and on-badge hardware.

#NodeConfEU Bluetooth LE Badge Workshop with @Espruino

— Nico Kaiser (@nicokaiser) November 5, 2018

Begin of bluetooth le, microcontrolers, and badges workshop at #NodeConfEU

— Roland Broekema (@RBFrontEnd) November 5, 2018

Management Panel

One good side-benefit of utilizing the Azure IOT SDKs was that we might inform the standing of all registered units (Pis). So we constructed a easy Management Panel for our personal use through the occasion. This confirmed the connectivity standing of all of the Pis together with the Alert/Information/Now/Subsequent that every Pi was presently broadcasting (if any) by analysing the telemetry knowledge from IOT Hub. We additionally added the power to ship our personal notifications to the badges, separate from the App ones, to facilitate simpler testing.

1.24 Million Messages!

The Node.js IOT SDKs of all the main cloud distributors, together with Azure, are constructed on MQTT.js, from the ever-brilliant Matteo Collina of NearForm. So it gave me an unlimited thrill to see how a lot we’d used it over the three.5 days.


Simply take into consideration that for a second. Approx 300 cheap Bluetooth LE units communicated with 20 x $35 Raspberry Pis throughout convention hours solely, inflicting 1.24 million MQTT messages to be despatched to Azure IOT Hub, over convention wifi(!), with no a part of the system ever breaking a sweat.

I’m satisfied that we’re at an inflection level in IOT. Many use instances will transfer to a mess of small low cost low-power redundant units, speaking by way of different low cost less-low-power redundant units to an “infinitely” scalable pay-as-you-go back-end. The worth will probably be within the actionable insights which might be potential by way of AI/ML+IOT in that cloud. And far of the implementation end-to-end, outdoors of hard-real-time, will probably be in JavaScript.

Getting worth from the info with Azure Databricks

As soon as we had all of this anonymized knowledge in CosmosDB, we needed to do one thing helpful with it. As a primary step, one of many staff spun up an occasion of Azure Databricks. This blew our minds. Single click on deployment of a whole Apache Spark occasion that auto-shuts-down after an idle interval. The time-saving worth of providers like this will’t be underestimated.

A easy Scala question in Databricks data-crunched for a number of minutes and output some CSVs. These information have been then consumed by a easy web-app based mostly on PivotTable.js which enabled us to visualise temperature, clap and badge knowledge alongside numerous dimensions. I used to be speechless once I noticed how a lot we might infer from Pivot desk output. Even easy information have been shocking. The height of individuals/badges on Monday was 9am however was extra like 10.30am on the next days. The typical temperature in rooms modified lots all through the day. The clap-o-meter was too delicate to motion 🙂

While these are enjoyable experiments, there are actual sensible insights for convention venues and convention organisers on this knowledge. Think about correlating throughout a number of occasions in a single venue and feeding that knowledge to those that design occasion venues. Most significantly for me – what’s the optimum time/location/quantity of espresso stations for any given occasion.


It’s timelapse time

It turned out to be fairly straightforward to take all the knowledge saved in CosmosDB and generate some very fascinating timelapses. The primary is successfully a replay of what individuals noticed stay in realtime on the occasion displaying badge counts in rooms and claps:


And the second timelapse made use of that beforehand not proven temperature knowledge from the badges. Notice that the sensor is on the again of the badge and therefore would have been strongly affected by the temperature of the attendee themselves. Nevertheless it’s nonetheless pretty to observe!


Azure ML Studio

We didn’t have time to start out something on ML earlier than the occasion however we’ve simply kicked off a venture with Azure ML Studio targeted on the occasion knowledge. We’ll do a follow-up publish on this quickly however suffice to say that new customers discovered the getting-started course of on ML Studio extremely straightforward. Doing primary linear regressions on the uncooked temperature knowledge in CosmosDB was solely some extent and click on train.

In case you are within the Pacific Northwest on Monday 17th of December, Luca Maraschi is giving a chat within the Microsoft workplaces in Vancouver round CosmosDB, Azure ML and Node.js.

Node.js Meetup

I gave a full run-down of the badge platform on the Node.js Meetup Dublin just lately. Individuals proceed to be excited by the badge and the chances of utilizing the platform at different occasions.

Hacking on the badges

The badge is basically an expanded Pixl.js and runs precisely the identical firmware because it. The software program you run on prime of that may be something you want. I already talked about the Desktop Clock above.

Emma obtained it simply the best way she needed:

Badge upgraded. #nodeconfeu

— Emma does not want an egg nog latte, she wants ☕️ (@triagegirl) November 5, 2018

Chris jumped the shark. It’s a shark, isn’t it 🙂

I *might* have stayed up a bit late enjoying with my #NodeConfEU badge…

— Chris Wilcox 🐍, 🐢🚀, ☁️, 🏍️ (@chriswilcox47) November 6, 2018

And simply the opposite day, Kas Perch, who was an enormous assist to us at NodeConf EU (thanks Kas!!), has began constructing their very own badge software program, based mostly on the NodeConf EU one, however with simply the options they want. Take a look at the Twitch video they did of the method:

At this time on stream: let’s begin turning my @NodeConfEU badge, powered by @espruino, into my every-conference badge! I will be taking aside the firmware and constructing it again up piece by piece. 1pm CST!

— Mx. Kas Perch (@nodebotanist) December 9, 2018

Watch Reside from the lab — Espruino Badge! from Nodebotanist on www.twitch.television

Wifi? You betcha!

We made positive you possibly can simply add Wifi to the badge with an ESP-01 however didn’t embrace it by default as a consequence of battery utilization. Gordon has put collectively a video displaying precisely methods to do it. It’s very straightforward and I’ve modded two already.

Change the identify in your badge or flip it right into a clock

When you’d like to vary the identify displayed in your badge, simply use this easy Identify Changer Net Bluetooth App.

We’ll quickly have a easy Net Bluetooth app to transform your badge right into a desk clock too. Within the meantime, extra technical customers can do it utilizing the Net IDE. See the feedback on the prime of that hyperlink for flashing the code.


We’ve actually been overwhelmed by the constructive response to the badge by the attendees. Right here’s only a pattern:

Coolest convention badge I’ve ever had 🙂 #NodeConfEU #NodeJS #espruino

— Maya (@maya_papayaa__) November 5, 2018

The #NodeConfEU badge is the most effective factor ever

— Jelle Kralt (@jellekralt) November four, 2018

Nodeconf, superior as all the time! ✨@NodeConfEU

— Simona Cotin (@simona_cotin) November four, 2018

Rave mode #NodeConfEU

— Use The Pressure, Luke (@sienaluke) November four, 2018

Oh, and did I point out badges? They hook up with IDE in your browser by way of WebBluetooth and are programmable with javascript (from a browser in fact), they notify you for talks and occasions, and you may even play video games. Nice job @NodeConfEU #NodeConfEU

— tretton37 (@tretton37) November 5, 2018

So excited for the kickoff of @NodeConfEU and simply take a look at these badges!

— Siobhan Meier (@justshiv_) November 5, 2018

And plenty of footage of the badges from Nico Kaiser right here.

Open Sourcing

The Espruino code for the badge and the hardware design information have already been open sourced. We’ll be saying the open sourcing of the remainder of the platform together with each the Raspberry Pi and Azure code very quickly.

Business Help

Should you want to interact commercially relating to the badge platform itself or any elements of Azure, please get in contact with NearForm.

Gordon Williams can deal with any of your hardware queries about customized badges or Espruino.

And eventually

Right here’s a stunning abstract video of the occasion with numerous appearances by the badge:

About the author