element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Summer of Sensors Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Summer of Sensors Design Challenge
  • More
  • Cancel
Summer of Sensors Design Challenge
Blog Summer of Sensors Design Challenge - In The Air Tonight – Blog #5 (System Integration)
  • Blog
  • Forum
  • Documents
  • Design Challenge
  • Leaderboard
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Summer of Sensors Design Challenge to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: abhayrjoshi
  • Date Created: 12 Nov 2022 10:10 AM Date Created
  • Views 321 views
  • Likes 5 likes
  • Comments 0 comments
  • zmod4510
  • Summer of Sensors Design Challenge
  • renesas
  • In the Air Tonight
Related
Recommended

Summer of Sensors Design Challenge - In The Air Tonight – Blog #5 (System Integration)

abhayrjoshi
abhayrjoshi
12 Nov 2022

Challenger - ZMOD4510 - Outdoor Air Quality Sensor

Hello element14 Family,

Subsequently, I started combining the data from the various sensors viz. Temperature & Humidity, Microphone & Outdoor Air Quality Sensor.

The Feather M0's inbuilt LiPo charger was one of the main factors in my first decision to work with it. To appropriately recharge the LiPo battery, we need to know what voltage it is at. The LiPoly batteries are typically "maxed out" at 4.2V, hover about 3.7V for much of their lifespan, and then gradually drop to about 3.2V before the protective circuitry shuts them off. The board's double-100K resistor divider linked to D9 (also known as analog #7 A7) on the BAT pin makes it simple for us to monitor the voltage. To get the voltage of the battery, we just need to read the voltage of this pin and multiply it by two.

/* Read Battery Level */
/* Ref: https://learn.adafruit.com/adafruit-feather-m0-adalogger/power-management */
#define VBATPIN             A7

void loop() {
  
    /* Report Battery Level */
    float measuredvbat = analogRead(VBATPIN);
    measuredvbat *= 2;    // we divided by 2, so multiply back
    measuredvbat *= 3.3;  // Multiply by 3.3V, our reference voltage
    measuredvbat /= 1024; // convert to voltage

    Serial.print(F("VBat = "));
    Serial.print(measuredvbat);

    /* Issue A Low Battery Warning */
    if(measuredvbat < 3.7)
    {
        Serial.println(F("CHARGE BATTERY NOW!"));
    }
}

By creating an object of the Si7021 sensor and calling the appropriate methods, it is simple to carry out the algorithmic compensation for temperature and humidity for the ZMOD4510 OAQ 2nd Gen algorithm.

/* Includes For Si7021 Temperature & Humidity Sensor */
#include "Adafruit_Si7021.h"

/* Temperature & Humidity Sensor */
Adafruit_Si7021 sensor = Adafruit_Si7021();

void loop {

    /*
 * The ambient compensation needs humidity [RH] and temperature [DegC]
    * measurements! Input them here.
  */
    algorithm_input.humidity_percentage = sensor.readHumidity();
    algorithm_input.temperature_degc = sensor.readTemperature();
}

Moving on, I used the Adafruit instructions to measure the sound level, although the output is in volts, which is difficult to comprehend. Upon a quick search through the forums, I stumbled across an old thread which tried to convert the obtained volts into decibels (dB). Prior to running the code, I had to take care to set the little potentiometer to gain 25x (totally clockwise - and give up when you encounter even the tiniest resistance).

image

/* Read Microphone Level */
/* Ref: https://learn.adafruit.com/adafruit-microphone-amplifier-breakout/measuring-sound-levels */
#define MICROPHONE_PIN      A5

/* Variables Specific To Electret Microphone */
const int sampleWindow = 50;   // Sample window width in mS (50 mS = 20Hz)
unsigned int sample;

void loop() {
  
unsigned long startMillis= millis();  // Start of sample window
    unsigned int peakToPeak = 0;      // peak-to-peak level
    
    unsigned int signalMax = 0;
    unsigned int signalMin = 1024;
    
    /* Collect Data For 50 ms */
    while (millis() - startMillis < sampleWindow) {
    
        sample = analogRead(MICROPHONE_PIN);
              
        if (sample < 1024) {
              if (sample > signalMax)  {
                  signalMax = sample;  // save just the max levels
              }
              else if (sample < signalMin) {
                  signalMin = sample;  // save just the min levels
              }
          }
    }

    /* Ref: https://forums.adafruit.com/viewtopic.php?f=8&t=100462&p=503661 */
    peakToPeak = signalMax - signalMin;  // max - min = peak-peak amplitude
    double volts = ((peakToPeak * 3.3) / 1024) * 0.707;  // convert to RMS voltage
    double first = log10(volts/0.00631)*20;
    double decibels = first + 94 - 44 - 25;
    
    Serial.print(F("Noise:"));
    Serial.print(decibels);
}

After confirming the findings using the serial console, I eventually put everything in the box together, plugged the microphone into the case's slot, and added the prints that would be shown on the OLED display.

And now it's time for some staging,

Welcome Splash Screen:

image

Well, what is In The Air Tonight? 

image

The resting console display with all the sensor parameters shown (ZMOD4510 is warming up...):

image

After a couple of minutes, the ZMOD4510 warm up is complete!

image

and to test that the microphone is capturing the noise well (and the dB conversions actually work), I verified it with some typical apps from the Play Store and the values obtained were quite satisfactory. 

and of course, the low battery warning as well!

image

To test the sound capture further, I decided to exclaim a "Hurrah!", and well - it shows up on the screen! :)

image

I added the case a key ring so that it may also be worn fastened to a backpack or any other alternative options. Also, the BLE and the LoRa options for the main board are also shown in the images as an alternative to the WiFi module that I had used. For the next steps, I will explore the options to connect it to a dashboard and visualize the historical data - and further personalized advice can also be integrated thereafter based on the exposure levels.

Next Blog Series: Summer of Sensors Design Challenge - In The Air Tonight – Blog #6 (Platform Connectivity)

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube