Trying to read values from pressure transducer via ADS1115 chip [SOLVED]

Hello,

I am new to the forum so I apologize if I am incomplete in my problem statement.

I am currently trying to read values from a pressure sensor in real time. I have a pressure transducer, an ADS1115 chip, an I2C shield and an Arduino uno.

I followed the tutorial from ncd.io for the setup of the Arduino script. The url is listed below.

I copied that file and ran the script in the ide.

So here are where the problems begin....

According to the website, The raw analog values I am supposed to be seeing are 6430 for 4 ma and 32154 for 20 ma. I am not seeing those values at all. The attached png file shows what I am seeing on the serial monitor. Channel 0 immediately shows a real high analog value when the sensor is connected. The sensor is also attached to a power source.

I am honestly not sure what I am doing wrong here.

Additionally, when there is nothing plugged in to the current receiver the analog output for channel 0 is around 212.

ArduinoChannel1.PNG

The printouts in the png do not match the printout format of the example on the website. Please post the code you are running in tags in addition to a schematic

Power_Broker,

The script that I am using is shown below. It is similar to the one on the website I linked but I wanted to see all the channel outputs.

As for the schematic, I am not sure how to really draw it. I mean the Arduino is attached to the i2c shield. The i2c shield is attached to the current receiver (The ADS1115) and the current receiver has the output wire and the ground wire from the sensor. I can draw a crude graphical picture of the layout if that is alright.

The crude graphic is added as an attachment. I am sorry but I am not an electrical engineer by trade so schematics are not my strong suit.

Let me know if you need more information.

SketchForSensor.ino (1.6 KB)

I've not used the ADS1115 so I'll leave the code to others. I did notice A0 is at max for a a signed int 16 (aka int16_t)

For basic troubleshooting you might disconnect the inputs to the ADS1115 and ground A0. It should read 0 or a very low number. If not you should work with the code and the ADS1115 board. If it is OK then add piece by piece until you find something that is not working the way you think.

Do you have a multimeter? If not you should get one. Even a cheap one will help you in these cases. You could measure the voltage at A0 and see what it is.

In general its helpful to build your system piece by piece testing at each stage. It makes getting your project going easier and can save a few damages parts along the way.

John

The ADS1115 is an absolute/voltage A/D, and can't measure currents directly.
You need a resistor of specific value to first convert current to voltage.
And some more parts to protect the input of the ADS.

In your post I didn't see any links to parts, circuit diagram, pictures, or correctly posted code.
If you don't post according to the forum guidelines it's unlikely that you will end up with a proper answer.
Go read them. They are on top of every main page.
Leo..

Wawa,

The parts I purchased were from the url on my initial post. I purchased the current loop receiver and i2c shield from there. The code was also added as an attachment but I can post it again in the tags. The diagram is also an attachment as well. Like i said before I am not an electrical engineer by trade so I am not the best with circuit diagrams.

#include <Wire.h>

#include <ADS1115.h>

ADS1115 ads;

void setup(void)
{
  Serial.begin(9600);

  ads.getAddr_ADS1115(ADS1115_DEFAULT_ADDRESS); 

  //ads.getAddr_ADS1115(ADS1115_VDD_ADDRESS); 

  ads.setGain(GAIN_TWO);

  ads.setMode(MODE_CONTIN); 

  ads.setRate(RATE_128);

  ads.setOSMode(OSMODE_SINGLE);

  ads.begin();
  
}

void loop(void)
{
  byte error;
  int8_t address;

  address = ads.ads_i2cAddress;

  Wire.beginTransmission(address);
  error = Wire.endTransmission();

  if (error == 0)
  {
    int16_t adc0, adc1, adc2, adc3;

    //Serial.println("Getting Single-Ended Readings from AINO..3");
    //Serial.println(" ");
    //adc0 = ads.Measure_SingleEnded(0);
    //Serial.print("Digital value of Analog input: "); 
   // Serial.println(adc0);
    //float mACurrent= adc0 * .000628;
    //Serial.print("Current Loop input: ");
    //Serial.println(mACurrent,3); 

    
    adc0 = ads.Measure_SingleEnded(0);
    
    
    adc1 = ads.Measure_SingleEnded(1);
    
    
    adc2 = ads.Measure_SingleEnded(2);
    
    
     adc3 = ads.Measure_SingleEnded(3);
    
    
    Serial.print("AIN0: "); Serial.println(adc0);
    
    
    Serial.print("AIN1: "); Serial.println(adc1);
    
    
    Serial.print("AIN2: "); Serial.println(adc2);
    
    
    Serial.print("AIN3: "); Serial.println(adc3);
    
    
    Serial.println(" ");

    
  }

  else
  {
    Serial.println("ADS1115 Disconnected!");
    Serial.println(" ");
    Serial.println("        ************        ");
    Serial.println(" ");

  }

  delay(1000); 
}

This is basically the same code as the one on the url on the first post. I just cut off some of the extra lines to test the channel outputs.

Here is the url for the current receiver

Here is the url for the i2c shield

I have attached the graphic of the physical layout of the system in the attachments.

Let me know if you need anything else.

Sincerely,

Jon

Posting guidelines tell you to post code inline, so people with phones/tablets can also see it.
The code, with all white-speces removed.

#include <Wire.h>
#include <ADS1115.h>
ADS1115 ads;

void setup(void) {
  Serial.begin(9600);
  ads.getAddr_ADS1115(ADS1115_DEFAULT_ADDRESS); //ads.getAddr_ADS1115(ADS1115_VDD_ADDRESS);
  ads.setGain(GAIN_TWO);
  ads.setMode(MODE_CONTIN);
  ads.setRate(RATE_128);
  ads.setOSMode(OSMODE_SINGLE);
  ads.begin();
}

void loop(void) {
  byte error;
  int8_t address;
  address = ads.ads_i2cAddress;
  Wire.beginTransmission(address);
  error = Wire.endTransmission();
  if (error == 0)
  {
    int16_t adc0, adc1, adc2, adc3;
    //Serial.println("Getting Single-Ended Readings from AINO..3");
    //Serial.println(" ");
    //adc0 = ads.Measure_SingleEnded(0);
    //Serial.print("Digital value of Analog input: ");
    // Serial.println(adc0);
    //float mACurrent= adc0 * .000628;
    //Serial.print("Current Loop input: ");
    //Serial.println(mACurrent,3);
    adc0 = ads.Measure_SingleEnded(0);
    adc1 = ads.Measure_SingleEnded(1);
    adc2 = ads.Measure_SingleEnded(2);
    adc3 = ads.Measure_SingleEnded(3);
    Serial.print("AIN0: "); Serial.println(adc0);
    Serial.print("AIN1: "); Serial.println(adc1);
    Serial.print("AIN2: "); Serial.println(adc2);
    Serial.print("AIN3: "); Serial.println(adc3);
    Serial.println(" ");
  }

  else
  {
    Serial.println("ADS1115 Disconnected!");
    Serial.println(" ");
    Serial.println("        ************        ");
    Serial.println(" ");
  }
  delay(1000);
}

So where is the link to the pressure sensor,
and a clear picture of the setup/wiring.
Leo..

I am currently trying to read values from a pressure sensor

WHICH (of hundreds) pressure sensor?

JCA34F,

The pressure sensor is a TD1000 from transducers direct.

http://www.transducersdirect.com/products/pressure-transducers/td1000-pressure-transducer/

Wawa,

Here are pictures of the setup. They are in the attachments.

20190929_133705 (2).jpg

20190929_133726.jpg

What voltage do you read at the current receiver board input (IN and GND pins)?

Many types of sensors on that page, I guess (bad) that you actually have the 4-20mA version.
And I still have to guess from the blurry pictures how you have connected this.
Where did you get the information for the sensor wires (colours). Can't find it on that useless website.

Good idea to measure the voltage between INPUT/GND of the ADS module.
Should be about 0.4volt without pressure.
Leo..

Wawa,

Sorry about the pictures. I was trying to resize them so that I could share them with you. I will resend the physical setup picture as soon as I can.

The way the wires are setup is as follows.

The white wire is the 4-20 ma output, the blue wire was labeled NC on the transducer. The black wire is power and brown is the other NC wire which I assume means ground.

I don't have a multimeter. Is it not possible to read values with the Wire library?

If you need anything else, let me know.

Jon12453:
The white wire is the 4-20 ma output, the blue wire was labeled NC on the transducer. The black wire is power and brown is the other NC wire which I assume means ground.

Sensors with a 4-20mA current output normally only use two wires.
One for power and one to the receiver input.
Sensor power ground normally only goes to ground of the receiver.
Better email the shop that you got the wire harnass from, and ask them for clarification.

Put a $20.00 DMM on your Christmas wishlist.
Leo..

Wawa,

Thank you for the responses. You might be right in that I needed to find a cable that has only two wires. I am going to do some more research into this. If I find out anything else, I will let you know. I am also going to put in an order for a multimeter.

Sincerely,

Jon

"NC" probably means "NoConnection".
The spare wires in that harnass are likely for sensors with a voltage output (need three wires for that).
Just leave the NC labled wires unconnected.

I would make sure before connecting things like that.
Don't know how well the sensor and that ADS board are protected against wiring mistakes.
Leo..

Wawa, JCA34F, and JohnRob

I have a couple of questions after doing some additional research.

So i was looking at the ADS1115 specs and saw that it has an onboard 16v supply. Would i connect the power wire there? If so, i am not seeing an obvious place to put the supply voltage wire.

I also managed to get a multimeter at work. With nothing connected and chip powered on the pins are reading 16v on ads1115. I dont think that should be happening.

There was a poster who suggested grounding A0 for basic troubleshooting. When I try to ground A0 (I am assuming this is the "IN" pin at the front of the board next to ground). The analog values skyrocket.

Does this mean i fried A0?

Sincerely,

Jon

Didn't that module come with instructions.
It seems that that module already has a sensor supply buildin.
If so, then you just have to connect the two wires of the sensor (power and output) directly to the module.
Nothing else needed, no external supply.

Labling is confusing/backwards. IN seems to be power out (in for the sensor), and GND seems to be input for the ADS1115 (ground/return for the sensor).

The resources tab for this module links to a Github page with a different module.
Not helpful either.
Leo..

Wawa,

You were right

I found the problem. It was the wiring. The supply wire goes into the in terminal and output goes to ground.

Thanks for your help!

I am going to close the problem now.