Sensitive air pressure sensor advice

Hi,

I need to measure the air pressure of a latex ballon that is more or less gently squashed by hand. I tried to use the Adafruit Square Force-Sensitive Resistor that I had access to but as you could expect it was not sensitive enough. What technique and/or sensor would be suitable?

Thankful for advice!

An air pressure sensor with an extended connection port should work.

1 Like

Thank you. I am also using an accelerometer on this object/project, sending the data serially to a computer.
Can I use both the accelerometer and the Barometric Pressure Sensor MPS20N0040D with the same microcontroller, or should I use two separate? The accelerometer is using "I2C interface". The Barometric Pressure Sensor is using two digital pins, as well stating "This module does not support I2C communication".

I just want to make sure before I order the MPS20N0040D. I have no experience of using I2C communication.

Code for accelerometer + serial communication

// Accelerometer till Pd för Blobb
// Merging sparkfun & serial to Pd code

#include "SparkFunLSM6DS3.h"
#include "Wire.h"
#include "SPI.h"

LSM6DS3 myIMU; //Default constructor is I2C, addr 0x6B

void setup() {
  
  int channel = 0;

// ska byta detta till accelXYZ, gyroXYZ och thermoCF
int analogPins[4] = {0, 1, 2, 3};

const int AnalogArrLen = sizeof(analogPins) / sizeof(analogPins[0]);

  Serial.begin(115200);
  
  //Serial.begin(9600);
  delay(1000); //relax...
  Serial.println("Processor came out of reset.\n");
  
  //Call .begin() to configure the IMU
  myIMU.begin();

}


void loop()
{
  
  
  //Get all parameters
  Serial.print("\nAccelerometer\n");
  Serial.print(" X ");
  Serial.println(myIMU.readFloatAccelX(), 4);
   Serial.print("\nAccelerometer\n");
  Serial.print(" Y ");
  Serial.println(myIMU.readFloatAccelY(), 4);
   Serial.print("\nAccelerometer\n");
  Serial.print(" Z ");
  Serial.println(myIMU.readFloatAccelZ(), 4);

  Serial.print("\nGyroscope\n");
  Serial.print(" X ");
  Serial.println(myIMU.readFloatGyroX(), 4);
  Serial.print("\nGyroscope\n");
  Serial.print(" Y ");
  Serial.println(myIMU.readFloatGyroY(), 4);
  Serial.print("\nGyroscope\n");
  Serial.print(" Z ");
  Serial.println(myIMU.readFloatGyroZ(), 4);

  Serial.print("\nThermometer\n");
  Serial.print(" C ");
  Serial.println(myIMU.readTempC(), 4);
  Serial.print("\nThermometer\n");
  Serial.print(" F ");
  Serial.println(myIMU.readTempF(), 4);

}

Code for Barometric Pressure Sensor

/*
  on Sep 21, 2020
  by MohammedDamirchi
  Home
*/

#include <Q2HX711.h>
#include <Average.h>

const byte MPS_OUT_pin = 2; // OUT data pin
const byte MPS_SCK_pin = 3; // clock data pin
int avg_size = 10; // #pts to average over

Q2HX711 MPS20N0040D(MPS_OUT_pin, MPS_SCK_pin); // start comm with the HX710B
Average<long> ave(avg_size);

void setup() {
  Serial.begin(9600); // start the serial port
}

void loop() {
  ave.push(MPS20N0040D.read());
  Serial.println(ave.mean());
}

One microcontroller can easily handle two sensors. I2C sensors and the air pressure sensor use completely independent sets of pins and channels for communication, but only one sensor can be read out at a time.

Oh, I would like to send both sensors' data with Serial.print() at the same time in loop(). Could I solve that or should I look for other sensors?

No problem. Use something like the following to print two headings and data values on the same line.

Serial.print("accel data: ");
Serial.print(ax);
Serial.print(", pressure: ");
Serial.println(p);

Forum members strongly recommend to start by studying and running the simple program examples included in the Arduino IDE before starting an ambitious project like this one.

File>Examples>(built in examples) ...

sorry, but what did you mean by this then?

Isn't it quite basic though, the first one is more or less MinimalistExample.ino from SparkFun_LSM6DS3_Arduino_Library? Then just merging two codes and outputting the added data with Serial.print()?

MCUs can do only one thing at a time. Read one sensor, read the other, and print the two readings. All using one program, of course.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.