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

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
Small update: JLCPCB didn't feel like they could load SOD-123 diodes onto an 0805 sized pad (which is fair, its not really the right size). A few hours later, trying with SOD-323 diodes from their catalog. And saved an extra $5 in the process by using some mainland brand parts.


I have to say, if you can fall under the limits of the assembly service (not too many unique parts, using mostly parts already loaded on their machines, etc) the whole thing is a very good value.
Thats awesome.
It makes a lot of sense to design boards specifically to fit this constrain
 

marekd1

Active Member
View Badges
Joined
Dec 24, 2019
Messages
133
Reaction score
200
Rating - 0%
0   0   0
How you are moving the metric from reef-pi to influxdb ? You can not assign the metadata in that mechanism ?
it’s bit confusing on reef-pi end to specify those metadata since it’s not pushing metrics anywhere, it just publish the metrics in a handler/endpoint which prom scrapes . Any metadata is associated by the prom scrape config

The metrics re picked up by mosquitto then I pick them up in node red. Then node red populates infulxdb.

Here is the some data but flows are not reef-pi specific as I am still waiting for segregation so I do not have to redo everything

Capture1.JPG Capturedb.JPG mosq-Capture.JPG
 
Last edited:

marekd1

Active Member
View Badges
Joined
Dec 24, 2019
Messages
133
Reaction score
200
Rating - 0%
0   0   0
I think I get it now. You are talking about your work node red controller. Reef/pi does not uses any external db like influx , uses its own embedded database called boltdb. In this way reef-pi is significantly less component compared to the stack you are using . A full reef-pi does not need any external host to store metric or visualize charts . It has all those built in, and ships as single Debian package that comes with the entire db, backend, front end . For advance use cases (like arbitrary graphs, long term retention ) reef-pi allows Prometheus integration .

I've posted my flow in another post above. Basically I use the reef-pi as datasource through MQTT. Once MQTT topic is published (in Ree-Pi's case everything is one big clump of data and its not segregated under a specific topic say reef-pi-01 then I can pick this data up from MQTT and do anything I want. no dependency on internals of reef-pi. This method allows data collection from any device that published MQTT and then I can use most optimal platform to do post processing.

Here is an example of how MQTT reef-pi data looks in comparison to other MQTT providers

mqtt JPG.JPG
 

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,349
Reaction score
1,724
Location
Missouri
Rating - 0%
0   0   0
Just as a test, since its a very simple adapter, I dropped a full turnkey order to JLCPCB for 15 units. This means everything except the headers will come pre-assembled on the boards. Due to some aggressive couponing ("please try our service!"), the whole thing was sub $50 including DHL. Its amazing how cheap some simple prototypes have gotten..

The part rotations needed some tweaking, and odds are I'm going to get the board back with all the diodes on backwards. Will report back when I get something in hand :)
Awesome, I have an order on pcbway but not sure on a couple of the components, if you could point me to what I need for d1-TL432DBZ, d2,d3 - 1n4148 and d4,d5 - D_Schottky? I am willing to chip in on the ones you had made, but would like to know how you figure out the part number for those items I listed. I am trying to learn to do more smd work so I am ok with putzing around with stuff.

Let me know how I can help the cause etc, really appreciate you doing this. :)

Update I didn't read down far enough, I think you answered a couple of the questions, man I wish I understood electronics a tenth of what you guys do, like its another language to me.
 

theatrus

Valuable Member
View Badges
Joined
Mar 26, 2016
Messages
2,223
Reaction score
3,632
Location
Sacramento, CA area
Rating - 0%
0   0   0
Awesome, I have an order on pcbway but not sure on a couple of the components, if you could point me to what I need for d1-TL432DBZ, d2,d3 - 1n4148 and d4,d5 - D_Schottky? I am willing to chip in on the ones you had made, but would like to know how you figure out the part number for those items I listed. I am trying to learn to do more smd work so I am ok with putzing around with stuff.

Let me know how I can help the cause etc, really appreciate you doing this. :)

Update I didn't read down far enough, I think you answered a couple of the questions, man I wish I understood electronics a tenth of what you guys do, like its another language to me.

Here is a grab from the parts picked on JLCPCB:
1641532378358.png



The part numbers (C####) can be popped into lcsc.com to get the details - in these cases, they're mainland (China) parts.

1N4148: As it says, anything with this part number, but sized to fit a SOD-323 (closest to an 0805).

TL432DBZ: You'll notice this is a TL432ASA.

The first letter is the tolerance, in this case A is worse than B, but no B parts were available and 1% vs 0.5% in this application isn't going to matter:

1641532561331.png


The "SA" is the package code for Diodes Inc for SOT-23-3. I'm unsure what the BZ in the original was after. TL432s come sometimes in a 1.24V version, but I picked the standard 2.495V.

"D_Schottky": Opted for a BAT54 in SOD-323 package. BAT45 is a pretty common "generic" part for a Schottky diode. Rated for 30V (more than enough) and 200mA (also more than enough). Usually, BAT54 is packaged in a SOT-23-3 (three leg part) as well, but there was a mainland brand packaged in a SOD-323, so just rolled with it.
 

im_jeremy5

Community Member
View Badges
Joined
Aug 14, 2019
Messages
41
Reaction score
61
Rating - 0%
0   0   0
Thats awesome.
It makes a lot of sense to design boards specifically to fit this constrain
Hey buddy, pal,

Due to some negligent actions on my part I can't access the gui. I need to reset reef-pi to factory settings without access to it. Is there a file location for the settings I can delete/edit? Or a command line way to reset it? Specifically I changed the adress on the configuration page, after that I can no longer access the gui.
 
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
Hey buddy, pal,

Due to some negligent actions on my part I can't access the gui. I need to reset reef-pi to factory settings without access to it. Is there a file location for the settings I can delete/edit? Or a command line way to reset it? Specifically I changed the adress on the configuration page, after that I can no longer access the gui.
answered on the other thread https://www.reef2reef.com/threads/reef-pi-5-0-release-announcement.874824/page-3#post-9764461
 
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
I've posted my flow in another post above. Basically I use the reef-pi as datasource through MQTT. Once MQTT topic is published (in Ree-Pi's case everything is one big clump of data and its not segregated under a specific topic say reef-pi-01 then I can pick this data up from MQTT and do anything I want. no dependency on internals of reef-pi. This method allows data collection from any device that published MQTT and then I can use most optimal platform to do post processing.

Here is an example of how MQTT reef-pi data looks in comparison to other MQTT providers

mqtt JPG.JPG
this has been fixed in main branch, will be out in next release. thank you for the detailed report, it helps a lot.
 
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
i was thinking about attending aquashella, but now with omicron rise, I don't know how I feel about it. There will be a lot of folks :-/ . Any of you are attending the event? orlando covid cases are on the rise.
Screen Shot 2022-01-08 at 10.47.00 AM.png


but I so want to be there :-( . may be I'll wait out another two weeks before making a call.
 

theatrus

Valuable Member
View Badges
Joined
Mar 26, 2016
Messages
2,223
Reaction score
3,632
Location
Sacramento, CA area
Rating - 0%
0   0   0
i was thinking about attending aquashella, but now with omicron rise, I don't know how I feel about it. There will be a lot of folks :-/ . Any of you are attending the event? orlando covid cases are on the rise.
Screen Shot 2022-01-08 at 10.47.00 AM.png


but I so want to be there :-( . may be I'll wait out another two weeks before making a call.

Personally, not for any of January, and indoors only with (KF95|KN95|N95). Will see if the current spike is so fast moving it burns its self out by Feb.
 

GaryE

Well-Known Member
View Badges
Joined
Mar 12, 2020
Messages
992
Reaction score
1,385
Location
Coatesville, Indiana
Rating - 0%
0   0   0
a quick update. I was trying to do this all in the arduino, but it seems it's really not up to the task of slurping in all of the metrics, parsing for the right data and then spitting out the right bit.. So... I decided to write a python script to do that part and output to a file, then will have the arduino connect and FTP the files to get the data and then display it. Should be way easier on the ardiuno side that way. Then it's a matter of finding a case and figuring out how I want to power it long term.. Fun stuff!!

On the positive side, this will make the gadget portable. Will not be tied to the tank. Just will need to plug it in somewhere and instant stats!

so far, this is the python code.


import requests

URL = "http://10.167.15.10/x/metrics"
tankTemp = "tank_temp_reading"
sumpTemp = "sump_temp_reading"
boxTemp = "box_temp_reading"

..... yadda yadda...
so, since this post I have mostly finished.. There are a few small changes I want to make, but until I find a good way to do them, this will do... (keep in mind, I'm neither a python, nor a C++ programmer, try not to point and laugh too much)

I was planning to use FTP to connect and get the file data, but HTTP was way easier. I was able to setup nginx in with autoindex on and set to JSON format, so it was a simple matter of using ArduionJSON to get the file names from the webserver and then use that list to pull the data from them. I'm sure if you know a little C/C++ you'll see what I'm doing there in the code and shake your head in amazement that it even does anything but cause a buffer over run and crash the Arduino.. It doesn't.. It happily churns out digits to me like I intended..



Python code:

Code:
# add metrics from the reefpi/x/metrics end point
# here that you'd like to display on your
# Arduino or whatever else may be reading these files


metrics = {
    "tankTemp": "tank_temp_reading",
    "sumpTemp": "sump_temp_reading",
    "boxTemp": "internal_box_temp_reading",
    "boxFan": "equipment_fan_state",
    "heater1state": "equipment_tank_1_heater_1_state",
    "heater2state": "equipment_tank_1_heater_2_state"
}

# retrieve the metrics from the server and save them to a variable.

from urllib.request import urlopen

response = urlopen('http://10.167.15.10/x/metrics')
html = response.read()
html = html.decode()
serverMetrics = html.split('\n')  # split everything into lines.


# function to remove the metric
# name from the line found in getTemp()


def listToString(s):
    # initialize an empty string
    string = " "
    # return string
    return string.join(s)


# while looping through the metrics dictionary,
# get the metric value from


def getMetric(t, m):
    for line in m:
        if not line.startswith(t):
            # remove commented lines from metrics to reduce size in memory
            pass
        else:
            text = line.split(' ')  # split everything into lines.
            text.pop(0)
            tempMetric = (listToString(text))  # strip the metric name
            return tempMetric


# loop the dictionary to get the values of the temp readings
for key, value in metrics.items():
    met = (getMetric(value, serverMetrics))  # get the values
    if met is None:
        metric = str("0")  # display error if a sensor fails
    else:  # all data should be good, so let's write some files...
        f = open("html/" + value + ".txt", "w")
        f.write(met)
        f.close()

Arduino code:

Code:
/**
 * BasicHTTPClient.ino
 *
 *  Created on: 24.05.2015
 *
 */

#include <Arduino.h>
#include <ArduinoJson.h>
#include <StreamUtils.h>
#include <WiFi.h>
#include <WiFiMulti.h>

#include <HTTPClient.h>

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

WiFiMulti wifiMulti;
HTTPClient http;

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET     -1
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
String url = "http://IPADDRESS:81/";

float getMetric (String name) {
  float met;
  String website = url + name;
  http.begin(website); //HTTP
  http.GET();
  String metric = http.getString();
  met = metric.toFloat();
  return met;
}

void setup() {
//    Serial.begin(9600);

  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
 display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS);
 display.clearDisplay();
 display.setTextSize(1);
 display.setTextColor(WHITE);
 delay(2000);
 display.clearDisplay();
 display.setCursor(0,0);
 display.println("Metrics Display \nSystem starting...");
 display.display();

 /*
    for(uint8_t t = 4; t > 0; t--) {
        Serial.printf("[SETUP] WAIT %d...\n", t);
        Serial.flush();
        delay(500);
    }
*/
    wifiMulti.addAP("SSID", "PASS");
}

void loop() {
    display.clearDisplay();
    display.setTextColor(WHITE);
    // wait for WiFi connection
    if((wifiMulti.run() == WL_CONNECTED)) {

//        Serial.print("[HTTP] begin...\n");
        http.useHTTP10(true);
        http.begin(url); //HTTP

//        Serial.print("[HTTP] GET...\n");
        // start connection and send HTTP header
        int httpCode = http.GET();

        // httpCode will be negative on error
        if(httpCode > 0) {
            // HTTP header has been send and Server response header has been handled
//            Serial.printf("[HTTP] GET... code: %d\n", httpCode);

            // file found at server
            if(httpCode == HTTP_CODE_OK) {
              
                DynamicJsonDocument doc(4096);
                deserializeJson(doc, http.getString());
                display.clearDisplay();
                display.setCursor(0, 0);
                for (JsonObject item : doc.as<JsonArray>()) {

                    String name = item["name"];
//                    Serial.println(getMetric(name));
       
                      if (name == "tank_temp_reading.txt"){
                       display.print("Tank Temp: ");
                      }
                      else if (name == "sump_temp_reading.txt") {
                       display.print("Sump Temp: ");                  
                      }
                      else if (name == "internal_box_temp_reading.txt") {
                       display.print("Box Temp: ");                  
                      }
                      else if (name == "equipment_tank_1_heater_1_state.txt") {
                       display.print("Tank Heater: ");                 
                      }
                      else if (name == "equipment_tank_1_heater_2_state.txt") {
                       display.print("Sump Heater: ");                 
                      }
                      else if (name == "equipment_fan_state.txt") {
                       display.print("Fan : ");                 
                      }

                    display.println(getMetric(name));
                    display.display();
                  
                }     

            }
        } else {
//            Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
            display.clearDisplay();
            display.setCursor(0, 0);
            display.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
            display.display();
        }

        http.end();
    }

    delay(10000);
}
 
Last edited:

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,349
Reaction score
1,724
Location
Missouri
Rating - 0%
0   0   0
Hey buddy, pal,

Due to some negligent actions on my part I can't access the gui. I need to reset reef-pi to factory settings without access to it. Is there a file location for the settings I can delete/edit? Or a command line way to reset it? Specifically I changed the adress on the configuration page, after that I can no longer access the gui.
Remove the database file should get you sorted, this is a good page that has troubleshooting tips - https://reef-pi.github.io/guides/troubleshooting/

Eh I see @Ranjib gave you a much better answer ignore my answer, although that troubleshooting page is a good resource. :)
 
Last edited:

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,349
Reaction score
1,724
Location
Missouri
Rating - 0%
0   0   0
i was thinking about attending aquashella, but now with omicron rise, I don't know how I feel about it. There will be a lot of folks :-/ . Any of you are attending the event? orlando covid cases are on the rise.
Screen Shot 2022-01-08 at 10.47.00 AM.png


but I so want to be there :-( . may be I'll wait out another two weeks before making a call.
They say they think Florida will peak next couple of weeks but how fast it comes back down is anyones guess. They think it will be a quick decline but they also said a lot of things that proved to be inaccurate. My gut feel is that by the end of Feb things may indeed be pretty decent in Florida since it's so bad now but what will it be like in the rest of the country is anyone's guess. Hopefully soon we can get to some state of normalcy, starting to wonder when that will be...
 
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
Alrighty, aquashella vendor booth reserved. In the application form I had to choose the type of vendor we are. I was torn between "charity", "club" and "brand", as type of business. I went with "brand", hopefully its not too controversial.

We've got a 10'x10' booth. The hotel is really nice, wify and son will have a blast. Disney world and sea world is right in there too. So they should be engaged....

@theatrus @robsworld78 @Schreiber I'll be carrying the older boards I have with me from each of you, that will be on display. If you want to showcase anything else, do send them in my way. I'll DM my address.

Im thinking of not setting up any wet tank, and instead just showcase all the integration (powerbars, ATO, temperature, light, doser, ph , orp, ec probes etc). There will be several interactive reef-pi UI setup for folks to try it out. We'll have some flyers and visiting cards for contacts and reference documentation. And may be a few hand built controllers (3d printed housing) for give away. There will be many luminaries of the community, from whom I learned a lot, it will be super cool to say thanks by actually gifting a reef-pi unit . Ideas?
 

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,349
Reaction score
1,724
Location
Missouri
Rating - 0%
0   0   0
Alrighty, aquashella vendor booth reserved. In the application form I had to choose the type of vendor we are. I was torn between "charity", "club" and "brand", as type of business. I went with "brand", hopefully its not too controversial.

We've got a 10'x10' booth. The hotel is really nice, wify and son will have a blast. Disney world and sea world is right in there too. So they should be engaged....

@theatrus @robsworld78 @Schreiber I'll be carrying the older boards I have with me from each of you, that will be on display. If you want to showcase anything else, do send them in my way. I'll DM my address.

Im thinking of not setting up any wet tank, and instead just showcase all the integration (powerbars, ATO, temperature, light, doser, ph , orp, ec probes etc). There will be several interactive reef-pi UI setup for folks to try it out. We'll have some flyers and visiting cards for contacts and reference documentation. And may be a few hand built controllers (3d printed housing) for give away. There will be many luminaries of the community, from whom I learned a lot, it will be super cool to say thanks by actually gifting a reef-pi unit . Ideas?
You want or need something 3d printed let me know, I can do pla, petg or abs be glad to print something to give away at the show etc, just let me know. :)
 

theatrus

Valuable Member
View Badges
Joined
Mar 26, 2016
Messages
2,223
Reaction score
3,632
Location
Sacramento, CA area
Rating - 0%
0   0   0
Alrighty, aquashella vendor booth reserved. In the application form I had to choose the type of vendor we are. I was torn between "charity", "club" and "brand", as type of business. I went with "brand", hopefully its not too controversial.

We've got a 10'x10' booth. The hotel is really nice, wify and son will have a blast. Disney world and sea world is right in there too. So they should be engaged....

@theatrus @robsworld78 @Schreiber I'll be carrying the older boards I have with me from each of you, that will be on display. If you want to showcase anything else, do send them in my way. I'll DM my address.

Im thinking of not setting up any wet tank, and instead just showcase all the integration (powerbars, ATO, temperature, light, doser, ph , orp, ec probes etc). There will be several interactive reef-pi UI setup for folks to try it out. We'll have some flyers and visiting cards for contacts and reference documentation. And may be a few hand built controllers (3d printed housing) for give away. There will be many luminaries of the community, from whom I learned a lot, it will be super cool to say thanks by actually gifting a reef-pi unit . Ideas?

Not going wet sounds like a major hassle win.

I'll reach out and get some prototypes and such to you, and a few gift cards/etc for raffling off :)
 
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
You want or need something 3d printed let me know, I can do pla, petg or abs be glad to print something to give away at the show etc, just let me know. :)
i just setup my ender 3 v2. after 4 years of rigorous service, it was time for some upgrades. I don't do PETG though, only PLA.

Anything you have spare , you think can be useful for the community , feel free to send my way. It will be awesome to show and share things made by the community members. Im planning to print a bunch of housing, hs300 brackets, float switch holders etc.
 

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,349
Reaction score
1,724
Location
Missouri
Rating - 0%
0   0   0
i just setup my ender 3 v2. after 4 years of rigorous service, it was time for some upgrades. I don't do PETG though, only PLA.

Anything you have spare , you think can be useful for the community , feel free to send my way. It will be awesome to show and share things made by the community members. Im planning to print a bunch of housing, hs300 brackets, float switch holders etc.
PLA hold up in saltwater decent? Most folks I read do petg for in tank stuff, I have a heavily modified ender v2 clone, all metal hotend blah blah, but it's pretty dialed in and I can print pretty much whatever I need. Just offering to help if it will help the cause. :)
 
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
PLA hold up in saltwater decent? Most folks I read do petg for in tank stuff, I have a heavily modified ender v2 clone, all metal hotend blah blah, but it's pretty dialed in and I can print pretty much whatever I need. Just offering to help if it will help the cause. :)
they dont, they warp. But the components I use, like hs300 power strip bracket, controller housing, float switch holder etc, do not touch saltwater. And I have been using them for years now without issue. For filter etc, that goes inside the water I have started using plexiglass/acrylic. They are relatively easy to fabricate
 

HAVE YOU EVER KEPT A RARE/UNCOMMON FISH, CORAL, OR INVERT? SHOW IT OFF IN THE THREAD!

  • Yes!

    Votes: 32 45.7%
  • Not yet, but I have one that I want to buy in mind!

    Votes: 9 12.9%
  • No.

    Votes: 26 37.1%
  • Other (please explain).

    Votes: 3 4.3%
Back
Top