• 1
    Prerequisites

    We have picked the M5Stack Air Quality Kit based on the PMSA003 Digital laser dust sensor for this application. The M5Stack ecosystem is based on the ESP32 SoC and is beautifully integrated with a big enough screen for a User Interface.

    • Install M5Burner according to your OS.
    M5Burner
    • Install Thonny following the steps on the official website.
    Thonny Python IDE
  • 2
    Setting up the device
    • Connect the M5Stack kit to your PC using the provided USB Type-C cable.
    • Launch M5Burner, download the UIFlow(CORE). Click the Erase button, wait for it to finish, and then press the Burn button to upload the UIFlow(CORE) firmware on the device. We have used 1.8.1_en. You will be prompted for the WiFi details that the device will use to connect to your local network. If the burn fails, change the baud rate to a lower one.

    On Linux, make sure your user is part of the dialout group by running:

    sudo adduser $USER dialout
    M5Burner interface
    • The device will be programmed and you will be greeted by a series of screens showcasing the available features.
    • All is well. Now let's set up the cloud solution!
  • 3
    Setting up the cloud solution

    Register on Waylay IO if you have not already and log in.

    • Go to Resources and add a resource. Name it something like AirQuality. This resource is practically your device representation in the cloud where you will send the data.
    • Add a new property with the customerkey and the Zalmotekvalue.
    • Add another property with the tagskey and the [ "AirQualityMonitor" ]value.
    Creating a resource on Waylay IO
    • Go to Webscripts in the left main menu and add a new one. Name it something like AirQualityIngestion and add the following details in the body:
      async function handleRequest (req, res) {
        if (!req.body) {
          // No body found
          return
        }
      
        // Parse body if needed
        let payload = req.body
        if (typeof payload === 'string' || payload instanceof String)
          payload = JSON.parse(payload)
      
        /*
        You can do some processing of the payload over here.
        */
      
        // Post values to our resource
        waylay.data.baseUrl = 'https://data-io.waylay.io'
        await waylay.data.postSeries('replace_with_resource_id', payload, { store: true, forward: true })
          .catch(e => console.error(e.message))
      
        res.sendStatus(200)
      }

     Be sure to replace thereplace_with_resource_id placeholder with the actual resource_id from the above step. Navigate to the resource page to get it. Ours is something like 453472c9-8553-4b12-b24f-fc6e052e8255. Press Save once you have pasted the correct details.