Reef pi and Anyleaf PH Module

trenfrow

New Member
View Badges
Joined
Jun 28, 2021
Messages
4
Reaction score
0
Location
Paso Robles
Rating - 0%
0   0   0
I need some help. I purchased an Anyleaf PH module. https://www.anyleaf.org/ph-module

Wired it up and for some reason Reef pi does not see it. Any help would be awesome. I am sure it is something easy. I am not good at the code. I just need someone to point me in the right direction.

thanks in advance
 

attiland

2500 Club Member
View Badges
Joined
Jul 22, 2020
Messages
2,594
Reaction score
4,800
Location
United Kingdom
Rating - 0%
0   0   0
I need some help. I purchased an Anyleaf PH module. https://www.anyleaf.org/ph-module

Wired it up and for some reason Reef pi does not see it. Any help would be awesome. I am sure it is something easy. I am not good at the code. I just need someone to point me in the right direction.

thanks in advance
I don’t know this model but as per the description you need to use a python script to query the probe.
Assuming you have wired it up correctly (check if you see the board in i2c installed on I2C address: 0×48 or 0x49 (selectable))the software you should able to do;
  • python3 ph_orp.py
This should display the ph reading
Did you get this fare?
If so just a few line to modify and you can pass the reading to a file and that can be picked up by reef-pi

from git; https://github.com/anyleaf/anyleaf-python

Quickstart​

To get started as quickly as possible on Raspberry Pi:

  • Activate I2C (pH and ORP module): Run sudo raspi-config. Select Interfacing Options → I2C → Yes.
  • Activate SPI (RTD temp module): Same as above, but select SPI instead of I2C.
  • Reboot
Then run these commands from a terminal:

 
Last edited:
OP
OP
T

trenfrow

New Member
View Badges
Joined
Jun 28, 2021
Messages
4
Reaction score
0
Location
Paso Robles
Rating - 0%
0   0   0
I don’t know this model but as per the description you need to use a python script to query the probe.
Assuming you have wired it up correctly (check if you see the board in i2c installed on I2C address: 0×48 or 0x49 (selectable))the software you should able to do;
  • python3 ph_orp.py
This should display the ph reading
Did you get this fare?
If so just a few line to modify and you can pass the reading to a file and that can be picked up by reef-pi

from git; https://github.com/anyleaf/anyleaf-python

Quickstart​

To get started as quickly as possible on Raspberry Pi:

  • Activate I2C (pH and ORP module): Run sudo raspi-config. Select Interfacing Options → I2C → Yes.
  • Activate SPI (RTD temp module): Same as above, but select SPI instead of I2C.
  • Reboot
Then run these commands from a terminal:

@attlland ok. I know now that the probe works. now I need to get it to talk to Reefpi.
 
OP
OP
T

trenfrow

New Member
View Badges
Joined
Jun 28, 2021
Messages
4
Reaction score
0
Location
Paso Robles
Rating - 0%
0   0   0
Can you post the script you are using? I can help you to add the few lines to talk to Pi
When I run this bit of code, it spits out data.
import time
import board
import busio
from anyleaf import PhSensor, CalPt, OnBoard

def main():
i2c = busio.I2C(board.SCL, board.SDA)
delay = 1 # Time between measurements, in seconds
phSensor = PhSensor(i2c, delay)

phSensor.calibrate_all(
CalPt(0., 7., 25.), CalPt(0.18, 4., 25.)
)

while True:
print(f"pH: {phSensor.read(OnBoard())}")

time.sleep(delay)


if __name__ == "__main__":
main()

How do I get Reef PI to use this data?
 

attiland

2500 Club Member
View Badges
Joined
Jul 22, 2020
Messages
2,594
Reaction score
4,800
Location
United Kingdom
Rating - 0%
0   0   0
When I run this bit of code, it spits out data.
import time
import board
import busio
from anyleaf import PhSensor, CalPt, OnBoard

def main():
i2c = busio.I2C(board.SCL, board.SDA)
delay = 1 # Time between measurements, in seconds
phSensor = PhSensor(i2c, delay)

phSensor.calibrate_all(
CalPt(0., 7., 25.), CalPt(0.18, 4., 25.)
)

while True:
print(f"pH: {phSensor.read(OnBoard())}")

time.sleep(delay)


if __name__ == "__main__":
main()

How do I get Reef PI to use this data?
You have put the reading to a file so reef-pi can read it. I will able to change this code for you so you can ran it and write to a file for you on Monday
 

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,058
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
butt @attiland mentioned, you have to update the code to write the data into a file. and do so in a loop, say after every 1 minute. and then in reef-pi you add a file driver (configuration ->drivers -> new) that reads that file. With the file driver added, next create an analog connector that will use the new driver (based on the file your python script is generating) . Once you have the analog connector, you can use it with ph controller.
 

theatrus

Valuable Member
View Badges
Joined
Mar 26, 2016
Messages
1,958
Reaction score
3,355
Location
Sacramento, CA area
Rating - 0%
0   0   0
Hey - AnyLeaf creator here. Let me know if there's anything I can do to help adapt the code to work with Reef pi.

Glad to see more module makers around :) (Its hard to keep up with demand sometimes)

The simplest integration now with Reef-Pi would be to make a canned daemon which reads sensors and writes results to a file (preferably in tmpfs) - the file driver can pick it up.

If you want to integrate directly you can add a driver here (and a few other places in the UI): https://github.com/reef-pi/drivers - the other pH drivers are (all?) I2C as well so its easy to adapt.

I see you have a few Rust MCU examples, which is cool as I've been dabbling in that space as well.
 

eves65

New Member
View Badges
Joined
Jan 24, 2010
Messages
1
Reaction score
0
Location
italy
Rating - 0%
0   0   0
@attlland ok. Ora so che la sonda funziona. ora ho bisogno di farlo parlare con Reefpi.
ciao anche io, ho recentemente acquistato i moduli ph e orp anyleaf.... puoi dirmi come lo fai parlare con reef-pi?
Seve

Translation:
hello me too, i recently bought the ph and orp modules anyleaf .... can you tell me how you make it talk to reef-pi?
 
Last edited by a moderator:

Reefing threads: Do you wear gear from reef brands?

  • I wear reef gear everywhere.

    Votes: 17 15.3%
  • I wear reef gear primarily at fish events and my LFS.

    Votes: 6 5.4%
  • I wear reef gear primarily for water changes and tank maintenance.

    Votes: 0 0.0%
  • I wear reef gear primarily to relax where I live.

    Votes: 18 16.2%
  • I don’t wear gear from reef brands.

    Votes: 62 55.9%
  • Other.

    Votes: 8 7.2%
Back
Top