Ph probe, co2 and solenoid valve

Kurtzisa

Community Member
View Badges
Joined
Mar 21, 2020
Messages
71
Reaction score
61
Location
Parma, Italy
When i control my solenoid valve using the ph probe in reef-pi, every 60 seconds the valve turns off and on, you can see the spike in the graph.
For me there is a bug in the program.

If i turn the solenoid valve on and off manually by the equipment page, i have no spike so i don't have a cable problem

Screenshot_20210512-210457_Chrome.jpg
 
https://www.youtube.com/c/ReefStache
OP
Kurtzisa

Kurtzisa

Community Member
View Badges
Joined
Mar 21, 2020
Messages
71
Reaction score
61
Location
Parma, Italy
I have bought this board


but I have replaced every single cheap chinese relay with an Omron pin-to-pin compatible one,
I'm using a UNL2803A interface from raspberry to relays board
I also have a separate +5V power supply for relays board. I don't remember if the ground is in common but I think I separate it too

I have a three ph-board https://github.com/reef-pi/pH-Board/blob/master/README.md connected together with a 20 cm long cable (total length).

every time I try to use one of my probes to control equipment, I can enter any value in the high or low threshold and the equipment starts to switch off and on continuously, without any reason. For example, now I can read, in my calcium reactor, 6.5 ph, the lower threshold is 6, the high threshold is 9, the equipment (my solenoid valve) start to switch on and off every 30 sec.
The raw value of my probe (i see it in the calibration tab) is from 3865 to 3935, using reef-pi log "sudo journalctl -fu reef-pi.service" i can read

2021/05/13 07:24:29 ph sub-system: Probe: PH-REATTORE Reading: 6.522382974262201
2021/05/13 07:24:30 ph sub-system: Probe: PH-REATTORE Reading: 6.515786549247785
2021/05/13 07:24:31 ph sub-system: Probe: PH-REATTORE Reading: 6.515336792996802
2021/05/13 07:24:32 ph sub-system: Probe: PH-REATTORE Reading: 6.514587199245165
2021/05/13 07:24:33 ph sub-system: Probe: PH-REATTORE Reading: 6.514587199245165
2021/05/13 07:24:34 ph sub-system: Probe: PH-REATTORE Reading: 6.513987524243854
2021/05/13 07:24:35 ph sub-system: Probe: PH-REATTORE Reading: 6.513837605493526
2021/05/13 07:24:36 ph sub-system: Probe: PH-REATTORE Reading: 6.514137442994182

so I can read a nearly stable vale (6.5), if I read the value every 300 seconds I think my solenoid valve turns off and on every 300 seconds but turn on and off every 30 sec instead.

because of that, I think there is a bug in the program.
 
OP
Kurtzisa

Kurtzisa

Community Member
View Badges
Joined
Mar 21, 2020
Messages
71
Reaction score
61
Location
Parma, Italy
ag 13 08:33:13 reef-pi reef-pi[2487]: 2021/05/13 08:33:13 macro-subsystem: executing step: equipment id: 11 state: true
mag 13 08:33:13 reef-pi reef-pi[2487]: 2021/05/13 08:33:13 Euipment: 11 On: true
mag 13 08:33:13 reef-pi reef-pi[2487]: 2021/05/13 08:33:13 macro subsystem. Finished: ON Co2
mag 13 08:33:13 reef-pi reef-pi[2487]: 2021/05/13 08:33:13 macro subsystem. Running: OFF Co2
mag 13 08:33:13 reef-pi reef-pi[2487]: 2021/05/13 08:33:13 macro-subsystem: executing step: equipment id: 11 state: false
mag 13 08:33:13 reef-pi reef-pi[2487]: 2021/05/13 08:33:13 Euipment: 11 On: false
mag 13 08:33:13 reef-pi reef-pi[2487]: 2021/05/13 08:33:13 macro subsystem. Finished: OFF Co2
mag 13 08:33:13 reef-pi reef-pi[2487]: 2021/05/13 08:33:13 ph sub-system: Probe: PH-VASCA Reading: 7.79179845158015
mag 13 08:33:13 reef-pi reef-pi[2487]: 2021/05/13 08:33:13 ph sub-system: Probe: REDOX Reading: 1.168598151408451
mag 13 08:33:13 reef-pi reef-pi[2487]: 2021/05/13 08:33:13 ph sub-system: Probe: PH-REATTORE Reading: 6.530028830528909
mag 13 08:33:13 reef-pi reef-pi[2487]: 2021/05/13 08:33:13 Current value of 'PH-REATTORE' within range switching off control equipments
mag 13 08:33:13 reef-pi reef-pi[2487]: 2021/05/13 08:33:13 macro subsystem. Running: ON Co2
mag 13 08:33:13 reef-pi reef-pi[2487]: 2021/05/13 08:33:13 macro-subsystem: executing step: sleep for 300 seconds
 
OP
Kurtzisa

Kurtzisa

Community Member
View Badges
Joined
Mar 21, 2020
Messages
71
Reaction score
61
Location
Parma, Italy
I have made two macros,

the first one, OFF co2, turn off the equipment co2
the second one, ON co2, wait 300 sec and turn on equipment co2

in the log, I see running both macros!

the program must do these step:

Code:
if (threshold < 6.5) {
       if(co2==on){
              co2=off;
       else
              ;
       }
}
if (threshold > 6.8){
     if(co2==off){
               co2=on;
      else
             ;
      }
}
 
Last edited:
Top Shelf Aquatics

robsworld78

Active Member
View Badges
Joined
Feb 14, 2020
Messages
473
Reaction score
682
Location
Edmonton, Canada
Sorry I can't help with this, it does sound like you're on to something, I think there's some misunderstanding on how to use macros properly or something needs tweaked. When I try to trigger a macro based on a sensor it seems like if there is more than one step it doesn't run properly.
 
OP
Kurtzisa

Kurtzisa

Community Member
View Badges
Joined
Mar 21, 2020
Messages
71
Reaction score
61
Location
Parma, Italy
in my opinion, reef-pi can do a lot of things, but there is a lack of documentation.
for example, I'm used to read 20 years old siemens plc program in my job, every single line have a comment because, after so many years and a lot of people working on it, without comment no-one can understand the program

I can try to learn how to use git-hub, go, and try to work on the reef-pi project, but without comment on the program line, it's hard task to do.
 
OP
Kurtzisa

Kurtzisa

Community Member
View Badges
Joined
Mar 21, 2020
Messages
71
Reaction score
61
Location
Parma, Italy
I made you an example, my plc run in a heavy electromagnetic noise environment, so if I need to read an analog value, I need to make an electronic filtration, built-in analog-in plc module, and software filtration.
For the calibration routine, I read like 20 values, I remove the highest and the smallest value, and I make the average of the rest.
After that, if the actual value is near the previous value ( previous-value +-10% ) I use it, otherwise, i reject it. and so on.

If I read ph 8,2, after 10ms I read ph 4, after 10 ms I read ph 8,2, certainly, the ph4 is an electromagnetic noise

ah, i apologize for my grammatically incorrect English, i woke up at 4 a.m, it's Friday and i'm soo tired!
 

robsworld78

Active Member
View Badges
Joined
Feb 14, 2020
Messages
473
Reaction score
682
Location
Edmonton, Canada
Yeah without comments it's very hard, I've looked in the code a few times but get lost quick.

I like how you filter and average the readings, that's a good thing to do.
 
First Choice

ZaneTer

Well-Known Member
View Badges
Joined
Jan 14, 2018
Messages
903
Reaction score
849
@Kurtzisa

it’s nice to see there are a few other Siemens PLC programmers around here. Why didn’t you choose to go with a small PLC and then interface it with an Arduino for analogue readings?
 
OP
Kurtzisa

Kurtzisa

Community Member
View Badges
Joined
Mar 21, 2020
Messages
71
Reaction score
61
Location
Parma, Italy
@Kurtzisa

it’s nice to see there are a few other Siemens PLC programmers around here. Why didn’t you choose to go with a small PLC and then interface it with an Arduino for analogue readings?
I'm too lazy to do it :p

Seriously, there is a lot of open projects, i found one i like most and i work on it.
I'm a maintainer, so i know to found a bug, to improve the program but i'm not a real programmer. For example, i don't know how to make a graphical interface.
 

ZaneTer

Well-Known Member
View Badges
Joined
Jan 14, 2018
Messages
903
Reaction score
849
I'm too lazy to do it :p

Seriously, there is a lot of open projects, i found one i like most and i work on it.
I'm a maintainer, so i know to found a bug, to improve the program but i'm not a real programmer. For example, i don't know how to make a graphical interface.
The graphical interface is VERY easy to do. Then you can use something like AnyDesk to allow remote access even through your phone.
 

WHAT WATER CHANGE "PERCENTAGE" MAKES IT WORTH DOING?

  • 5% - 10%

    Votes: 74 9.5%
  • 10% - 20%

    Votes: 402 51.7%
  • 20% - 30%

    Votes: 183 23.6%
  • 30% - 40%

    Votes: 25 3.2%
  • 40% - 50%

    Votes: 18 2.3%
  • 50% or more

    Votes: 8 1.0%
  • No water change is worth it

    Votes: 31 4.0%
  • Not sure

    Votes: 13 1.7%
  • Other (please explain in the thread)

    Votes: 23 3.0%
LA
Top