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

elysics

Valuable Member
View Badges
Joined
Jan 15, 2020
Messages
1,591
Reaction score
1,590
Rating - 0%
0   0   0
sorry again
what is the best way to do it? tried it with no result or a plank in front of my head
You create the driver like normal, then you create an outlet that points to the particular channel of the pca9685 driver, then a piece of equipment that points to that outlet. So instead of driver->jack->doser for all your PWM channels, you go driver->outlet->equipment for the ato channels and Jack only for the other channels.

Oh and by channels I mean the pin number field
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
978
Location
Germany
Rating - 0%
0   0   0
Can anyone explain why there's gain 1-4?
Should I have different gains in the boxes or should I have same gain in all?
My brobe says -61 pH even if I do calibration
The ADS1115 has a gain setting, that allows you to measure different voltage ranges and as far as I think to know, therefore either increase your measurement range up to the supply voltage (in the 2/3 setting) or improve resolution for very low voltages (in the 2 to 16 setting), as you can see in table 3 in the datasheet:
PGA SETTING2/3124816
Full Scale (V)±6.144V*±4.096V*±2.048V±1.024V±0.512V ±0.256V
"Resolution"~0.19mV~0.13 mV~0.06 mV~0.03 mV~0.016~0.008 mV
* ... don't apply voltages below GND-0.3V or above VDD+0.3 volt on the signal inputs
"" ... that is only the digital resolution, noise might (and likely will) be higher than this

The ADS1115 or 1015 measure a voltage. I'm guessing that the driver returns volt or millivolts, but I don't know.
You now need to calculate this voltage into a pH value, depending on your circuit.
 
Last edited:

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
978
Location
Germany
Rating - 0%
0   0   0
Has anyone every used one of these Tuya PH and Salinity probes? I bet it would be easy to use the Tuya API to get the data.

It’s only easy if there is a publicly documented API or home assistant interface, as far as I know.
 

ColoredRock

Well-Known Member
View Badges
Joined
Aug 9, 2021
Messages
856
Reaction score
1,034
Location
Murrieta, CA (North of San Diego)
Rating - 0%
0   0   0

elysics

Valuable Member
View Badges
Joined
Jan 15, 2020
Messages
1,591
Reaction score
1,590
Rating - 0%
0   0   0
I think I am missing something, probably some weird quirk of the macro system, but how do I set it up so when I have 2 level sensors for ato, the second, slightly higher one acts as a backup cutoff incase the first is stuck and shuts the pump off?
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
978
Location
Germany
Rating - 0%
0   0   0
I think I am missing something, probably some weird quirk of the macro system, but how do I set it up so when I have 2 level sensors for ato, the second, slightly higher one acts as a backup cutoff incase the first is stuck and shuts the pump off?
I believe you have to configure the backup as an ATO (but inverted) as well and run a macro that disables the first ATO and shuts off the pump.
 

elysics

Valuable Member
View Badges
Joined
Jan 15, 2020
Messages
1,591
Reaction score
1,590
Rating - 0%
0   0   0
I believe you have to configure the backup as an ATO (but inverted) as well and run a macro that disables the first ATO and shuts off the pump.
If I leave the working single ato as it is, add a second one, either with inverted or non inverted inlet, and have it control a reversible macro that either just enables or disables the other ato, then the pump either doesn't start or doesn't stop and the enable disable button for the safety ato and/or the other one locks up with no reaction when clicking it, other equipment switches still work at that point. In trying to fix that by trying to delete the safety ato configuration, my pi crashed.
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
978
Location
Germany
Rating - 0%
0   0   0
If I leave the working single ato as it is, add a second one, either with inverted or non inverted inlet, and have it control a reversible macro that either just enables or disables the other ato, then the pump either doesn't start or doesn't stop and the enable disable button for the safety ato and/or the other one locks up with no reaction when clicking it, other equipment switches still work at that point. In trying to fix that by trying to delete the safety ato configuration, my pi crashed.
Hm. My guess is that it "locks up" (maybe intentionally), because the safety ATO and the associated macro are constantly engaged (switching the first).
In the inverted case this should happen when the safety ATO triggers and in the non-inverted case it should happen all the time (when the safety ATO is not triggered), stopping the first ATO from starting the pump in the first place.

Also, ATOs might have a check period, so I believe they should only change their behavior once every >insert period here< seconds.
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
978
Location
Germany
Rating - 0%
0   0   0
If I leave the working single ato as it is, add a second one, either with inverted or non inverted inlet, and have it control a reversible macro that either just enables or disables the other ato, then the pump either doesn't start or doesn't stop and the enable disable button for the safety ato and/or the other one locks up with no reaction when clicking it, other equipment switches still work at that point. In trying to fix that by trying to delete the safety ato configuration, my pi crashed.
Another thing: if you make it a reversible macro turning off the pump, if the safety ATO is off, it might actually trigger the reverse of this, e.g. turn the pump on all the time, when the safety ATO is not triggered.
 

elysics

Valuable Member
View Badges
Joined
Jan 15, 2020
Messages
1,591
Reaction score
1,590
Rating - 0%
0   0   0
Another thing: if you make it a reversible macro turning off the pump, if the safety ATO is off, it might actually trigger the reverse of this, e.g. turn the pump on all the time, when the safety ATO is not triggered.
No the macro is turning on and off the other ato system, not the pump.

But yeah, among various crashes that's what I have been getting: pump either stays on or stays off, it doesn't switch at the transitions of the sensors
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
978
Location
Germany
Rating - 0%
0   0   0
No the macro is turning on and off the other ato system, not the pump.

But yeah, among various crashes that's what I have been getting: pump either stays on or stays off, it doesn't switch at the transitions of the sensors
Hmm, what is your ATOs’ respective check period ? E.g. if that’s 10s, it could happen, that the pump only turns off up to 10s after the sensor is triggered.

If your safety ATO is not correctly inverted (at this point I wouldn’t claim to know which setting is the „correct“ one ), it switches the first ATO off when water is lower than the safety sensor. If that ATO already triggered the pump (because the first ATO is first in the list, hence it triggers first), the pump will never shut off.
If that first ATO didn’t trigger yet, it’s off now and can’t activate the pump.
This would explain your behavior. In that Case I believe your safety ATO‘s signal is incorrectly inverted.

Since in your current setting the safety ATO only triggers the first ATO, which is responsible for deactivating the pump, the pump can never shut off when reaching the safety sensor. At least as long as switching off an ATO doesn’t also switch off the triggered equipment.
 
Last edited:

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
978
Location
Germany
Rating - 0%
0   0   0
No the macro is turning on and off the other ato system, not the pump.

But yeah, among various crashes that's what I have been getting: pump either stays on or stays off, it doesn't switch at the transitions of the sensors
Personally, I’m not quite sure if you’d want a safety ATO to be reversible. You want it to deactivate the faulty ATO and the pump so you can afterwards manually remove the fault and reset the system.
What you could do is set up both ATO and backup ATO as an actual ATO, but turn off the backup ATO.
Then additionally define a safety ATO that uses the backup ATO as inverted signal and as soon as that’s triggered, switch off the first ATO, activate the backup ATO and switch off the pump (nonreversible).

That way, as soon as your backup ATO sees water, it takes over from the faulty first one.
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,848
Reaction score
17,081
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Just create two different ato and control them separately ? Apologies I have not read all the details, just skim through the post
 

elysics

Valuable Member
View Badges
Joined
Jan 15, 2020
Messages
1,591
Reaction score
1,590
Rating - 0%
0   0   0
Just create two different ato and control them separately ? Apologies I have not read all the details, just skim through the post
The point was that if the first ATO malfunctions (snail stuck in flotor for example) the task of the second ato is to disable/veto the first one, or rather stops the pump.

Does reef pi do that if I just point two separate ATO entities to the same equipment entity?

I guess what I mean is with sensors A and B is:

Pump runs iff NOT A AND NOT B
 
Last edited:

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
978
Location
Germany
Rating - 0%
0   0   0
The point was that if the first ATO malfunctions (snail stuck in flotor for example) the task of the second ato is to disable/veto the first one, or rather stops the pump.

Does reef pi do that if I just point two separate ATO entities to the same equipment entity?

I guess what I mean is with sensors A and B is:

Pump runs iff NOT A AND NOT B
It will probably not work, since the second sensor (B) will always trigger the pump if the water is below sensor B, but above sensor A, basically overriding sensor A.
You could also run into strange behavior, where ATO B turns on the pump, but ATO A afterwards turns it off, since sensor A is already triggered. Rinse and repeat with the pump turning on and off all the time.

The only way I currently see (which is most likely not the only one) is the following setting, altough you will find that it doesn't work and creates bugs.
  • create 3 inlets:
    • two regulars on your 2 ATO signals (with the correct polarity, which you should know if you simply test one of them with an ATO)
    • and one on the safety ATO, but with the opposite polarity
    • 1673641669390.png
  • Then create 2 ATOs that run off the 2 regular inlets that both trigger your top-off pump:
    • One on Signal A:
    • 1673641799207.png
    • One on Signal B, but deactivated:
    • 1673641916804.png
  • Create a macro that disables ATO A, activates ATO B and deactivates your top-off pump:
    • 1673642052208.png
  • Now create a third ATO on the reversed Signal B that runs that Macro as a One Shot:
    • 1673642584013.png
This should:
- run your standard ATO on Signal A
- as soon as Signal B triggers, your third ATO (in my example called "ATOSafety") runs the macro that should switch to the backup ATO on Signal B and deactivate your top-off pump to keep your tank from overflowing

Personally I set the ATO check frequency intentionally low (10s) so I can test this quickly, not sure what kind of value is best here. The Adafruit guide used 120s, but I guess this very much depends on the speed at which your pump can refill water.

ATO A worked fine. When I switched my ATO_Dummy A signal to low, my doser started running within the next 10s. When I set the signal back to high it stopped.

As soon as I also triggered SignalB something worked ... the doser doesn't get trigger by ATO A anymore. But the macro also doesn't switch the ATOs:
1673643007713.png


Strange. I tested the same with switching a light. That also doesn't seem to work. If I tell a macro to switch off a light, the light stays enabled. @Ranjib ? Is that supposed to happen ? Feels very strange to me that "Turn On" and "Turn Off" doesn't enable or disable the ATOs (or lights for that matter). I removed the "Turn off Doser 1" from the macro, but nothing happens, the doser doesn't turn on again. I also can't switch the ATOs manually, because that freezes my Pi Zero.

@Ranjib that's definitely not nice ^^
 
Last edited:

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
978
Location
Germany
Rating - 0%
0   0   0
Wait, what ?
Now my Pi reacts again, and the ATOs are correctly set (I did click the buttons a few times during the freeze though with no immediate reaction):
1673643364313.png


Notice though, that the "OneShot" on the ATOSafety does strangely disable.

Also: I now can't edit ATO B, which has reset its check frequency to the standard 60. That's seriously not nice behavior.
I also can't create new ATOs. Is that a UI bug ? Even clearing the Cach and reloading ReefPi didn't help :(
 
Last edited:

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
978
Location
Germany
Rating - 0%
0   0   0
The point was that if the first ATO malfunctions (snail stuck in flotor for example) the task of the second ato is to disable/veto the first one, or rather stops the pump.

Does reef pi do that if I just point two separate ATO entities to the same equipment entity?

I guess what I mean is with sensors A and B is:

Pump runs iff NOT A AND NOT B
Sry, seems that I have been too quick to advise you. I hope this gets resolved.
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,848
Reaction score
17,081
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Wait, what ?
Now my Pi reacts again, and the ATOs are correctly set (I did click the buttons a few times during the freeze though with no immediate reaction):
1673643364313.png


Notice though, that the "OneShot" on the ATOSafety does strangely disable.

Also: I now can't edit ATO B, which has reset its check frequency to the standard 60. That's seriously not nice behavior.
I also can't create new ATOs. Is that a UI bug ? Even clearing the Cach and reloading ReefPi didn't help :(
I’m pretty sure there’s ui bug that’s not syncing the ui state with backend data (api response in JavaScript console under network section should reveal it ). I’ll have to read through this when I have some time to decode the macro synchronization issue . There’s likely bug, and some of it might be as expected (locking), and we have to do some validation to avoid those . I have to reproduce this and the. Use the profiler to track them (locks/freeze) down . It will be fun work(I knew macro will bring this type of stuff, since it’s uncontrolled concurrency , unlike the stock ato, temp etc). But I need some time ….bit busy with some other things.. bare with me till then.
the ui bug is so annoying it’s keeps popping up with version upgrades of different libraries... and min or changes in code, we need a better story there,, I want do some large scale refactoring .. react has changed a lot in past 6 years :-(
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,848
Reaction score
17,081
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
The point was that if the first ATO malfunctions (snail stuck in flotor for example) the task of the second ato is to disable/veto the first one, or rather stops the pump.

Does reef pi do that if I just point two separate ATO entities to the same equipment entity?

I guess what I mean is with sensors A and B is:

Pump runs iff NOT A AND NOT B
You should be able to use the same equipment, I think reef-pi won’t stop you from doing that, but then doing so can lead to locking things up inadvertently or by code bugs (I have track those down ). Hence it’s unsafe unless you know and tested what it’s supposed to do.
 

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,349
Reaction score
1,724
Location
Missouri
Rating - 0%
0   0   0
Need some more eyes and suggestion on controlling a nicrew led 50w version with reef-pi. I have taken a couple runs at this and think I just have a non working unit but trying to see how to debug their board to see if there is something I can correct or fix. I have wired up a 0-10v control section light whats in the lighting guide - https://learn.adafruit.com/reef-pi-lighting-controller/circuit-construction and have verified that its all working via a meter, pwm controls take it from 0-10v. Supposed to be able to control the nicrew 50w and up lights with a 0-10v input, when I try to do it the lights do nothing. Here is a posting that calls out the wiring - https://www.reef2reef.com/threads/reef-pi-control-lighting.811639/post-8787689

I have taken the unit apart and did some continuity on the 0-10v board and I see 24v coming form the main board to the unit (to go to the out port) but I do not see the 0-10v input coming into the board and not sure what I can do to figure out where on the board could be the issue. Here are a couple pics of the board:

PXL_20230116_043622492.jpg


Backside:

PXL_20230116_043658493.jpg


Just not smart enough on the back side to know how to troubleshoot with a meter and maybe figure out the issue. If anyone has some suggestions or ideas let me know. I wanted to use this light in a new build and purchase a couple more but if I am unable to control them I not sure what to do at that point.

Thanks :)
 
Back
Top