Skip to content

Using MQTT to Build a Better Mousetrap

by Ravi Subramanyan
13 min read

As Dominik Obermaier, CTO and Cofounder of HiveMQ, mentioned in a recent article to commemorate the 25th anniversary of MQTT, MQTT is now the standard IoT protocol, a pivotal innovation which has driven much of the progress in technology and communication we rely on today. We all know the story that the initial version of MQTT was invented in 1999 by Andy Stanford-Clark and Arlen Nipper to monitor oil and gas pipelines over satellite networks. However, did you know about a practical application for MQTT and the Internet of Things (IoT) to build a better mousetrap?

I got the idea to write this article when I heard Arlen tell a story at a recent event. Andy used to live in the countryside of the UK in a house with a thatched roof. The thatched roof attracted a lot of mice, which would then make their way into the house to wreak havoc. Andy wanted to find a solution to this problem. 

He hooked up a few mousetraps with sensors running MQTT clients which would then trigger a system he had set up whenever the mousetrap went off. This way he could not only catch the mice but also get real-time information on when they got caught, where in the roof they got caught, their movement patterns, and other information that he could use to not only help him eliminate the problem, but also build longer-term solutions to keep it under control. Andy gave a brilliant TED talk where he covered this and a few other technology topics.

A smart mouse trap using MQTT and IoTThis is a simple but powerful use case for a technology like MQTT. It not only works efficiently in home automation projects, but also in industrial use cases because it is publish-subscribe based, supports bidirectional messaging, and works in limited bandwidth/connectivity situations with lightweight message size.

MQTT features

MQTT and HiveMQ for a Connected Mousetrap 

Let’s have some fun with the MQTT-enabled connected mousetrap use case by comparing that to an industrial connected device use case where we typically monitor smart devices and do analytics on them on the cloud. 

Let’s say the mice continue to be a menace. The problem was detected in a single house, but it was later discovered that the entire neighborhood (and worse yet, the entire city) had a mice problem. That would be millions of sensor data points from millions of connected mousetrap devices feeding data that would need to be tracked and assessed in real-time. Also, since the mice problem might be seasonal, the challenge could be how many devices to install, where to install them, and how to scale up and down the solution to ensure that even one mouse is not spared and the pattern for the mice breeding is identified. 

Another issue could be that the data would need to be secured. If the connectivity from the device sensors clients to the broker is lost, the clients would all need to be re-authenticated and re-connected to the broker without any perceived downtime so that the rodent population in the city can continue to be monitored and managed in real time. In addition, the data flowing from the clients to the broker, broker to clients, and the access to the broker itself need to be secured so that rogue players don’t hack the system, get access to the mice data, and misuse that information to take over the world. 

HiveMQ is a proven enterprise MQTT platform that is reliable under real-world stress, is built for flexibility, security, and scale, and provides real-world solutions including building robust connected mousetraps. 

HiveMQ MQTT Broker and HiveMQ Edge connecting industrial applicationsHiveMQ provides the following features to power bidirectional data movement in the connected mousetrap use case:

Data Ingestion and Data Quality at the Edge 

HiveMQ provides a HiveMQ Edge gateway that can translate device sensor data points in various formats like OPC UA, Modbus etc. into MQTT; store and forward the data if connection is lost; improve data quality, normalize and contextualize the data through Data Hub so that it can all be interpreted easily and bridge to an enterprise broker. 


HiveMQ supports MQTT’s three quality of service (QoS) levels to control whether a message is sent at most once, at least once, or exactly once. This makes it possible to establish reliability rules for various kinds of messages related to mice information to be shared at various levels of reliability based on the use case.


HiveMQ ensures the secure transfer of device data with industry standards such as TLS, secure WebSockets, and state-of-the-art cipher suites. Support for authentication and authorization includes X.509 certs, username/password, IP-based authentication, and an API that allows for custom authentication, authorization, and permission logic, such as OAuth 2.0 integration. This ensures highly secure connections between sensors capturing the mice information and the applications on the cloud, like mice remote monitoring applications or mice prediction analytics applications. The HiveMQ Enterprise Security Extension (ESE) makes it easy to integrate third-party enterprise security systems into HiveMQ, including support for authentication and authorization using SQL databases, OAuth 2.0, and LDAP. 


HiveMQ scales with underlying mousetrap hardware. HiveMQ has benchmarked 200M concurrent connections while maintaining high-speed throughput and adding minimal latency. This is especially useful to ensure data is transferred quickly when mousetraps have limited data connectivity and bandwidth.

High-Availability Clustering 

HiveMQ is architected with a distributed and masterless cluster architecture, which means there is no single point of failure, and the cluster can grow and shrink at runtime without losing data or availability. Support for Kubernetes, OpenShift, and cloud platforms like Azure, AWS, and Google, makes it possible to automatically scale HiveMQ to high availability requirements of mousetrap applications while preventing disruptions.

Extension Framework

HiveMQ has an open API and flexible extension framework that enables integrating mice-related data into existing enterprise systems. The extension framework allows developers to quickly create extensions for custom data processing, device authentication, and device authorization mechanisms. HiveMQ also provides a marketplace of pre-built extensions for Kafka, MongoDB, and other systems.

Full Support of MQTT 5 

HiveMQ provides full support for MQTT 5, the most recent version of the MQTT protocol. MQTT 5 includes new features that make it easier to develop reliable systems and integrate the mice data into other systems.

HiveMQ is 100% compliant with all versions of the MQTT specification. MQTT 3 and MQTT 5 clients can communicate with HiveMQ simultaneously. All features, such as topic wildcards, persistent sessions with offline queuing, retained messages, and quality of service levels, are available at scale.

The Future of the Connected Mousetrap

Future enhancements for the connected mousetrap could include building out detailed digital twins of the mouse, and heatmaps of the city showing the mice population and distribution. This could include sophisticated analytics including predicting the failures of mousetraps so that they can be properly maintained as well as generative AI that enables homeowners and community workers to get answers about their mice problems. HiveMQ can support all of these use cases by providing consolidated, real-time, high-quality, secure, scalable, reliable, and contextualized data.   

Despite all of these advancements, the mice could mutate and be averse to all traps and other capture patterns. As a result, we will continue to evolve our technology to be able to support building a better mousetrap. To learn more about HiveMQ, download and try out software for free.

Try HiveMQ

Ravi Subramanyan

Ravi Subramanyan, Director of Industry Solutions, Manufacturing at HiveMQ, has extensive experience delivering high-quality products and services that have generated revenues and cost savings of over $10B for companies such as Motorola, GE, Bosch, and Weir. Ravi has successfully launched products, established branding, and created product advertisements and marketing campaigns for global and regional business teams.

  • Ravi Subramanyan on LinkedIn
  • Contact Ravi Subramanyan via e-mail
HiveMQ logo
Review HiveMQ on G2