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

Michael Lane

Well-Known Member
View Badges
Joined
Aug 11, 2018
Messages
677
Reaction score
1,123
Rating - 0%
0   0   0
I've been working on adding drivers for ADS1015 and ADS1115 to reef-pi. I'm planning for it to only support single shot since reef-pi can't keep up with continuous conversions anyway. I have a few points that could use some community input.

Single Ended vs Differential
Does anyone have a use case for differential inputs? Driver configuration is easy for single ended since it just exposes 4 channels. Differential could be kind of easy by exposing 3 channels since they all have an option to pair with AIN3, but there's a fourth option for differential to pair AIN0 and AIN1. This makes the driver configuration much more complicated to present to users.

Gain settings
Should we go with a single gain setting, or the possibility of different gain on each channel? There are a handful of amplification settings available. It's possible to have the gain configured differently for each channel, but that gets much more complicated for differential readings since the channels would be more dynamic.

Comparator
Does anyone have a use case for the comparator functions? It could be exposed as a digital input, but I haven't really thought through this functionality.

Bad readings

I've got a test board hooked up and things are mostly running fine. I see the values change as I move the position of the potentiometer.

sailfin.jpg


I occasionally see a sporadic conversion returned as 0. All those lines to the bottom are bad readings. The jump at the end is from me pushing the slider up.

1592767502526.png


I can't seem to find any reason for the bad conversions, but I do find that they are always correlated with the config register being reset to default. So it's not technically a bad conversion since the config is stating to read AIN0 with AIN1, but I haven't been able to pin down the root of this problem.

1592767656998.png


I thought it might be some other I2C traffic causing a problem, but nothing else has been captured on that bus using a logic analyzer. Only the intended messages are flowing. I also thought it might be a voltage sag causing the chip to reset. I've hooked up a scope on the power pins around this chip and set a trigger at 4.75v. It's never triggered (except at power on and power off). I've also searched for any mention of others having this kind of problem, but that turned up empty as well... I have an ADS1115 board showing up soon, so I'll repeat these tests with that module.

To work around this problem, I think I'll just read back the config register and discard the conversion if the config doesn't match what it should be. It can retry a few times in the event of a mismatch or failure. I don't see this kind of behavior in any other samples, though.

The analog reading also wiggles a bit. it's exaggerated by 16 times in my samples above since ADS1015 is 12 bit instead of 16 and I haven't shifted it to compensate. Is there an appetite to have the driver take multiple conversions and average the results?
 

BenB

Active Member
View Badges
Joined
Jun 11, 2019
Messages
112
Reaction score
155
Rating - 0%
0   0   0
I've been working on adding drivers for ADS1015 and ADS1115 to reef-pi. I'm planning for it to only support single shot since reef-pi can't keep up with continuous conversions anyway. I have a few points that could use some community input.

Single Ended vs Differential
Does anyone have a use case for differential inputs? Driver configuration is easy for single ended since it just exposes 4 channels. Differential could be kind of easy by exposing 3 channels since they all have an option to pair with AIN3, but there's a fourth option for differential to pair AIN0 and AIN1. This makes the driver configuration much more complicated to present to users.

Gain settings
Should we go with a single gain setting, or the possibility of different gain on each channel? There are a handful of amplification settings available. It's possible to have the gain configured differently for each channel, but that gets much more complicated for differential readings since the channels would be more dynamic.

Comparator
Does anyone have a use case for the comparator functions? It could be exposed as a digital input, but I haven't really thought through this functionality.

Bad readings

I've got a test board hooked up and things are mostly running fine. I see the values change as I move the position of the potentiometer.

sailfin.jpg


I occasionally see a sporadic conversion returned as 0. All those lines to the bottom are bad readings. The jump at the end is from me pushing the slider up.

1592767502526.png


I can't seem to find any reason for the bad conversions, but I do find that they are always correlated with the config register being reset to default. So it's not technically a bad conversion since the config is stating to read AIN0 with AIN1, but I haven't been able to pin down the root of this problem.

1592767656998.png


I thought it might be some other I2C traffic causing a problem, but nothing else has been captured on that bus using a logic analyzer. Only the intended messages are flowing. I also thought it might be a voltage sag causing the chip to reset. I've hooked up a scope on the power pins around this chip and set a trigger at 4.75v. It's never triggered (except at power on and power off). I've also searched for any mention of others having this kind of problem, but that turned up empty as well... I have an ADS1115 board showing up soon, so I'll repeat these tests with that module.

To work around this problem, I think I'll just read back the config register and discard the conversion if the config doesn't match what it should be. It can retry a few times in the event of a mismatch or failure. I don't see this kind of behavior in any other samples, though.

The analog reading also wiggles a bit. it's exaggerated by 16 times in my samples above since ADS1015 is 12 bit instead of 16 and I haven't shifted it to compensate. Is there an appetite to have the driver take multiple conversions and average the results?

Hi Michael I think that the separate Gain settings will be needed for the 4 different instruments you can connect per ADS1115. When connecting a flow sensor, a Ph sensor, or a Pressure sensor they possibly need a different gain.

What I understand from single-ended vs differential is that differential is not connected to ground and therefore is more accurate. When a filter board will be used a single-ended will be fine.
 

speedstar

Well-Known Member
View Badges
Joined
Sep 18, 2018
Messages
704
Reaction score
1,030
Location
Grand Rapids
Rating - 0%
0   0   0
We've made significant changes to reef-pi in 3.0 compared to 2.0. I recommend backing up your reef-pi.db configuration (or even the whole SD card) before upgrading. The latest release is 3.4 and includes many new drivers and several bug fixes.

This is assuming you are using pi zero based on the snippets in your post. It stops reef-pi, backs up the reef-pi.db in case you want to revert, then it downloads reef-pi and installs it. I would run each line one by one.
That was my mistake, I was looking for a link and that is what popped up. I and running a 3b+ board. So I'll just do a fresh build on a new memory card and setup from scratch. Do you have a link handy to download that code. Thanks
 

Michael Lane

Well-Known Member
View Badges
Joined
Aug 11, 2018
Messages
677
Reaction score
1,123
Rating - 0%
0   0   0
That was my mistake, I was looking for a link and that is what popped up. I and running a 3b+ board. So I'll just do a fresh build on a new memory card and setup from scratch. Do you have a link handy to download that code. Thanks
The releases are listed in github. The most recent release is 3.4, and I've just added those upgrade snippets to the release description.

Code:
wget -c https://github.com/reef-pi/reef-pi/releases/download/3.4/reef-pi-3.4-pi3.deb
sudo dpkg -i reef-pi-3.4-pi3.deb
 

MosBronco

New Member
View Badges
Joined
Jun 6, 2020
Messages
23
Reaction score
16
Rating - 0%
0   0   0
reefpi just saved my tank. ive had several hot days here and i was still using my reef keeper elite to run my tank. I had my reefpi probes in the tank to kinda do a week uptime/trial test. The temp probe said my tank was at 83 and rising.. sending me into a panic at midnight. I was pretty confused and turning everything off and turning on fans until i noticed that the reef keeper had decided to not turn off my heaters... One element had failed causing it to be stuck on . SO a BIG thanks to @Ranjib and @Michael Lane for helping me out along the way and saving my fishies lives and who knows how much in corals . Side note... a great reef keeper elite will be for sale soon :D
Screenshot_2020-06-22 ReefPi.png
 

Matevz Savarin

Active Member
View Badges
Joined
Dec 5, 2018
Messages
209
Reaction score
163
Rating - 0%
0   0   0
Tnx to reefpi all my stuff is almost automatic, all its left is tds meter for rodi water. Any plan to add it in the future?
I am using dsr reefing, no wc for2.5 years now.,justcadding stuff on 8 peristatic pumps 3 of them are on pi. 5 will come on in the future or not.. if tds would be possible that means I dont do anything exept testing parameters on 3 weeks, prety cool
 
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 see this thread is becoming popular and a few guys seems to talk about "Heartbeat" which I know is an Apex term / feature.

Does reef-pi have plans to implement something like this? Can it even be done easily?
Since reef-pi does not have any cloud based counter part , it does not have exactly similar heart beat mechanism. You can however use Prometheus or adafruit io for achieving the exactly same thing, since they are external to reef-pi and receives data from reef-pi , they can alert you when incoming data is missing or stopped.
 
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
Question regarding motor drivers. I’m using the mosfet TB6612. It works like all the others, has 2 GPIO inputs and a PWM input. If I don’t need bi-directional motor control and want to conserve GPIO pins can I put one of the inputs direct to ground?
I don’t think so. But I have to read a bit. Tb6612 is a dc motor driver or stepper driver ?
 
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
Tnx to reefpi all my stuff is almost automatic, all its left is tds meter for rodi water. Any plan to add it in the future?
I am using dsr reefing, no wc for2.5 years now.,justcadding stuff on 8 peristatic pumps 3 of them are on pi. 5 will come on in the future or not.. if tds would be possible that means I dont do anything exept testing parameters on 3 weeks, prety cool
Thank you for the kind words :)
 

Des Westcott

Well-Known Member
View Badges
Joined
May 29, 2018
Messages
646
Reaction score
1,035
Location
Durban - South Africa
Rating - 0%
0   0   0
Since reef-pi does not have any cloud based counter part , it does not have exactly similar heart beat mechanism. You can however use Prometheus or adafruit io for achieving the exactly same thing, since they are external to reef-pi and receives data from reef-pi , they can alert you when incoming data is missing or stopped.

OK. That's a cool work-around I guess. Always good to make use of what exists already.
 
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
reefpi just saved my tank. ive had several hot days here and i was still using my reef keeper elite to run my tank. I had my reefpi probes in the tank to kinda do a week uptime/trial test. The temp probe said my tank was at 83 and rising.. sending me into a panic at midnight. I was pretty confused and turning everything off and turning on fans until i noticed that the reef keeper had decided to not turn off my heaters... One element had failed causing it to be stuck on . SO a BIG thanks to @Ranjib and @Michael Lane for helping me out along the way and saving my fishies lives and who knows how much in corals . Side note... a great reef keeper elite will be for sale soon :D
Screenshot_2020-06-22 ReefPi.png
That’s awesome to see :) . Corals should be fine though, my tanks go through crazy 84 degrees swing (from 79) due to the hot weather here.. I’m slowly getting a hold of this situation
 

Somdelt

New Member
View Badges
Joined
Jun 22, 2020
Messages
2
Reaction score
4
Rating - 0%
0   0   0
Hi everyone I made a account just to say thank you to rob with robo tank and everyone with reef pi I run fresh water but I love this project so far I've got all 4 power head's up and running with my kessils and 2 temp probes waiting on my ph probe to get here can't wait to see what is to come
 

t951

Community Member
View Badges
Joined
Feb 5, 2016
Messages
60
Reaction score
46
Location
Orlando, FL
Rating - 0%
0   0   0
Is there a document that contains all of your configuration steps for the ML pihat? I am slowly making progress and I would prefer to use a proper solution. I have the imgur pictures showing the connections and scour the thread for the rest, but if there is a complete doc that would be great.

I am setting up my ATO. The Ranjib guide on adafruit mentioned a 12v pump. How does the ML pi-hat control the ATO pump?
I have the ATO sensor connected as you mentioned here previously. (ATO1, pin IO27).
I imagine I could use the ATO2 for a switch to a float valve.
How does the pump get wired? I have the 12v power going into the board via the connector on the hat.
Do I connect a cable to V+ and pick an IO, IO8 for example?
Thanks again,
t.
 

Des Westcott

Well-Known Member
View Badges
Joined
May 29, 2018
Messages
646
Reaction score
1,035
Location
Durban - South Africa
Rating - 0%
0   0   0
Is there a document that contains all of your configuration steps for the ML pihat? I am slowly making progress and I would prefer to use a proper solution. I have the imgur pictures showing the connections and scour the thread for the rest, but if there is a complete doc that would be great.

I am setting up my ATO. The Ranjib guide on adafruit mentioned a 12v pump. How does the ML pi-hat control the ATO pump?
I have the ATO sensor connected as you mentioned here previously. (ATO1, pin IO27).
I imagine I could use the ATO2 for a switch to a float valve.
How does the pump get wired? I have the 12v power going into the board via the connector on the hat.
Do I connect a cable to V+ and pick an IO, IO8 for example?
Thanks again,
t.

Think of it like this. The pump you use for your ATO is just a piece of equipment. So set it up as you would any equipment in reef-pi Obviously making sure you you run the correct power through the relay that the pump requires.

Now when you create your ATO in reef-pi, you set it up to use the float switch you have on IO27 to control whatever piece of equipment you want. In this case point it to the pump you want to use. You could actually have an ATO turn anything you've set up as equipment on and off. You just change what equipment the ATO controls.

Going forward reef-pi also plans to let you have an ATO trigger macro's.
 

t951

Community Member
View Badges
Joined
Feb 5, 2016
Messages
60
Reaction score
46
Location
Orlando, FL
Rating - 0%
0   0   0
Think of it like this. The pump you use for your ATO is just a piece of equipment. So set it up as you would any equipment in reef-pi Obviously making sure you you run the correct power through the relay that the pump requires.

Now when you create your ATO in reef-pi, you set it up to use the float switch you have on IO27 to control whatever piece of equipment you want. In this case point it to the pump you want to use. You could actually have an ATO turn anything you've set up as equipment on and off. You just change what equipment the ATO controls.

Going forward reef-pi also plans to let you have an ATO trigger macro's.
Ah-ha....thank you. So, I could also use my 120v AC pump from my old ATO and just turn the power on and off on the plug....nice.
Thank you again.
 

robsworld78

Well-Known Member
View Badges
Joined
Feb 14, 2020
Messages
985
Reaction score
1,325
Location
Edmonton, Canada
Rating - 0%
0   0   0
Hi everyone I made a account just to say thank you to rob with robo tank and everyone with reef pi I run fresh water but I love this project so far I've got all 4 power head's up and running with my kessils and 2 temp probes waiting on my ph probe to get here can't wait to see what is to come

Glad to hear you're enjoying it. :)
 

Des Westcott

Well-Known Member
View Badges
Joined
May 29, 2018
Messages
646
Reaction score
1,035
Location
Durban - South Africa
Rating - 0%
0   0   0
Ah-ha....thank you. So, I could also use my 120v AC pump from my old ATO and just turn the power on and off on the plug....nice.
Thank you again.

Cool. Or just thinking of it another way........ If you're using smart plugs for equipment, your ATO just controls that smartplug and whatever is plugged into it.
 

Somdelt

New Member
View Badges
Joined
Jun 22, 2020
Messages
2
Reaction score
4
Rating - 0%
0   0   0
Hey guys question I keep getting this error when I try and use adafruit I've reset my key and changed everything in reef pi ty for any help error":"not found - that is an invalid URL, please check the API documentation at https://io.adafruit.com/api/docs to make sure your URL is correct"}
 

denniscahill

Community Member
View Badges
Joined
Jun 12, 2019
Messages
37
Reaction score
50
Rating - 0%
0   0   0
Ok, getting a weird error when I try to start reef-pi from the terminal window.

I was suddenly unable to connect through any browser, but could VNC into the Pi and reboot, start/stop reef-pi.service. I even deleted the databases and tried again. I was running 3.3.1 so I decided to try upgrading to 3.4.

This is the error :

pi@CakeReef:~ $ reef-pi
2020/06/24 21:57:30 driver-subsystem: registering driver id: rpi Name: Raspberry Pi
2020/06/24 21:57:30 Successfully started subsystem: system
2020/06/24 21:57:30 INFO: equipment subsystem: Finished syncing all equipment
2020/06/24 21:57:30 Successfully started subsystem: equipment
2020/06/24 21:57:30 Successfully started subsystem: ato
2020/06/24 21:57:30 Successfully started subsystem: temperature
2020/06/24 21:57:30 Successfully started subsystem: macro
2020/06/24 21:57:30 Successfully started subsystem: timers
2020/06/24 21:57:30 reef-pi is up and running
2020/06/24 21:57:30 Starting http server at: 0.0.0.0:80
2020/06/24 21:57:30 ERROR: Failed to run http server. Error: listen tcp 0.0.0.0:80: bind: permission denied
2020/06/24 21:57:30 Starting health checker
Methods: [GET]
2020/06/24 21:57:30 API Doc path: /api/settings


So, how do I fix the http server?
 

stefanm

Active Member
View Badges
Joined
Oct 11, 2017
Messages
360
Reaction score
397
Location
Sweden
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?
 
Back
Top