I have made a circuit for a pressure sensor, wherein I have connected an MPX5700 pressure sensor output to the A0 pin of an ADS1115 ADC, which is connected through an I2C interface to an Arduino Nano.
I used a device scanner code to see if the Nano could detect the ADS1115, which gave an output as detecting the ADS1115. But on trying to read the raw data output from the ADS1115 on the serial monitor, it gives 0.
I checked my connection, tried changing pins, and gave A3 pin a constant voltage of 2.5 V other than the sensor voltage output, but to no avail. The voltage is 5 V, and has not dripped at any needed point (so no scope of error thus). I have attached the schematic and a picture of my connections. Can you give me suggestions on what to do?
#include <Wire.h>
#include <ADS1115_WE.h>
// Initialize the ADS1115 at address 0x48
ADS1115_WE ads(0x48); // Create an instance of the ADS1115
void setup() {
Serial.begin(9600); // Initialize the serial communication at 9600 baud rate
Wire.begin();
Wire.setClock(100000);
delay(500); // Delay to allow serial communication to initialize
Serial.println("Initializing ADS1115...");
delay(500); // Delay to allow serial communication to initialize
// Initialize the ADS1115
if (!ads.init()) {
Serial.println("Failed to initialize ADS1115.");
while (1); // Halt the program if initialization fails
} else {
Serial.println("ADS1115 initialized successfully.");
}
// Configure ADS1115 settings
ads.setVoltageRange_mV(ADS1115_RANGE_4096); // Set voltage range to +/- 2.048V
ads.setMeasureMode(ADS1115_SINGLE); // Set single-ended measurement mode
ads.setCompareChannels(ADS1115_COMP_3_GND); // Compare A0 to GND
}
void loop() {
// Read the analog value from the ADS1115 (connected to A0)
int16_t adc0 = ads.getRawResult(); // Get raw ADC result
Serial.print("ADC Value: ");
Serial.print("Bits: ");
for (int i = 15; i >= 0; i--) {
Serial.print(bitRead(adc0, i));
}
Serial.println();
// Wait for a moment before the next reading
delay(5000);
}