

The MPS20N0040D-S is a piezoresistive pressure sensor manufactured by Sparkfun. It is designed to measure pressure in a variety of applications, providing an analog output that is proportional to the pressure applied. This sensor is known for its high accuracy, stability, and reliability, making it suitable for industrial, automotive, and consumer electronics applications.








Below are the key technical details of the MPS20N0040D-S pressure sensor:
| Parameter | Value |
|---|---|
| Pressure Range | 0 to 40 kPa |
| Supply Voltage (Vcc) | 5V DC |
| Output Voltage Range | 0.2V to 4.7V (analog output) |
| Accuracy | ±0.25% FS (Full Scale) |
| Operating Temperature | -40°C to +85°C |
| Response Time | ≤1 ms |
| Sensor Type | Piezoresistive |
| Dimensions | 18 mm x 18 mm x 8 mm |
The MPS20N0040D-S has a 4-pin interface. The pinout is as follows:
| Pin | Name | Description |
|---|---|---|
| 1 | Vcc | Power supply (5V DC) |
| 2 | GND | Ground |
| 3 | OUT+ | Positive analog output (pressure signal) |
| 4 | OUT- | Negative analog output (reference) |
Below is an example of how to connect and read data from the MPS20N0040D-S using an Arduino UNO:
// MPS20N0040D-S Pressure Sensor Example
// Reads the analog output from the sensor and converts it to pressure in kPa.
const int sensorPin = A0; // Analog pin connected to OUT+ of the sensor
const float maxVoltage = 5.0; // Arduino operating voltage
const float maxPressure = 40.0; // Maximum pressure in kPa
const float minVoltage = 0.2; // Minimum sensor output voltage
const float maxSensorVoltage = 4.7; // Maximum sensor output voltage
void setup() {
Serial.begin(9600); // Initialize serial communication
}
void loop() {
int sensorValue = analogRead(sensorPin); // Read the analog value (0-1023)
float voltage = (sensorValue / 1023.0) * maxVoltage; // Convert to voltage
// Map the voltage to pressure in kPa
float pressure = (voltage - minVoltage) * (maxPressure /
(maxSensorVoltage - minVoltage));
// Ensure pressure is within valid range
if (pressure < 0) pressure = 0;
// Print the pressure value to the Serial Monitor
Serial.print("Pressure: ");
Serial.print(pressure);
Serial.println(" kPa");
delay(500); // Wait for 500 ms before the next reading
}
No Output Signal:
Inaccurate Readings:
Output Voltage Stuck at Maximum or Minimum:
Q: Can this sensor measure negative pressure (vacuum)?
A: No, the MPS20N0040D-S is designed to measure positive pressure only, within the range of 0 to 40 kPa.
Q: Is the sensor waterproof?
A: No, the sensor is not waterproof. Avoid exposing it to liquids or high humidity environments.
Q: Can I use this sensor with a 3.3V microcontroller?
A: The sensor requires a 5V power supply for proper operation. If your microcontroller operates at 3.3V, you may need a level shifter for the output signal.
Q: How do I implement temperature compensation?
A: Use a temperature sensor to measure the ambient temperature and apply a correction factor to the pressure readings based on the sensor's temperature characteristics.
By following this documentation, you can effectively integrate the MPS20N0040D-S pressure sensor into your projects and achieve accurate pressure measurements.