Tool/software:
Hi,
is the way converting the adc value to adc_voltage value is correct using single ended input configuration for ads1115 ?.
if(mux == 0x60) //AIN2 for gas flow rate sensor
{
uint8_t zero_output = 1; //Sensor zero output voltage
uint8_t fs_output = 5; //Sensor full scale output voltage
uint16_t sensor_fs = 1000; //Sensor full scale measurement range (sccm)
float pga = 6.144; //PGA gain setting
float sccm = 0;
//Convert adc_result to voltage equivalent
float adc_voltage;
adc_voltage = (adc_result*pga)/((1<<16)/2);
//Convert uint16_t adc_results to uint8_t sd_data[] array
sd_data[29] = (adc_result>>8) & 0xFF; //MSB
sd_data[30] = adc_result & 0xFF; //LSB
//Calculate flow rate
sccm = (((float)(adc_voltage - zero_output) / (fs_output - zero_output))*sensor_fs);
plot_data[11] = sccm;
return sccm;
}
Regards,
Harris