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?
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.
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.
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()?