Giter Site home page Giter Site logo

soligen2010 / adafruit_ads1x15 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adafruit/adafruit_ads1x15

60.0 60.0 31.0 51 KB

Driver for TI's ADS1x15: 12 and 16 bit Differential or Single-Ended ADC with PGA and Comparator

License: Other

C++ 100.00%
adc ads1015 ads1115 ads1x15 arduino arduino-library arduino-platform i2c i2c-device

adafruit_ads1x15's People

Contributors

andrei128x avatar andydoro avatar soligen2010 avatar srgdamia1 avatar tdicola avatar toddtreece avatar valeros avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_ads1x15's Issues

Re-register with PlatformIO

I know you deleted library.json at Adafruit's request hoping that they might finally, finally, finally accept a pull request to correct their library. But deleting that caused your library to disappear from the PlatformIO library register (https://platformio.org/lib).

I asked on their forums for the PlatformIO team to reresister your library.properties as the same library number you were previously (344). (https://community.platformio.org/t/soligen2010-ads1x15-library-disappeared-from-registry/6892) I hope you do not object. I'm just.. not hopeful that Adafruit is ever going to pull in your changes and would like your library to reappear in the registry.

no conversion

i am having troubles using the adc1115 with your library. no matter what i do, i always get a reading of -1 for all channels. can you help me?

timeout if no connection to address available

I use your modified library - it makes adc read time as short as possible.

But sometimes i get my ESP8266 stop responding. And problem disapears if i do not use ADC.
Could it be that ADC reading loop (waitForConversion) blocks everything, if connection to ADS1105 is lost, or ADS1105 is not responding?

Question regarding differential

First off, thank you for making this fork. I am implementing it into my project and have a couple questions.

I have 2 hall effect sensors plugged into 0 and 1, and 2, and 3. they both go from 0-2V. I am trying to use an ads1015 as an ammeter (connected to an esp8266)

I would like it to continually convert, and allow me to sample the conversion as the esp has time. the esp is doing a lot of other stuff. So i was thinking doing continuous conversion + differential on 0_1 and 2_3.
I dont really need the alert pin, just need it to be ready when the data is asked for.

first, does that make sense?
if it does, ill post the code I have now (using your library fork) to try and get the values.

Regarding the ADS1115 and continuous mode!

I wanted to know if it is possible to have continuous mode turned on, on A0 and A1 at the same time. And if not what workaround would you suggest?! I need to read data from 2 sensors with a 500Hz sample rate (as steady as possible) is a medical application project (in a beginning test stage). Thank you for your time

Refactoring for SoftwareWire and other features ...

I wanted to touch base with you about some refactoring that I"m about to do, and also adding support for SoftwareWire functionality that I need.

Here are some of the changes that I intend to make, and I wanted your input and thoughts in case you might think about accepting a pull request back.

  1. Adding SoftwareWire support: I need to use SoftwareWire to change the pins that I am using for I2C. I found a "nice" way that Sparkfun implemented this in their BME280 library, and I've now implemented it a few times. It adds a few new constructors that allow the Wire or SoftwareWire object to be passed in, along with the I2C address.

  2. Adding a "isPresent()" method to test for the chip being present on the I2C bus at the current I2C address.

  3. Adding a "setI2CAddress()" method to allow the I2C Address to be changed on the fly. Support for multiple chips.

  4. Getting rid of the "#if ARDUINO >= 100" options as it seems that we are well past the time of needing this? It makes the support of hard and soft I2C select logic that much more complex. I could be convinced differently on this, and will see as I get going on the refactoring.

I'll be working on all of this today in the next few hours ... but wanted to get any feedback and ideas from you to make a future pull request cleaner.

Random spikes when running for a long time?

Hi, I'm having a issue where the adc sent value seems to be not read sometimes...
the adc is used to measure a voltage divider circuit, where a thermistor and a reference resistor are connected in series and a temperature is measured.
The measured resistance is first put into a array for getting the rolling average (reduces the noise), and sometimes the average of this array drops as shown below....
I used a fletcher16 checksum to make sure there were no errors...
now i'm just guessing there are times when the ADC is returning weird values....
Would be great if you could give me some advice.....thanks :)
Here is how i read the values, i didn't use the waitforconversion() function because i think it's not needed here?

voltage01 = ads.readADC_Differential_0_1();
// V01t-=millis();
/////////////////////////////////////////////////////////////////
total1 = total1 - (unsigned long)readings1[readIndex1];// subtract the last reading:
readings1[readIndex1] = voltage01;// read from the sensor:
total1 = total1 + (unsigned long)readings1[readIndex1];// add the reading to the total:
readIndex1 = readIndex1 + 1;// advance to the next position in the array:
if (readIndex1 >= numReadings1) {// if we're at the end of the array...
readIndex1 = 0;// ...wrap around to the beginning:
wait1 = true;
}
if (wait1)
{
average1 = 100 * total1 / numReadings1;// calculate the average:
}
else average1 = 100 * total1 / readIndex1;
//////////////////////////////////////////////////////////////////
voltage0 = ads.readADC_SingleEnded(0);

image
Edit: The plotted graph is Voltage01, which is the voltage difference between the thermistor, this is summed up 500 times though...

Best Regards,

Ken

i2C high-speed mode master code

Hi soligen-

Love this library, thanks for writing it.

I'm trying to push the limits of the ADS1015 sampling speed. I'd like to put the ADS1015 into I2C high-speed mode (3.4MHz). This thread http://e2e.ti.com/support/legacy_forums/automotive/f/26/t/552044 suggests that upgrading from I2C fast mode (400 kHz) to high speed mode (3.4MHz) may save up to 77us on the read time, which would be significant in my application. Even half or a third of that would be awesome.

From the datasheet http://www.ti.com/lit/ds/symlink/ads1015.pdf :

No special action is required to use the ADS101x in standard or fast mode, but high-speed mode must be activated. To activate high-speed mode, send a special address byte of 00001xxx following the START condition, where xxx are bits unique to the Hs-capable master. This byte is called the Hs master code, and is different from normal address bytes; the eighth bit does not indicate read/write status. The ADS101x do not acknowledge this byte; the I2C specification prohibits acknowledgment of the Hs master code. Upon receiving a master code, the ADS101x switch on Hs mode filters, and communicate at up to 3.4 MHz. The ADS101x switch out of Hs mode with the next STOP condition.

Any idea how to implement this? I looked through your library, but I'm flummoxed because:

  • I cant figure out how to send a binary byte like "0000 1111" over I2C
  • Does the Hs master code get written to a register, if so, which one?

I'm using a microcontroller that is high speed mode capable, the ATSAMD51.

Seems like this would probably end up being 3 lines of code, but I'm an Arduino noob, sorry.

Thanks for any help you can offer!

Conversion Delay Issues

This is a continuation of an issue from adafruit's fork. I created this issue to continue the discussion on addressing the issue because it is being worked on in fork. the original issue is here

Summary: Conversion delays have been removed in favor of polling the chip every 1 ms until conversion completes. The delay(1) causes a yield for ESP8266 to it doesn't eat up too many cycles.

Here is the final post from the old thread

It occurs to me that 1 ms delay resolution makes the faster SPS settings rather pointless.

gordonthree, what specifically is your concern of taking too many cycles? I am considering changing to delay(0) which will tighten the loop and make response faster, but will still do a yield for ESP8266 processing. Thoughts?

Thank you

This is not a bug. I would like to say thank you for implementing additional features.
I use this library for my electronic load and it works fine (even with the purple clone board)!

You can add the STM32 bluepill board to the list of supported boards (PB7=SDA, PB6=SCL), it works fine. Link: https://wiki.stm32duino.com/index.php?title=Blue_Pill

greetings from germany

Can not access I2C addr 0x4A and 0x4B with ADS1115 and Cortex M0

Hi,

I've got a number of ADS1115 boards which I've been trying to get to work with Adafruit Feather Cortex M0 Adalogger Arduinos. With the stock Adafruit ADS1X15 library none of the single ended outputs lined up, Differential mode 01 showed up on 23 and other craziness -- with your fork it Just Works. Brilliant, thanks!

Using an ATMega328p the original library from Adafruit worked fine, just not with the faster M0.

One problem I'm still having though, that was also seen with the original library is that I can only change the I2C address between 0x48 and 0x49 (addr tied to gnd or vdd) but I get no response if I try addresses 0x4A and 0x4B (addr pin tied to sda or scl). I've tried this with a number of ADS1115 boards and it's the same with all of them. I assume it's some timing conflict with the I2C lines? I have not tried adding a pF capacitor there, but it's an idea.

Have you/anyone else had a similar setup working on the two higher I2C addresses? This issue limits me to using two ADS boards at a time instead of four.

many thanks for your fine work,
Hamish

Detect that ADS1x15 is not present?

Hello,

Thank you for taking this library forward. I appreciate the work you have put into it ... Adafruit owes you for doing their work for them. :-)

I noticed that if the ADS1x15 is NOT present on the I2C bus, there is no indication that I can find that my code can use to know the values are all "bad". Often, in other libraries, the .begin() method will fail if the chip is not detected on the I2C bus.

Is there currently a way in the library to determine that an ADS1x15 chip is or is not present and responding?

Do you have ideas or suggestions on implementing such a test?

Thanks again!

Runing multiple analog channels on continuous-conversion mode

Hello,

Thanks you soo much for this library, it works much better than the adafruit one, really good at solving the conversion delay problem.

Before i explain my issue, i had like to explain what i need the ADC to do.

I have 6 pressure transducers that I want to ultimately sample at 2.5kHz each, for this I need to use the ads1015. But right now i only have a ads1115 so 860 will do. Now my problem is to sample all of them at max sampling rate (860 or 3.3k depending on the chip I have). When I use all the analog channels the sampling rate goes down to about 860/4, because of the conversiondelay for each reading. So I tried to use multiple chips each having only 1 analog input, so 4 chips each having 1 pressure transducer. But this result in the same problem since the chips still has the same conversiondelay X 4.

Then I read about the continuous-conversion-mode that you have implemented /example/continuous/continuous.ino, utilizing the interrupt pin. I can see that having 1 analog input to one sensor gives the max sampling rate of 860, so that is cool.

Now my question is it possible to all the channels (4) on continuous-conversion-mode having all running on max sampling rate? If so how does the code look like running multiple channels? because I tried to outcomment line 38 to try to run 2 analog channels, but i only get the reading of the last one.

If this is not possible will it then be possible to run multiple chips all running on continuous-conversion-mode with each having 1 analog input, and then use two I2C buses since only 4 chips can be used togeather?

Thanks so much!

//Fadi

Also tested on ESP32

FWIW: Also tested on ESP32 (NodeMCU ESP32-v3 to be exact).
SDA/SCL default to pins 21 & 22 but any two pins can be assigned as SDA/SCL using Wire.begin(SDA,SCL).
Tested with i2c speed upto 800000 Wire.setClock(800000) !

SAMD21 with ADS1115

Hello, i saw this fork in adafruit version. Looking at the ads1115 example got me confused about the extra pins. is it possible to run just with SDA/SCL pins without alert and raisevoltage pin?
Im just looking to measure couple of batteries with voltage dividers thats all. thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.