Setting ADS1115 PGA through Electron

electron
Tags: #<Tag:0x00007fe21ff72778>

#1

Good morning,

I have an NCD 1 Channel 4-20 mA Current Loop Receiver 16 Bit ADS1115 I2C Mini Module I am trying to interact with via a Particle Electron.

I am using the control everything library recommended in an older thread on this forum.

Per the product description on NCD, 4 mA should read approx 6430 and 20 mA should read approx 32154. However, using the above library, I am getting 2100/10493 respectively.

I believe the issue is that the PGA is not set correctly. However, the library does not appear to have a way to set the PGA. Other libraries (Arduino, Adafruit) do, but I haven’t been able to adapt those to my current needs (lack of knowhow).

Can someone advise on how I might set the PGA for the ADS1115 using the Particle IDE?

Thank you!


#2

Have you tried using the Adafruit ADS1115 library? It’s specifically called Adafruit_ADS1X15, I’m using it successfully to read a 4-channel ADS1115. You just set the gain using adc.setGain(GAIN_ONE); or similar, depending on what gain level you need. I’ve used it on both the Electron and Boron.


#3

I did end up modifying the Adafruit library to suit my needs. Thanks!