reef-pi :: An opensource reef tank controller based on Raspberry Pi.

Michael Lane

Well-Known Member
View Badges
Joined
Aug 11, 2018
Messages
677
Reaction score
1,123
Rating - 0%
0   0   0
The circuit is in heatshrink but if I remember correctly it's a just a 10k resistor splitting the ground wire.

Here's the main bit of the python script...

Code:
def my_callback(channel):
    if GPIO.input(8) == GPIO.HIGH:
        print('\n FLOAT at ' + str(datetime.datetime.now()))
        log = open("current_water_level.txt", "w")
        print (('OK | Last flipped at ' + str(datetime.datetime.now())), file = log)
    else:
        print('\n SINK at ' + str(datetime.datetime.now()))
        log = open("current_water_level.txt", "w")
        print (('Low | Last flipped at ' + str(datetime.datetime.now())), file = log)

GPIO.setmode(GPIO.BCM)
GPIO.setup(8, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.add_event_detect(8, GPIO.BOTH, callback=my_callback)

It's run every few minutes via cron and the status is broadcast via mqtt to my home assistant server which can send out alerts & trigger the top off. I'd prefer getting it into reef-pi so I can trigger the top off directly.
The python script seems to configure the IO with pull down instead of pull up. This makes it seem like the switch should be wired to 3v3 and GPIO.
 

pickupman66

5000 Club Member
View Badges
Joined
Aug 10, 2010
Messages
6,032
Reaction score
1,166
Location
Winchester, TN
Rating - 0%
0   0   0
Yes, wavemaker is definitely a thing for 3.0 . Theres an existing issue on providing finer grain pwm (say 12bit) control as well. I have already mentioned there that we want to incremenet/decrement interval customizable as well. Together this two will allow us to generate any arbitrary pwm profile. I think we'll introduce a wave profile similar to light profile.
Even in 2.0 reef-pi will provide a jack control api , i.e. users can write a script to directly control the PWM values and generate pretty much anything. at that level (connectors), reef-pi does not really know its light or pump, user can do whatever they want.
@ranjib can you provide some direction on where I can learn to write such a script and how to apply it with reef pi?
 

Johan Fe Scheepers

New Member
View Badges
Joined
Nov 4, 2018
Messages
16
Reaction score
27
Location
Drummond, KZN, South Africa
Rating - 0%
0   0   0
Hi,

I am new to the build , have thought looked and followed it for sometime. I am now starting my build and need a bit of help please.

How doe you restart the reef-pi?

Have run "sudo systemctl restart reef-pi.service"

But still getting

* reef-pi.service - raspberry pi based reef tank controller
Loaded: loaded (/lib/systemd/system/reef-pi.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sun 2018-11-04 20:54:19 SAST; 11s ago
Process: 1509 ExecStart=/usr/bin/reef-pi -config /etc/reef-pi/config.yml (code=exited, status=1/FAILURE)
Main PID: 1509 (code=exited, status=1/FAILURE)
Nov 04 20:54:19 Tank systemd[1]: reef-pi.service: Unit entered failed state.
Nov 04 20:54:19 Tank systemd[1]: reef-pi.service: Failed with result 'exit-code'.


Running attest Noobs and reef-pi-2.0.0-beta-pi3.deb
 
OP
OP
Ranjib

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
Hi,

I am new to the build , have thought looked and followed it for sometime. I am now starting my build and need a bit of help please.

How doe you restart the reef-pi?

Have run "sudo systemctl restart reef-pi.service"

But still getting

* reef-pi.service - raspberry pi based reef tank controller
Loaded: loaded (/lib/systemd/system/reef-pi.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sun 2018-11-04 20:54:19 SAST; 11s ago
Process: 1509 ExecStart=/usr/bin/reef-pi -config /etc/reef-pi/config.yml (code=exited, status=1/FAILURE)
Main PID: 1509 (code=exited, status=1/FAILURE)
Nov 04 20:54:19 Tank systemd[1]: reef-pi.service: Unit entered failed state.
Nov 04 20:54:19 Tank systemd[1]: reef-pi.service: Failed with result 'exit-code'.


Running attest Noobs and reef-pi-2.0.0-beta-pi3.deb
Welcome to reef2reef, you'll love it here :) . We need bit more of the logs to understand why reef-pi is failing. Can you run:
Code:
journalctl -u reef-pi.service
 
OP
OP
Ranjib

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
Welcome to reef2reef, you'll love it here :) . We need bit more of the logs to understand why reef-pi is failing. Can you run:
Code:
journalctl -u reef-pi.service
Also share any details around the build you may have: like reef-pi version, pi version, circuit etc.
 

sfgabe

Active Member
View Badges
Joined
Sep 7, 2018
Messages
167
Reaction score
264
Rating - 0%
0   0   0
I don't see anything suspicious here. Things should work. Is is possible for you to check the log? Like, declare an inlet with GPIO 8 and associate it with an ATO, and set the check interval to 5 second (for example), and see what reef-pi says, when you put the float switch in and out of water
Code:
journalctl -fu reef-pi.service
It gives a float value of 1, regardless of the actual float position.
Code:
ReefControlPi reef-pi[25376]: 2018/11/04 14:27:07 ato sub-system:  sensor Float1 value: 1

(running 2.0.0-rc2)
 
OP
OP
Ranjib

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
OP
OP
Ranjib

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
It gives a float value of 1, regardless of the actual float position.
Code:
ReefControlPi reef-pi[25376]: 2018/11/04 14:27:07 ato sub-system:  sensor Float1 value: 1

(running 2.0.0-rc2)
This means reef-pi is reading it always on... I think its highly unlikely that we have a driver bug in reef-pi, and we are missing something else here, likely configuration related. Did you already shared your configuration screenshot? If not please do, connectors (inlet GPIO 8 ?? ) and ato details (check interval, control pump etc). I just tested ATO again with master (rc-2) release, and I could not find a bug. I am doing a whole lot of field testing now, and will hate to ship reef-pi with bugs like this (if it turns out) :-( . If your issue does not resolve, then I'll create a dedicated issue on this in github and I'll try to reproduce this with actual circuit. I have spare float switches, so no issue on getting this physically verified.
 

sfgabe

Active Member
View Badges
Joined
Sep 7, 2018
Messages
167
Reaction score
264
Rating - 0%
0   0   0
This means reef-pi is reading it always on... I think its highly unlikely that we have a driver bug in reef-pi, and we are missing something else here, likely configuration related. Did you already shared your configuration screenshot? If not please do, connectors (inlet GPIO 8 ?? ) and ato details (check interval, control pump etc). I just tested ATO again with master (rc-2) release, and I could not find a bug. I am doing a whole lot of field testing now, and will hate to ship reef-pi with bugs like this (if it turns out) :-( . If your issue does not resolve, then I'll create a dedicated issue on this in github and I'll try to reproduce this with actual circuit. I have spare float switches, so no issue on getting this physically verified.

I switched it to pin 7 to make sure there was no conflict with the python script. Also, I tried the inlet in "reverse" mode and then it reads as "0" in all positions instead of "1".

Config:
Screen Shot 2018-11-04 at 2.40.53 PM.png

ATO:
Screen Shot 2018-11-04 at 2.38.10 PM.png
 

Johan Fe Scheepers

New Member
View Badges
Joined
Nov 4, 2018
Messages
16
Reaction score
27
Location
Drummond, KZN, South Africa
Rating - 0%
0   0   0
This means reef-pi is reading it always on... I think its highly unlikely that we have a driver bug in reef-pi, and we are missing something else here, likely configuration related. Did you already shared your configuration screenshot? If not please do, connectors (inlet GPIO 8 ?? ) and ato details (check interval, control pump etc). I just tested ATO again with master (rc-2) release, and I could not find a bug. I am doing a whole lot of field testing now, and will hate to ship reef-pi with bugs like this (if it turns out) :-( . If your issue does not resolve, then I'll create a dedicated issue on this in github and I'll try to reproduce this with actual circuit. I have spare float switches, so no issue on getting this physically verified.

Have a pi - 3 B and configured pin18 for equipment, just switching a led on and off.

Ran
sudo systemctl stop reef-pi.service
sudo rm -rf /var/lib/reef-pi/reef-pi.db
sudo systemctl start reef-pi.service

So it is up and running now

upload_2018-11-4_21-57-29.png


upload_2018-11-4_21-58-6.png
 
OP
OP
Ranjib

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
The python script seems to configure the IO with pull down instead of pull up. This makes it seem like the switch should be wired to 3v3 and GPIO.
But it should still not make any difference right?

Assuming its GPIO 8 (inlet), we can do low level verification like this:
Code:
cat /sys/class/gpio/gpio8/value
 
OP
OP
Ranjib

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
Have a pi - 3 B and configured pin18 for equipment, just switching a led on and off.

Ran
sudo systemctl stop reef-pi.service
sudo rm -rf /var/lib/reef-pi/reef-pi.db
sudo systemctl start reef-pi.service

So it is up and running now

upload_2018-11-4_21-57-29.png


upload_2018-11-4_21-58-6.png
Can you upgrade to rc-2? There were bugs where if you have pca9685 enabled but not present in circuit, reef-pi will crash fatally
 

crusso1993

7500 Club Member
View Badges
Joined
Oct 21, 2018
Messages
8,671
Reaction score
44,648
Location
SW, FL, USA
Rating - 0%
0   0   0
Can you upgrade to rc-2? There were bugs where if you have pca9685 enabled but not present in circuit, reef-pi will crash fatally
"Crash fatally".... sounds a little daunting! Lol
 
OP
OP
Ranjib

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
"Crash fatally".... sounds a little daunting! Lol
yeah, if reef-pi is not running, we call it fatal. Generally we try to make reef-pi work, even if things are not in good state, at least be running and show errors.
 

Diamond1

Valuable Member
View Badges
Joined
Oct 17, 2013
Messages
1,368
Reaction score
1,911
Location
Cleveland Ohio
Rating - 0%
0   0   0
I'm having an issue with setting up my optical sensor. I set it up on the inlet tab, I'm able to set the sensor up in the ATO section, assign it to an outlet and save the setting for it. Then regardless of the sensor being in or out of water it turns the outlet on and wont shut off even after the sensor is re submerged in water.

I ran: cat /sys/class/gpio/gpio17/value and it says 0 even when the equipment tab shows the #2 outlet to be on. I also get an error message {"error":"stats for id: '2' not found"} | HTTP 404

I thought maybe it was a problem with the circuit so I pulled everything apart and set the same circuit up on a bread board and got the same results.
I'm running reef pi version 2.0.0-rc2 on a pi-3
 

High pressure shells: Do you look for signs of stress in the invertebrates in your reef tank?

  • I regularly look for signs of invertebrate stress in my reef tank.

    Votes: 39 32.5%
  • I occasionally look for signs of invertebrate stress in my reef tank.

    Votes: 28 23.3%
  • I rarely look for signs of invertebrate stress in my reef tank.

    Votes: 23 19.2%
  • I never look for signs of invertebrate stress in my reef tank.

    Votes: 30 25.0%
  • Other.

    Votes: 0 0.0%
Back
Top