Project tutorial
Breathing Tests Measure

Breathing Tests Measure © GPL3+

Use to record somebody's blow strength. Since without calibration it is relative value.

  • 1,992 views
  • 0 comments
  • 1 respect

Components and supplies

Apps and online services

About this project

"Similarly to my other project. This is a Wi-Fi version and upload data to the Arduino Cloud."

By recording the amount of exhalation every day, we can observe the changes in our lung capacity.

System measurement method:

When the DC fan rotates, a voltage is generated. After bridge rectification, use capacitor storage, and calculate the electricity generated and convert it to the relative value of blowing volume.

Hardware:

Arduino MKR1000: with ATSAMW25 module it is very easy to connect to the cloud with security.

Sensor circuit: connect as below.

DC fan: use old PC cooling brush fan. If using BLDC follow this project to modify it.

Bridge rectifier: or use 4 diodes.

Capacitor: attention to voltage.

Resistor: don't select too small.

Software:

Arduino IDE

Arduino IOT cloud

CODE:

The AD value is measured 100 times per second. When AD is greater than the threshold (20), it is judged that there is blowing, and the AD value and time are accumulated. When AD gradually decreases and is less than the threshold value, calculate the total and average value. Then upload to the cloud.

void loop() {
ArduinoCloud.update();
// Your code here
delay(10);
ADread = analogRead(A0);
Serial.print(ADread);
Serial.print(",");
Serial.print(total_blow);
Serial.print(",");
Serial.print(blow_AVG);
Serial.print(",");
Serial.println(read_cnt);
if(ADread>20)
{
Blow_Flag = 1;
ADsum += ADread;
read_cnt++;

}
else if( ADread <= 20 && Blow_Flag == 1 && read_cnt>20)
{
total_blow = ADsum;
blow_AVG = ADsum / read_cnt;
Blow_Flag = 0;
read_cnt = 0;
ADsum = 0;
//Serial.println(total_blow);

}
else if( ADread < 20 )
{
Blow_Flag = 0;
read_cnt = 0;
ADsum = 0;
}

}

Result:


Code

Blow.inoArduino
Upload data to Arduino IoT Cloud
/* 
  Sketch generated by the Arduino IoT Cloud Thing "Blow_Strength_Record"
  https://create.arduino.cc/cloud/things/48864b4f-9d4c-4b83-8f13-587dcfd3b8cc 

  Arduino IoT Cloud Properties description

  The following variables are automatically generated and updated when changes are made to the Thing properties

  float total_blow;

  Properties which are marked as READ/WRITE in the Cloud Thing will also have functions
  which are called when their values are changed from the Dashboard.
  These functions are generated with the Thing and added at the end of this sketch.
*/
#include "arduino_secrets.h"
#include "thingProperties.h"

long ADsum,ADavg;
int ADread,read_cnt;
int Blow_Flag;

void setup() {
  // Initialize serial and wait for port to open:
  Serial.begin(115200);
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found
  delay(1500); 

  // Defined in thingProperties.h
  initProperties();

  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  
  /*
     The following function allows you to obtain more information
     related to the state of network and IoT Cloud connection and errors
     the higher number the more granular information youll get.
     The default is 0 (only errors).
     Maximum is 4
 */
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();
}

void loop() {
  ArduinoCloud.update();
  // Your code here 
  delay(10);
  ADread = analogRead(A0);
  Serial.print(ADread);
  Serial.print(",");
  Serial.print(total_blow);
  Serial.print(",");
  Serial.print(blow_AVG);
  Serial.print(",");
  Serial.println(read_cnt);
  if(ADread>20)
  {
    Blow_Flag = 1;
    ADsum += ADread;
    read_cnt++;

  }
  else if( ADread <= 20 && Blow_Flag == 1 && read_cnt>20)
  {
    total_blow = ADsum;
    blow_AVG = ADsum / read_cnt;
    Blow_Flag = 0;
    read_cnt = 0;
    ADsum = 0;
    //Serial.println(total_blow);

  }
  else if( ADread < 20 )
  {
    Blow_Flag = 0;
    read_cnt = 0;
    ADsum = 0;
  }
  
}

Schematics

Easy connect
P1 prru5mkt19

Comments

Similar projects you might like

Measure Heart Rate and SpO2 with MAX30102

Project tutorial by SurtrTech

  • 180,051 views
  • 58 comments
  • 256 respects

Alzheimer's Assistant

Project tutorial by Abdullah Muhammad Sadiq

  • 50,255 views
  • 22 comments
  • 147 respects

Measure your reaction time

Project tutorial by Jayraj Desai

  • 40,656 views
  • 12 comments
  • 41 respects

Measure Mains Frequency Using Arduino

Project tutorial by Neeraj Rane

  • 7,349 views
  • 0 comments
  • 4 respects
Add projectSign up / Login