-
Notifications
You must be signed in to change notification settings - Fork 23
Problem in i2C between ESP32 and Adafruit_ADS1015 #28
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
Comments
@Natalie88 , You 'scope image does not show a correctly functioning i2c bus. SCL should be a regular square wave, oscillating from 3.3v to 0v. If I am reading your image correctly it has an irregular pattern that is only varying from 3v to 3.3v. SDA is also wrong, It should be idle at 3.3v not 0V. I don't see where you specify the SDA and SCL pins using With my current release (V0.2.0) any call to Search through your code for I have proposed a path in the main Espressif repo 1239 that fixes this problem. I haven't yet posted it to my repo. Chuck. |
@stickbreaker Thank you very much for your reply i have configured the PINs inside the ADS_1015 library in the begin() method i altered it instead of wire.begin() to wire.bigen(18,19) |
@Natalie88 try the scan.ino example. Update the wire.begin() to match your hardware. That will show all devices on the bus. The 4095 probably is just the 'no comms' value. Lets verify the esp32 can see the adc. What resistance value are your pullups? Chuck |
@stickbreaker I got it to work finally, the problem was hardware related. |
Uh oh!
There was an error while loading. Please reload this page.
Hardware:
Board: ESP32 ?ESP32
Core Installation/update date: ?27/Mar/2018?
IDE name: ?Arduino IDE
Flash Frequency: ?80Mhz?
Upload Speed: ?115200?
yellow PIN 18 SDA, RED PIN 19 SCL
Description:
I have ESP32 connected to ADS1015 through i2C (PIN 18, 19), everything was cool when I first had the ESP8266 but when I changed to ESP32 first I got zeros from the function readADC_SingleEnded()
However when I changed to your arduino-esp32 I am getting a constant value of 4096 all the time.
any suggestions.
`#include "Arduino.h"
#include "Adafruit_ADS1015.h"
Adafruit_ADS1015 adc;
void getSolarCurrent() {
adc.setGain(adsGain_t::GAIN_TWO); //set upper limit vmax to 2.048V
uint16_t adc_res = adc.readADC_SingleEnded(1);
Serial.println("ADC res: "+String(adc_res));
Serial.flush();
//return (double) adc_res / 8.326; //Result is in mA (adc_val 2048mV/2047 / 8.33 / 1 Ohm)
}
void getCapVoltage() {
adc.setGain(adsGain_t::GAIN_ONE); //set vmax to 4.096V
uint16_t adc_res = adc.readADC_SingleEnded(0);
Serial.println("ADC res: "+String(adc_res));
Serial.flush();
//return (double)adc_res / 0.4998;//Result in mV (adc_res * 4096mV/2047)
}
void setup() {
//rtc_clk_cpu_freq_set(RTC_CPU_FREQ_80M);
Serial.begin(115200);
Serial.println();
Serial.println("Booted");
Serial.flush();
}
void loop() {
}`
Debug Messages:
The text was updated successfully, but these errors were encountered: