Quantcast
Channel: Sensors - Arduino Forum
Viewing all articles
Browse latest Browse all 1079

PH sensor out of range readings being sent to another arduino using hc-12 transceiver

$
0
0

So I have a boat robot it has a ph level sensor, the value of ph sensor being sent to hc-12 is accurate when being powered through USB to pc/laptop, but when powered by battery with buck converter the data being sent is out of range to the water buffer the ph sensor being submerged.

This is how I get and send the ph value to another microcontroller:

float readPH() {
  int measuring = 0;
  for (int i = 0; i < samples; i++) {
    measuring += analogRead(PHpin);
    delay(10);
  }
  float voltage = 5.0 / adc_resolution * (measuring / samples);
  return phLevel = ph(voltage);
  
}
void transmitPHLevel() {
  unsigned long currentTime = millis();
  if (currentTime - lastPHTransmitTime >= phTransmitInterval) {
    lastPHTransmitTime = currentTime;
    phLevel = readPH(); // Implement this to get the actual pH sensor reading
    hc12.print("PH");
    hc12.println(phLevel);
  }
}

I tested the voltage coming through the ph-4502c it is 5v when powered through battery, and when powered through pc/laptop 4.89 ranging up and down

I cant solve this problem.

3 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 1079

Trending Articles