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

Joseph Lim

New Member
View Badges
Joined
Oct 6, 2018
Messages
21
Reaction score
23
Rating - 0%
0   0   0
should work just fine. I'd recommend using uln2803 in between pi GPIO and relay input pins, to keep the current draw from GPIO at minimal.

28cgdqw.jpg
@Ranjib I used used an lm2596 to drop voltage from 12v to 5v.

1. If i connect 5v and ground from gpio together with power from lm2596 to the uln2803 the relays work fine

2. If i just connect 5v from gpio to the uln2803 and the ground from lm2596 to the relay board, the led light turns on but the relay doesnt trigger.

3. If i just follow the diagram exactly, nothing works.

BTW, i dont have a pi proto hat yet so i'm doing this all on a breadboard.
 

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
@Ranjib I used used an lm2596 to drop voltage from 12v to 5v.

1. If i connect 5v and ground from gpio together with power from lm2596 to the uln2803 the relays work fine

2. If i just connect 5v from gpio to the uln2803 and the ground from lm2596 to the relay board, the led light turns on but the relay doesnt trigger.

3. If i just follow the diagram exactly, nothing works.

BTW, i dont have a pi proto hat yet so i'm doing this all on a breadboard.

I think the grounds need to be linked like here

https://www.reef2reef.com/threads/r...troller-based-on-raspberry-pi.289256/page-241
 

Erica-Renee

Valuable Member
View Badges
Joined
Oct 4, 2017
Messages
1,596
Reaction score
3,288
Location
lost
Rating - 0%
0   0   0
This is exactly Correct and his issue with lights and no action was happening to me in my testing.. Also the power supply power for the relay board does not have to be shared with the uln .They all just need a Common ground.. Using db9 i used the red wire as ground to uln on my pi hat board and then ran ground from relay board to the power supply for relay..
 

Michael Lane

Well-Known Member
View Badges
Joined
Aug 11, 2018
Messages
677
Reaction score
1,121
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,165
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,876
Reaction score
16,680
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,876
Reaction score
16,680
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
178
Reaction score
258
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,876
Reaction score
16,680
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
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 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
178
Reaction score
258
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,876
Reaction score
16,680
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,876
Reaction score
16,680
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
 

TOP 10 Trending Threads

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

  • 100% live rock + bagged sand

    Votes: 38 27.3%
  • 100% dry rock + 100% live sand

    Votes: 47 33.8%
  • 50/50 live/dry rock, 50/50 live/bagged sand

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

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

    Votes: 10 7.2%
Back
Top