convert signal from ads1015 to a pressure reading

I'm having a little trouble getting the value converted correctly to a pressure reading.

I have a 4-20mA signal coming in as a 1-5v signal. at 1v its 330count and 5v its 1632 count

I have tried to get the reading two differetn ways below but can't seem to get it right.

Also after I get the value I'm also trying to round to nearest whole number which I dont even know where to begin

#include <Wire.h>
#include <Adafruit_ADS1015.h>

// Adafruit_ADS1115 ads;  /* Use this for the 16-bit version */
Adafruit_ADS1015 ads;     /* Use thi for the 12-bit version */

void setup(void) 
{
  Serial.begin(9600);
  Serial.println("Hello!");
  
  Serial.println("Getting single-ended readings from AIN0..3");
  Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)");
  
  // The ADC input range (or gain) can be changed via the following
  // functions, but be careful never to exceed VDD +0.3V max, or to
  // exceed the upper and lower limits if you adjust the input range!
  // Setting these values incorrectly may destroy your ADC!
  //                                                                ADS1015  ADS1115
  //                                                                -------  -------
  // ads.setGain(GAIN_TWOTHIRDS);  // 2/3x gain +/- 6.144V  1 bit = 3mV      0.1875mV (default)
  // ads.setGain(GAIN_ONE);        // 1x gain   +/- 4.096V  1 bit = 2mV      0.125mV
  // ads.setGain(GAIN_TWO);        // 2x gain   +/- 2.048V  1 bit = 1mV      0.0625mV
  // ads.setGain(GAIN_FOUR);       // 4x gain   +/- 1.024V  1 bit = 0.5mV    0.03125mV
  // ads.setGain(GAIN_EIGHT);      // 8x gain   +/- 0.512V  1 bit = 0.25mV   0.015625mV
  // ads.setGain(GAIN_SIXTEEN);    // 16x gain  +/- 0.256V  1 bit = 0.125mV  0.0078125mV
  
  ads.begin();
}

void loop(void) 
{
  int16_t adc0, adc1, adc2, adc3;
   int16_t pressure1;
    float pressure2;
    //float pressure1 = 0.0;
    float voltage1 = 0.0;

  adc0 = ads.readADC_SingleEnded(0);
  adc1 = ads.readADC_SingleEnded(1);
  adc2 = ads.readADC_SingleEnded(2);
  adc3 = ads.readADC_SingleEnded(3);

  
  voltage1 = adc0 * .003;
  pressure1 = map(adc0, 333, 1584, 0, 5000); //The 331 value of sensor is around 0psi
  pressure2 =(adc0 - 333)*5000/(1580-333);

     Serial.print("AIN0: "); 
  Serial.print(adc0);
  Serial.print("\tvoltage1: ");
  Serial.println(voltage1, 7);  
  Serial.print("\tpressure1: ");
  Serial.println(pressure1, 7);
    Serial.print("\tpressure2: ");
  Serial.println(pressure2, 7);   
  Serial.println();

  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(" ");
  
  delay(1000);
}

Thanks,

You say you don't get it right but forgot to mention:

  • what output you consider it should be "right"
  • what output do you get instead - the "not right" one

Sorry I forgot to add the results

at 4mA I get this

AIN0: 330 voltage1: 0.9900000
pressure1: 211301422340
pressure2: -12.0000000

AIN0: 330 voltage1: 0.9900000
pressure1: 211301422340
pressure2: -12.0000000

AIN0: 330 voltage1: 0.9900000
pressure1: 211301422340
pressure2: -12.0000000

at 10mA I get this

AIN0: 831 voltage1: 2.4930000
pressure1: 5542
pressure2: 0.0000000

AIN0: 831 voltage1: 2.4930000
pressure1: 5542
pressure2: 0.0000000

AIN0: 831 voltage1: 2.4930000
pressure1: 5542
pressure2: 0.0000000

at 20mA I get this

AIN0: 1633 voltage1: 4.8990001
pressure1: 21101
pressure2: 9.0000000

AIN0: 1633 voltage1: 4.8990001
pressure1: 21101
pressure2: 9.0000000

AIN0: 1633 voltage1: 4.8990001
pressure1: 21101
pressure2: 9.0000000

To me the counts and voltage look correct. I'm just having issues converting that into a pressure.

I dont even know if I'm using the correct scale as I have gotten turned around a bit with the ads1015.

I used 2045 because I loose one byte since its a single ended reading and that 2045 as i understand it corresponds to 6.144v

again just trying to see what I'm doing wrong

I think if I get it setup right 4mA will read 0psi and 20mA will read 5000psi

Thanks,

Try to put a decimal zero in those constant values to make sure compiler uses floating point in map() macro.

e.g. use 0.0 and 333.0 instead of 0 or 333

PS sorry, it seems map is a function that wants integer. But you use the same formula for pressure2.

Int16_t is a 16bit integer, that's -32k to 32k, 600 * 5000 it's out of that range. Use floating point constants in the equation to make sure compiler does the right conversions.

I believe the following statement will cause problems if adc0 is less than 333 or greater than 1584
try range-limiting the object

pressure1 = map(adc0, 333, 1584, 0, 5000);

Yeah, the first result of map returns negative (330 smaller than 333 used as minimum limit)

I checked int16_t and it seems it is 16 bit unsigned int 0-65535 range, That explains the weird first 200milion result.

Use simple "long" for pressure1 if you want to use map function, or float numbers in your formula (pressure2) if you want decimals.

could you please show me an example of simple long as well as floating point?

or possibly a link or a good search topic.

Trying to understand it but still need a little more help

I'm still learning not only how to get the data but also how to convert it so it compiles correctly in the code.

I have a long way to go

Thanks for all the help thus far

if I try to add

float adc0 = 0.0:

it conflicts with adc0 = ads.readADC_SingleEnded(0);

Is adc0 what I'm trying to turn into a float value for the equation to work?

Again new to this

Thanks,

Modify only two lines:

...
int16_t pressure1;
...
pressure2 =(adc0 - 333)*5000/(1580-333); //The 331 value of sensor is around 0psi
// ??? then why use 333 instead of 331? 
....

Use:

...
long  pressure1;
...
pressure2 =(adc0 - 331.0)*5000.0/(1580.0-331.0);
....

You need also to read about variable types and casting e.g. Arduino Reference - Arduino Reference to understand why your code failed.

pseudo code using your numbers:

Zero = 330
Max  = 1632 // if this is the adc count a 20 mA why are you using 1584?
Span = 1302

if Input < Zero
  Input = Zero
  
if Input > Max
  Input = Max
  
pressure = map(Input,Zero,Max,0,5000)


This gives reasonable results 
Input = 330 gives 0
Input = 981 gives 2500 (Zero + 50%Span)
Input = 1632 gives 5000

If your numbers are correct your results should be accurate.

Ok So I got the pressure2 to work but not the pressure1 using your code

#include <Wire.h>
#include <Adafruit_ADS1015.h>

// Adafruit_ADS1115 ads;  /* Use this for the 16-bit version */
Adafruit_ADS1015 ads;     /* Use thi for the 12-bit version */

void setup(void) 
{
  Serial.begin(9600);
  Serial.println("Hello!");
  
  Serial.println("Getting single-ended readings from AIN0..3");
  Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)");
  
  // The ADC input range (or gain) can be changed via the following
  // functions, but be careful never to exceed VDD +0.3V max, or to
  // exceed the upper and lower limits if you adjust the input range!
  // Setting these values incorrectly may destroy your ADC!
  //                                                                ADS1015  ADS1115
  //                                                                -------  -------
  // ads.setGain(GAIN_TWOTHIRDS);  // 2/3x gain +/- 6.144V  1 bit = 3mV      0.1875mV (default)
  // ads.setGain(GAIN_ONE);        // 1x gain   +/- 4.096V  1 bit = 2mV      0.125mV
  // ads.setGain(GAIN_TWO);        // 2x gain   +/- 2.048V  1 bit = 1mV      0.0625mV
  // ads.setGain(GAIN_FOUR);       // 4x gain   +/- 1.024V  1 bit = 0.5mV    0.03125mV
  // ads.setGain(GAIN_EIGHT);      // 8x gain   +/- 0.512V  1 bit = 0.25mV   0.015625mV
  // ads.setGain(GAIN_SIXTEEN);    // 16x gain  +/- 0.256V  1 bit = 0.125mV  0.0078125mV
  
  ads.begin();
}

void loop(void) 
{
  int16_t adc0, adc1, adc2, adc3;
   long pressure1;
    float pressure2;
    //float pressure1 = 0.0;
    float voltage1 = 0.0;
    

  adc0 = ads.readADC_SingleEnded(0);
  adc1 = ads.readADC_SingleEnded(1);
  adc2 = ads.readADC_SingleEnded(2);
  adc3 = ads.readADC_SingleEnded(3);

  
  voltage1 = adc0 * .003;
  pressure1 = map(adc0, 328, 1627, 0, 5000); //The 328 value of sensor is around 0psi
  pressure2 =(adc0 - 328.0)*5000/(1627.0-328.0);

     Serial.print("AIN0: "); 
  Serial.print(adc0);
  Serial.print("\tvoltage1: ");
  Serial.println(voltage1, 7);  
  Serial.print("\tpressure1: ");
  Serial.println(pressure1, 7);
    Serial.print("\tpressure2: ");
  Serial.println(pressure2, 7);   
  Serial.println();

  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(" ");
  
  delay(1000);
}

At 4mA I get

AIN0: 328 voltage1: 0.9840001
pressure1: 0
pressure2: 0.0000000

AIN0: 328
AIN1: 4093
AIN2: 4035
AIN3: 4088

AIN0: 328 voltage1: 0.9840001
pressure1: 0
pressure2: 0.0000000

AIN0: 328
AIN1: 4093
AIN2: 4035
AIN3: 4088

At 10mA I get

AIN0: 828 voltage1: 2.4839999
pressure1: 5416
pressure2: 1924.5573730

AIN0: 828
AIN1: 4092
AIN2: 4047
AIN3: 4088

AIN0: 827 voltage1: 2.4809999
pressure1: 5412
pressure2: 1920.7082519

AIN0: 827
AIN1: 4092
AIN2: 4047
AIN3: 4087

At 20Ma I get

AIN0: 1628 voltage1: 4.8839998
pressure1: 20405
pressure2: 5003.8491210

AIN0: 1628
AIN1: 4092
AIN2: 4049
AIN3: 4086

AIN0: 1628 voltage1: 4.8839998
pressure1: 20405
pressure2: 5003.8491210

AIN0: 1628
AIN1: 4092
AIN2: 4048
AIN3: 4087

I can use pressure2 just curious why pressure1 is so far off?

With pressure1 what is the best way to change that number to nearest whole number?

could I just use cast

int i;
float f:

f = pressure2;
i = (int) f;

Is that how I can convert the value to a whole number?

Also what is a good way to average the results? So I can take for example 10 reads and average them?

Thanks for the help

I don't know why the map function is not working for you. It works for me when I try it.

Here is a little program you can run that compares the map function with another method using floats.

Be sure to set (lower right corner) the serial monitor to send a Newline.

To round your float to an integer just add 0.5 and store in a integer variable.

intVar = floatVar + 0.5

/*
 *   *** configure the serial monitor to send a newline ***
 */

// adc stuff
uint16_t Zero = 328;  // 4mA
uint16_t Max  = 1627; // 20mA 
//uint16_t Span = 1299; // Max - Zero
uint16_t Span = Max - Zero;
uint16_t Input;
uint16_t P1;
float P2;

void setup() 
{
  Serial.begin(9600);
  Serial.println(__FILE__);
  
  Serial.print("Enter an integer number between ");
  Serial.print(Zero);
  Serial.print(" and ");
  Serial.println(Max);      
} // setup

void loop() 
{
  while ( Serial.available () > 0 ) 
  {
    uint8_t inChar = Serial.read ();  

    switch ( inChar )
    {
      
      case '\n': // end of data input

        Serial.print("Input = ");       
        Serial.println ( Input );
        if (Input < Zero - 50 || Input > Max + 50)
        {
          Serial.println("Loop failure");
          Input = 0;
          break;
        }
        if (Input < Zero)
        {
          Input = Zero;
        }
        if (Input > Max)
        {
          Input = Max; 
        }
                      
        Serial.print("int P1 = ");
        P1 = map( Input, Zero, Max, 0, 5000);
        Serial.println(P1);
        
        Serial.print("float P2 = ");
        P2 = (((Input - Zero) /(float)Span)*5000.0);
        Serial.println(P2,1);
        
        
        // reset inVal for next input
        Input = 0;
      
      break; 
      
      case '0' ... '9': // capture the numeric ascii input and convert to integer
        
        Input = ( Input * 10 ) + ( inChar - '0' ); // ascii to integer
          
      break;

    }  // switch
      
  }  // while 
  
} // loop

Instead of that demo -- just try this with your pressure transmitter and adc .

#include <Wire.h>
#include <Adafruit_ADS1015.h>

Adafruit_ADS1015 ads;     /* Use this for the 12-bit version */

uint16_t adc0;

void calcPressure (uint16_t Input, uint16_t Zero, uint16_t Max)
{

  uint16_t Span = Max - Zero;

  Serial.print("Input = ");       
  Serial.println ( Input );
                
  Serial.print("int P1 = ");
  uint16_t P1 = map( Input, Zero, Max, 0, 5000);
  Serial.println(P1);
  
  Serial.print("float P2 = ");
  float P2 = (((Input - Zero) /(float)Span)*5000.0);
  Serial.println(P2,1);

  Serial.print("float P2 as integer = ");
  uint16_t P3 = P2 + 0.5; // round up
  Serial.println(P3);

} // calcPressure 

void setup(void)
{
  Serial.begin(9600);
  Serial.println("Hello!");
 
  Serial.println("Getting single-ended readings from AIN0..3");
  Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)");

  ads.begin();
 
}  // setup           

void loop(void)
{
  adc0 = ads.readADC_SingleEnded(0);

  calcPressure (adc0, 328, 1627);

  delay(1000);

} // loop

That worked great.

Now I'm trying to bring in the other 3 pressures but having issues. I tried ti add to that code but messed up somewhere

#include <Wire.h>
#include <Adafruit_ADS1015.h>

Adafruit_ADS1015 ads;     /* Use this for the 12-bit version */

uint16_t adc0, adc1, adc2, adc3;

void calcPressure (uint16_t Input, uint16_t Zero, uint16_t Max)
{

  uint16_t Span = Max - Zero;

  Serial.print("adc0 = ");       
  Serial.println ( adc0 );
                
  Serial.print("int madc0 = ");
  uint16_t madc0 = map( adc0, Zero, Max, 0, 5000);
  Serial.println(madc0);

  Serial.print("int madc1 = ");
  uint16_t madc1 = map( adc1, Zero, Max, 0, 5000);
  Serial.println(madc1);

  Serial.print("int madc2 = ");
  uint16_t madc2 = map( adc2, Zero, Max, 0, 5000);
  Serial.println(madc2);

   Serial.print("int madc3 = ");
  uint16_t madc3 = map( adc3, Zero, Max, 0, 5000);
  Serial.println(madc3);
  
  Serial.print("float P2 = ");
  float P2 = (((Input - Zero) /(float)Span)*5000.0);
  Serial.println(P2,1);

  Serial.print("float P2 as integer = ");
  uint16_t P3 = P2 + 0.5; // round up
  Serial.println(P3);

} // calcPressure 

void setup(void)
{
  Serial.begin(9600);
  Serial.println("Hello!");
 
  Serial.println("Getting single-ended readings from AIN0..3");
  Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)");

  ads.begin();
 
}  // setup           

void loop(void)
{
  adc0 = ads.readADC_SingleEnded(0);
  adc1 = ads.readADC_SingleEnded(0);
  adc2 = ads.readADC_SingleEnded(0);
  adc3 = ads.readADC_SingleEnded(0);

  calcPressure (adc0, 332, 1634);
  calcPressure (adc1, 332, 1634);
  calcPressure (adc2, 332, 1634);
  calcPressure (adc3, 332, 1634);

  delay(1000);

} // loop

Result

adc0 = 832
int madc0 = 1920
int madc1 = 1916
int madc2 = 1920
int madc3 = 1916
float P2 = 1920.1
float P2 as integer = 1920
adc0 = 832
int madc0 = 1920
int madc1 = 1916
int madc2 = 1920
int madc3 = 1916
float P2 = 1916.3
float P2 as integer = 1916
adc0 = 832
int madc0 = 1920
int madc1 = 1916
int madc2 = 1920
int madc3 = 1916
float P2 = 1920.1
float P2 as integer = 1920

Also how would I add if it reads over max just use max and if it reads lower than min just read min?

I tried using your code up a ways and if I used the greater than sign it would just always use either the min or max value and not even read the actual value.

Again thanks for the help

Also in the result the others should be zero since nothing was hooked up to them but they appear to be reading the same as the first one

Thanks,

You could store a table with as many entries as possible analog reads (10 bit AVR or 12 bit Adafruit) and the correct pressure in each one. Lookup could take less than a microsecond.

Screw using floats. Floats are dirty, an operation or two and 1.0 changes to 0.999999....
Arduino types float and double are the same thing, 32-bit IEEE floating point where 64-bit

Use smaller units, like if you want meters to 3 places then work in integer millimeters or smaller. 32-bit longs can hold 9 digits that can all be 0 to 9.

That would be far beyond my level of coding.

I'm having enough trouble with this method although I like the idea.

I can design pcb's pretty well but coding is still quite new to me although I enjoy learning it and enjoy it even more once it works!

If you want, you can get walked though this. Using PROGMEM is not a big deal. Why do you think that the 328 has 32K of flash? It's not just for code.

There's some syntax to learn/copy and you will make/get a read function to return a float value if that's what you want.

The most actual work will be filling the table values into source. Does the sensor manufacturer have any graphs or tables to lift that data from?

Does this help?

#include <Wire.h>
#include <Adafruit_ADS1015.h>

Adafruit_ADS1015 ads;     /* Use this for the 12-bit version */

uint16_t adc0;

// make these global so if you need to change them they will be easy to find
// you want to avoid "magic" numbers in your code
// you can give a variable a meaningful name, a number is just a number
// if each transmitter is different you will need variables for all
// adc0Max, adc1Max etc.
uint16_t adcMax  = 1627;
uint16_t adcZero = 328;

float adc0Pressure;

uint16_t adc0Map;

float calcPressure ( uint16_t Input, uint16_t Zero, uint16_t Max )
{

  uint16_t Span = Max - Zero;

  return (((Input - Zero) /(float)Span)*5000.0);

} // calcPressure 

uint16_t mapPressure( uint16_t Input, uint16_t Zero, uint16_t Max )
{

  return (map( Input, Zero, Max, 0, 5000));

} // mapPressure

uint16_t validInput (uint16_t Input, uint16_t Zero, uint16_t Max )
{
   // if you have a large difference you probably
   // have a loop fault
   if (Input < Zero - 50 || Input > Max + 50)
   {
     // you should probably have a bailout routine 
     Serial.println("Loop failure");
   }
   // otherwise for small errors just do this
   if (Input < Zero)
   {
     return Zero;
   }
   if (Input > Max)
   {
     return Max; 
   }
   
} // validInput

void setup(void)
{
  Serial.begin(9600);
  Serial.println("Hello!");
 
  Serial.println("Getting single-ended readings from AIN0..3");
  Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)");

  ads.begin();
 
}  // setup           

void loop(void)
{
  adc0 = ads.readADC_SingleEnded(0);

  adc0 = validInput ( adc0, adcZero, adcMax );

  adc0Pressure = calcPressure ( adc0, adcZero, adcMax );

  adc0Map = mapPressure ( adc0, adcZero, adcMax );


// or you can use the functions in print statments
  Serial.println( calcPressure ( adc0, adcZero, adcMax ),1 );

  delay(1000);

} // loop

Thanks again for the help

I still dont quite have it but hopefully its something simple I didn't do right

This is what I tried

#include <Wire.h>
#include <Adafruit_ADS1015.h>

Adafruit_ADS1015 ads;     /* Use this for the 12-bit version */

uint16_t adc0;
uint16_t adc1;
uint16_t adc2;
uint16_t adc3;


// make these global so if you need to change them they will be easy to find
// you want to avoid "magic" numbers in your code
// you can give a variable a meaningful name, a number is just a number
// if each transmitter is different you will need variables for all
// adc0Max, adc1Max etc.
uint16_t adcMax  = 1627;
uint16_t adcZero = 328;

float adc0Pressure;
float adc1Pressure;
float adc2Pressure;
float adc3Pressure;

uint16_t adc0Map;
uint16_t adc1Map;
uint16_t adc2Map;
uint16_t adc3Map;

float calcPressure ( uint16_t Input, uint16_t Zero, uint16_t Max )
{

  uint16_t Span = Max - Zero;

  return (((Input - Zero) /(float)Span)*5000.0);

} // calcPressure 

uint16_t mapPressure( uint16_t Input, uint16_t Zero, uint16_t Max )
{

  return (map( Input, Zero, Max, 0, 5000));

} // mapPressure

uint16_t validInput (uint16_t Input, uint16_t Zero, uint16_t Max )
{
   // if you have a large difference you probably
   // have a loop fault
   if (Input < Zero - 50 || Input > Max + 50)
   {
     // you should probably have a bailout routine 
     Serial.println("Loop failure");
   }
   // otherwise for small errors just do this
   if (Input < Zero)
   {
     return Zero;
   }
   if (Input > Max)
   {
     return Max; 
   }
   
} // validInput

void setup(void)
{
  Serial.begin(9600);
  Serial.println("Hello!");
 
  Serial.println("Getting single-ended readings from AIN0..3");
  Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)");

  ads.begin();
 
}  // setup           

void loop(void)
{
  adc0 = ads.readADC_SingleEnded(0);
  adc1 = ads.readADC_SingleEnded(0);
  adc2 = ads.readADC_SingleEnded(0);
  adc3 = ads.readADC_SingleEnded(0);

  adc0 = validInput ( adc0, adcZero, adcMax );
  adc1 = validInput ( adc0, adcZero, adcMax );
  adc2 = validInput ( adc0, adcZero, adcMax );
  adc3 = validInput ( adc0, adcZero, adcMax );

  adc0Pressure = calcPressure ( adc0, adcZero, adcMax );
  adc0Pressure = calcPressure ( adc0, adcZero, adcMax );
  adc0Pressure = calcPressure ( adc0, adcZero, adcMax );
  adc0Pressure = calcPressure ( adc0, adcZero, adcMax );

  adc0Map = mapPressure ( adc0, adcZero, adcMax );
  adc1Map = mapPressure ( adc0, adcZero, adcMax );
  adc2Map = mapPressure ( adc0, adcZero, adcMax );
  adc3Map = mapPressure ( adc0, adcZero, adcMax );


// or you can use the functions in print statments
  Serial.println( calcPressure ( adc0, adcZero, adcMax ),1 );
  Serial.println( calcPressure ( adc1, adcZero, adcMax ),1 );
  Serial.println( calcPressure ( adc2, adcZero, adcMax ),1 );
  Serial.println( calcPressure ( adc3, adcZero, adcMax ),1 );

  delay(1000);

} // loop

Result at 15mA

Loop failure
0.0
5192.5
5192.5
5192.5
5192.5
5000.0
5000.0
5000.0
5192.5
5000.0
5000.0
5000.0
5192.5
5000.0
5000.0
5000.0
5192.5
5000.0
5000.0
5000.0
5192.5
5000.0
5000.0
5000.0
5192.5
5000.0
5000.0
5000.0
Loop failure

Not sure what I'm doing wrong.

Also I would like to know what I will need to change to scale it to 1000

I assume I add another line and use 1000 instead of 5000 but do I just add another Span or how does that work?

 uint16_t Span = Max - Zero;

  return (((Input - Zero) /(float)Span)*5000.0);

} // calcPressure 

uint16_t mapPressure( uint16_t Input, uint16_t Zero, uint16_t Max )
{

  return (map( Input, Zero, Max, 0, 5000));

} // mapPressure

Last I'm intrigued by the PROGMEM

looking at it a bit here

Do you know of any other good examples so I can learn this even if I don't use it in this project?

Last the chip is an ads 1015 12 bit 4ch adc.

here is the data sheet

It has 4 ch and that's what I'm trying to get readings from. Its based off the Adafruit lib for it.