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

robsworld78

Well-Known Member
View Badges
Joined
Feb 14, 2020
Messages
985
Reaction score
1,325
Location
Edmonton, Canada
Rating - 0%
0   0   0
I have the 12v pump with the cable cut and plugged into the green connector. It goes to DC port 1. I have a legit float valve connected in the float valve spot. Sensor is in No contact with the NC jumper.

The sensor did have to be flipped to "reverse" to work properly.

Macro is sensor 2 - turn on DC1, 1 second interval. Alarm at 60 seconds.

Right now it's not even working. I might have tuned it too high on the detection level. It's a bit finicky.
Thanks, I was thinking you were using it for ATO, that's great you added the float switch to the DC1 backup port, that will turn off the DC port no matter what and would stop the pump in the reboot scenario you came across.

It is normal to have to change the "reverse" setting for the non-contact sensor, that's just how they work for ATO usage. I forgot to mention about that screw in the back of the sensor, it seems to be for the sensitivity of the sensor but when turned to much it can act a little strange. If the red light goes on/off based on water or your hand it should be ok. As you have the backup float switch installed it's important that's always in the correct position or the DC port won't turn on.

For the macro maybe try using the "equipment" selection in the ATO settings instead of the macro. When you change to equipment you can select DC1 and setup alerts from it, shouldn't need to use the macros for that.
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
978
Location
Germany
Rating - 0%
0   0   0
Looks like you did hit a bug. The DC ports are setup to turn off if no signal is present so I just did a test, when reef-pi is rebooted the pca9685 isn't reset or turned off.

How are you using the DC port?

@Ranjib I tested this with v5.3 by setting up a dosing pump in reef-pi using a pin from the pca9685, if the dose is running and reef-pi is rebooted the signal from the pca9685 is still present when it comes back online keeping the dose running until the next schedule comes around to turn it off. Might be rare that happens but could be serious if/when it does. To test have the dose running then in admin tab press the reboot button and you'll see it.

(...)
That's not a bug, it's a "feature". The PCA9685 is a stand-alone chip, as long as it has power, it will continue running the PWM signals it has been set to put out.

Only if you cut power or if Reef-Pi is programmed to reset all I2C components on reboot/power off, you will see these turn off. Maybe you could integrate that in Reef-Pi itself and in the drivers @Ranjib ? E.g. all drivers get a reset message from Reef-Pi on reboot/power off (maybe even make this an option, as you might not want this for some drivers) and drivers with output then reset all outputs, like the PCA9685 ?
 

robsworld78

Well-Known Member
View Badges
Joined
Feb 14, 2020
Messages
985
Reaction score
1,325
Location
Edmonton, Canada
Rating - 0%
0   0   0
That's not a bug, it's a "feature". The PCA9685 is a stand-alone chip, as long as it has power, it will continue running the PWM signals it has been set to put out.

Only if you cut power or if Reef-Pi is programmed to reset all I2C components on reboot/power off, you will see these turn off. Maybe you could integrate that in Reef-Pi itself and in the drivers @Ranjib ? E.g. all drivers get a reset message from Reef-Pi on reboot/power off (maybe even make this an option, as you might not want this for some drivers) and drivers with output then reset all outputs, like the PCA9685 ?
Yeah for sure resetting the pca9685 is a feature of it, calling it a bug in reef-pi isn't accurate, more like an oversight, I just tend to call anything unexpected a bug. There's a command that can be sent to the pca9685 which will turn off all outputs or another to reset it, if that was added to the startup function it would be nice, I don't think leaving it like this is good.
 
Last edited:

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
978
Location
Germany
Rating - 0%
0   0   0
@Ranjib What would be the easiest way to add a driver for any EC circuit I program ?
I think I can support quite a range if interfaces, like Serial, SPI, I2C and http/https over WiFi.

I'm currently thinking about I2C and an option for https
 

MikeSpike

Community Member
View Badges
Joined
Jan 2, 2019
Messages
79
Reaction score
52
Rating - 0%
0   0   0
Hi all,

Word of warning for all Reef Pi users. I went away for a couple of weeks with a neighbour watching over my tank and feeding every couple of days together with close my close monitoring via Reef Pi. He alerted me that the tank was a little quiet a couple of days ago, I tried to logon to Reef Pi (via VNC) but it didn't work (I didn't think anything of it and I assumed it was something with VNC). Unfortunately I retuned last night to a tank at 35/95 Celsius/Farenheight and full of dead livestock.

I tried logging into the app via the usual home WIFI - but I still couldn't and had to power cycle the whose raspberry pi and which point I was able to login and I received a flurry of emails that the temperature was too high.

It appears the app/raspberry pi crashed with the heater in the 'on' position. For reference, I'm using a full system built by robo-tank (although to be clear this wasn't hardware related - the relay is working perfectly).

This isn't a complaint or moan I am very grateful to Ranjib and all the other developers of this free platform but:

1. I would strongly advise everyone to invest in an audible temperature alarm (can be bought off Amazon for < $10). I have literally lost 000's of dollars by not having this.
2. I would advise against using a non-thermostatic heater (i had a 500W titanium heater)
3. I would be happy to share any files/more information from my Reef Pi instance that would help prevent this happening again
 

elysics

Valuable Member
View Badges
Joined
Jan 15, 2020
Messages
1,591
Reaction score
1,590
Rating - 0%
0   0   0
Hi all,

Word of warning for all Reef Pi users. I went away for a couple of weeks with a neighbour watching over my tank and feeding every couple of days together with close my close monitoring via Reef Pi. He alerted me that the tank was a little quiet a couple of days ago, I tried to logon to Reef Pi (via VNC) but it didn't work (I didn't think anything of it and I assumed it was something with VNC). Unfortunately I retuned last night to a tank at 35/95 Celsius/Farenheight and full of dead livestock.

I tried logging into the app via the usual home WIFI - but I still couldn't and had to power cycle the whose raspberry pi and which point I was able to login and I received a flurry of emails that the temperature was too high.

It appears the app/raspberry pi crashed with the heater in the 'on' position. For reference, I'm using a full system built by robo-tank (although to be clear this wasn't hardware related - the relay is working perfectly).

This isn't a complaint or moan I am very grateful to Ranjib and all the other developers of this free platform but:

1. I would strongly advise everyone to invest in an audible temperature alarm (can be bought off Amazon for < $10). I have literally lost 000's of dollars by not having this.
2. I would advise against using a non-thermostatic heater (i had a 500W titanium heater)
3. I would be happy to share any files/more information from my Reef Pi instance that would help prevent this happening again
Best practice is to always have two controls on any heater. If you've got a heater without thermostat that means heater+inkbird+reef-pi for example

Curious why it crashed though
 

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,349
Reaction score
1,724
Location
Missouri
Rating - 0%
0   0   0
@robsworld78 Might have a bug, if you hit reboot while the DC pump is on, it remains on. I'm not sure how much that matters, but something worth noting.


After I remembered to put the NC jumper on, my NC sensor started working... (Once I flipped it to "reverse") and now I have an ATO!

My only complaint now is I hate the chart so far, for that particular device. Trying to track how much it runs right now. I'll report back.


I also keep getting over use macro emails. Saying my timeout of 60 seconds is being hit. Even though the pump isn't on? I'm pretty confused about that.
^this might be due to me being a *******, I've tuned the sensor some more with a screwdriver behind the panel, we'll see!
^Yeah the alert keeps going off, but the pump isn't running. Probably because the sensor is in reverse?


Edit: Weird, it's still sending alerts even after the alerts are turned off for the macro. I had to turn telemetry off entirely.

Looks like you did hit a bug. The DC ports are setup to turn off if no signal is present so I just did a test, when reef-pi is rebooted the pca9685 isn't reset or turned off.

How are you using the DC port?

@Ranjib I tested this with v5.3 by setting up a dosing pump in reef-pi using a pin from the pca9685, if the dose is running and reef-pi is rebooted the signal from the pca9685 is still present when it comes back online keeping the dose running until the next schedule comes around to turn it off. Might be rare that happens but could be serious if/when it does. To test have the dose running then in admin tab press the reboot button and you'll see it.

Sorry can't help with the emails, something isn't right, maybe @Ranjib has some thoughts.

FYI I just wanted to throw this out there, YMMV and this is just my .02 but I had an issue long ago with pca9685 that was stuck in the on position on my doser port, in my case I was around when it happened and caught it but even a reboot and the port still runs...I still have that board and its still in the stuck position, no idea why but that was a valuable lesson at least for me, I no longer have my dosers hooked up to PCA/PWM ports since there are just IMHO to many failure modes that they can get stuck on. I have gone to outlet/timer controlled dosers and will not use the PCA9685 for anything but lights, if a light gets stuck on big deal but I will not use them for dosing ports. I have some posts that should what I am using for dosing but by choosing the rpm of the motor and swapping tubing I can dial in the rates that I need, I have nano tanks and doesn't take a lot to throw them off and a stuck doser is bad juju...:)

If anyone wants to know more about how I have things setup, I have extensive timers that force stuff off when it should be off regardless, timer/cron is great at that. :)
 

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,349
Reaction score
1,724
Location
Missouri
Rating - 0%
0   0   0
Hi all,

Word of warning for all Reef Pi users. I went away for a couple of weeks with a neighbour watching over my tank and feeding every couple of days together with close my close monitoring via Reef Pi. He alerted me that the tank was a little quiet a couple of days ago, I tried to logon to Reef Pi (via VNC) but it didn't work (I didn't think anything of it and I assumed it was something with VNC). Unfortunately I retuned last night to a tank at 35/95 Celsius/Farenheight and full of dead livestock.

I tried logging into the app via the usual home WIFI - but I still couldn't and had to power cycle the whose raspberry pi and which point I was able to login and I received a flurry of emails that the temperature was too high.

It appears the app/raspberry pi crashed with the heater in the 'on' position. For reference, I'm using a full system built by robo-tank (although to be clear this wasn't hardware related - the relay is working perfectly).

This isn't a complaint or moan I am very grateful to Ranjib and all the other developers of this free platform but:

1. I would strongly advise everyone to invest in an audible temperature alarm (can be bought off Amazon for < $10). I have literally lost 000's of dollars by not having this.
2. I would advise against using a non-thermostatic heater (i had a 500W titanium heater)
3. I would be happy to share any files/more information from my Reef Pi instance that would help prevent this happening again
First off really hate to hear this and sorry for the loss, I'm still trying to get my tank to where I have a lot of coral but I have fish and really would be bummed if that happened, I know they are just fish but man you get attached to them. I haven't been in the game for very long about 4-5 years but I have learned a lot and have read all the horror stories and have tried to minimize the risks as much as possible, here are some things to think about for anyone in the future.

I think the audible alarms are a good idea but I think there are several other things one can do also. @elysics touched on this but wanted to add to it, the main reason I started running a reef-pi was to monitor tank temp and turn off my heater since from what I gather its probably the most common thing that can happen. My rules are I go with 2 small heaters where it takes both to maintain temp and have a spare on hand. The idea is if they get stuck in the on position a single heater will not heat the tank up by itself and give you time to correct the issue. You make a good point if reef-pi is controlling them and they are not thermostatic then both could be stuck in the on position and that is what @elysics pointed out, if you are going to run with those heaters then having a secondary back up controller like a runco (inkbirds work I just trust runco more) is the way to go and I think that is a best practice when not using a heater with a thermostatic control. FYI Inkbirds and other controllers do also fail so in the case with a non termostatic heater you really should have a backup. Something else to think about, where your heaters are plugged into, I have 2 outlet banks, one is wired to reef-pi and the other is using a wifi tpllink kasa strip. If reef-pi locks up I can still get access to the kasa strip and in my case I would have one heater on each strip and I could turn off the heater and not have to have reef-pi operating, by turning off one I would be assured that a single heater could not continue to heat my tank. Lots of ways to do it but with all this stuff you need to have backups and more backups, unfortunately.

Now in regards to reef-pi here are some additional things to think about, I would like to know what rpi version you were running and what reef-pi software version would be helpful to go through the logs and maybe pinpoint what may have caused the issue. At least for me, for reef-pi I only run the bare minimum that I can get away with, no gui, really just reef-pi and a basic OS install, I think they call it the lite version. It's not that you cannot run other things but just provides more opportunities for bugs etc, I like to keep things lean and mean. The other thing that I do is to have a separate device on UPS and stable that monitors reef-pi instance, this can be a simple ping routine or in my case I have grafana instance running that is pulling data from my reef-pi instance, I get notified if the return pump power is cut and other notifications, if it cannot reach reef-pi for whatever reason I get notified and then I can take action to figure out what the issue is. It's all software and there are lots of things that can go south and you just need to get notified that reef-pi is not responding. I would also suggest you look into tailscale vs VNC, not sure if you were port forwarding but at least for me tailscale ( https://tailscale.com/ ) is a more secure way to do things and much lighter weight with less software. What ever you decide to have as your monitor device you can also have tailscale connect to it also and you could then troubleshoot remotely etc.

I just posted on dosing above but the rules are the same for all of these functions that we are automating, things can go wrong and often do, just need to try to have checks and balances and learn and refine as we move forward, again sorry for your loss.
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
978
Location
Germany
Rating - 0%
0   0   0
FYI I just wanted to throw this out there, YMMV and this is just my .02 but I had an issue long ago with pca9685 that was stuck in the on position on my doser port, in my case I was around when it happened and caught it but even a reboot and the port still runs...I still have that board and its still in the stuck position, no idea why but that was a valuable lesson at least for me, I no longer have my dosers hooked up to PCA/PWM ports since there are just IMHO to many failure modes that they can get stuck on. I have gone to outlet/timer controlled dosers and will not use the PCA9685 for anything but lights, if a light gets stuck on big deal but I will not use them for dosing ports. I have some posts that should what I am using for dosing but by choosing the rpm of the motor and swapping tubing I can dial in the rates that I need, I have nano tanks and doesn't take a lot to throw them off and a stuck doser is bad juju...:)

If anyone wants to know more about how I have things setup, I have extensive timers that force stuff off when it should be off regardless, timer/cron is great at that. :)
For anybody‘s interest: as I wrote earlier, the PCA 9685 is stand alone, so the only thing that helps currently is to power off the whole system.
One could also implement a kind of „panic button“ in reef-Pi, that resets/turns off all critical equipment similar to what I suggested earlier when resetting/rebooting/powering off Reef-Pi itself.
 

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,349
Reaction score
1,724
Location
Missouri
Rating - 0%
0   0   0
For anybody‘s interest: as I wrote earlier, the PCA 9685 is stand alone, so the only thing that helps currently is to power off the whole system.
One could also implement a kind of „panic button“ in reef-Pi, that resets/turns off all critical equipment similar to what I suggested earlier when resetting/rebooting/powering off Reef-Pi itself.
In my case rebooting did not fix the issue, I still have the board and that one pwn pin comiong from the pca9685 is stuck on, I do not know if its the pca9685 itself or a resistor etc but even rebooting that pin is still on regardless...:(
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
978
Location
Germany
Rating - 0%
0   0   0
In my case rebooting did not fix the issue, I still have the board and that one pwn pin comiong from the pca9685 is stuck on, I do not know if its the pca9685 itself or a resistor etc but even rebooting that pin is still on regardless...:(
That’s exactly what I meant, rebooting the PI doesn’t help, since the PCA9685 stores the settings locally. only power cycling the PCA9685, e.g. power cycling the whole system, has a chance of resetting that pin.
 

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,349
Reaction score
1,724
Location
Missouri
Rating - 0%
0   0   0
That’s exactly what I meant, rebooting the PI doesn’t help, since the PCA9685 stores the settings locally. only power cycling the PCA9685, e.g. power cycling the whole system, has a chance of resetting that pin.
Yeah sorry rebooting was a bad term, In my case I have a failure even power cycle did not reset the pin, like I said I have it as a spare board and I can power that board up and its still on...:)
 

elysics

Valuable Member
View Badges
Joined
Jan 15, 2020
Messages
1,591
Reaction score
1,590
Rating - 0%
0   0   0
hi elysics so I registered the nous a1t and set it up in reef-pi. Thanks a lot for this. I assume that the a1t are only for switching and cannot use the power consumed in the ree-pi?
Hey sorry that I just come back to you now, you forgot the @ in front of my name for the tag to work.

yes it is possible.

I was going to change the code of the tasmota driver directly, but laziness won out and I used the file driver for that too. Didn't want to confuse you with even more code during setup

Again, this is only a lazy solution, not perfect code.

First, on your pi, install jq:

Code:
sudo apt-get install jq

Then, in your home folder, or somewhere else, create a folder just for the currents to keep everything neat, I chose /home/pi/currents, and then go into that folder:

Code:
mkdir /home/pi/currents
cd /home/pi/currents

Then create a script currscript.sh:

Code:
echo "curl -s http://\$1/cm?cmnd=STATUS+10 | jq '.StatusSNS.ENERGY.Current'>/home/pi/currents/snsCurr\$1">/home/pi/currents/currscript.sh

sudo chmod +x currscript.sh

Then create another script requestCurrs.sh that calls the first one for all the ips of your plugs, my ips are examples:

Code:
echo "/home/pi/currents/currscript.sh 192.168.178.25
/home/pi/currents/currscript.sh 192.168.178.26
/home/pi/currents/currscript.sh 192.168.178.27" >/home/pi/currents/requestCurrs.sh

sudo chmod +x requestCurrs.sh


Then, again, schedule the last script to run regularly, I chose every 20 seconds, but you can do every minute, it takes a couple seconds to run, type "crontab - e"
And add the following line at the end:
Code:
* * * * * /bin/bash -c ' for i in {1..3}; do /home/pi/currents/requestCurrs.sh; sleep 20; done'

Then you should have text files in the currents folder named something like snsCurr192.168.178.25 or whatever the ip address of that particular plug is, that text file contains the current measurement.

Go into reef pi, Configuration->Drivers

And add a file-analog driver per plug and and input the path to the corresponding file like /home/pi/currents/snsCurr192.168.178.25

Then configuration->connectors->analog inputs and add a input per newly created driver, pin 0

Then go into the pH menu and add a pH Probe per newly created connector, check frequency 20 seconds or whatever period you chose, chart minimum 0, chart maximum whatever makes sense for your device, chart unit you can use "A" for Ampere if you want.

Then you can add those "pH probes" to your dashboard and/or do logic with them or whatever you want.

And now my fingers are sore from typing this on a phone, I hope there are no typos in the code

Edit: if you don't want current but actually power that works too, use

Code:
.StatusSNS.ENERGY.Power

Or

Code:
.StatusSNS.ENERGY.ApparentPower

In the first script instead


Edit2: fixed the crontab code
 
Last edited:

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
978
Location
Germany
Rating - 0%
0   0   0
Yeah sorry rebooting was a bad term, In my case I have a failure even power cycle did not reset the pin, like I said I have it as a spare board and I can power that board up and its still on...:)
Interesting, that would suggest that the Pin is either fried internally, or that the settings are saved by an EEPROM or FLASH.
 

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,349
Reaction score
1,724
Location
Missouri
Rating - 0%
0   0   0
Interesting, that would suggest that the Pin is either fried internally, or that the settings are saved by an EEPROM or FLASH.
Yeah there is no eeprom or flash, I believe that pin has failed in a closed manner, @robsworld78 mention that it could be a resistor that the pca9685 uses in the pathway but I've just never taken the time to fully debug it, I had spares and swapped the whole board out its one of these - https://www.tindie.com/products/ranthalion/ml-reef-pi-hat-goby/#specs but it showed me that pca's can fail and in terms of dosing could be a bad thing so I no longer do any dosing with a pca9685 driven doser, thats just me being paranoid but once I saw it happen that was enough for me...:)

I will drive lights with them but thats about it.
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
978
Location
Germany
Rating - 0%
0   0   0
Yeah there is no eeprom or flash, I believe that pin has failed in a closed manner, @robsworld78 mention that it could be a resistor that the pca9685 uses in the pathway but I've just never taken the time to fully debug it, I had spares and swapped the whole board out its one of these - https://www.tindie.com/products/ranthalion/ml-reef-pi-hat-goby/#specs but it showed me that pca's can fail and in terms of dosing could be a bad thing so I no longer do any dosing with a pca9685 driven doser, thats just me being paranoid but once I saw it happen that was enough for me...:)

I will drive lights with them but thats about it.
Same here, I might use PWM to regulate the speed, but the ultimate on/off happens with an I/O Pin of the PI.
 

eggi55

Community Member
View Badges
Joined
Sep 18, 2022
Messages
63
Reaction score
52
Location
germany
Rating - 0%
0   0   0
Hello @Ranjib
I have a 1-wire relay card there; 8 relays 220V with DS2408 chipset
if you would use that you would have 8 gpios freely available. I also have this card for USB
1666903789265.png
 

eggi55

Community Member
View Badges
Joined
Sep 18, 2022
Messages
63
Reaction score
52
Location
germany
Rating - 0%
0   0   0
Hey sorry that I just come back to you now, you forgot the @ in front of my name for the tag to work.

yes it is possible.

I was going to change the code of the tasmota driver directly, but laziness won out and I used the file driver for that too. Didn't want to confuse you with even more code during setup

Again, this is only a lazy solution, not perfect code.

First, on your pi, install jq:

Code:
sudo apt-get install jq

Then, in your home folder, or somewhere else, create a folder just for the currents to keep everything neat, I chose /home/pi/currents, and then go into that folder:

Code:
mkdir /home/pi/currents
cd /home/pi/currents

Then create a script currscript.sh:

Code:
echo "curl -s http://\$1/cm?cmnd=STATUS+10 | jq '.StatusSNS.ENERGY.Current'>/home/pi/currents/snsCurr\$1">/home/pi/currents/currscript.sh

sudo chmod +x currscript.sh

Then create another script requestCurrs.sh that calls the first one for all the ips of your plugs, my ips are examples:

Code:
echo "/home/pi/currents/currscript.sh 192.168.178.25
/home/pi/currents/currscript.sh 192.168.178.26
/home/pi/currents/currscript.sh 192.168.178.27" >/home/pi/currents/requestCurrs.sh

sudo chmod +x requestCurrs.sh


Then, again, schedule the last script to run regularly, I chose every 20 seconds, but you can do every minute, it takes a couple seconds to run, type "crontab - e"
And add the following line at the end:
Code:
* * * * * /bin/bash -c ' for i in {1..3}; do /home/pi/currents/requestCurrs.sh; sleep 20; done'

Then you should have text files in the currents folder named something like snsCurr192.168.178.25 or whatever the ip address of that particular plug is, that text file contains the current measurement.

Go into reef pi, Configuration->Drivers

And add a file-analog driver per plug and and input the path to the corresponding file like /home/pi/currents/snsCurr192.168.178.25

Then configuration->connectors->analog inputs and add a input per newly created driver, pin 0

Then go into the pH menu and add a pH Probe per newly created connector, check frequency 20 seconds or whatever period you chose, chart minimum 0, chart maximum whatever makes sense for your device, chart unit you can use "A" for Ampere if you want.

Then you can add those "pH probes" to your dashboard and/or do logic with them or whatever you want.

And now my fingers are sore from typing this on a phone, I hope there are no typos in the code

Edit: if you don't want current but actually power that works too, use

Code:
.StatusSNS.ENERGY.Power

Or

Code:
.StatusSNS.ENERGY.ApparentPower

In the first script instead


Edit2: fixed the crontab code
first of all thank you
I haven't forgotten, I didn't know
 
Back
Top