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

AquaRaider44

#Reef4Life
View Badges
Joined
Apr 19, 2019
Messages
526
Reaction score
823
Location
Brevard County
Rating - 0%
0   0   0
Would it be sufficient to have the sine set where it increments forward by about an hour each day? That would give it close to a monthly cycle (realistically could get closer to true cycle if needed).
Additionally be able to set min/max and where in the cycle to start that day (only needed to "sync" to current moon phase.)
I guess if you could make a custom pwm profile for 29.5 days you could just start it when you want and it would ramp up and down and repeat at the end of the 29.5 days. This would be the basic lunar cycle.
 
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
Yes.
I went through couple of articles, and I think i understand the details a bit more now. We need sine curves daily, but the amplitude of that sine curve will vary from 0 (new moon) to a max value(full moon), and that intensity increase is not linear, its actual mirrored exponential form. This is all about the intensity variation, theres a duration variation as well, but i think we can park that for next phase since the solar simulation itself is not really mimicing the yearly/monthly patterns. I'll make sure we have a lunar profile which basically runs a mirrored exponential monthly intensity multiplier against a daily sine curve. Actually, we have something called a composite profile which i can use to build something like this, it allows fully or partially combining multiple profiles

https://ask.metafilter.com/226118/What-part-of-the-earth-gets-the-most-moonlight
https://jeb.biologists.org/content/214/5/770
 

AquaRaider44

#Reef4Life
View Badges
Joined
Apr 19, 2019
Messages
526
Reaction score
823
Location
Brevard County
Rating - 0%
0   0   0
@Ranjib would a profile like the one I described above be possible with just generic settings? Such as


graph-1-illumination-vs-hours-for-the-lunar-cycle.png

https://plot.ly/~cowas78/114.embed
 

AquaRaider44

#Reef4Life
View Badges
Joined
Apr 19, 2019
Messages
526
Reaction score
823
Location
Brevard County
Rating - 0%
0   0   0
This would just be a huge 708.734 hour sine cycle where the brightness of the lights just increases over the whole time. It should be super simple to implement @Ranjib then you could just define the setting as start date which would be the last new moon for the user to input.

1f8929efcd49f5b91c3c9f2dc25958d7.png
 

AquaRaider44

#Reef4Life
View Badges
Joined
Apr 19, 2019
Messages
526
Reaction score
823
Location
Brevard County
Rating - 0%
0   0   0
Yes.
I went through couple of articles, and I think i understand the details a bit more now. We need sine curves daily, but the amplitude of that sine curve will vary from 0 (new moon) to a max value(full moon), and that intensity increase is not linear, its actual mirrored exponential form. This is all about the intensity variation, theres a duration variation as well, but i think we can park that for next phase since the solar simulation itself is not really mimicing the yearly/monthly patterns. I'll make sure we have a lunar profile which basically runs a mirrored exponential monthly intensity multiplier against a daily sine curve. Actually, we have something called a composite profile which i can use to build something like this, it allows fully or partially combining multiple profiles

https://ask.metafilter.com/226118/What-part-of-the-earth-gets-the-most-moonlight
https://jeb.biologists.org/content/214/5/770
I completely agree. Thank you!
 
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
@Ranjib would a profile like the one I described above be possible with just generic settings? Such as


graph-1-illumination-vs-hours-for-the-lunar-cycle.png

https://plot.ly/~cowas78/114.embed
This is a gaussian curve, we dont have this, we have sine curve, which is very similar except the smooth start/end plateue. Diurnal cycle has similar plateues.
But more importantly, this is not a daily cycle graph this is the graph of peak intensity (midnight ??) across a month. I think i know what we are looking here. Gimme some time and I'll get back with some updates
 
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 completely agree. Thank you!
No thank you, this is a great suggestion, we need this type of discussions. I learned a lot just by reading through those papers..
 

AquaRaider44

#Reef4Life
View Badges
Joined
Apr 19, 2019
Messages
526
Reaction score
823
Location
Brevard County
Rating - 0%
0   0   0
This is a gaussian curve, we dont have this, we have sine curve, which is very similar except the smooth start/end plateue. Diurnal cycle has similar plateues.
But more importantly, this is not a daily cycle graph this is the graph of peak intensity (midnight ??) across a month. I think i know what we are looking here. Gimme some time and I'll get back with some updates
Yes this would be the peak intensity at the time when the moon would be right above the tank / high point. It would still need to be adjusted for the time of day when the moon rises and sets with this number being the peak %.
 

MichaelA18454

Community Member
View Badges
Joined
Jun 22, 2019
Messages
50
Reaction score
40
Rating - 0%
0   0   0
Check if reef-pi is running (sudo systemctl status reef-pi.service), as mentioned here: https://reef-pi.github.io/guides/troubleshooting/

Directly after I am disconnected from a "REBOOT" i see:

pi@reeftank:~ $ sudo 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: activating (auto-restart) (Result: exit-code) since Sun 2019-07-14 18
Process: 9823 ExecStart=/usr/bin/reef-pi daemon -config /etc/reef-pi/config.ym
Main PID: 9823 (code=exited, status=1/FAILURE)
lines 1-5/5 (END)

After I reset "Service" I see:

pi@reeftank:~ $ sudo 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: active (running) since Sun 2019-07-14 18:44:49 AEST; 2min 15s ago
Main PID: 9917 (reef-pi)
Memory: 2.0M
CGroup: /system.slice/reef-pi.service
+-9917 /usr/bin/reef-pi daemon -config /etc/reef-pi/config.yml

Jul 14 18:44:50 reeftank reef-pi[9917]: 2019/07/14 18:44:50 Successfully started
Jul 14 18:44:50 reeftank reef-pi[9917]: 2019/07/14 18:44:50 Initializing DB for
Jul 14 18:44:50 reeftank reef-pi[9917]: 2019/07/14 18:44:50 Successfully started
Jul 14 18:44:50 reeftank reef-pi[9917]: 2019/07/14 18:44:50 reef-pi is up and ru
Jul 14 18:44:50 reeftank reef-pi[9917]: 2019/07/14 18:44:50 ERROR: health checke
Jul 14 18:44:50 reeftank reef-pi[9917]: 2019/07/14 18:44:50 Starting health chec
Jul 14 18:44:50 reeftank reef-pi[9917]: 2019/07/14 18:44:50 ERROR: Failed to loa
Jul 14 18:44:50 reeftank reef-pi[9917]: 2019/07/14 18:44:50 Starting http server
Jul 14 18:45:50 reeftank reef-pi[9917]: 2019/07/14 18:45:50 health check: Used m
Jul 14 18:46:50 reeftank reef-pi[9917]: 2019/07/14 18:46:50 health check: Used m
lines 1-18/18 (END)
 

MichaelA18454

Community Member
View Badges
Joined
Jun 22, 2019
Messages
50
Reaction score
40
Rating - 0%
0   0   0
I started at reformat SDcard again and did a complete fresh install.
Without setting up any modules and ONLY selecting the 3 items in the "Configuration" folder Dose-LightingpPCS8685 and pressing "REBOOT"
Here are the log files before and after pressing "REBOOT"

pi@reeftank:~ $ sudo 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: enabled)
Active: active (running) since Mon 2019-07-15 12:31:38 AEST; 2min 58s ago
Main PID: 268 (reef-pi)
Memory: 9.3M
CGroup: /system.slice/reef-pi.service
+-268 /usr/bin/reef-pi daemon -config /etc/reef-pi/config.yml

Jul 15 12:31:39 reeftank reef-pi[268]: 2019/07/15 12:31:39 INFO: equipment subsystem: Finished syncing all equipment
Jul 15 12:31:39 reeftank reef-pi[268]: 2019/07/15 12:31:39 Successfully started subsystem: equipment
Jul 15 12:31:40 reeftank reef-pi[268]: 2019/07/15 12:31:40 Successfully started subsystem: timers
Jul 15 12:31:40 reeftank reef-pi[268]: 2019/07/15 12:31:40 Successfully started subsystem: ato
Jul 15 12:31:40 reeftank reef-pi[268]: 2019/07/15 12:31:40 Successfully started subsystem: temperature
Jul 15 12:31:40 reeftank reef-pi[268]: 2019/07/15 12:31:40 Successfully started subsystem: macro
Jul 15 12:31:40 reeftank reef-pi[268]: 2019/07/15 12:31:40 reef-pi is up and running
Jul 15 12:31:40 reeftank reef-pi[268]: 2019/07/15 12:31:40 Starting http server at: 0.0.0.0:80
Jul 15 12:31:40 reeftank reef-pi[268]: 2019/07/15 12:31:40 ERROR: health checker. Failed to load usage. Error: Item 'health_stats' does not exist in bucket '
Jul 15 12:31:40 reeftank reef-pi[268]: 2019/07/15 12:31:40 Starting health checker

*****************************************************************
Error Log file after pressing "REBOOT"

pi@reeftank:~ $ sudo journalctl -fu reef-pi.service
-- Logs begin at Mon 2019-07-15 12:39:55 AEST. --
Jul 15 12:41:28 reeftank systemd[1]: Started raspberry pi based reef tank controller.
Jul 15 12:41:29 reeftank reef-pi[292]: 2019/07/15 12:41:29 Setting pca9685 frquency: 1500
Jul 15 12:41:29 reeftank reef-pi[292]: 2019/07/15 12:41:29 ERROR: Failed to initialize pca9685 driver with mock i2c bus. Error: remote I/O error
Jul 15 12:41:29 reeftank reef-pi[292]: 2019/07/15 12:41:29 ERROR: Failed to initialize controller. Error:remote I/O error
Jul 15 12:41:29 reeftank systemd[1]: reef-pi.service: Main process exited, code=exited, status=1/FAILURE
Jul 15 12:41:29 reeftank systemd[1]: reef-pi.service: Failed with result 'exit-code'.
Jul 15 12:44:19 reeftank systemd[1]: reef-pi.service: Service RestartSec=1min 30s expired, scheduling restart.
Jul 15 12:44:19 reeftank systemd[1]: reef-pi.service: Scheduled restart job, restart counter is at 1.
Jul 15 12:44:19 reeftank systemd[1]: Stopped raspberry pi based reef tank controller.
Jul 15 12:44:19 reeftank systemd[1]: Started raspberry pi based reef tank controller.
Jul 15 12:44:19 reeftank reef-pi[599]: 2019/07/15 12:44:19 Setting pca9685 frquency: 1500
Jul 15 12:44:19 reeftank reef-pi[599]: 2019/07/15 12:44:19 ERROR: Failed to initialize pca9685 driver with mock i2c bus. Error: remote I/O error
Jul 15 12:44:19 reeftank reef-pi[599]: 2019/07/15 12:44:19 ERROR: Failed to initialize controller. Error:remote I/O error
Jul 15 12:44:19 reeftank systemd[1]: reef-pi.service: Main process exited, code=exited, status=1/FAILURE
Jul 15 12:44:19 reeftank systemd[1]: reef-pi.service: Failed with result 'exit-code'.
 

MichaelA18454

Community Member
View Badges
Joined
Jun 22, 2019
Messages
50
Reaction score
40
Rating - 0%
0   0   0
I believe so in 2 places
The config.txt file:
Edit config.txt to include the following lines...

dtparam=i2c_arm=on
dtoverlay=w1-gpio
dtoverlay=pwm-2chan

and in sudo raspi-config
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get i2c-tools

sudo systemctl start ssh.service
sudo systemctl enable ssh.service

sudo systemctl start systemd-timesyncd.service
sudo systemctl enable systemd-timesyncd.service
sudo dpkg-reconfigure tzdata
 

MichaelA18454

Community Member
View Badges
Joined
Jun 22, 2019
Messages
50
Reaction score
40
Rating - 0%
0   0   0
Error log file after "REBOOT"


pi@reeftank:~ $ sudo 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: activating (auto-restart) (Result: exit-code) since Mon 2019-07-15 12
Process: 663 ExecStart=/usr/bin/reef-pi daemon -config /etc/reef-pi/config.yml
Main PID: 663 (code=exited, status=1/FAILURE)
lines 1-5/5 (END)
? reef-pi.service - raspberry pi based reef tank controller
Loaded: loaded (/lib/systemd/system/reef-pi.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Mon 2019-07-15 12:56:21 AEST; 47s ago
Process: 663 ExecStart=/usr/bin/reef-pi daemon -config /etc/reef-pi/config.yml (code=exited, status=1/FAILURE)
Main PID: 663 (code=exited, status=1/FAILURE)
 

BenB

Active Member
View Badges
Joined
Jun 11, 2019
Messages
112
Reaction score
155
Rating - 0%
0   0   0
Jul 15 12:44:19 reeftank reef-pi[599]: 2019/07/15 12:44:19 ERROR: Failed to initialize pca9685 driver with mock i2c bus. Error: remote I/O error

It does not find the pca9685 board on the i2c bus, therefore it gives an error...

Just connect the pca9685 board to the Pi.

It is a known bug that still has to be fixed, see page 570 of this thread.
 

Bigtrout

Valuable Member
View Badges
Joined
Dec 16, 2018
Messages
1,189
Reaction score
2,826
Rating - 0%
0   0   0
I believe so in 2 places
The config.txt file:
Edit config.txt to include the following lines...

dtparam=i2c_arm=on
dtoverlay=w1-gpio
dtoverlay=pwm-2chan

and in sudo raspi-config
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get i2c-tools

sudo systemctl start ssh.service
sudo systemctl enable ssh.service

sudo systemctl start systemd-timesyncd.service
sudo systemctl enable systemd-timesyncd.service
sudo dpkg-reconfigure tzdata

Go to command line and issue this command and post the results. It should find the pca on an i2c address, if it doesnt, you have wiring issues or a bad pca9685 or somehow i2c isnt enabled correctly.

sudo i2cdetect -y 1

It should come back with address 40 and 70 listed after giving that command.

Read more here:
https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c
 

MichaelA18454

Community Member
View Badges
Joined
Jun 22, 2019
Messages
50
Reaction score
40
Rating - 0%
0   0   0

MichaelA18454

Community Member
View Badges
Joined
Jun 22, 2019
Messages
50
Reaction score
40
Rating - 0%
0   0   0
i2cdetect -y 1 was not recognised , so then I went to the link and run
  1. sudo apt-get install -y python-smbus
  2. sudo apt-get install -y i2c-tools
And was able to see 40 70 as expected.
Much appreciated
Thank you
 
Back
Top