Forum Software Ferduino code Ph meter v1.0

Ph meter v1.0  [SOLVED]


Post Number:#1 Post Sun Feb 01, 2015 8:52 am
Posts: 28
Topics: 7
Solve rating: 0
Joined: Sun Jan 25, 2015 7:45 am
Topics: 7
Age: 49
Gender: None specified
National Flag:
Spain
hello would need your help have a ph meter v1.0 and not as connected to the arduino board 2560 besides not whether to modify the sketch addition of isolated temperature probe and ready for water'm doing everything halves this is possible? since I do not ferduino plate
no where to put the sketch
thanks in advance

Image

Post Number:#2 Post Sun Feb 01, 2015 11:43 am
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Hi!

Welcome Alfredo!

Which code you want add to Ferduino?

Best regards.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#3 Post Mon Feb 02, 2015 1:51 pm
Posts: 28
Topics: 7
Solve rating: 0
Joined: Sun Jan 25, 2015 7:45 am
Topics: 7
Age: 49
Gender: None specified
National Flag:
Spain
Hi fernando code the following is DFRobot and is showing me the manufacturer but not if I can get it or not is how to connect the arduino mega board 2560 :(( :(( :((

/*
 # This sample code is used to test the pH meter V1.0.
 # Editor : YouYou
 # Ver    : 1.0
 # Product: analog pH meter
 # SKU    : SEN0161
*/
#define SensorPin A0            //pH meter Analog output to Arduino Analog Input 0
#define Offset 0.00            //deviation compensate
#define LED 13
#define samplingInterval 20
#define printInterval 800
#define ArrayLenth  40    //times of collection
int pHArray[ArrayLenth];   //Store the average value of the sensor feedback
int pHArrayIndex=0;   
void setup(void)
{
  pinMode(LED,OUTPUT); 
  Serial.begin(9600); 
  Serial.println("pH meter experiment!");    //Test the serial monitor
}
void loop(void)
{
  static unsigned long samplingTime = millis();
  static unsigned long printTime = millis();
  static float pHValue,voltage;
  if(millis()-samplingTime > samplingInterval)
  {
      pHArray[pHArrayIndex++]=analogRead(SensorPin);
      if(pHArrayIndex==ArrayLenth)pHArrayIndex=0;
      voltage = avergearray(pHArray, ArrayLenth)*5.0/1024;
      pHValue = 3.5*voltage+Offset;
      samplingTime=millis();
  }
  if(millis() - printTime > printInterval)   //Every 800 milliseconds, print a numerical, convert the state of the LED indicator
  {
   Serial.print("Voltage:");
        Serial.print(voltage,2);
        Serial.print("    pH value: ");
   Serial.println(pHValue,2);
        digitalWrite(LED,digitalRead(LED)^1);
        printTime=millis();
  }
}
double avergearray(int* arr, int number){
  int i;
  int max,min;
  double avg;
  long amount=0;
  if(number<=0){
    Serial.println("Error number for the array to avraging!/n");
    return 0;
  }
  if(number<5){   //less than 5, calculated directly statistics
    for(i=0;i<number;i++){
      amount+=arr[i];
    }
    avg = amount/number;
    return avg;
  }else{
    if(arr[0]<arr[1]){
      min = arr[0];max=arr[1];
    }
    else{
      min=arr[1];max=arr[0];
    }
    for(i=2;i<number;i++){
      if(arr[i]<min){
        amount+=min;        //arr<min
        min=arr[i];
      }else {
        if(arr[i]>max){
          amount+=max;    //arr>max
          max=arr[i];
        }else{
          amount+=arr[i]; //min<=arr<=max
        }
      }//if
    }//for
    avg = (double)amount/(number-2);
  }//if
  return avg;
}
Last edited by Fernando Garcia on Mon Feb 02, 2015 1:55 pm, edited 1 time in total.
Reason: Please use tags [code] [/code] to post any code here.

Post Number:#4 Post Mon Feb 02, 2015 4:24 pm
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

This module have only 3 wires:

5 V, GND and Analog pin.

Where's the difficult?
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#5 Post Mon Feb 02, 2015 7:59 pm
Posts: 28
Topics: 7
Solve rating: 0
Joined: Sun Jan 25, 2015 7:45 am
Topics: 7
Age: 49
Gender: None specified
National Flag:
Spain
not in this connection that connect but does nothing for me, if not that, or the skecht but the program does not recognize it, and if you do not recognize I'm doing wrong I connect to the analog output 0 and sets in the manual but sees that
Is there to put the skecht which gives the manufacturer or next in ferduino would be worth?
if so how will the skecht gets into Ferduino?


Image


Image
Last edited by Fernando Garcia on Tue Jun 22, 2021 2:47 pm, edited 2 times in total.
Reason: Please use tags to post images [img=left][/img].

Post Number:#6 Post Mon Feb 02, 2015 8:31 pm
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

If this example doesn't work for you, I can't help you because I haven't hardware to test.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#7 Post Tue Feb 03, 2015 11:43 am
Posts: 28
Topics: 7
Solve rating: 0
Joined: Sun Jan 25, 2015 7:45 am
Topics: 7
Age: 49
Gender: None specified
National Flag:
Spain
thanks fernando

but the problem is that no where to put the program within ferduino the connection is easy to appreciate you to tell me where or how to get him
thanks again

Post Number:#8 Post Tue Feb 03, 2015 12:09 pm
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

If the code above doesn't work alone (without Ferduino), add this code to Ferduino won't solve your problem.

Only tell me if the example works or not.

Also show me the result that you can see on serial monitor.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#9 Post Tue Feb 03, 2015 3:06 pm
Posts: 28
Topics: 7
Solve rating: 0
Joined: Sun Jan 25, 2015 7:45 am
Topics: 7
Age: 49
Gender: None specified
National Flag:
Spain
While it finds when it comes to my house and tell you but I get ferduino -276 ph values also in the same amount ORP
or moving the potentiometer but not the values moves
without ferduino I have not tried something I try and tedigo
thx

Post Number:#10 Post Tue Feb 03, 2015 3:40 pm
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

It seems joke!
Ferduino NEVER will work with this pH module without changes on code.
Please buy pieces listed on this topic so, maybe I can help you.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#11 Post Wed Feb 04, 2015 11:44 am
Posts: 28
Topics: 7
Solve rating: 0
Joined: Sun Jan 25, 2015 7:45 am
Topics: 7
Age: 49
Gender: None specified
National Flag:
Spain
anything does not work with the program put in arduino goes blank screen flashes the LED makes loading the program but nothing comes on the display

and if I know that ferduino may not work with this ph meter works with scientific atlas but I'm sure it works well with which I have modified some parameter
if you can help me or know of any page to tell me how to modify these programs you would appreciate
thanks Fernando

Post Number:#12 Post Wed Feb 04, 2015 11:51 am
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Look the result on serial monitor as I told above.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#13 Post Wed Feb 04, 2015 9:24 pm
Posts: 28
Topics: 7
Solve rating: 0
Joined: Sun Jan 25, 2015 7:45 am
Topics: 7
Age: 49
Gender: None specified
National Flag:
Spain
hi fernando
Monitor and look what I brand standard and ph 4.84
I think it works perfectly only what I have to calibrate
Now what do I have to do?
for viewing in arduino?

Post Number:#14 Post Thu Feb 05, 2015 10:39 am
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Hi!

In the tab "Ferduino" change:

boolean Stamps = true;


To:

boolean Stamps = false;


After add:

#define SensorPin A0            //pH meter Analog output to Arduino Analog Input 14
#define Offset 0.00            //deviation compensate
int pHArray[10];   //Store the average value of the sensor feedback
int pHArrayIndex = 0;   
float pHValue;
unsigned long samplingTime = 0;
unsigned long samplingTime1 = 0;
byte samples = 0;


Remember that pin A0 is used for level sensor so, find a free pin.

Then create a new tab and add this code:

void readPh()
{
   if((millis()- samplingTime) > 500)
  {
    pHArray[pHArrayIndex] = analogRead(SensorPin);
    pHArrayIndex++;
    samplingTime = millis();
  }
  if((millis()- samplingTime1) > 5000)
  {
    float voltage = avergearray(pHArray, pHArrayIndex - 1)* 5.0 / 1024;
    pHValue += 3.5 * voltage + Offset;
    samplingTime1 = millis();
    samples++;
    pHArrayIndex = 0;
  }   
  if(samples == 12)
  {
    PHA = pHValue / 12;
    samples = 0;
    pHValue = 0;
  } 
}
double avergearray(int* arr, int number){
  int i;
  int max,min;
  double avg;
  long amount=0;
  if(number<=0){
    Serial.println("Error number for the array to avraging!/n");
    return 0;
  }
  if(number<5){   //less than 5, calculated directly statistics
    for(i=0;i<number;i++){
      amount+=arr[i];
    }
    avg = amount/number;
    return avg;
  }
  else{
    if(arr[0]<arr[1]){
      min = arr[0];
      max=arr[1];
    }
    else{
      min=arr[1];
      max=arr[0];
    }
    for(i=2;i<number;i++){
      if(arr[i]<min){
        amount+=min;        //arr<min
        min=arr[i];
      }
      else {
        if(arr[i]>max){
          amount+=max;    //arr>max
          max=arr[i];
        }
        else{
          amount+=arr[i]; //min<=arr<=max
        }
      }//if
    }//for
    avg = (double)amount/(number-2);
  }//if
  return avg;
}


On loop after:

t = rtc.getTime();


Add:

readPh();


Best regards.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#15 Post Fri Feb 06, 2015 7:15 am
Posts: 28
Topics: 7
Solve rating: 0
Joined: Sun Jan 25, 2015 7:45 am
Topics: 7
Age: 49
Gender: None specified
National Flag:
Spain
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡PERFECT FERNANDO SOLVED¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ^:)^ ^:)^ ^:)^
reads and recognizes only ferduino now I need I calibralo and longer
thank you very much're the best
seguire now trying to place the following modules ETHERNET LED etc .....
if you do not mind if I have any doubt Totra I can consult you with?
many thanks again

Post Number:#16 Post Fri Feb 06, 2015 7:23 am
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Hi!

Glad to hear.

Best regards.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.




Return to Ferduino code





Who is online

Users viewing this topic: No registered users and 0 guests

cron