GithubHelp home page GithubHelp logo

seeed-studio / seeed_arduino_ads1115 Goto Github PK

View Code? Open in Web Editor NEW
0.0 12.0 2.0 25 KB

This library comes with ADS1115. The library has an example to get 4 single-ended inputs or 2 differential inputs.

License: MIT License

C++ 100.00%
arduino arduinolibrary grove ads1115

seeed_arduino_ads1115's Introduction

Seeed Arduino ADS1115 Build Status

Introduction

An Arduino library for ADS1115 Ultra-Small, Low-Power, I2C-Compatible, 860-SPS, 16-Bit ADCs.ADC data can be obtained using IIC interface.

Usage

1.Git clone this resp to your Arduino IDE's libraries directory.
2.Run the demo "comparator" or "differential" or "singleended" on examples directory.
3.More information view code.

This software is written for seeed studio and is licensed under The MIT License. Check License.txt for more information.

Contributing to this software is warmly welcomed. You can do this basically by
forking, committing modifications and then pulling requests (follow the links above
for operating guide). Adding change log and your contact into file header is encouraged.
Thanks for your contribution.

Seeed Studio is an open hardware facilitation company based in Shenzhen, China.
Benefiting from local manufacture power and convenient global logistic system,
we integrate resources to serve new era of innovation. Seeed also works with
global distributors and partners to push open hardware movement.

Analytics

seeed_arduino_ads1115's People

Contributors

hansen0314 avatar jiacheng-lu avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

seeed_arduino_ads1115's Issues

Reading speed

Hello! I'm currently experimenting with this library in conjunction with a Seeed Studio XIAO nRF52840 (Sense) board. However, I've observed a low data rate when transmitting data via the serial port. Initially, I suspected that this might be due to the MCU speed, but since it operates at 64MHz, that shouldn't be the issue.

To provide context, I'm using basic Arduino code, and I'm seeing around 20-21 samples per second on the screen. Could this low data rate be attributed to a problem with the delay time conversion within the library?

` #include "ADS1115.h"
float Voltage = 0.0;

#ifdef SOFTWAREWIRE
#include <SoftwareWire.h>
SoftwareWire myWire(3, 2);
ADS1115 ads(myWire);//IIC
#else
#include <Wire.h>
ADS1115 ads(Wire);//IIC
#endif

void setup(void)
{
Serial.begin(115200);
while(!ads.begin(0x48)){
Serial.print("ads1115 init failed!!!");
delay(1000);
}
//ads.begin(0x49)
//ads.begin(0x4A)
//ads.begin(0x4B)

ads.setOperateMode(ADS1115_MODE_SINGLE);   
ads.setOperateStaus(ADS1115_OS_SINGLE);

ads.setPGAGain(ADS1115_PGA_6_144);    // 2/3x gain +/- 6.144V  1 bit =  0.1875mV (default)
// ads.setPGAGain(ADS1115_PGA_4_096); // 1x gain   +/- 4.096V  1 bit =  0.125mV
// ads.setPGAGain(ADS1115_PGA_2_048); // 2x gain   +/- 2.048V  1 bit =  0.0625mV
// ads.setPGAGain(ADS1115_PGA_1_024); // 4x gain   +/- 1.024V  1 bit =  0.03125mV
// ads.setPGAGain(ADS1115_PGA_0_512); // 8x gain   +/- 0.512V  1 bit =  0.015625mV
// ads.setPGAGain(ADS1115_PGA_0_256); // 16x gain  +/- 0.256V  1 bit =  0.0078125mV

//ads.setSampleRate(ADS1115_DR_8); //8 SPS
// ads.setSampleRate(ADS1115_DR_16); //16 SPS
// ads.setSampleRate(ADS1115_DR_32); //32 SPS
// ads.setSampleRate(ADS1115_DR_64); //64 SPS
// ads.setSampleRate(ADS1115_DR_128); //128 SPS
//ads.setSampleRate(ADS1115_DR_250); //250 SPS
// ads.setSampleRate(ADS1115_DR_475); //475 SPS
ads.setSampleRate(ADS1115_DR_860); //860 SPS

}
void loop(void)
{
int16_t adc0,adc1,adc2,adc3;
adc0 = ads.getConversionResults(channel0); //P = AIN0, N = GND
//adc1 = ads.getConversionResults(channel1); //P = AIN1, N = GND
//adc2 = ads.getConversionResults(channel2); //P = AIN2, N = GND
//adc3 = ads.getConversionResults(channel3); //P = AIN3, N = GND
Voltage = (adc0 * 0.1875);

Serial.print("AIN0: "); Serial.print(adc0);
Serial.print("      Voltaje:");Serial.print(Voltage);Serial.println("mV");

//Serial.print("AIN1: "); Serial.println(adc1);
//Serial.print("AIN2: "); Serial.println(adc2);
//Serial.print("AIN3: "); Serial.println(adc3);
//Serial.println(" ");    
//delay(10);

} `

Serial output:
image

PD: I change between 250, 475 and 860 sps settings and i got the same result

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.