I thought I would share a project I’ve recently worked on and integrated into SmartThings.
I have a small aquarium in my apartment that I spend a lot of time taking care of (mostly by choice) and just simply gazing upon. I decided that it would be great if I could monitor things while away for extended amounts of time or just check in while in the office. I did some searching and the only real solution was to build my own device. I chose a Raspberry Pi with Pi Cam and a waterproof temperature sensor to get things started.
At this point, I have a tiny device attached to the side of the tank logging the temperature to a database and offers a web app to see a live stream from the camera and temperature trends. It’s also capable of taking photos and videos and saving them to the Pi. Every hour any photos or videos are uploaded to Dropbox and removed from the Pi, along with nightly backups.
Once I had everything up and running I created a few api endpoints to get the latest temperature and snapshot from the camera. With this in place, it was easy to create a device type in SmartThings that would allow temperature monitoring within the app along with easily getting a quick view of the tank on the go! I’m utilizing the integration by getting notifications when the temperature fluctuates too much, incredibly useful! I am also using a quirky pivot power to control a day and night light for the tank, much easier than timers when it comes time to make changes to the schedule.
At some point I would like to add a water sensor or water level sensor to the Pi or maybe just a simple Zwave sensor so that I could get an alert if the water level drops suddenly (or because I haven’t made a water change in a long time and it’s evaporated). It has been a ton of fun to build and program, I’ve been thinking non stop of more fun build ideas since I “finished” this.
Thanks for reading! I’ll share photos/screenshots if anyone is interested (I’ll have to do them, and of course I’m always busy tinkering with SmartThings).
I also use ST for my aquarium but only for the lighting. I have 2 banks of 2 T5 bulbs that are staggered and I use ST to control that. I use two of the GE outdoor Z wave outlets (http://amzn.com/B0013V8K3O). Next thing I have to do is add the moisture sensor in case of a water leak.
@eibyer the GE outdoor module would be a better idea, not to mention more reliable than the Pivot Power. I’m constantly moving my devices around and switching them out, who know what will be controlling the aquarium lights next haha. I really should get some of those outdoor modules though.
Took a few photos/screenshots to share.
The device attached to the aquarium.
I’m using the two USB modules I have plugged in to hold the camera
This is a great project that has so many other potential uses. Outdoor dog pin monitoring, Chicken coop monitoring, green house monitoring, stand alone generator monitoring or just general weather monitoring.
I have been wanting to try out a RPi. So many potential ideas.
@kg4fku it so does! I’ve actually been planning one to control and monitor a hydroponic system. You can add as many 1-wire temperature sensors as you need using the same GPIO pins! Plus light sensors, humidity, relays for lighting and fans. Add in a touch panel and Pi Cam and you have an incredible garden controller that’s super easy to connect to SmartThings.
I’m running Raspbian, easy to get going and lots of info around the net.
Second for the code request. I don’t actually own an aquarium (maybe someday), but I do own a RPi. I thought something like this would be great to deploy at a second location without the need to put a ST Hub an sensors there. It would provide some extra peace of mind if I’m keeping an eye on the neighbor’s house while they were gone if I had a small, redeployable setup with a motion sensor, a temp sensor, etc. that communicated to the cloud via WiFi. I just wouldn’t know where to start in getting the RPi talking to the ST Cloud.
What are you looking for exactly? I’m using a smartapp to run the poll on my custom device type that just checks a file on the Pi web server for the current temperature.
I don’t want to derail your thread here and take the focus off of your awesome project, so I’d be happy to move this to a new thread.
I’m pretty comfortable with the Arduino, and would probably find this most doable by modding a version of my Smart Room Controller , which is essentially an Arduino + a few sensors and outputs built in. My modified version could send a serial command to the RPi when there is a qualified event such as a motion sensor activation.
That’s where I get fuzzy. I don’t have any experience with web hosting on the RPi, how to get the info from the serial port to the hosted web file, or with how to get SmartThings to tap into that. It sounds like you have done most of that already with this project, so if you’re willing to share your code, I just might be able to see how you did it to get my own project rolling. I am a self-taught programmer who has learned almost everything I know from example code. Of course, if you’d rather not share your code I understand, but in that case I’d be curious if you know of any tutorials that cover any of this.
@dome All that’s running on the Pi is a Python script that reads the temperature file every 15 min and records it to a db. SmartThings is polling a simple api I built into the web server that gets the current temperature from the db. I’m happy to share what I’ve got if you’d like. Most of the Python stuff is just pieced together from different tutorials around the web.
Gotcha. Thanks for the reply. I’m admittedly much more comfortable with programming on the Arduino than anything web-based but this might give me a good opportunity to get out of my comfort zone.
Great work Ronny! I am planning on replicating this for my own aquarium that I setup recently. Could you please share which waterproof temperature sensor you are using? (sorry if I missed this somewhere)
Hey Adam, that’s the one! I can’t recall if I ordered it from Adafruit or somewhere else. I do know they have a five or ten pack on Amazon for pretty cheap too though!
Thanks! I now have my SmartThings, Raspberry Pi, and the Raspberry Pi cam,and the temperature sensor should be arriving today.
I was familiar with Arduino but not so much the Raspberry Pi, so I have done some playing around with it to figure it all out.
There seem to be a bunch of methods for streaming video to the web via the Pi, so I was just wondering if you could provide some more information on how you have this set up exactly. I tried to decipher it from your code but my knowledge base with this stuff is limited at this point. Thanks so much!