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

Erica-Renee

Valuable Member
View Badges
Joined
Oct 4, 2017
Messages
1,596
Reaction score
3,288
Location
lost
Rating - 0%
0   0   0
I'm getting myself a list of parts together for some controllable 240v sockets and nice to see I will need to add the ULN2803, ill be shopping on ebay and would the ULN2803A be the same item but with a circuit board?
Need to keep it as simple as I can as it will be my first time with electronics, ill be building a four socket relay as 4 controllable is enough for me but will be adding float switchs for ato and skimmer switch off if sump fills as it floods my cup and want to avoid that.

Also @Erica-Renee the above diagram is good for me but a little unclear to a beginner like me, I'm not quite understanding the 5v power supply input, also I will need 4 wires connected for a four channel relay from the gpio pins?
thankyou for any help.


The 5v power supply is to power the electronics on the Relays, This keeps from having to power the relay board from the pi gpio 5v pin...
The uln2803a has 18 pins... pin 1-8 are gpio pins .... They connect to the assigned gpio on your pie Pin 18-11 are gpio output to relay giving you a total of 8 relay channels .
Example
pin 1 connects to gpio on pi.... Pin 18 connects to relay 1
pin 2 connects to gpio on pi .... Pin 17 on connects to relay 2
pin 3 connects to gpio on pi .... pin 16 connects to relay 3
pin 4 connects to gpio on pi .. pin 15 connects to relay 4
up to 8 relays
I have nothing connected to pin 10.. only thing common is ground
Pin 9 is Ground and connects to pi ground, power supply ground and relay board ground.

Hope this is helpful...

Disclaimer.. I am not a electronics expert this is just how mine is working with no issues.. I had A Issue with power drain when i connected pin 10... After some internet searching i found somewhere pin 10 is not needed .. You can do this with a Diode resister and npn transistor for each of your relays without the uln chip. if only or or two relays might be best solution.. But you need to calculate diode, resister and transistor values

ALSO
This has way more info then I am capable of.. There are more ways of doing this..

http://www.instructables.com/id/I2C-Relay-Board/
 

LionHeart2017

Active Member
View Badges
Joined
Sep 13, 2017
Messages
185
Reaction score
321
Location
Lincolnshire
Rating - 0%
0   0   0
Welcome to r2r. And thank you for giving reef-pi a try
Thank you Ranjib for the welcome and your time on this is appreciated, looking forward to get this going on my tank, always been into diy, not so much electronics but I feel that's about to change after discovering this.
I have been thinking of problems of wiring and keeping it nice and tidy, would getting cases a certain size help with making the design more modular, like a project case for the boards that are needed and then using a certain type of connection cable between the raspberry and cases and making them all the same with the same connection and add a label to each case for identification and a case for the raspberry with the connection on the case from the gpio pins or would this not work well do you think?
 

Erica-Renee

Valuable Member
View Badges
Joined
Oct 4, 2017
Messages
1,596
Reaction score
3,288
Location
lost
Rating - 0%
0   0   0
Thank you Ranjib for the welcome and your time on this is appreciated, looking forward to get this going on my tank, always been into diy, not so much electronics but I feel that's about to change after discovering this.
I have been thinking of problems of wiring and keeping it nice and tidy, would getting cases a certain size help with making the design more modular, like a project case for the boards that are needed and then using a certain type of connection cable between the raspberry and cases and making them all the same with the same connection and add a label to each case for identification and a case for the raspberry with the connection on the case from the gpio pins or would this not work well do you think?
This is exactly what i am working on with my version.. Because of WORK being busy. then we just had to replace hvac system in our house I have not decided on project boxes yet. But i am going to use stereo hacks for sensors . a 4o pin external SCSI Connector and cable from the pi to the box with the components and DB9 From component box to relays housing.. I will be another week or so getting it together..

On a Good Note the hvac shipped from Florida to Kentucky arrived Thursday early .. I installed furnace and evaporator . then last night my hvac guy came and checked my wiring , and made the line set connections and started the system... saved me about 2k doing most of the work myself.
 
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
Thank you Ranjib for the welcome and your time on this is appreciated, looking forward to get this going on my tank, always been into diy, not so much electronics but I feel that's about to change after discovering this.
I have been thinking of problems of wiring and keeping it nice and tidy, would getting cases a certain size help with making the design more modular, like a project case for the boards that are needed and then using a certain type of connection cable between the raspberry and cases and making them all the same with the same connection and add a label to each case for identification and a case for the raspberry with the connection on the case from the gpio pins or would this not work well do you think?
I would definitely recommend having separate cases for all the DC stuff and AC stuff. I went with everything in one case in the beginning, but since I have a small tank in limited space, it was hard to get everything. From handling perspective also, i think its easier to have AC and DC things separate and connect them with a hdmi or db9 cable
 

philshel

Active Member
View Badges
Joined
Jul 24, 2010
Messages
365
Reaction score
375
Rating - 0%
0   0   0
The 5v power supply is to power the electronics on the Relays, This keeps from having to power the relay board from the pi gpio 5v pin...
The uln2803a has 18 pins... pin 1-8 are gpio pins .... They connect to the assigned gpio on your pie Pin 18-11 are gpio output to relay giving you a total of 8 relay channels .
Example
pin 1 connects to gpio on pi.... Pin 18 connects to relay 1
pin 2 connects to gpio on pi .... Pin 17 on connects to relay 2
pin 3 connects to gpio on pi .... pin 16 connects to relay 3
pin 4 connects to gpio on pi .. pin 15 connects to relay 4
up to 8 relays
I have nothing connected to pin 10.. only thing common is ground
Pin 9 is Ground and connects to pi ground, power supply ground and relay board ground.

Hope this is helpful...

Disclaimer.. I am not a electronics expert this is just how mine is working with no issues.. I had A Issue with power drain when i connected pin 10... After some internet searching i found somewhere pin 10 is not needed .. You can do this with a Diode resister and npn transistor for each of your relays without the uln chip. if only or or two relays might be best solution.. But you need to calculate diode, resister and transistor values

ALSO
This has way more info then I am capable of.. There are more ways of doing this..

http://www.instructables.com/id/I2C-Relay-Board/


Thank you, that is very clear and pretty much what I had surmised but wanted confirmation. Is the RasPi capable of supplying the 5v to the relay and uln2803 to avoid the additional power supply?
 
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
I assumed it probably could be but as I haven't got mine up and running yet I haven't tried. Not sure if the ATO module can also send alerts at all or if it can have other features like timers built into it as fail safes?

If I can I am planning to put float switches everywhere (how many could Reef-Pi support?).

Another example is I currently have an auto top off for my auto top off :p when my ATO gets low a float switch is triggered and a solenoid switches to let the RODI start filling the ATO up which then turns off when the ATO is full (and another float switch is triggered). It is currently set up with a couple of SSR but I would like to move it over to Reef-Pi eventually if it can be supported. In this case it would be good to have timer back ups build into the task such as 'if top float switch is not triggered within 2hrs, then turn off solenoid and send alarm notification'.

Again, this might be able to be done through the ATO module so I am just throwing possible scenarios out there in case they haven't been thought of :) Hopefully I will be able to test out a few use cases in the next month or so :)
I recently updated the power controller guide around total limits or reef-pi.

https://reef-pi.github.io/build-guides/power/

TLDR;
reef-pi does not have any software limits, but raspberry pi has GPIO limits. In most cases you'll be limited to total 22 GPIOs. Its your choice how to distribute them among outlets, inlets, leak detectors and mechanical push buttons. Total has to be exactly or below 22. For example, you can go with 16 outlets, 6 inlets. Each inlet can power one ATO sensor.
 
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
Thank you, that is very clear and pretty much what I had surmised but wanted confirmation. Is the RasPi capable of supplying the 5v to the relay and uln2803 to avoid the additional power supply?
It can, but it will stretching. I'll recommend getting a 5v 3 AMP power supply (barrel jack) and connect it to a 5v rail and connect all 5v +ve to connections to it. Raspberry Pi only allows upto 1A draw. But that will risk functionalities of other components, so I wont recommend this configuration
 

MaccaPopEye

Well-Known Member
View Badges
Joined
Jan 5, 2016
Messages
697
Reaction score
1,224
Rating - 0%
0   0   0
reef-pi does not have any software limits, but raspberry pi has GPIO limits. In most cases you'll be limited to total 22 GPIOs. Its your choice how to distribute them among outlets, inlets, leak detectors and mechanical push buttons. Total has to be exactly or below 22. For example, you can go with 16 outlets, 6 inlets. Each inlet can power one ATO sensor.

Thanks, thats good to know :) and it also answers my question a page back on the housing I started designing.

But just to confirm, multiple temp sensors only take up 1 GPIO pin? Do multiple i2c boards also chain together and use 1 GPIO pin (I think I remember reading it somewhere so things like the pca9685 & pH etc.)? And if I have 2 float switches that I want to use for the same function can I chain them together (like a high and emergency high level switch that will both turn off the ATO can be chained together as either one of them will trigger the circuit)?

I also remember you wanting to make Reef-Pi so modular that each module could have a separate Pi Zero running it but they all communicated back the the main hub, is that still something you are going to look at doing? At the time I didn't understand the benefits of it but I sure can now haha.

I'll either have to plan more carefully or design my housing to hold a Pi Zero as well as the Pi 3 (there should be enough room)
 
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
You are spot on.
Temperature sensor used one wire protocol, which is a bus (GPIO4), and multiple of them can be connected to the same pin. Same is the case with i2c. But i2c uses two pins. As of now I have tested 3 temp sensors (and I am aware at many as 7-9 working without any issues) and 3 i2c devices (pca9685, pH sensor, LED panel).

You are also right on the clustering bit. But I plan to work on it after 2.0 release. 3.0 release (next year) will feature the ability to control multiple reef-pi from a single pane etc. But I was expecting multiple independent reef-pi installations, like a ph monitor, a temperature controller, a power center, doser etc. Not multiple pi in same housing. Not that I think it wont work, but the reasoning for my thinking was to isolate failure domains. When you are keeping multiple pi in the same housing, if the incoming power shorts, then both of them will fail together.
 

MaccaPopEye

Well-Known Member
View Badges
Joined
Jan 5, 2016
Messages
697
Reaction score
1,224
Rating - 0%
0   0   0
You are spot on.
Temperature sensor used one wire protocol, which is a bus (GPIO4), and multiple of them can be connected to the same pin. Same is the case with i2c. But i2c uses two pins. As of now I have tested 3 temp sensors (and I am aware at many as 7-9 working without any issues) and 3 i2c devices (pca9685, pH sensor, LED panel).

You are also right on the clustering bit. But I plan to work on it after 2.0 release. 3.0 release (next year) will feature the ability to control multiple reef-pi from a single pane etc. But I was expecting multiple independent reef-pi installations, like a ph monitor, a temperature controller, a power center, doser etc. Not multiple pi in same housing. Not that I think it wont work, but the reasoning for my thinking was to isolate failure domains. When you are keeping multiple pi in the same housing, if the incoming power shorts, then both of them will fail together.
Good to know about the one wire and I2C :)

As for the clustering, no rush of course haha I think the amount of progress that you have made on this project on your own in such a short time is truly staggering!

And using it for redundancy is definitely not a bad idea at all. It would also be great for people with remote sumps etc. one Reef-Pi at the tank and another with the sump but controlled from the same place. So many possible uses.

I guess my thinking is I wouldn't really be using it if I could just have unlimited GPIO pins on the one Pi :p I'll build in a space for a zero and then if I ever actually need it / when 3.0 release is ready then I will consider getting one. Hopefully by that point I will actually have had Reef-Pi running for a while and might even revisit how I have it set up, who knows :D
 
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
Its been few weeks since I have hooked up the ph monitoring, and from that what I have learned is my ph is much lower than normal (7.8-8.2). My tank pH hovers between 6.2 - 7.2 .
Screen Shot 2018-05-28 at 6.49.44 PM.png


I am not super worried about it, since my sps growth is stable, and corals are not showing any sign of serious stress. But I would certainly likely to attain the desired pH level (around 8.2). With that aim, I have decided switching from two part to Kalkwasser. I bought the brightwell aquatics kalkwasser which has Mg and Strontium as well. https://www.amazon.com/t/dp/B001DIIVU4/

I have mixed 1/4th teaspoon of this to my 1G ATO reservoir. My ATO reservoir last for about 5 days. My plan is to go slow and see the effect (for about a month or two at least( and then decide on the next steps.

Anyway, I thought I'll share this as its relevant to reef-pi ph monitoring :-)
 
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 Ranjib,

Again, I would be very skeptical of those pH readings being correct.

Chris
Why? I have calibrated the probe using standard solutions from atlas scientific . It’s a three point calibration. I have to have reason to doubt them. I can cross check with titration based test, but as of now, I don’t see any compelling reason
 

wykat

Active Member
View Badges
Joined
May 23, 2018
Messages
182
Reaction score
421
Rating - 0%
0   0   0
TLDR;
reef-pi does not have any software limits, but raspberry pi has GPIO limits. In most cases you'll be limited to total 22 GPIOs. Its your choice how to distribute them among outlets, inlets, leak detectors and mechanical push buttons. Total has to be exactly or below 22. For example, you can go with 16 outlets, 6 inlets. Each inlet can power one ATO sensor.

Hi Ranjib,
It should be possible to extend I/O ports via the MCP23017 (I2C) . Also the PCA9685 could be used as digital output according the documentation. I have been thinking about a modular electronic/mechanical concept and this is my (mechanical) idea so far:

upload_2018-5-29_13-51-10.png

I made these drawings for myself this morning, because it helps to get a better understanding of the whole concept and questions to be resolved (e.g. size of the modules, way of electrical/mechanical connections, power solutions, etc.)


the I2C bus should work like this (side view, below top view)
upload_2018-5-29_13-53-47.png

Depending on the number of modules required, the I2C bus can be extended and present idea is to have additional 5V and 12V on the 'rail'. I think we should have a small (for single I2C devices, or connection of the single wire DS18B20 sensors) and a larger for I2C controllers with many I/O ports.



Already made a PWM board design with 16 outputs on a 6*13 cm size board (started to learn KiCad :) ) which mechanically would look like this:
upload_2018-5-29_14-9-51.png

The red circles I added as not yet fix for myself. Present idea is to plug module from top on the I2C bus. This will make the total design a little higher but potentially also smaller (width) and think mechanically it's better due to the I/O connectors on the other side.
upload_2018-5-29_14-18-40.png

Unfortunately it's not showing the audio 2 connectors and a 7810 chip. I want to make some modifications to this design to fit the modular concept and most likely will change the I2C address solution.
I know that it contains an SMT component, but if you look at the upper left side of the design, maybe that can be replaced by the PCA9685 module, haven't checked that yet.
Have not designed the piggy back board yet, but basically is copy of part of the main controller

I have some idea's about the overall housing (base with I2C PCBA) which then also connect mechanically to the individual modules (didn't made a drawing of that yet)

I'm waiting for some electronic components to arrive (they are very expensive in Europe and Asia takes time :-( ). I'm also planning to design a MCP23017 module. Any comments/critics are welcome, it can only help me/us to come up with a flexible electronics/housing design.
 
Last edited:

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
Hey all, especially Ranjib.

I am from South Africa and have recently stumbled apon this project. I have used Raspberry Pi's a bit before and have kept reef tanks for most of the last 25 years. I am very interested in setting up a Reef-Pi system. So far, I have set up a Pi3 and installed Reef -Pi 1.5 (just because it is the stable version). I have got grips with controlling the relays. I am going to start connecting equipment up to the 8 relays that I have at the moment.

I have not completely caught up with all 228 pages of reading in this thread, but want to ask a few questions :-
  1. How many features are available? I'm aware of the following -
    1. Temperature measurement and control
    2. ATO
    3. Power switching of equipment.
    4. PWM control of dimmable LED's
  2. I see that PH measurement is happening. What else can we expect? Do you think we will get to the point of Nitrates, Amonia, Calc etc? What are the limitations?
  3. I can't find a guide for setting up an IO expander - I see myself needing one.

Thanks to all the guys doing work on this . It's fantastic!

Des

 

Erica-Renee

Valuable Member
View Badges
Joined
Oct 4, 2017
Messages
1,596
Reaction score
3,288
Location
lost
Rating - 0%
0   0   0
Its been few weeks since I have hooked up the ph monitoring, and from that what I have learned is my ph is much lower than normal (7.8-8.2). My tank pH hovers between 6.2 - 7.2 .
Screen Shot 2018-05-28 at 6.49.44 PM.png


I have mixed 1/4th teaspoon of this to my 1G ATO reservoir. My ATO reservoir last for about 5 days. My plan is to go slow and see the effect (for about a month or two at least( and then decide on the next steps.

Anyway, I thought I'll share this as its relevant to reef-pi ph monitoring :)


remember Kalk will only saturate x amount in the water you mix it in.. mixing it in a cup with a oz of vinegar then into your gallon jug will allow the water to saturate more kalk. .. (I do not do this anymore) I just dump a half cup in my Kalk tank every 4-6 months ..My ATO Tank is 15 gallons and last almost 3 days. It auto fills thru float switch on my rodi system.. The residue on the bottom when stirred up will be dissolved or saturated up to the saturation amount
 

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