sonda PH
-
Hello, I'm sorry for my Anglish.
I was looking for a connection of soda PH to domoticz. I found one project but it is old and it does not work. There is somebody able to do it, I'm sure it will not be useful to one.#include <Average.h>
Average<float> sredniaPH(100); //średnia ze 100 pomiarów
void setup()
{
Serial.begin(9600);
}
void loop()
{
int Volty = analogRead(A7);
float V =(float) Volty * 5.0 / 1024.0;
float peha =(float) V*3.5;
sredniaPH.push(peha);
sredniaPH.mean();
float pH =((float) sredniaPH.mean());
Serial.println(pH);delay(1000)
}
-
Hi, @szybki946 !
Code in your post is working or not?
If yes - you want to someone modify it, so it will send yourpH
to domoticz from MySensors node?
If yes - if you use nrf24l01+ radio - maybe you want this code:#include <Average.h> #define MY_NODE_ID 100 //set node fixed id #define MY_BAUD_RATE 9600 //set serial baud rate #define MY_RADIO_RF24 //if you use nrf24l01+ #include <MySensors.h> #define PH_CHILD_ID 0 MyMessage ph_msg(PH_CHILD_ID, V_PH); Average<float> sredniaPH(100); //średnia ze 100 pomiarów void presentation() { sendSketchInfo("PH_meter", "1.0"); // Send the sketch version information to the gateway and Controller present(PH_CHILD_ID, S_WATER_QUALITY, "average_ph"); } void setup() { //Serial.begin(9600); //don't need it because of #define MY_BAUD_RATE 9600 } void loop() { int Volty = analogRead(A7); float V =(float) Volty * 5.0 / 1024.0; float peha =(float) V*3.5; sredniaPH.push(peha); sredniaPH.mean(); float pH =((float) sredniaPH.mean()); Serial.println(pH); send(ph_msg.set(pH, 2)); //2 = number of digits after comma wait(1000); //in mysensors do not use delay - use wait() or sleep() }
(change IDs, texts and numbers of digits after comma as you want)