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

DeeEmm

New Member
View Badges
Joined
Sep 20, 2020
Messages
24
Reaction score
27
Location
RADelaide
Rating - 0%
0   0   0
https://raspberrypihq.com/use-a-push-button-with-raspberry-pi-gpio/#:~:text=Connecting the Raspberry Pi's general,pin 1 using a resistor. does this help? you can also search for how to connect float switches to pi. or check the design of dfrobot's photoelectric sensor breakout board.

It's more of a software question than a how to connect the wiring question.

- If the software uses the internal pull UP resistor, I will need to ground the input to give it a state change
- If the software uses the internal pull DOWN resistor, I will need to raise the input to vcc (with a current limiting resistor) to give it a state change
- If no internal pullups are set in software than I can use an external pull up or pull down resistor and the above cases will apply, (except that the on and off signal will only be correct in one case.)

BTW, I'm not using any hats / shields breakout boards, I want to connect direct to the GPIO

The physically connecting part is easy.

But what Reef Pi does with the result is unclear.

From your example I assume that you are using the internal pull-down? Is that correct?

/DM
 

Des Westcott

Well-Known Member
View Badges
Joined
May 29, 2018
Messages
646
Reaction score
1,025
Location
Durban - South Africa
Rating - 0%
0   0   0
I suspect one of the sensor probes "latched up" and held the bus, so none of the remaining sensors could respond. Killing the power fixed it of course.

You could use a Raspberry Pi GPIO pin to control the power to the sensors so you can at least soft restart it when it does fail. Normally, the Maxim sensors shouldn't do this (they can only hold the bus for short bursts).

Well it happened again that I lost all my temp sensors. Luckily there was someone at home and I asked them to do a "Widows reset" - turn everything off and then back on again and it seems to have corrected itself again. I'm seeing feeds back in AIO. When it happened last night, the heaters were off, so my temp dropped about 2 degrees C, this time it looks like the heaters were on and the temp rose by nearly 1.5 degrees C, despite getting alerts that he temp was out of range (0 deg C)

So my question is :- Is this likely a hardware issue or software? What steps can I take to prevent it happening again? Replace sensors? Create a backup SD? Do a clean install and keep as a spare?

I've had no problems with this for a year, now it's done this twice in less than 24 hours.
 

DeeEmm

New Member
View Badges
Joined
Sep 20, 2020
Messages
24
Reaction score
27
Location
RADelaide
Rating - 0%
0   0   0
Suspect that the water sealing crimp on a sensor has given out. Replace would be my call.


Sounds likely if a DS18B20 sensor is being used as the bus controller is integrated, if it gets wet then the whole bus will go down.

It surprises me that there is no watchdog / bus check implemented. It should be possible to monitor the bus status before transmitting / receiving to detect bus issues. Some automatic recovery may then be possible with an auto reboot. Even if bus status is not available to the Pi, it should be easy to set up a simple change monitor function. the DS18B20 has a 12 bit resolution I would expect that the value would be different every time you read it.

Other solutions might be to allow for more than one input parameter into the ATO function, a second identical redundant I2C network could then be used. A failure in one network would then not result in a loss of control. (if sensor1 < temp OR sensor2 < temp then heater ON)

OR use of a hardware watchdog such as a CAT1161 timer or even something like the 'Super-Watchdog'.


I think that some form of system integrity checking is critical for any control system, especially one where it is possible to end up with a situation like Des has with temp increases due to a failed temp sensor / control bus.

/DM
 

theatrus

Valuable Member
View Badges
Joined
Mar 26, 2016
Messages
2,253
Reaction score
3,603
Location
Sacramento, CA area
Rating - 0%
0   0   0
I think that some form of system integrity checking is critical for any control system, especially one where it is possible to end up with a situation like Des has with temp increases due to a failed temp sensor / control bus.

Strongly agree. At the minimum, we should look at using multiple 1-wire buses if the Linux kernel driver supports it, which prevents one failed sensor dominating the bus. That would be simple for most people to build into their setups. I haven't dug into the kernel driver to see if it supports that, or how special the devicetree support in the RPi kernel is (which the RPi kernel is many levels of special :))
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,876
Reaction score
16,680
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Strongly agree. At the minimum, we should look at using multiple 1-wire buses if the Linux kernel driver supports it, which prevents one failed sensor dominating the bus. That would be simple for most people to build into their setups. I haven't dug into the kernel driver to see if it supports that, or how special the devicetree support in the RPi kernel is (which the RPi kernel is many levels of special :))
kernel supports multiple 1 wire gpio pins, if thats what you are asking,
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,876
Reaction score
16,680
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
It is :) Probably the best recommendation for reliability would be enabling multiple pins?
I dont know.. i have to think about this, specifically the failure conditions. I hear your suggestions.. but i dont know yet if thats all we have to consider. More research on my end i guess :-)
 

robsworld78

Valuable Member
View Badges
Joined
Feb 14, 2020
Messages
1,029
Reaction score
1,293
Location
Edmonton, Canada
Rating - 0%
0   0   0
It is :) Probably the best recommendation for reliability would be enabling multiple pins?

I've setup 3 buses on Pi 3 and 4 with no issues, was too easy.

 

DeeEmm

New Member
View Badges
Joined
Sep 20, 2020
Messages
24
Reaction score
27
Location
RADelaide
Rating - 0%
0   0   0
I like the idea of multiple busses along with additional ATO logic, Whilst this does mean that the users has to create the additional redundant network, it opens up the possibilities of more complex control schemas.

At the moment we only have

IF THIS THEN THAT

What we really need is

IF THIS AND / OR THIS THEN THAT

Then just set up two temp probes, each on a different bus. Problem solved.

It also means that the system degrades nicely. i.e. there is no loss of control of the system (i.e. the heater) in the event of a single temp probe failure or single bus issue. This is basically how a safety PLC works.

You can use the same control logic to implement redundant control for any connected device, not just heaters and temp probes. E.g. redundant float control for ATO, redundant Ph control, in fact redundant control for any device or control schema.

Plus there's the added bonus of more complex control schemas that would be available with the additional ' AND / OR THIS ' logic.
 

stefanm

Active Member
View Badges
Joined
Oct 11, 2017
Messages
360
Reaction score
394
Location
Sweden
Rating - 0%
0   0   0
I thought this might be helpful if you're facing any issues with reef pi.

I had a few things that wouldn't work as they should, no issues with the hardware. I was in the verge of wiping the sdcard and reinstalling, the pi has been running for for around 20 months, I felt the software had been corrupted.

So instead of removing the card and doing it all again, I decided to try updating the raspberry pi os, it worked a treat and no need to reconfigure anything.

I guess that the power cuts we have had which the battery backup has run out (around 10 times) had corrupted the os.
 

Bigtrout

Valuable Member
View Badges
Joined
Dec 16, 2018
Messages
1,189
Reaction score
2,811
Rating - 0%
0   0   0
I thought this might be helpful if you're facing any issues with reef pi.

I had a few things that wouldn't work as they should, no issues with the hardware. I was in the verge of wiping the sdcard and reinstalling, the pi has been running for for around 20 months, I felt the software had been corrupted.

So instead of removing the card and doing it all again, I decided to try updating the raspberry pi os, it worked a treat and no need to reconfigure anything.

I guess that the power cuts we have had which the battery backup has run out (around 10 times) had corrupted the os.
Take a look at my build thread somewhere I have instructions for adding a Real Time Clock board. This helps with corruption issues from power outages/internet outages. Sometimes raspian gets wonky when file timestamps dont match. Without a RTC if raspian comes up without internet, it wont be able to get the correct time.

Since adding the RTC i have not had an issue, going on 1.5 years now and we get power outages and internet outages regularly in the woods of NW Pennsylvania.
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,876
Reaction score
16,680
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Take a look at my build thread somewhere I have instructions for adding a Real Time Clock board. This helps with corruption issues from power outages/internet outages. Sometimes raspian gets wonky when file timestamps dont match. Without a RTC if raspian comes up without internet, it wont be able to get the correct time.

Since adding the RTC i have not had an issue, going on 1.5 years now and we get power outages and internet outages regularly in the woods of NW Pennsylvania.
Might be useful: https://learn.adafruit.com/adding-a-real-time-clock-to-raspberry-pi
 

Yov

Community Member
View Badges
Joined
May 24, 2020
Messages
51
Reaction score
44
Rating - 0%
0   0   0
@Ranjib is there a way to control servo motors from the reef-pi?

F180217E-BB00-4491-8A83-C30348305F68.jpeg
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,876
Reaction score
16,680
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
@Ranjib is there a way to control servo motors from the reef-pi?

F180217E-BB00-4491-8A83-C30348305F68.jpeg
Not yet. But this was something I wanted to get done for 4.0 :-/, along side stepper driver
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,876
Reaction score
16,680
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Not yet. But this was something I wanted to get done for 4.0 :-/, along side stepper driver
Something I forgot to mention, it’s relatively easy to control servo with pi, https://learn.adafruit.com/adafruits-raspberry-pi-lesson-8-using-a-servo-motor?view=all , and though we don’t have any direct integration with servo in reef-pi yet, it should be possible to do an indirect integration using the file driver. Reef-pi can output (jack or outlet ) state to a file and and external python script can read that file and do the required servo work , as described in the adafruit guide.
 

Yov

Community Member
View Badges
Joined
May 24, 2020
Messages
51
Reaction score
44
Rating - 0%
0   0   0
I would like to use it in a macro to open or close my top lid of the terrarium. This contains al the electronics and i use the heat to warm the terrarium, but in case things get to hot it would be nice to just open the lid to vent! (Like in green houses)

A6815508-E021-42F7-8A82-B09EED4E3749.jpeg
 

TOP 10 Trending Threads

WHAT AMOUNT OF LIVE ROCK AND SAND SHOULD BE PRIORITIZED FOR OPTIMAL BIODIVERSITY/FILTRATION?

  • 100% live rock + bagged sand

    Votes: 37 27.0%
  • 100% dry rock + 100% live sand

    Votes: 46 33.6%
  • 50/50 live/dry rock, 50/50 live/bagged sand

    Votes: 30 21.9%
  • 75% live rock, 25% live sand

    Votes: 14 10.2%
  • 25% live rock, 75% live sand

    Votes: 10 7.3%
Back
Top