Serial monitor not printing

Hey everyone, I'm making a system to measure pressure using an Arduino Giga R1, a breadboard, an ADS1115 amplifier, and a PendoTech Single-Use Pressure Sensor. I've hooked up things as follows (and I've also attached a photo below):

Arduino 3V3 → breadboard + rail
Arduino GND → breadboard – rail
ADS1115 VDD → 3.3 V rail
ADS1115 GND → GND rail
ADS1115 SDA → Arduino SDA
ADS1115 SCL → Arduino SCL
Sensor red (V+) → 3.3 V rail
Sensor black (GND) → GND rail
Sensor green (signal +) → ADS1115 A0
Sensor white (signal –) → ADS1115 A1

Here's my code below. I haven't been able to test it yet to determine whether it's correct because the Serial Monitor isn't printing anything out. I've tried test print lines, restarting the board and the Arduino IDE, and other programs are running just fine.

#include <Wire.h>
#include <Adafruit_ADS1X15.h>

Adafruit_ADS1115 ads;

const int samples = 50;
const float AMP_GAIN = 1.0;
const float SENSOR_V_PER_PSI = 0.0008527;
const float ADS_FS_V = 0.256;

int iteration = 0;
float zeroOffset = 0;

void setup() {
  Serial.begin(115200);
  Wire.begin();
  Serial.println("starting");

  ads.setGain(GAIN_SIXTEEN);
  ads.begin();

  delay(5000);

  long sum = 0;
  for (int i = 0; i < samples; i++) {
    sum += ads.readADC_Differential_0_1();
  }
  zeroOffset = sum / (float)samples;

  Serial.print("zeroOffset: ");
  Serial.println(zeroOffset, 4);
}

void loop() {
  iteration++;

  long sum = 0;
  for (int i = 0; i < samples; i++) {
    sum += ads.readADC_Differential_0_1();
  }
  float rawAvg = sum / (float)samples;

  float volts =
    (rawAvg - zeroOffset) * (ADS_FS_V / 32768.0);

  float pressure_psi =
    volts / (SENSOR_V_PER_PSI * AMP_GAIN);

  Serial.print("iteration: ");
  Serial.print(iteration);
  Serial.print(" | zeroOffset: ");
  Serial.print(zeroOffset, 4);
  Serial.print(" | rawAvg: ");
  Serial.print(rawAvg, 4);
  Serial.print(" | volts: ");
  Serial.print(volts, 6);
  Serial.print(" | pressure_psi: ");
  Serial.println(pressure_psi, 4);

  delay(200);
}

Has anyone had a similar problem or would be able to help me out? Thanks so much.

Welcome to the forum

What baud rate have you got the Serial monitor set to ?

I have the Serial Monitor at 115200.

Add a delay(1000); after the begin. Also click the serial monitor button top right a time or two.

try adding a while (!Serial) {;} after the begin

Tried adding this and clicked the button a few times. I don't think it made much of a difference.

Just tried this. Now, it prints the "starting" line, but it doesn't print anything later on in the code.

Now it's a new problem

I see. Thank you for the earlier suggestion - I'm glad the "starting" line works now. However, even if the measurements aren't registering properly, some print lines like "iteration," "zeroOffset," and "rawAvg" should still print fine. Would anyone have a potential fix?

Now it's printing, try a print before/after every line of code in setup and loop until you narrow it down

Your topic does not indicate an upload problem and therefore has been moved to a more suitable category of the forum.

You are not looking for a "fix." You are looking for the cause.

I suspect the ADC is not working, and when this function (above) is called 50 times, the program waits... and if nothing arrives, the program does not proceed, and nothing is printed.

Verify your hardware is connected correctly, especially a SHARED GROUND for all devices.

SOLDER. THE. HEADER. PINS.

You're just wasting your time until you do that. And potentially damaging the sensor.

6 Likes

How do I give five hearts? (@van_der_decken )

awesome spot @van_der_decken .

Sadly, it's the first thing I look for now.

3 Likes

Hey everyone, thanks for the suggestions. I used some print lines and you were right, it was the first "ads.readADC_Differential_0_1()" that caused problems. I went ahead and sautéed the amplifier to the pins, but that doesn't seem to have addressed the issue - seems like it might be something deeper with not detecting the ads.

Post a closeup picture of your soldered pins

Your soldering is indicative of cold solder joints, which do not connect board to wire. Add flux, then add more heat to reflow the solder. See the example...

1 Like