Isolate PH Circuit

Hi, I’m trying to create my own ph circuit but having trouble isolating it.

I attached the schematic for the circuit and connected to the Arduino exactly as schematic it works great, better than expected. I have a high end tester I’m comparing with and it’s very close so I’m happy. The power for the circuit is coming from the Arduino.

Here’s a sketch for it.

#define PROBE_IN 57   // anlaog a3  - green wire
#define PROBE_REF 56   // anlaog a2  - white wire

#define PROBE_MV_TO_PH 59.2

float average[10];


void setup()
{
  Serial.begin(115200);
}
void loop()
{
  measuremV();
}

void measuremV() 
{
  double differentialmV;
  float  probeIn, probeRef, inputV, adcResolution;
  static byte a,f=0;
  analogReference(DEFAULT);
  inputV = getVin();
  probeIn  = ((readADC(PROBE_IN) * inputV) / 1024.0);
  probeRef = ((readADC(PROBE_REF) * inputV) / 1024.0);
  differentialmV = (probeIn - probeRef);

  if (differentialmV <= -1.1)
  {
    analogReference(INTERNAL2V56);
    adcResolution = 2.56;
  }
  else if (differentialmV <= -0)
  {
    analogReference(INTERNAL1V1);
    adcResolution = 1.1;
  }
  else if (differentialmV <= 1.1)
  {
    analogReference(INTERNAL1V1);
    adcResolution = 1.1;
  }
  else if (differentialmV <= 2.56)
  {
    analogReference(INTERNAL2V56);
    adcResolution = 2.56;
  }

  // take a reading
  probeIn  = ((readADC(PROBE_IN) * adcResolution) / 1024.0);
  probeRef = ((readADC(PROBE_REF) * adcResolution) / 1024.0);

  // turn V into mV
  differentialmV = (probeIn - probeRef) * 1000;
  
  float pH = fabs(7.0 - (differentialmV / PROBE_MV_TO_PH));
  float totalPh = 0.0;
  
  if ((a == 9) && (f == 1))
  {
    for (byte b=0; b < 9; b++) 
    {
      average[b] = average[b+1];
    }
    average[a] = pH;
  }
  if (a == 9) f = 1;
  average[a] = pH;
  if (a < 9) {a++;}
  for (byte b=0; b < a; b++) 
  {
    totalPh = totalPh + average[b];
  }
  Serial.print(F("average  :     ")); for (byte t = 0; t < 10; t++){Serial.print(average[t],3); Serial.print(F(","));} Serial.println(F(""));

  pH = totalPh / a;
  Serial.print(F("pH: "));
  Serial.println(pH,3);
}
double readADC(int channel)
{
  uint32_t total = 0UL;
  uint16_t sampleCount = 4096;
  for (uint16_t i = 0; i < sampleCount; i++) {total += analogRead(channel);}
  total = total >> 6;
  double proportional = (total * 1.0) / (0b00000001 << 6);
  return proportional;
}
float getVin()
{
  #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || \
  defined(__AVR_ATmega2560__)
  ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
  #elif defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || \
  defined(__AVR_ATtiny84__)
  ADMUX = _BV(MUX5) | _BV(MUX0);
  #elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || \
  defined(__AVR_ATtiny85__)
  ADMUX = _BV(MUX3) | _BV(MUX2);
  #else // if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) ||
  // defined(__AVR_ATmega2560__)
  ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
  #endif // if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) ||
  // defined(__AVR_ATmega2560__)
  delay(2);
//  tws_delay(2);
  ADCSRA |= _BV(ADSC);

  while (bit_is_set(ADCSRA, ADSC));

  uint8_t low  = ADCL;
  uint8_t high = ADCH;

  long result = (high << 8) | low;

  result = 1125300L / result;
  return (double(result) - 0) * (6 - 0) / (6000 - 0) + 0;
}

Now the problem comes in when I add a ADM3260ARSZ-RL7 to isolate the 3.3v and GND and here’s why.

If you look on the schematic there’s a drop down resistor which is R2 - 15 ohms and causing the problem. Because of the value of this resistor there’s a short on the analog pin and GND, if I use a conductivity meter it confirms a short but obviously the Arduino doesn’t mind it as it works good and the power output from Arduino stays at 3.3v.

The ADM3260 however does not like that short, the output of it should be 3.3v the way I have it setup however with this short its only putting out 2.6v and it gets quite warm. Because of that the PH output isn’t stable and jumps around. If I remove that 15ohm resistor the ADM3260 works as expected but now the PH circuit doesn’t work because it needs that resistor.

I tried replacing that resistor with a 100ohm which doesn’t cause that short but again the ph circuit doesn’t work.

I’m banging my head trying to get both working together but having no luck, any suggestions would be greatly appreciated.

Thanks

The schematic makes absolutely no sense to me, especially the part about connecting two GNDs and 3.3V with a low value voltage divider. But then, the connections to the mystery chip U4 don't make any sense either.

when I add a ADM3260ARSZ-RL7

What is that, and why are you adding it?

He’s using an I2C isolator for its power supply. It’s only good for 30ma and we don’t know he’s driving with it.

OP: lease post a schematic that makes some sense, at least show the correct part number and pins for the device.

Sorry U4 is a LMC6061 operational amplifier, and I updated the image with labels that match the datasheet for LMC6061, sorry I didn't notice they were wrong.

I'm driving the ADM3260 with the Arduino for now. Same power source I use without the isolator.


EDIT: the output 3.3v from ADM3206 connects directly to the LMC6061 and R1 pullup.

WattsThat:
He’s using an I2C isolator for its power supply. It’s only good for 30ma and we don’t know he’s driving with it.

OP: lease post a schematic that makes some sense, at least show the correct part number and pins for the device.

Once you mentioned 30ma I starting thinking how much does this draw so I just finished testing and it appears to be under the limit. I put my meter inline on the VCC wire from Arduino. Using 3.3v from Arduino it draws 15.89ma, using 5v it draws 24.1ma.
I have the ADM3206 setup so 5v goes in and 3.3v isolated comes out so it will only be drawing 15.89ma.

Please use the regular symbols for an OpAmp. That way we can see immediately how it's wired (in this case unity gain buffer).

Good choice for OpAmp, not cheap but specialised for this job.

That isolator looks nice but really expensive but you really have to wire it between the power source and the Arduino, then have another Arduino on the outside that then in turn reads the communication again.

I've designed a similar circuit (haven't gotten around to build it) around an ATtiny, using a Murata power isolator and two optocouplers for isolated 9,600 bps Serial communication with the device.

robsworld78:
Once you mentioned 30ma I starting thinking how much does this draw so I just finished testing and it appears to be under the limit. I put my meter inline on the VCC wire from Arduino. Using 3.3v from Arduino it draws 15.89ma, using 5v it draws 24.1ma.
I have the ADM3206 setup so 5v goes in and 3.3v isolated comes out so it will only be drawing 15.89ma.

The way I read the datasheet, you’ve got a 3.3V 30ma output available with a 5 volt input.

3.3 volts into 115 ohms is how much current?

WattsThat:
3.3 volts into 115 ohms is how much current?

Oh, wow, misread that schematic. I was so expecting that this voltage divider was 100k + 15k (quite normal values) that I didn't realise it's just 100R + 15R!

By the way, it's normal to buffer this bias voltage through an OpAmp before connecting it to the pH probe as bias.

wvmarle:
Please use the regular symbols for an OpAmp. That way we can see immediately how it's wired (in this case unity gain buffer).

Good choice for OpAmp, not cheap but specialised for this job.

That isolator looks nice but really expensive but you really have to wire it between the power source and the Arduino, then have another Arduino on the outside that then in turn reads the communication again.

I've designed a similar circuit (haven't gotten around to build it) around an ATtiny, using a Murata power isolator and two optocouplers for isolated 9,600 bps Serial communication with the device.

Sorry I couldn't find anything in Eagle so I grabbed something with the same package.

Obviously I agree these isolators are very expensive but easy to work with which is vital for me. I'm setting this up like yours but using I2C to communicate with the master Arduino, the circuit board will have an ATtiny85. Right now I'm bypassing that and connected directly to a Mega 2560 for easy testing.

WattsThat:
The way I read the datasheet, you’ve got a 3.3V 30ma output available with a 5 volt input.

3.3 volts into 115 ohms is how much current?

Yeah your correct, after I read that I pulled up the datasheet and see on page 3 where it says for 5v in and 3.3v out you get 30ma IISO. The line after that in the datasheet says "Efficiency at IISO (MAX) --- 24%, IISO = 27ma" so maybe not even 30ma available. Either way I'm only at 15.9ma.

OK so now I hang my head low. I found the problem, even though I'm embarrassed I still have a smile on my face. I was checking everything for the 10th time it seems and because WattsThat got me back in the datasheet I went back to the recommended setup and board layout. After reading it over I saw "The recommended capacitor values are 0.1 μF and 10 μF for VIN" well turns out I somehow read that as 2 10uf's originally, after changing one of them to 0.1uf the isolated voltage was correct. I then hooked up a common GND from Arduino, powered up board with external source and I was in business.

Here's the last 10 readings from it and it's always in this range. It takes about 1.8 seconds of processing time to produce a number so not the fastest but seems quite accurate.

8.194
8.196
8.193
8.189
8.196
8.194
8.195
8.196
8.197
8.196

Thanks so much to everyone who jumped in, I appreciate the help and willingness to help, you guys are great! One day I hope to contribute more but I'm still learning.

Oh one other thing, would you expect some heat on the isolator with 16ma load?

16 mA @ 5V = 80 mW.

If there’s 20% conversion loss (should be a ballpark figure) that’d be a dissipation of some 20 mW in the chip. That should be no problem.

wvmarle:
16 mA @ 5V = 80 mW.

If there's 20% conversion loss (should be a ballpark figure) that'd be a dissipation of some 20 mW in the chip. That should be no problem.

Thanks but I think I was wrong on how much current was being drawn. After more checks and now everything is working correctly I have a load of 31 mA on the isolated side and on the non-isolated side powering it up it's drawing 89 mA.

The load side is 3.3v so 31 mA @ 3.3v = 102.3 mW and the chip has a max rating of 100 mW @ 3.3v.

Do the 20% conversion, no idea what that means, it's obviously much lower and should be no problem. Are you sure this conversion should be used?

After running a couple hours I'm unable to squeeze it for very long because it's too hot that's why I ask.

Is there anything I can do to increase this limit slightly, I'm guessing not? I'm guessing with the heat the isolator won't last very long?

The best measure is to calculate the output and input power (measure current & voltage). The input will be about 20% higher than the output, that’s the conversion loss. Maybe a bit more - the data sheet of the chip no doubt will indicate this number. That’s what gets lost in the chip itself, so for 80 mW output you need 100 mW input; 20% of which is 20 mW which is dissipated in the IC.

I now see in #8 you mention 24% efficiency for your IC - that’s far lower than I expected, and a much lower efficiency than the Murata NME5050 isolated power supply I have here, which is doing 70-80% efficiency (as in output power vs. input power) according to the data sheet.

Just run your numbers:
Input 89 mA @ 5V = 445 mW.
Output 31 mA @ 3.3V = 102 mW.
That’s 23% so pretty close to the stated efficiency. The remaining 333 mW is dissipated in the chip. That’s going to get it pretty warm indeed.

With your output at 31 mA you’re definitely doing something wrong. You should have no problem bringing that down to <5 mA, probably <1-2 mA, though you will see peaks due to the optocouplers used in the I2C lines.

Also check whether your IC has a minimum draw - the Murata device needs 10% minimum for the output voltage to fall down to spec.

wvmarle:
The best measure is to calculate the output and input power (measure current & voltage). The input will be about 20% higher than the output, that’s the conversion loss. Maybe a bit more - the data sheet of the chip no doubt will indicate this number. That’s what gets lost in the chip itself, so for 80 mW output you need 100 mW input; 20% of which is 20 mW which is dissipated in the IC.

I now see in #8 you mention 24% efficiency for your IC - that’s far lower than I expected, and a much lower efficiency than the Murata NME5050 isolated power supply I have here, which is doing 70-80% efficiency (as in output power vs. input power) according to the data sheet.

Just run your numbers:
Input 89 mA @ 5V = 445 mW.
Output 31 mA @ 3.3V = 102 mW.
That’s 23% so pretty close to the stated efficiency. The remaining 333 mW is dissipated in the chip. That’s going to get it pretty warm indeed.

With your output at 31 mA you’re definitely doing something wrong. You should have no problem bringing that down to <5 mA, probably <1-2 mA, though you will see peaks due to the optocouplers used in the I2C lines.

Also check whether your IC has a minimum draw - the Murata device needs 10% minimum for the output voltage to fall down to spec.

Thanks for the details, now I understand how that works and it makes sense.

Any idea what I could be doing wrong? I think the reason it draws so much is because that R2 - 15ohm resistor is causing a short from analog pin and GND and there’s no way I know of to remove that resistor, I tried everything I could think of.

I left it running overnight and when I touch the isolator after a couple seconds my brain says remove finger because of heat but can just tough it out. Obviously I’m over the limit and I’m sure if left its only a matter of time before the isolator degrades.

That'd mean the chip is at ~60C or so, should be OK for the chip even in the long run but not ideal for sure.

A major problem is that voltage divider indeed. Use 100k/15k resistors instead. Those resistors will see quite some self heating, and as a result change resistance. As I mentioned before you'll have to buffer that signal with an OpAmp before connecting it to the pH probe's GND to prevent noise.

wvmarle:
That'd mean the chip is at ~60C or so, should be OK for the chip even in the long run but not ideal for sure.

A major problem is that voltage divider indeed. Use 100k/15k resistors instead. Those resistors will see quite some self heating, and as a result change resistance. As I mentioned before you'll have to buffer that signal with an OpAmp before connecting it to the pH probe's GND to prevent noise.

Thanks, I will try the 100k/15k and see what happens, that would eliminate the short.
You must have missed it, the circuit does have an OpAmp, you can see the image in post #3, it's an LMC6061.

No, didn't miss it.
That one is for the pH probe signal. You need a second one for the offset (a general purpose OpAmp will do).

First I tried your suggestion of 100k/15k and your a genius, it worked. :slight_smile: Now the load is only 1.2 mA and the isolator is ice ice bay. :slight_smile: :slight_smile:

wvmarle:
No, didn't miss it.
That one is for the pH probe signal. You need a second one for the offset (a general purpose OpAmp will do).

Hmmm, that's interesting. As you probably figured out by now I didn't create the PH circuit, I'm only trying to add isolation to it and thanks to your help that's been accomplished.

What would this 2nd OpAmp do or help? Reason I ask is because I almost can't see this working any better than it already is. I'm doing comparisons from this circuit to an Atlas Scientific circuit which I consider good. I'm using the same probe and solution just swapping over the BNC.

Because the isolation was working last night I mixed up a batch of 4.01 buffer and with the Atlas circuit I got a rock solid 4.06. I then went to this circuit and left it overnight and I got a rock solid 4.01 all through the night. With those resistors changed I still have the 4.01 and no short.

Over the last couple days I've been testing with different PH levels and the difference is always the same so I think once both circuits are calibrated for this probe they would be a perfect match.

That's why I ask if that 2nd OpAmp is really necessary? I just checked the last readings and 5 out of 6 are all 4.015 and the 6th is 4.016 so it appears as stable as it can get.

EDIT: Forgot to mention, the 100k/15k resistors have no heat either.