Today: December 5, 2024 12:15 am
A collection of Software and Cloud patterns with a focus on the Enterprise

The Architecture Behind MosquitoMax’s IoT Transformation

In May I delivered a session at Google Cloud Next 2024 showing the technology behind MosquitoMax’s journey from a legacy system to a modern, connected mosquito control solution. In this post I highlight the architecture, programming languages, cloud services, and key hardware components that came together to create a real-time, user-friendly experience. Most of the content here aligns with the recording of my presentation:

The Architecture’s Backbone:

The foundation of MosquitoMax’s new system is built around a Raspberry Pi Zero 2 W mounted on a custom Printed Circuit Board (PCB) that brings together a collection of sensors, relays, and other critical components. All these communicate with a cloud backend and integrate with Android and iOS native apps (and a web interface).

Hardware Components:

  • Sensors:
    • Pressure sensors (line in & line out): These monitor pressure in both the chemical solution and water lines. In the demos, you can see how these sensors are monitored in the app, alerting maintenance personnel if pressure drops below a certain threshold.
    • Vacuum sensor: This sensor tracks the vacuum in the chemical suction line, ensuring consistent and effective chemical delivery.
    • Electronic scale: The scale measures the amount of chemical solution used during a spray. This data is crucial for optimization and understanding consumption patterns.
  • Control:
    • Relays: These are responsible for switching valves and controlling the pump motor, ensuring that the correct chemical and water mixtures are delivered to the misting nozzles. In the demo, you can see the user triggering the spray and the relays responding to activate the valves and pump.
    • Analog to Digital Converter (ADC) and HX711: These components facilitate reading analog data from the sensors and converting it into a digital format that the Raspberry Pi can understand.
  • Raspberry Pi Zero 2 W: This miniature computer serves as the control center, handling data acquisition, processing, and relay activation. It runs a custom Python application, which interacts with the sensors, relays, and the cloud backend.

Programming Languages:

  • Python: The primary controller software, including a CLI, was written in Python. This manages sensor readings, controls relays, and communicates with the cloud.
  • Dart: The mobile app for customers is built with Flutter, a cross-platform framework that utilizes Dart for development. The app enables users to schedule sprays, view spray history, and manage their accounts.
  • JavaScript: Some of the Cloud Functions on Google Cloud are implemented in JavaScript, which allows the system to respond to events and automate actions triggered by the device or the app.
  • Bash: Bash scripting plays a role in automating aspects of device manufacturing and managing device maintenance.

Cloud Services:

  • Google Cloud Storage: Stores the system’s configuration data, spray history, and other relevant information. In the demo, you see how the app retrieves and displays past spray data from Google Cloud Storage.
  • Google Cloud Functions: Enable serverless execution of code in response to events. An example in the demo involves the device sending a notification to the app after a spray, triggering a Cloud Function to update the spray history in the database.
  • Google Cloud Run: Provides a managed environment for running the API, which handles communication between the device and the app. The demo shows the app making RESTful calls to the Cloud Run-hosted API to perform various actions, like initiating a spray or retrieving device status.
  • Firebase: The cloud backend uses Firebase for real-time database management, authentication, Firestore, and messaging. The demo shows the use of Firebase Realtime Database to store spray data and Firebase Authentication to secure access to the app.

Key Features in Action:

The demos showcase how these components work together to achieve the desired functionality:

  • Device Calibration: The calibration process involves the device sending data to the cloud backend through a RESTful call. This data is then analyzed to identify zero values for each sensor, ensuring accurate readings.
  • Device Registration: The user interface guides the user through the registration process. A Firebase-based authentication system ensures secure access for the user and the device.
  • Spray Scheduling: The app enables users to set fixed-time schedules or relative-time schedules (e.g., 15 minutes after sunrise). Weather data can be integrated to optimize spray timing for maximum effectiveness.
  • Spray History: The spray history is stored in the Firebase database, accessible by the user in the app. The user can view details about each spray, including the date, time, temperature, and amount of solution used.

Beyond the Demos:

  • Predictive Maintenance: Future development could incorporate AI and machine learning to analyze data patterns and predict potential issues, enabling proactive maintenance and minimizing downtime.
  • Geospatial Analysis: Integrating geospatial data could allow MosquitoMax to identify high-risk mosquito breeding areas and optimize spray schedules accordingly.

Conclusion:

This project showcases how a well-designed combination of hardware, software, and cloud services can transform a traditional business. By leveraging Google Cloud’s serverless platform, MosquitoMax created a connected, user-friendly system that improves customer experience, streamlines operations, and paves the way for further innovation in the future.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.