-1

I got problem in my result where my ADC read cannot give the biggest and the lowest ADC Value if I am using ADS1115. meanwhile, when I am not using ADS1115 I can get the biggest and the lowest ADC Value using a listing program that I use before. Thank u, need for help.

Result with ADS

Result without ADS

Program with ADS[![][3]] program without ADS

  • 3
    why did you post pictures of the code? .... how do you expect anyone to run the program and test it? – jsotola May 16 at 6:47
  • what do you need help with? .... you did not ask any questions. – jsotola May 16 at 6:49
  • @jsotola no, i post the pictures of the code to ask if anything wrong in my code. my question is, why i cant get biggest and lowest value of my ADC if i using ADS1115? the value is just same the biggest and the lowest. – adi dharma May 16 at 7:03
  • The practice on this SE is to post code as text (e.g. so that others may copy/paste and help you by providing correct code), not as images. – MichaelT May 16 at 8:34
  • is the ADS1115 fast enough to measure AC? are you using some sort of RC filter and bridge? – dandavis May 16 at 17:47
0

The ZMPT101b is a transformer which converts voltage. You can read the output with analog pin.

The ADS1115 is an analog to digital converter. It reads the analog voltage the same way as the analog pin of your Arduino does. The result then can be read over I2C as a register value. You can't read it with analogRead.

So you can use the ADS1115 to convert the analog output of the ZMPT101b.

To read the digital value from the ADS1115 with Arduino, use the Wire library or find a library for the ADS1115. For example this one.

I use ADC121 with Wire library. I initialize it in setup()

  const byte REG_ADDR_RESULT = 0x00;
  const byte REG_ADDR_CONFIG = 0x02;

  // initialize the Wire library
  Wire.begin();
  Wire.setClock(400000);

  // configure the ADC
  Wire.beginTransmission(I2C_ADC121);
  Wire.write(REG_ADDR_CONFIG);
  Wire.write(REG_ADDR_RESULT);
  Wire.endTransmission();

  // set the 'result' register as default
  Wire.beginTransmission(I2C_ADC121);
  Wire.write(REG_ADDR_RESULT);
  Wire.endTransmission();

and then in code I read the value with this function

unsigned short adcRead() {
  Wire.requestFrom(I2C_ADC121, 2); // request 2 bytes
  byte buff[2];
  Wire.readBytes(buff, 2); // read 2 bytes
  return (buff[0] << 8) | buff[1]; // get the result as 16 bit number
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.