Go Down

Topic: ADS1114 convert bi-directional output to positive (Read 739 times) previous topic - next topic


Hi. Another question in my quest to learn.
I am using an ADS1114 16 bit a/d converter and the Adafruit ADS1115 library
although I suppose this is common with many ADC's.
My sensor has a total output from 0.3v to 1.4v so only approx 1v full scale.
The ads1114 is giving me approximately -6000 to 6000 as an output which is about right I guess, 12000 counts for a 1v input.

My question is how do convert the input into a positive ONLY value in the most efficient way for processing time. I know i could just add 7000 to the value and always have it positive but I am sure there is a more efficient way done by the pro's?


Adding an offset seems like a perfectly reasonable thing to do, but you could also consider using the map() function to shift the values to another range and scale them at the same time if you wanted to.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.


Great, Thanks
I think the problem with Mapping is that the beginning and end values are not always the same from sensor to sensor.


that should not be a problem. You can make a different map function for every sensor. on the other hand, sensors measured with an arduino are usually not that precize to begin with.

if i'm not mistaking the map function is used as this:

your_var map(0,6000,0,5);

the first zero is the lowest value received from the sensor
6000 is the max value
next zero is the minimum value you want to get
and 5 is the maximum value (voltage)

if you want the voltage to be displayed with 2 numbers behing the comma, use "float" before "your_var"


Apr 01, 2013, 05:27 pm Last Edit: Apr 01, 2013, 05:29 pm by retrolefty Reason: 1
There might be a better way. When you set the configuration word for the ADS1114, that determines if you are going to use two input pins as a differential pair (thus allowing for the possibilities of - and + value digital conversions, or you can set it for single input mode channels and only positive values will be converted from a single input pin.

Note that the ADS1114 as with most/many external ADC modules does not read true (relative to the chip's ground pin) negative voltages but rather the difference between two positive values on the the two input pins if run in differential input mode. Thus the max positive digital value is when the + input is at +5vdc and the - input is at ground and the max digital negative value is when the + input is at ground and the - input is at +5vdc.


Go Up