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

robsworld78

Member
View Badges
Joined
Feb 14, 2020
Messages
59
Reaction score
160
Is there a way a person can setup Reef-pi for easy editing basically like an Arduino, as in make a small change, upload and view? I mostly use Visual Studio Code on windows. I'm dying to see what makes it tick and to know if I have any chance of contributing to it. As a challenge these are the two things I would like to see if I could pull off.

The first it appears a dosing pump can only be activated with a schedule and calibration, it would be nice to trigger one at any given time using a macro. Looks like they are only enabled/disabled via the macro.

The other is with the equipment tab, thinking an option when you add a piece of equipment to select AC or DC, if DC is selected you can set a min/max speed. I see this useful for pumps, fans, lights etc. that you might only want to run based on sensor feedback and need to change the speed. Its fine now but everything runs at 100%.
 
OP
Ranjib

Ranjib

Valuable Member
View Badges
Joined
Apr 16, 2016
Messages
7,749
Reaction score
13,914
Location
Palo Alto, Bay Area
Is there a way a person can setup Reef-pi for easy editing basically like an Arduino, as in make a small change, upload and view? I mostly use Visual Studio Code on windows. I'm dying to see what makes it tick and to know if I have any chance of contributing to it. As a challenge these are the two things I would like to see if I could pull off.

The first it appears a dosing pump can only be activated with a schedule and calibration, it would be nice to trigger one at any given time using a macro. Looks like they are only enabled/disabled via the macro.

The other is with the equipment tab, thinking an option when you add a piece of equipment to select AC or DC, if DC is selected you can set a min/max speed. I see this useful for pumps, fans, lights etc. that you might only want to run based on sensor feedback and need to change the speed. Its fine now but everything runs at 100%.
reef-pi is more involved compared to Arduino or circuit python. Its more similar to how web services are written to power cloud-based services, websites etc with a combination frontend, backend technology and the development practices involve continuous integration, code review etc. You can get close to very similar to arduino like experience in development, where you can see the effect of your code change instantly, but it's with limited capability and running on your local laptop/workstation mostly. I have used Pi for some development, but it's morbidly slow for most development tools.
 

robsworld78

Member
View Badges
Joined
Feb 14, 2020
Messages
59
Reaction score
160
reef-pi is more involved compared to Arduino or circuit python. Its more similar to how web services are written to power cloud-based services, websites etc with a combination frontend, backend technology and the development practices involve continuous integration, code review etc. You can get close to very similar to arduino like experience in development, where you can see the effect of your code change instantly, but it's with limited capability and running on your local laptop/workstation mostly. I have used Pi for some development, but it's morbidly slow for most development tools.
Thanks, it does look complicated, that's what scared from the Pi. At some point I'm still going to give it a shot, gotta learn somehow.

On a different note, I just hooked up one of these pH circuits, it works and I get -8036 which sounds ok based on what I've read but how do I get it to show an actual pH value?

https://github.com/reef-pi/pH-Board
 

AbjectMaelstroM

Well-Known Member
View Badges
Joined
Jul 21, 2019
Messages
789
Reaction score
897
Location
Richmond
Thanks, it does look complicated, that's what scared from the Pi. At some point I'm still going to give it a shot, gotta learn somehow.

On a different note, I just hooked up one of these pH circuits, it works and I get -8036 which sounds ok based on what I've read but how do I get it to show an actual pH value?

https://github.com/reef-pi/pH-Board
To get a Ph reading the probe needs to be calibrated.
 

robsworld78

Member
View Badges
Joined
Feb 14, 2020
Messages
59
Reaction score
160
Last edited:

AbjectMaelstroM

Well-Known Member
View Badges
Joined
Jul 21, 2019
Messages
789
Reaction score
897
Location
Richmond
Thanks, would that still be using this method?

https://www.reef2reef.com/threads/reef-pi-an-opensource-reef-tank-controller-based-on-raspberry-pi.289256/page-556

Not sure what this at the end means though?

you'll need a build from master.

Also where would I put the calibration.json file?
All you need to do to calibrate is get your hands on reference solution for example 7ph and 10ph, go into the pH tab in reefpi, make sure probe is disabled then click on the calibrate button. It will bring up a promp with two reference fields: Midpoint and Endpoint, enter the value if the calibration solution in the box, put your probe into that solution, wait for the current reading value to stabilize and then hit Run. Repeat for the second reference fluid. That's it.
 

robsworld78

Member
View Badges
Joined
Feb 14, 2020
Messages
59
Reaction score
160
lol oh boy, just spent 2 hours searching. I tried with mid which changed the pH but it was still wrong, never thought to try both. Thanks for your help.
 

AbjectMaelstroM

Well-Known Member
View Badges
Joined
Jul 21, 2019
Messages
789
Reaction score
897
Location
Richmond
lol oh boy, just spent 2 hours searching. I tried with mid which changed the pH but it was still wrong, never thought to try both. Thanks for your help.
Just make sure the reading settles before you hit run (can take a min or two). Also, rinse the probe in rodi water between two fluids.
 

robsworld78

Member
View Badges
Joined
Feb 14, 2020
Messages
59
Reaction score
160
How stable of readings should one expect with this pH circuit?

https://github.com/reef-pi/pH-Board

I'm getting a range from 8.11 to 8.18, almost every reading the 100th is different by 3-4 points.

@Michael Lane is your circuit different? I noticed in the description it said it has a microcontroller but on the schematic I see the same components as the link above.
 

robsworld78

Member
View Badges
Joined
Feb 14, 2020
Messages
59
Reaction score
160
Looks about right.
Thanks, I thought that might be the case.

If someone can give me a hand with some Arduino I2C code I have a very stable circuit that can mirror the Atlas so nothing needs to be done with Reef-pi.

This uses an ATtiny85, when I saw @Michael Lane circuit description mentioned a microcontroller I thought maybe it's the same thing?

It works like the Atlas, everything is done on board and it sends the pH value to the controller when asked. I wanted to mirror the commands that Atlas uses but was unable to as the Wire library for the ATtiny didn't support what I was trying. So I ended up doing my own thing which works fine but obviously won't work with Reef-pi which is sad because I worked so hard on this thing and now I have nothing to use it on.

I've been using it about a year on my tank and it's more stable than the Atlas. On my controller I setup a half auto calibration feature, when you put the probe in a buffer you had to wait until the reading didn't shift more than +/- 0.003 in 60 seconds, if it got to 50 seconds and the pH changed by more than the threshold the timer would start over. This circuit can do it in about 2 minutes over and over on a $70 probe, the Atlas never did it once and I tried a lot. I had to add a 5 minute timeout otherwise it would run forever trying to hit the goal.

The circuit can do temp compensation, 1, 2 or 3 point temperature compensated calibration, output the probe slopes and calibration offsets in mV so you know when to replace the probe and as a bonus the circuit is cheaper, all parts are $12.75 vs $21.62.

Downside is the ATtiny needs programming but it's easy to do and the code will be available.

I attached the Arduino sketch if anyone wants to see if they can match the I2C Atlas codes.

Reef-pi will be sending an R to get the pH so the I2C in sketch needs to respond to that and send the pH variable, should be so easy but I couldn't get it work on the ATtiny, it works on a Due when I tried with it but I couldn't put a Due on the pH circuit. So yeah this needs to be compiled for the ATtiny.

Then if Reef-pi is sending calibration values to Atlas that would need to be done as well. There's only two commands being used unless Reef-pi also sends the temperature.

For mid point Reef-pi sends - Cal,mid,7.00
For second point it sends - Cal,high,10.00

The sketch needs to respond to these incoming messages and put the 7.00 in a float and 10.00 in another float. If that's done I can tie it in. Maybe setup new variables and I'll replace with the proper one.

pH_board.jpg


ph_schematic.png
 

Attachments

Last edited:

Matt Carden

Valuable Member
View Badges
Joined
Apr 13, 2018
Messages
1,449
Reaction score
3,842
Location
Detroit Metro
Raspberry pi 4 2gb for $35
 

Mandelstam

Well-Known Member
View Badges
Joined
Oct 29, 2017
Messages
635
Reaction score
1,016
Location
Malmö, Sweden
Getting closer and closer to start my reef-pi build but there are a few things I want to get sorted out first as I'm going to use it for a vivarium instead of a reef tank. Tried to do a lot of research on this but still have a few questions I want to ask the devs here.

- I'm going to have two 140mm fans inside the vivarium for airflow, think of them as the equivalent of powerheads. I want to control them via pwm and the pca9685 board as I'll be using that for the light controller too. My problem is that 4 pin pwm fans expect a 25kHz control signal and the pca9685 only outputs max 1.6kHz. To my knowledge there isn't a way to get a higher frequency from the pca9685, right?
I have two options that I see, use 2 or 3 pin fans and drive them directly with pwm over a mosfet driver. This isn't optimal for the fan motor and will likely cause it to be noisy. My other option is to basically put the whole fan controller in an arduino where I can get 25kHz pwm output and then send pwm from the reef-pi as an input to the arduino. It would only have to be a pretty basic program, read pwm --> output pwm with some delay in between.
A third option would be to use a high side mosfet driver and put a low pass filter between that and the fan so the fan receives analoge 12V dc instead of a chopped up pwm current. But if I don't want unreasonably long settling times that means it's still going to be pretty choppy with ripples.

Right now the arduino controller receiving input from the reef-pi seems to be the easiest option but I still wanted to check if you geniuses have any other ideas to check out.
 

robsworld78

Member
View Badges
Joined
Feb 14, 2020
Messages
59
Reaction score
160
Getting closer and closer to start my reef-pi build but there are a few things I want to get sorted out first as I'm going to use it for a vivarium instead of a reef tank. Tried to do a lot of research on this but still have a few questions I want to ask the devs here.

- I'm going to have two 140mm fans inside the vivarium for airflow, think of them as the equivalent of powerheads. I want to control them via pwm and the pca9685 board as I'll be using that for the light controller too. My problem is that 4 pin pwm fans expect a 25kHz control signal and the pca9685 only outputs max 1.6kHz. To my knowledge there isn't a way to get a higher frequency from the pca9685, right?
I have two options that I see, use 2 or 3 pin fans and drive them directly with pwm over a mosfet driver. This isn't optimal for the fan motor and will likely cause it to be noisy. My other option is to basically put the whole fan controller in an arduino where I can get 25kHz pwm output and then send pwm from the reef-pi as an input to the arduino. It would only have to be a pretty basic program, read pwm --> output pwm with some delay in between.
A third option would be to use a high side mosfet driver and put a low pass filter between that and the fan so the fan receives analoge 12V dc instead of a chopped up pwm current. But if I don't want unreasonably long settling times that means it's still going to be pretty choppy with ripples.

Right now the arduino controller receiving input from the reef-pi seems to be the easiest option but I still wanted to check if you geniuses have any other ideas to check out.
How about something like this fan, it's 5-12v so you could drive a mosfet with PWM and use the PWM value that allows the mosfet to output 5v as the minimum value and adjust up from there.


Something like this mosfet should get you down to 5v.

https://www.adafruit.com/product/355
 

Are you getting any reefing "to do" list items done this weekend?

  • YES and its not fun

    Votes: 41 15.1%
  • YES and it's fun stuff for me

    Votes: 166 61.3%
  • Nope nothing!

    Votes: 42 15.5%
  • Maybe, maybe not!

    Votes: 22 8.1%

Online statistics

Members online
2,422
Guests online
5,996
Total visitors
8,418
TheCoralConnect.com
Top