Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading speed #3

Closed
Leufu opened this issue Mar 5, 2024 · 2 comments
Closed

Reading speed #3

Leufu opened this issue Mar 5, 2024 · 2 comments
Assignees
Labels
Seeed_Arduino_ADS1115 Label for Seeed_Arduino_ADS1115 UAY Unassigned yet

Comments

@Leufu
Copy link

Leufu commented Mar 5, 2024

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

@MatthewJeffson MatthewJeffson added UAY Unassigned yet Seeed_Arduino_ADS1115 Label for Seeed_Arduino_ADS1115 labels Oct 9, 2024
@Lesords Lesords self-assigned this Oct 14, 2024
@Lesords
Copy link
Contributor

Lesords commented Oct 16, 2024

Hello,

I'm very sorry to have kept you waiting so long.

Does this problem still exist? If so, can you please tidy up the file description?

@Lesords
Copy link
Contributor

Lesords commented Oct 30, 2024

Hello,

I'm going to close this issue, feel free to re-open it if you have any other questions.

[Autocommentary]

@Lesords Lesords closed this as completed Oct 30, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Issues and PR Assemble Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Seeed_Arduino_ADS1115 Label for Seeed_Arduino_ADS1115 UAY Unassigned yet
Projects
Status: Done
Development

No branches or pull requests

3 participants