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

I have used almost 12 GPIO, and almost all raspberry pins for one of the build, following is details: Pin numbers denote serial numbers, not GPIO number
1) Both 5v pins (2, 4)-> to power pca9685, and relay board (8 channel)
2) Two 3.3 pins ( 1, 17) -> to power mco3008 and photo electric sensor
3) 8 GPIO pins (31,32,33,35,36,37,38,40) -> to control 8 channel relay
4) Both i2c pins, sda & scl (3,5) -> pca9685 i2c connection
5) GPIO4 (pin 7) -> for temperature probe. This is a fixed pin (can be changed by kernel parameter, but I prefer to use the default pin) for 1 wire protocol (DS182b temperature probe)
6) 1 GPIO pin for ATO (11)
8) 3 pins for SPI connection to mcp3008 (19,21,23,24)
9) There are 8 GND pins, i connect them all to a single rail...
9) I keep the UART pins (pin 8 , 10) for debugging perpose, to use console cable .. They are not used for any equipments. I keep the eeprom i2c pins unplugged as well (27,28)

At the end I had only 4-5 GPIO pins left (if i recall correctly )

Does that answer your question ?

Definitely answers my question.
Just got reef-pi 0.1.1 up and running and viewing it remotely on my laptop. Nothing connected to it yet for testing purposes, but hopefully I can get some of that done this weekend.
I will attempt to make notes as I go on anything that I get hung up on. What is your preferred method on reporting? Some may not be actual issues, just something that I got caught up on.
Is the Adafruit telemetry implemented already? I am not sure if I am overlooking where to set that up in reef-pi.
Again, thanks for all of your work on this, it really is amazing.
 
Last edited:
Ranjib, Do you have logic built in so that when the temperature probe reaches a defined degree, a fan on a power outlet will be activated? Does that make sense? Just thinking out loud.
 
Definitely answers my question.
Just got reef-pi 0.1.1 up and running and viewing it remotely on my laptop. Nothing connected to it yet for testing purposes, but hopefully I can get some of that done this weekend.
I will attempt to make notes as I go on anything that I get hung up on. What is your preferred method on reporting? Some may not be actual issues, just something that I got caught up on.
Is the Adafruit telemetry implemented already? I am not sure if I am overlooking where to set that up in reef-pi.
Again, thanks for all of your work on this, it really is amazing.
Ryan, I am pretty sure the build guide has a link to Adafruit that tells how to set up the telemetry https://reef-pi.github.io/build-guides/temperature/
Did you start your pi without a monitor and keyboard? Are you using wifi aor SSH to remote into ithe pi? thanks
 
Definitely answers my question.
Just got reef-pi 0.1.1 up and running and viewing it remotely on my laptop. Nothing connected to it yet for testing purposes, but hopefully I can get some of that done this weekend.
I will attempt to make notes as I go on anything that I get hung up on. What is your preferred method on reporting? Some may not be actual issues, just something that I got caught up on.
Is the Adafruit telemetry implemented already? I am not sure if I am overlooking where to set that up in reef-pi.
Again, thanks for all of your work on this, it really is amazing.
Telemetry settings is still not implemented in UI. It used to be configurable via configuration file, which I dont want take again, since it makes thing difficult. I'll have the UI up soon, but meanwhile, you can use the api to directly update the settings (which contains telemetry). To do this, we cant get the existing setting, modify it, and upload it back (change localhost with your raspberry pi IP)
Code:
curl http://localhost:8080/api/settings > settings.json
exit that file, change the adafruitio values with your username and token. then save the file and upload
Code:
curl -v POST  http://localhost:8080/api/settings  -d @settings.json --header "Content-Type: application/json"

And reboot reef-pi.
Let me know if this does not solve your issue,
 
Ranjib, Do you have logic built in so that when the temperature probe reaches a defined degree, a fan on a power outlet will be activated? Does that make sense? Just thinking out loud.
Yes. Temperature controller will switch on/off hitters or chillers. Here is the logic : https://github.com/reef-pi/reef-pi/blob/master/controller/temperature/controller.go#L155
This is trivial implementation, and needs lots of love, I have a separate PID implementation, which we'll be integrating with the temperature controller,
 
Thanks, I am going to try to boot my pi tonight or this weekend (depends on wife) using a headless or hatless (not sure of term) procedure with SSH. If it works I will write a procedure if you want to include it. My cable was back ordered. If it doesn't work, I will go get a usb to vga cable and hook the pi up to my monitor. I hope it works
 
No, the ttl cable is the cable that the seller back ordered... I am going to try to do it another way using ssh at boot up. I will ask you for a build page if it works. Thanks and have a great holiday.
 
Ryan, I am pretty sure the build guide has a link to Adafruit that tells how to set up the telemetry https://reef-pi.github.io/build-guides/temperature/
Did you start your pi without a monitor and keyboard? Are you using wifi aor SSH to remote into ithe pi? thanks
I used a mouse, keyboard and HDMI to my TV. Now with reef-pi up and running, I am connecting through WIFI

Telemetry settings is still not implemented in UI. It used to be configurable via configuration file, which I dont want take again, since it makes thing difficult. I'll have the UI up soon, but meanwhile, you can use the api to directly update the settings (which contains telemetry). To do this, we cant get the existing setting, modify it, and upload it back (change localhost with your raspberry pi IP)
Code:
curl http://localhost:8080/api/settings > settings.json
exit that file, change the adafruitio values with your username and token. then save the file and upload
Code:
curl -v POST  http://localhost:8080/api/settings  -d @settings.json --header "Content-Type: application/json"

And reboot reef-pi.
Let me know if this does not solve your issue,
Awesome, I will try this out tonight.
Thanks
 
@Ranjib Just want to say thanks again for putting the time into this development!

Do you have any recommendations for the making the reef-pi interface available from anywhere, not just on the local network?
 
@Ranjib Just want to say thanks again for putting the time into this development!

Do you have any recommendations for the making the reef-pi interface available from anywhere, not just on the local network?
I would love to, but this will incur recurring cost of running /maintaining a server on cloud. Which is something I am not sure I want to do by myself. If there's enough interested we can have a common pledge and create a common fund (at least 200$ a month) , if we enough people it will cost little to individuals.
That said, remember we can see the dashboard/monitoring values from anywhere (since its on adafruit), I'll be rolling out image integration via email or imagur which will be available from anywhere as well, that will leave us with only a single use case , I.e. control any equipment from anywhere left out. And who knows we might be able to build an workaround for that as well.
Current focus is really to get the basic controller done, end to end tested, reduce the learning curve as much as possible, and get the documentation done. That's a very solid foundation for 1.0 release, after that we can focus on the next set of challenges
Makes sense ?
 
I would love to, but this will incur recurring cost of running /maintaining a server on cloud. Which is something I am not sure I want to do by myself. If there's enough interested we can have a common pledge and create a common fund (at least 200$ a month) , if we enough people it will cost little to individuals.
That said, remember we can see the dashboard/monitoring values from anywhere (since its on adafruit), I'll be rolling out image integration via email or imagur which will be available from anywhere as well, that will leave us with only a single use case , I.e. control any equipment from anywhere left out. And who knows we might be able to build an workaround for that as well.
Current focus is really to get the basic controller done, end to end tested, reduce the learning curve as much as possible, and get the documentation done. That's a very solid foundation for 1.0 release, after that we can focus on the next set of challenges
Makes sense ?
We should be able to open port forwarding in your router and be able to use you external ip address to get back the the reefpi.
Has anyone tried it?
 
I would love to, but this will incur recurring cost of running /maintaining a server on cloud. Which is something I am not sure I want to do by myself. If there's enough interested we can have a common pledge and create a common fund (at least 200$ a month) , if we enough people it will cost little to individuals.
That said, remember we can see the dashboard/monitoring values from anywhere (since its on adafruit), I'll be rolling out image integration via email or imagur which will be available from anywhere as well, that will leave us with only a single use case , I.e. control any equipment from anywhere left out. And who knows we might be able to build an workaround for that as well.
Current focus is really to get the basic controller done, end to end tested, reduce the learning curve as much as possible, and get the documentation done. That's a very solid foundation for 1.0 release, after that we can focus on the next set of challenges
Makes sense ?

Yup! I'm going to PM you something to take a look at it when you're bored =P, some of the DIY home automation stuff may have already figured this out but I'm not smart enough to figure out why I couldn't get it working.

We should be able to open port forwarding in your router and be able to use you external ip address to get back the the reefpi.
Has anyone tried it?

I looked into port forwarding, the security concerns is what scares me as I think I lack the skill set to ensure my network isn't comprised or put at undue risk.

In the mean time, I'm using the VNC viewer seems to work fine.
 
We should be able to open port forwarding in your router and be able to use you external ip address to get back the the reefpi.
Has anyone tried it?
This will only work if your ISP provides a static or public routable IP. We still have to do the security bits before exposing reef-pi controls out in the open. At least some sort of basic auth.
 
Yup! I'm going to PM you something to take a look at it when you're bored =P, some of the DIY home automation stuff may have already figured this out but I'm not smart enough to figure out why I couldn't get it working.



I looked into port forwarding, the security concerns is what scares me as I think I lack the skill set to ensure my network isn't comprised or put at undue risk.

In the mean time, I'm using the VNC viewer seems to work fine.

I have a feeling we should be able to get 80% of what we need from adafruit.io straight, including the ability to turn on/off equipment and triggers..While I would love to see what other have done (sharing is caring :-) ), I would also emphasize on capturing the use case first (e.g. we want the equipments tab functionality in on internet), that helps us putting focused effort and getting that particular feature implemented while avoiding unbounded/open ended discussions. Otherwise it will be very hard to stay focused since theres just an immense amount of options out there... for almost anything related to IoT
 
Exciting updates. This week I added whole bunch of UI fixes, tests...and now testing things on my physical controller. If things go right, I'll cut a 0.2 release sometime today or early tomorrow. Following are the things rolled into the 0.2 release:

- I have enable all the available modules from UI (equipments, timers, lighting, camera, temperatures and ATO). This leaves only the doser module. which will be targeted in one of the next minor release (i.e. 0.x series), before major release (1.0)
- Telemetry details can now be configured via UI
- Several bug fixes, including first time click issue on dev mode, restarting reef-pi from UI under devmode
- Increased UI testing coverage. UI tests now cover ATO ui.
- UI alignment fixes

Some screenshots, to see the whole thing in action :-) . Its exciting for me, as we can see the full blown controller slowly coming into reality

1) Very first thing we do, is to add new outlets (relay) and jacks (pwm) using the system tab.
system-jacks.png


2) I also name the controller (since i have one for each of my 3 tanks).. enable/disable different modules etc.. all of these done on the "systems" tab. Notice telemetry settings (i.e. adafruit.io token/user names) can be configured from systems tab as well.

systems-settings.png


3) Next thing to do, is to add some equipments
equipments-1.png

4) Once all equipments are added, the equipments tab is handy place to switch on/off things. This is the most used feature (for me), as i need it almost every water change
equipments-2.png

5) Once equipments are declared, I can use timers to automate some of them. Like I turn on heater (and in some cases skimmer) at night. Timer add UI


timer-1.png

Another timer job to turn heater off
timer-2.png
:
List of all timer based jobs
timer-3.png

6) Next is to set up lighting. The "add light" UI allows selecting a Jack (pwm output, as declared under 'systems' tab)., number of channels auto-detected from the jack.
light-1.png

Once added , I can either set individual channel to a fixed value (using the horizontal slider) or auto (24 hour cycle)
light-2.png

I run my Kessil A80 on auto mode, while the moonlight is used on-deman as and when I want it (at night)

8) The ATO module is one of the simpler thing to configure, I have to declare the GPIO pin to which the sensor is connected, the ato pump pin (relay) to switch on/off when water level changes, and the check interval (frequency at which reef-pi will read the sensor data)
ato.png

9) The temperature module , allows whether to just monitor (enable) temperature, or to also control it (i,.e. turn on heater of chiller), if control is enables, we can specify an minium and maximum temperature and along side heater and cooler GPIO pins (relays) that reef-pi will use to switch on/off those equipments.
temperature.png

10) Last but not the least, the camera module, when enabled will take snapshots after every tick interval. I enable it when I'm outta town, at 120 min (2 hour) interval. I have a separate script that emails me the image, but I think soon we'll have it built inside reef-pi itself.

camera.png


Thats all :-) .. thanks for tugging along, exciting time ahead as I put most of these modules to test. Any help with testing or feedback will be very helpful
 
Exciting updates. This week I added whole bunch of UI fixes, tests...and now testing things on my physical controller. If things go right, I'll cut a 0.2 release sometime today or early tomorrow. Following are the things rolled into the 0.2 release:

- I have enable all the available modules from UI (equipments, timers, lighting, camera, temperatures and ATO). This leaves only the doser module. which will be targeted in one of the next minor release (i.e. 0.x series), before major release (1.0)
- Telemetry details can now be configured via UI
- Several bug fixes, including first time click issue on dev mode, restarting reef-pi from UI under devmode
- Increased UI testing coverage. UI tests now cover ATO ui.
- UI alignment fixes

Some screenshots, to see the whole thing in action :) . Its exciting for me, as we can see the full blown controller slowly coming into reality

1) Very first thing we do, is to add new outlets (relay) and jacks (pwm) using the system tab.
system-jacks.png


2) I also name the controller (since i have one for each of my 3 tanks).. enable/disable different modules etc.. all of these done on the "systems" tab. Notice telemetry settings (i.e. adafruit.io token/user names) can be configured from systems tab as well.

systems-settings.png


3) Next thing to do, is to add some equipments
equipments-1.png

4) Once all equipments are added, the equipments tab is handy place to switch on/off things. This is the most used feature (for me), as i need it almost every water change
equipments-2.png

5) Once equipments are declared, I can use timers to automate some of them. Like I turn on heater (and in some cases skimmer) at night. Timer add UI


timer-1.png

Another timer job to turn heater off
timer-2.png
:
List of all timer based jobs
timer-3.png

6) Next is to set up lighting. The "add light" UI allows selecting a Jack (pwm output, as declared under 'systems' tab)., number of channels auto-detected from the jack.
light-1.png

Once added , I can either set individual channel to a fixed value (using the horizontal slider) or auto (24 hour cycle)
light-2.png

I run my Kessil A80 on auto mode, while the moonlight is used on-deman as and when I want it (at night)

8) The ATO module is one of the simpler thing to configure, I have to declare the GPIO pin to which the sensor is connected, the ato pump pin (relay) to switch on/off when water level changes, and the check interval (frequency at which reef-pi will read the sensor data)
ato.png

9) The temperature module , allows whether to just monitor (enable) temperature, or to also control it (i,.e. turn on heater of chiller), if control is enables, we can specify an minium and maximum temperature and along side heater and cooler GPIO pins (relays) that reef-pi will use to switch on/off those equipments.
temperature.png

10) Last but not the least, the camera module, when enabled will take snapshots after every tick interval. I enable it when I'm outta town, at 120 min (2 hour) interval. I have a separate script that emails me the image, but I think soon we'll have it built inside reef-pi itself.

camera.png


Thats all :) .. thanks for tugging along, exciting time ahead as I put most of these modules to test. Any help with testing or feedback will be very helpful

Wow.
 
Ranjib,
Once again great work.
This may be fixed by changing to 0.2, but...
Running through some of the configuration in 0.1.1, I am now not able to access reef-pi, I believe it was attempting to change interface and address when I was trying to get telemetry to run.
I have tried to completely remove reef-pi to start with a fresh install, using sudo dpkg --remove and then I deleted every occurrence I could find of reef-pi (.db, .yml, etc...)
When I rerun the install
now I am getting
Code:
pi@raspberrypi:~ $ sudo dpkg -i /home/pi/Documents/reef-pi-0.1.1-pi3.deb
(Reading database ... 122735 files and directories currently installed.)
Preparing to unpack .../reef-pi-0.1.1-pi3.deb ...
Unpacking reef-pi (0.1.1) over (0.1.1) ...
Setting up reef-pi (0.1.1) ...
pi@raspberrypi:~ $ systemctl status reef-pi.service
● reef-pi.service - raspberry pi based reef tank controller
   Loaded: loaded (/lib/systemd/system/reef-pi.service; enabled; vendor preset:
   Active: failed (Result: exit-code) since Sun 2017-09-03 09:35:48 CDT; 15s ago
  Process: 3937 ExecStart=/usr/bin/reef-pi -config /etc/reef-pi/config.yml (code
 Main PID: 3937 (code=exited, status=1/FAILURE)

Sep 03 09:35:48 raspberrypi systemd[1]: Started raspberry pi based reef tank con
Sep 03 09:35:48 raspberrypi reef-pi[3937]: 2017/09/03 09:35:48 Failed to parse c
Sep 03 09:35:48 raspberrypi systemd[1]: reef-pi.service: Main process exited, co
Sep 03 09:35:48 raspberrypi systemd[1]: reef-pi.service: Unit entered failed sta
Sep 03 09:35:48 raspberrypi systemd[1]: reef-pi.service: Failed with result 'exi
Any recommendations on how to start from scratch if things get corrupted?
 
Ranjib,
Once again great work.
This may be fixed by changing to 0.2, but...
Running through some of the configuration in 0.1.1, I am now not able to access reef-pi, I believe it was attempting to change interface and address when I was trying to get telemetry to run.
I have tried to completely remove reef-pi to start with a fresh install, using sudo dpkg --remove and then I deleted every occurrence I could find of reef-pi (.db, .yml, etc...)
When I rerun the install
now I am getting
Code:
pi@raspberrypi:~ $ sudo dpkg -i /home/pi/Documents/reef-pi-0.1.1-pi3.deb
(Reading database ... 122735 files and directories currently installed.)
Preparing to unpack .../reef-pi-0.1.1-pi3.deb ...
Unpacking reef-pi (0.1.1) over (0.1.1) ...
Setting up reef-pi (0.1.1) ...
pi@raspberrypi:~ $ systemctl status reef-pi.service
● reef-pi.service - raspberry pi based reef tank controller
   Loaded: loaded (/lib/systemd/system/reef-pi.service; enabled; vendor preset:
   Active: failed (Result: exit-code) since Sun 2017-09-03 09:35:48 CDT; 15s ago
  Process: 3937 ExecStart=/usr/bin/reef-pi -config /etc/reef-pi/config.yml (code
 Main PID: 3937 (code=exited, status=1/FAILURE)

Sep 03 09:35:48 raspberrypi systemd[1]: Started raspberry pi based reef tank con
Sep 03 09:35:48 raspberrypi reef-pi[3937]: 2017/09/03 09:35:48 Failed to parse c
Sep 03 09:35:48 raspberrypi systemd[1]: reef-pi.service: Main process exited, co
Sep 03 09:35:48 raspberrypi systemd[1]: reef-pi.service: Unit entered failed sta
Sep 03 09:35:48 raspberrypi systemd[1]: reef-pi.service: Failed with result 'exi
Any recommendations on how to start from scratch if things get corrupted?
The log is truncated for some reason, so I cant see what's wrong, other than the fact that its not starting.
To clean up everything and start from scratch :
Code:
sudo apt-get remove reef-pi -y --purge
sudo rm -rf /var/lib/reef-pi /etc/reef-pi
sudo dpkg -I reef-pi....deb
 
Ranjib,
Once again great work.
This may be fixed by changing to 0.2, but...
Running through some of the configuration in 0.1.1, I am now not able to access reef-pi, I believe it was attempting to change interface and address when I was trying to get telemetry to run.
I have tried to completely remove reef-pi to start with a fresh install, using sudo dpkg --remove and then I deleted every occurrence I could find of reef-pi (.db, .yml, etc...)
When I rerun the install
now I am getting
Code:
pi@raspberrypi:~ $ sudo dpkg -i /home/pi/Documents/reef-pi-0.1.1-pi3.deb
(Reading database ... 122735 files and directories currently installed.)
Preparing to unpack .../reef-pi-0.1.1-pi3.deb ...
Unpacking reef-pi (0.1.1) over (0.1.1) ...
Setting up reef-pi (0.1.1) ...
pi@raspberrypi:~ $ systemctl status reef-pi.service
● reef-pi.service - raspberry pi based reef tank controller
   Loaded: loaded (/lib/systemd/system/reef-pi.service; enabled; vendor preset:
   Active: failed (Result: exit-code) since Sun 2017-09-03 09:35:48 CDT; 15s ago
  Process: 3937 ExecStart=/usr/bin/reef-pi -config /etc/reef-pi/config.yml (code
 Main PID: 3937 (code=exited, status=1/FAILURE)

Sep 03 09:35:48 raspberrypi systemd[1]: Started raspberry pi based reef tank con
Sep 03 09:35:48 raspberrypi reef-pi[3937]: 2017/09/03 09:35:48 Failed to parse c
Sep 03 09:35:48 raspberrypi systemd[1]: reef-pi.service: Main process exited, co
Sep 03 09:35:48 raspberrypi systemd[1]: reef-pi.service: Unit entered failed sta
Sep 03 09:35:48 raspberrypi systemd[1]: reef-pi.service: Failed with result 'exi
Any recommendations on how to start from scratch if things get corrupted?
I think the configuration file format is wrong . can you share it?
 

IF YOU HAD TO TAKE A REEFING EXAM, WOULD YOU PASS?

  • 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