Skip to main content
Arduino

Return to Question

Tweeted twitter.com/StackArduino/status/906462846728458247
added 334 characters in body
Source Link
Jasper
  • 115
  • 1
  • 1
  • 11

USB power vs linked? Another strange thing seems to happen when I disconnect the Nano from the USB port of my laptop and instead power it via a Raspberry. I want to use I2C to send the value from the Nano to the RPi. This works, but as soon as I power the nano from the RPi (5V connected to vIn), the calculated pH value drops?

USB power vs linked? Another strange thing seems to happen when I disconnect the Nano from the USB port of my laptop and instead power it via a Raspberry. I want to use I2C to send the value from the Nano to the RPi. This works, but as soon as I power the nano from the RPi (5V connected to vIn), the calculated pH value drops?

added 543 characters in body
Source Link
Jasper
  • 115
  • 1
  • 1
  • 11

Next update: :)

So I now reverted to my original code to try the adjusted pH calculations. I used the 7.0 reference solution to calibrate again and then measured the 4.0 solution. It reads 4.1! Ok, not completely spot on but not bad either. It's a small difference which might as well come from the probe, not the most expensive one.

So I wonder whether we should still try to get the other approach working cause it sounds better (more scientific?) for some reason. Anyway, this is at least a whole lot better than nothing :)

Next update: :)

So I now reverted to my original code to try the adjusted pH calculations. I used the 7.0 reference solution to calibrate again and then measured the 4.0 solution. It reads 4.1! Ok, not completely spot on but not bad either. It's a small difference which might as well come from the probe, not the most expensive one.

So I wonder whether we should still try to get the other approach working cause it sounds better (more scientific?) for some reason. Anyway, this is at least a whole lot better than nothing :)

Added a new update
Source Link
Jasper
  • 115
  • 1
  • 1
  • 11

Update 18-11-2015

Working on @slash-dev's solution, here's what I did:

I first turned the pot all the way down to the lowest value. The readings (for pH 7.0) are as follows: low = 540 and high = 1017. Code as follows:

int rawValue = analogRead(SensorPin);
int buf[10]; //buffer for read analog
for(int i=0;i<10;i++) //Get 10 sample value from the sensor for smooth the value
{ 
 buf[i] = rawValue;
 delay(10);
}
// sorting left out to reduce the sample length
int avgValue=0;
for(int i=2;i<8;i++) // take the average value of 6 center samples
 avgValue += (buf[i] - CENTER);

In this stage I'm printing the raw value of course.

The shorting of the BNC connector I don't exactly understand, should I short the inside (where the pin goes) or the outside of the connector? And short it to the GND? I used the reference solution instead.

Now I added the formula to determine the voltage. For the low value that reads 0.10. I now put in the center value of 540 which brings the voltage reading to 0.0, seems good.

Now for step 2 I placed the probe into the 4.0 reference solution. The voltage now reads 0.48, raw value 637. I start adjusting the pot to where the voltage reads 2.25, takes quit some adjusting. Raw now reads 1000.

Now comes the part I don't exactly get. You say we can now calculate the pH/V, but with what variables? I mean, -3 / 2.25 will always result in -1.33 but shouldn't there be a variable here depending on how far I actually adjusted the pot?

When I now put in the formula to calculate the pH as expected it reads 4.0 for the 4.0 reference solution. But it now screws up the 7.0 solution as we adjusted the pot but didn't compensate for it as far as I see? I also tried the adjusted pH formulas but I guess those are meant for the first code we had and not this adjusted one.

So what am I missing between step 2 and 3 that messes up things here? Also, you state that the inverting by subtracting from 1024 is correct, but when I do that the voltage readings become minus.

Another thing I wonder about; if the pot has to be a slope, shouldn't it be a different one than the one next to it (where a linear one makes more sense)? Cause it isn't, they both read "W103 / 143C". In the meantime, the vendor is kindly sending over a replacement one to ensure it's not a hardware defect somewhere.

Update 18-11-2015

Working on @slash-dev's solution, here's what I did:

I first turned the pot all the way down to the lowest value. The readings (for pH 7.0) are as follows: low = 540 and high = 1017. Code as follows:

int rawValue = analogRead(SensorPin);
int buf[10]; //buffer for read analog
for(int i=0;i<10;i++) //Get 10 sample value from the sensor for smooth the value
{ 
 buf[i] = rawValue;
 delay(10);
}
// sorting left out to reduce the sample length
int avgValue=0;
for(int i=2;i<8;i++) // take the average value of 6 center samples
 avgValue += (buf[i] - CENTER);

In this stage I'm printing the raw value of course.

The shorting of the BNC connector I don't exactly understand, should I short the inside (where the pin goes) or the outside of the connector? And short it to the GND? I used the reference solution instead.

Now I added the formula to determine the voltage. For the low value that reads 0.10. I now put in the center value of 540 which brings the voltage reading to 0.0, seems good.

Now for step 2 I placed the probe into the 4.0 reference solution. The voltage now reads 0.48, raw value 637. I start adjusting the pot to where the voltage reads 2.25, takes quit some adjusting. Raw now reads 1000.

Now comes the part I don't exactly get. You say we can now calculate the pH/V, but with what variables? I mean, -3 / 2.25 will always result in -1.33 but shouldn't there be a variable here depending on how far I actually adjusted the pot?

When I now put in the formula to calculate the pH as expected it reads 4.0 for the 4.0 reference solution. But it now screws up the 7.0 solution as we adjusted the pot but didn't compensate for it as far as I see? I also tried the adjusted pH formulas but I guess those are meant for the first code we had and not this adjusted one.

So what am I missing between step 2 and 3 that messes up things here? Also, you state that the inverting by subtracting from 1024 is correct, but when I do that the voltage readings become minus.

Another thing I wonder about; if the pot has to be a slope, shouldn't it be a different one than the one next to it (where a linear one makes more sense)? Cause it isn't, they both read "W103 / 143C". In the meantime, the vendor is kindly sending over a replacement one to ensure it's not a hardware defect somewhere.

Notice removed Authoritative reference needed by Community Bot
Bounty Ended with no winning answer by Community Bot
Added update
Source Link
Jasper
  • 115
  • 1
  • 1
  • 11
Loading
Added new update
Source Link
Jasper
  • 115
  • 1
  • 1
  • 11
Loading
Loading
Notice added Authoritative reference needed by Jasper
Bounty Started worth 50 reputation by Jasper
Added information + link to documentation ZIP.
Source Link
Jasper
  • 115
  • 1
  • 1
  • 11
Loading
Source Link
Jasper
  • 115
  • 1
  • 1
  • 11
Loading
lang-cpp

AltStyle によって変換されたページ (->オリジナル) /