DIY Aquarium Controller based on Raspberry Pi

Upside of RPi:

- Full Linux environment, allows use of languages like Python, Go, etc
- Internet connected fully out of the box
- You're not going to run out of CPU/memory resources

Upside of Arduino:

- Can implement hard real-time (timing dependent things)
- Extra features like PWMs, etc
- Simpler operating environment (write some C++, it runs in a loop)
- Analog inputs built in


Me? I use an RPi as supervisory control, and various other microcontrollers as the actual hardware I/O (RPi is the SCADA system, various other things are the actual control points). The easiest way I've found is to string things, like sensors and PWM, off the RPi over the I2C bus (one multi-drop bus - not the most robust thing in the world but totally serviceable over a few meters). In the case of my lights I used Bluetooth Low Energy.
 
It starts getting complicated real soon, don't it.

In researching I've seen a lot of people with the Pi + Arduino combo making it work. I thought the Pi might be enough and it may be. I chose it because of a passing familiarity with Linux. I guess the most attractive aspect of the Arduino to me would be it handles analog easily where in the case of the Pi you gotta do a work around.

Aie! My head is spinning!
 
Do you know any other programming languages?

Python's heavy use of classes gives it a pretty steep learning curve. If you know any other languages, it will help.

I just downloaded some python examples and started modifying them to fit my needs. After doing that, I was able to start my own app.

I've never really dabbled in programming but learning Python would have dual use as we are about to use a form of ti at work. I will try playing with some examples.

"A byte of Python" was recommend to me by one of the embedded gurus at work. I read it and it made sense at the time, but I have not had need to implement anything in python yet so who knows if I actually learned anything from it. Google it. Its a free resource.

Thank you, I will look it up.
 
One option for learning python is an online course offered free if you have a san diego public library card. It's one of the online database services through Gale Courses. 6 week course starting every 2 weeks I believe.
 
I did some PHP in a college course, don't remember a darn thing. What aspects do you use PHP with? Updating a Web page to show tank status?
 
Personally I think the best model is arduinos to do the grunt work and automation, with RPi or similar for the UI and data logging. Use multiple arduinos, keep the code very simple and automated. Keep the code simple and they'll run happily even if the RPi locks up so control of your critical devices continues (additional fail-safes are never a bad idea) and keeping the control separate from the UI simplifies the code massively (a fact I am well aware of having just coded control and UI into an arduino nano for 10 channel LEDs). And the RPi is capable of so much more than an arduino for UI and data logging.

Fishinthewall - I'd set the backup heater to be a tad lower rather than a tad higher, but can't see why it makes much difference either way :)

Tim
 
I did some PHP in a college course, don't remember a darn thing. What aspects do you use PHP with? Updating a Web page to show tank status?

PHP is my front end web for calling the various functions of the Pi, you can view it in the screenshots.
 
Anybody automate their salt water preparation. The challenge is going to be controlling the amount of salt that gets dumped in the mix, and solenoids will likely not work in this case. Another is checking for salinity using a sensor. If not a sensor, will have to compute based on average volume of salt and water to get the required salinity. Presuming somebody's already tried something like this, any input on thus appreciated.
 
I know there's electronic refractometers. Presumably using conductivity to test. There must be a white paper on it somewhere.

Sent from my SM-N900P using Tapatalk
 
I know there's electronic refractometers. Presumably using conductivity to test. There must be a white paper on it somewhere.

Sent from my SM-N900P using Tapatalk



You can do a conductivity probe for salinity. The electronic refractometers simply use a prism, light, and linear CCD to see offset (roughly the guts of the Milwaukee digital refractometer)
 
Had looked into the conductivity probes, biggest challenge there seems to be the cost. Probably the most expensive of the various aquarium sensors available. Either way, the raspberry pi 3 arrived, so certainly excited to get going with this mini aquarium enhancement.
 
In doing some research I've discovered that my light is internally controlled by PWM and I'm getting a DC pump that would need to use the SDA and SCL pins. Mind you I haven't tried this yet. The point is this; while planning out my controller I'm going to do my best to make sure to use the regular GPIO pins first wherever I'm able and reserve the special function pins for their special functions.

Something to think about.

Sent from my SM-T810 using Tapatalk
 
In doing some research I've discovered that my light is internally controlled by PWM and I'm getting a DC pump that would need to use the SDA and SCL pins. Mind you I haven't tried this yet. The point is this; while planning out my controller I'm going to do my best to make sure to use the regular GPIO pins first wherever I'm able and reserve the special function pins for their special functions.

Something to think about.

Sent from my SM-T810 using Tapatalk


You may be interested in the 16-chan PWM breakout. https://www.adafruit.com/products/815

My lights are PWM as well (using LDD drivers - 4 channels) and I opted to do a USB serial connection between my PI and an arduino to make use of PWM pins at the start of my project. I wrote up a sketch to receive commands via serial to control all pins and pass back all pin states for the arduino. Code on the pi can then call a getArduinoStatus or setArduinoState function with arguments which then passes a serial command to the arduino.

I am however switching to a full node.js implementation on the PI and swaping out the arduino for the above breakout board.
 
Last edited:
I built one also. Want to share code? Already did ph and leak detection. We did ato with relays and temp probes. Working on rodi refill shortly.
7.gif

8.gif
25.gif
 
You may be interested in the 16-chan PWM breakout. https://www.adafruit.com/products/815

My lights are PWM as well (using LDD drivers - 4 channels) and I opted to do a USB serial connection between my PI and an arduino to make use of PWM pins at the start of my project. I wrote up a sketch to receive commands via serial to control all pins and pass back all pin states for the arduino. Code on the pi can then call a getArduinoStatus or setArduinoState function with arguments which then passes a serial command to the arduino.

I am however switching to a full node.js implementation on the PI and swaping out the arduino for the above breakout board.



My one complaint with the PCA9685 is the limited 1.6kHz PWM frequency. It's fine visually but throws cameras for a loop.

I'm actually rebuilding my LEDBrick board to avoid this problem and run at a 10bit 30kHz PWM.
 
My one complaint with the PCA9685 is the limited 1.6kHz PWM frequency. It's fine visually but throws cameras for a loop.

I'm actually rebuilding my LEDBrick board to avoid this problem and run at a 10bit 30kHz PWM.


Interesting. Maybe I will leave my lights on the arduino then, and keep everything else native to the pi. I would like to remove the arduino all together though, just another point of failure.

Any ideas of a break out board with better spec for PWM?
 
Interesting. Maybe I will leave my lights on the arduino then, and keep everything else native to the pi. I would like to remove the arduino all together though, just another point of failure.

Any ideas of a break out board with better spec for PWM?

What frequency are you using on the Arduino?

The PCA9635 is an option, but 100kHz is too high for most LED drivers. I don't know of a comparable all-in-one PWM chip which strikes the balance. It does work, but point a phone camera at a dimmed light - you'll see the rolling shutter bands on most drivers.

(You could get to 2.6kHz on the 9685 by driving it with a 50MHz clock, but thats pretty extreme).
 
Back
Top