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

Zippyfear

Community Member
View Badges
Joined
Apr 30, 2019
Messages
86
Reaction score
152
Rating - 0%
0   0   0
Hi, I had taken my pi board out a couple of weeks back to test something else on the pi, I just realised my doser isn't working, it's powered via a pca9685, I don't seem to have any output from the PCA 9685 (zero volts) now I removed the PCA 9685 from the drivers and after a reboot I'm now getting this error.
Screenshot_2020-06-25-19-20-14-584_com.android.chrome.jpg

This shows up when I click on connectors, is there a way I can put a clean install over the top without having to wipe the SD card?

You can uninstall, delete the database, and reinstall.. you might have to do some searching through the forum at the commands for this, but it's pretty simple.
 

stefanm

Active Member
View Badges
Joined
Oct 11, 2017
Messages
360
Reaction score
397
Location
Sweden
Rating - 0%
0   0   0
You can uninstall, delete the database, and reinstall.. you might have to do some searching through the forum at the commands for this, but it's pretty simple.

Thanks, I managed to get it back earlier it turns out that the PCA9685 isn't working anymore, I checked on the SSH pinged the i2s and no show. Bummer really as I had removed the pi to test an audio DAC that wasn't working as it should to show the manufacturer, pretty sure everything was put back exactly the same, strange thing is an Arduino Uno stopped working along with another pca9685 for my lighting, only the 12v PSU was shared between the Arduino and the l293d driver boards, at least the pi works
 

Martin Lowry

Community Member
View Badges
Joined
Sep 19, 2017
Messages
60
Reaction score
66
Location
Dover, NH
Rating - 0%
0   0   0
I tried the Servo again and I found that the servo PWM needs to be in between 1 and 2 ms. 1 ms is 0dgr and 2 ms is 180dgr. Using the PCA9685 you can set the Frequency. When a frequency is used of 350Hz that means 1/350= 2.86 ms. I used the Lights tab in Reefpi and set it to manual. When the percentage is set to 17% it moves to 0dgr and 55% it moves to 90dgr and 93% to 180dgr.

1592689238567.png


After some fine-tuning when the frequency is set to 320Hz (1/320=3.125ms) i get with 17% it moves to 0dgr and 50% it moves to 90dgr and 83% to 180dgr.
I am thinking of building an auto-feeder with Servos!!!

Sounds like an interesting project. I had an EHEIM and followed @robsworld78 directions to hook it up to my RPi3B ReefPi works really well. I setup a Macro to kill the return pump, wave makers and skimmer with a 1 sec wait on the EHEIM to feed, just like pushing the button ontop. Pretty slick.... I think I only paid $18 for the EHEIM. May be worth a look... cheap enough!
 
Last edited:

NeonRabbit221B

2500 Club Member
View Badges
Joined
Jun 21, 2019
Messages
3,037
Reaction score
5,614
Location
Richmond, Va
Rating - 0%
0   0   0
Hey y’all. I am looking for a reef-pi friendly lighting for my fluval evo 13.5. Stock light has been doing just fine for me but to be honest I miss the lack of control and night lighting. Tank is about 18.5x11.5x12.5 tall and I am looking for a light that I could control using reef-pi. I have seen a few posts suggesting kessil 80 and 160 but never a follow up on how it worked. Any ideas?
 

robsworld78

Well-Known Member
View Badges
Joined
Feb 14, 2020
Messages
985
Reaction score
1,325
Location
Edmonton, Canada
Rating - 0%
0   0   0
I've been playing with some code lately and made up a bash script that will install reef-pi from a fresh Raspbian install.

Now that I've done it so many times (one sd card doing 10 things) I see it really isn't that difficult but my first time it felt overwhelming as it was all new so this should help some. These steps will get you running.

1. Use Raspberry Pi Imager to install Rasbpian on your microSD card.

2. Add the files in attachment to /boot/ directory on microSD card. On Windows this is root directory of the SD card it shows. These 3 files are for wifi access to Pi and the installation script. Make sure to update the wpa_supplicant.conf file you just copied with your wifi login information.

3. Insert SD card into Pi, log into SSH terminal and run the following command.

bash /boot/install_reefpi.sh

4.
Login to reef-pi and setup.

This will do the following automatically, it's two steps as it needs a reboot after expanding the file system. After reboot log back into SSH terminal and it will continue.

* updates Raspbian
* expands file system on microSD card
* prompts for time zone (TZ database name - https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
* enables time sync
* enables I2C
* sets I2C speed to 10 kHz
* disables SPI
* enables 1-wire
* enables PWM on Raspberry Pi pin GPIO12 and GPIO13
* installs reef-pi (prompts for Pi Zero W or Pi3/Pi4 install)
* generates website address link and shows credentials to access reef-pi

I'm going to be adding option for friendly URL, try and remove the output on terminal from processes so my guide isn't lost in it all and see if I can have this script auto start once.

@Ranjib Can a working database from a Pi Zero be installed over a working database on a Pi 3 or vice versa and work? What I want to do is setup reef-pi with defaults for my board, then with this script after it installs reef-pi it will copy over the database to match my board, then when they log in the drivers and connectors are there. This would be good for others who make boards as well, when this happens in script it can prompt, show a list of boards and a person can select what they have or skip. Right now I only have a Pi 3 so can't test.
 

Attachments

  • install_reefpi.zip
    30.7 KB · Views: 95
Last edited:

robsworld78

Well-Known Member
View Badges
Joined
Feb 14, 2020
Messages
985
Reaction score
1,325
Location
Edmonton, Canada
Rating - 0%
0   0   0
Well now I'm embarrassed, I posted this 15 minutes too soon, after this I started setting up a default database the I2C wasn't working, turns out just changing the config.txt file wasn't enough. So download this one instead. If a mod can remove the attachment on the previous post that would be cool. I tried but couldn't edit the post when I discovered.

This one is tested, I2C and 1-wire works. Command also needs sudo in front now.

sudo bash /boot/install_reefpi.sh
 

Attachments

  • install_reefpi.zip
    31 KB · Views: 97
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
Hi, I had taken my pi board out a couple of weeks back to test something else on the pi, I just realised my doser isn't working, it's powered via a pca9685, I don't seem to have any output from the PCA 9685 (zero volts) now I removed the PCA 9685 from the drivers and after a reboot I'm now getting this error.
Screenshot_2020-06-25-19-20-14-584_com.android.chrome.jpg

This shows up when I click on connectors, is there a way I can put a clean install over the top without having to wipe the SD card?
I think you have deleted a driver without deleting the corresponding connectors, which is breaking the UI. This bug is fixed in newer version, otherwise you have to reset the database
 
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 been playing with some code lately and made up a bash script that will install reef-pi from a fresh Raspbian install.

Now that I've done it so many times (one sd card doing 10 things) I see it really isn't that difficult but my first time it felt overwhelming as it was all new so this should help some. These steps will get you running.

1. Use Raspberry Pi Imager to install Rasbpian on your microSD card.

2. Add the files in attachment to /boot/ directory on microSD card. On Windows this is root directory of the SD card it shows. These 3 files are for wifi access to Pi and the installation script. Make sure to update the wpa_supplicant.conf file you just copied with your wifi login information.

3. Insert SD card into Pi, log into SSH terminal and run the following command.

bash /boot/install_reefpi.sh

4.
Login to reef-pi and setup.

This will do the following automatically, it's two steps as it needs a reboot after expanding the file system. After reboot log back into SSH terminal and it will continue.

* updates Raspbian
* expands file system on microSD card
* prompts for time zone (TZ database name - https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
* enables time sync
* enables I2C
* sets I2C speed to 10 kHz
* disables SPI
* enables 1-wire
* enables PWM on Raspberry Pi pin GPIO12 and GPIO13
* installs reef-pi (prompts for Pi Zero W or Pi3/Pi4 install)
* generates website address link and shows credentials to access reef-pi

I'm going to be adding option for friendly URL, try and remove the output on terminal from processes so my guide isn't lost in it all and see if I can have this script auto start once.

@Ranjib Can a working database from a Pi Zero be installed over a working database on a Pi 3 or vice versa and work? What I want to do is setup reef-pi with defaults for my board, then with this script after it installs reef-pi it will copy over the database to match my board, then when they log in the drivers and connectors are there. This would be good for others who make boards as well, when this happens in script it can prompt, show a list of boards and a person can select what they have or skip. Right now I only have a Pi 3 so can't test.
yes, databases across pi zero/pi 3 should be portable. Let me know if you encounter any issue
 

buddy.

Active Member
View Badges
Joined
May 16, 2018
Messages
291
Reaction score
617
Location
Australia
Rating - 0%
0   0   0
I made up a sensor holder today for my ATO which is working great so far.
The lower one is the ATO sensor and the upper one turns off the skimmer if the water level gets high.

Is it possible to also use the upper sensor as a fail safe for the ATO if the sensor fails with the pump on? What would be the best way to set this up?
If I just set the upper sensor to turn the ATO pump off, will they just fight with each other each time the sensors do a check?

20200627_142627.jpg
 

Matevz Savarin

Active Member
View Badges
Joined
Dec 5, 2018
Messages
209
Reaction score
163
Rating - 0%
0   0   0
Hi I am looking to add tds sensor for rodi. So I can go arduino one and tds board or is there a way to go analog to digital converter and then to pi? Mcp3008 driver is supported and izssame for ph.. is there something I am missing so tds would work on reefpi? Thank you!
 

BenB

Active Member
View Badges
Joined
Jun 11, 2019
Messages
112
Reaction score
155
Rating - 0%
0   0   0
Hi I am looking to add tds sensor for rodi. So I can go arduino one and tds board or is there a way to go analog to digital converter and then to pi? Mcp3008 driver is supported and izssame for ph.. is there something I am missing so tds would work on reefpi? Thank you!
Michael lane is working on an ads1115 driver, that might work aswell with a TDS meter.
 

t951

Community Member
View Badges
Joined
Feb 5, 2016
Messages
60
Reaction score
46
Location
Orlando, FL
Rating - 0%
0   0   0
I posted this on my thread, but this thread gets far more views...

I have setup Reef-Pi to use ML pi-hat pins 4,5,6. These pins will activate the three doser pumps. I imagine that each motor gets the positive connected to a pin. (Motor 1 goes to pin 4, Motor 2 to 5, etc). I read the thread and know that they should share the ground with the controller to avoid voltage drift. My question is how do I get 12v to those pins.
I have a buck converter that connects to the hat 12v.
Each motor has a + -
So the wiring from the motors would go from my second box (holding the dosers), to my reef-pi box. A straight through connection with 3 wires for positive (one for each motor) and a shared ground. The wires then get connected to what?

I hope my question is clear....

TLDR....how do i power 12v pumps from the pi-hat?
 

trustychords

New Member
View Badges
Joined
Aug 17, 2019
Messages
24
Reaction score
31
Location
Virginia, USA
Rating - 0%
0   0   0
I have some basic questions about setting up Prometheus on Windows 10. I think I am close but can't get it to run. Here is what I have done so far, step-by-step.

  1. Downloaded Prometheus here and unziped it.
  2. Opened Windows Powershell and executed the following commands one-by-one:
    1. Code:
      Set-Location -Path C:\ -PassThru
    2. Code:
      MKDIR prometheus
    3. Code:
      CD prometheus
    4. Copy/pasted the contents of the Prometheus download into the newly created folder.
    5. Went to http://localhost:9090/graph to ensure Prometheus is operational. It is operational and I got the following screen.
      Untitled.png
    6. At the very bottom of the "prometheus.yml" file in the Prometheus folder, I edited the "static_configs" section. Here is where I can't get things to work, even though I think they should. I add my IP and save. The line now reads 'localhost:9090','000.000.0.201:80/x/metrics'. I save and then go to "http://000.000.0.201:80/targets" but it won't connect. "000.000.0.201" is just a placeholder IP, I enter my actual IP when configuring!
Does anyone have guidance?
 
Last edited:

trustychords

New Member
View Badges
Joined
Aug 17, 2019
Messages
24
Reaction score
31
Location
Virginia, USA
Rating - 0%
0   0   0
I have some basic questions about setting up Prometheus on Windows 10. I think I am close but can't get it to run. Here is what I have done so far, step-by-step.

  1. Downloaded Prometheus here and unziped it.
  2. Opened Windows Powershell and executed the following commands one-by-one:
    1. Code:
      Set-Location -Path C:\ -PassThru
    2. Code:
      MKDIR prometheus
    3. Code:
      CD prometheus
    4. Copy/pasted the contents of the Prometheus download into the newly created folder.
    5. Went to http://localhost:9090/graph to ensure Prometheus is operational. It is operational and I got the following screen.
      Untitled.png
    6. At the very bottom of the "prometheus.yml" file in the Prometheus folder, I edited the "static_configs" section. Here is where I can't get things to work, even though I think they should. I add my IP and save. The line now reads 'localhost:9090','000.000.0.201:80/x/metrics'. I save and then go to "http://000.000.0.201:80/targets" but it won't connect. "000.000.0.201" is just a placeholder IP, I enter my actual IP when configuring!
Does anyone have guidance?

I figured this out. In the prometheus.yml file, you have to change the metrics_path option. Instead of this:
Code:
  # metrics_path defaults to '/metrics'
you have to put
Code:
metrics_path: /x/metrics

So the complete section of code looks like this:

Code:
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    metrics_path: /x/metrics
    # scheme defaults to 'http'.

    static_configs:
     - targets: ['ENTER YOUR REEF-PI IP ADDRESS HERE']
 

Litserv

Community Member
View Badges
Joined
May 3, 2020
Messages
62
Reaction score
60
Rating - 0%
0   0   0
(
Ranjib said:
I have not tried this personally, but should be fairly easy. Try this: https://pimylifeup.com/raspberry-pi-ssl-lets-encrypt/ , its for apache web server (which we are not using) but the instructions provided here does show how to control the path of generated certificates.
Please do report back if this works. If not, i'll find out how to do this. Its an important topic (to run reef-pi with https and proper cert authority), which should be easy, and we should know if theres some obvious gotchas.
)

I'm away from home until next week. Asap I'll try it and report the resulst. THANKS!

I wasn't able to get a certificate from letsencrypt. Sorry, I give up...
 

Kerinin

Community Member
View Badges
Joined
Jun 8, 2020
Messages
45
Reaction score
29
Rating - 100%
1   0   0
I know there's been some discussion of adding the ability to control stepper peristaltic pumps. I'm thinking about doing some work on that topic and I thought I'd describe my plans to make sure I'm not duplicating any existing work, or going in a direction that doesn't make sense for some reason.

One of my priorities is minimizing stepper noise, so I've been looking at the Trinamic TMC-series stepper drivers. They claim to be able to run silently at lower speeds. The two drivers I've been looking at are the TMC2130 and TMC5160. The TMC5160 is basically a more powerful version of the TMC2130 that includes a step/ramp generator controllable via UART.

My first thought was to use the rpi's serial pins to drive the *5160, allowing multiple drivers to be controlled via a shared serial bus. The problem with the approach is that it could lead to uncontrolled dosing: the reef-pi could instruct the *5160 to ramp up to a given velocity with the intention of instructing it to ramp back down the future, then fail somehow, and leave the driver running for an indefinite amount of time (power loss, OOM, unhandled panic, etc).

So my second thought was to use the TMC2130 and an Arduino Nano to generate the step signals. The *2130's are available in 4-packs for $30 and the Nano costs $10 so it ends up being cheaper to run 2+ steppers. There's a stepper library for Arduino that can control multiple drivers simultaneously and includes features like acceleration and deceleration. The Arduino could additionally be used to read GPIO pins, which could be useful for things like preventing dosing if a fluid level sensor is triggered (or not). A serial API would be needed between the rpi and the Arduino, ideally something along the lines of "please execute N steps". On the software side, I think this would involve writing a "sketch" to drive the arduino and a driver for reef-pi.

Does this seem reasonable? Are there concerns I should be considering?
 

Urtoo

Well-Known Member
View Badges
Joined
Jul 1, 2019
Messages
688
Reaction score
925
Rating - 0%
0   0   0
My TMC2130’s run my 3D printer for hours without fail and are silent. I have not seen the other 51 series you mention, but that gives me something to look at today.
It would be amazing to have stepper motor control for many reasons. I wish you success in this.
 

elysics

Valuable Member
View Badges
Joined
Jan 15, 2020
Messages
1,591
Reaction score
1,590
Rating - 0%
0   0   0
Yeah, controlling the amount of steps is the way to go. It's a small pet peeve of mine, seeing people that want to use stepper motors trying to control time and speed instead of actually leveraging the benefit of them and controlling degrees of turning.
 
Back
Top