"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:
Comments
Please log in or sign up to comment.