Hacker News new | past | comments | ask | show | jobs | submit login
Rethinking temperature, sensors, and Raspberry Pi (rethinkdb.com)
39 points by mglukhovsky on Aug 22, 2015 | hide | past | favorite | 12 comments



I feel like using RethinkDB, instead of something like SQLite (or if you absolutely insist on NoSQL, maybe LevelDB or BerkeleyDB) kind of seems like using a supertanker for a tugboat's job. Especially if you're going to write your temperature sensor logger in Python, and it's just being used as an embedded application, SQLite really seems like one of the smarter choices you could make there. Maybe the point is to demo RethinkDB features, but wouldn't it make sense for the Python script to also emit the status data and send notifications as well, without needing all those extra Node dependencies?

Also, maybe I'm just crazy, but man I can't believe people are encouraging others to curl stuff from the internet right into a shell. Especially on Raspian where the default Pi user has NOPASSWD in sudoers, this seems like a bad practice that we shouldn't encourage.


> Maybe the point is to demo RethinkDB features,

given that this is the RethinkDB blog, I'm pretty sure that is the point: a nice little toy example to show what it can do.

That said, the node parts probably could have been done in Python as well and made the entire thing a bit easier.


Howdy! Author here.

I definitely wanted to do all parts in Python but am somewhat allergic to the `while True:` pattern necessary in Python for changfeeds. I haven't brought myself up-to-date on the more recent asyncio library to write the more Pythonic `yield from` for a changefeeds example.

Would you know how to do this in Python elegantly? Because I would love to rip out the Node/Javascript parts.


Still, it kind of seems like a blog for Kenworth demoing someone using a giant truck to race around a track, I mean I guess you can do it, but it doesn't seem like the intended application.


Howdy! Author here. I can totally agree that there are definitely more simple methods to logging these sorts of things on a Raspberry Pi, most of all `your_basic_data_in_csv_format.log`.

What I think RethinkDB adds here is the WebUI interface and an easy to way to come to grips with what information is being stored on the machine versus digging around in the home directory, or project folder, or /var/log/ for the right log file (I've come to a consensus with myself many times on where I should put it and definitely forget where). Also, spinning up and replicating the data over to another machine is click-easy and convenient.

As for having the entire functionality in one Python script, it was more of wanting to have à la carte functionality since I know projects like this coming in all shapes and sizes. I definitely agree that from a simplicity point of view, one Python script would be much easier. But, I wanted people to be able to just copypasta what they wanted and go from there with multiple sensors or multiple notification messages.

I also did not like the Node dependencies (why is installing Node on RBPi still so hard?). I felt though that I couldn't get behind doing the un-Pythonic `while True:` pattern necessary for RethinkDB changefeeds. In the near future we'll have better patterns with asyncio but Node felt like a better fit from an elegance/grok-ability standpoint in this case.


Well, I get that this is a RethinkDB blog but I can't help to see this as another example of this "virus" that has gotten hold of some segments of the software development world making for utterly bloated and pointlessly complex solutions to simple problems. I call it the "OOP+Framework 'Hello World'" syndrome. It seems nobody can write code without adding layers of classes, loading-up the call stack and megabytes of libraries.

In this particular case a simple C program logging to a comma-delimited text file, or, if you want to splurge, JSON-formatted text file would have done the job.

But, I get it, proposing not everything requires OOP is heresy. What was I thinking?


"When all you have is a hammer..."


I went overboard with my Raspberry PI and temperature sensors a couple of years ago. I hooked a bunch of sensors up to old wiring in the house that a previous owner had used for a security system. And while I was at it, I hooked up an old crank-telephone so I could remotely ring the bells, play "The Raspberries" on the handset, etc. It's not all operational anymore, but the DS1820b temperature sensors are. It's surprising how sensitive they are. By watching a graph, you can see when the heater or AC runs, when someone takes a shower, when the garage door opens, when a car is in the garage, etc.

http://buzbee.asuscomm.com:8100/


I have to say, I accomplished all this with a simple bash script in about 60 minutes or less. Using a sledgehammer like Rethink for something that can be easily handled with a text file and logrotate is just...overkill. I understand that it's a rethink blog, but I completely finished the project in less time that it took him to compile the database.


I recently set up a raspi to monitor my wine cellar temperatures. If you're looking for a 3rd party solution, check out librato [1]. We use them at work and they're really great. I hooked temperature readings up to librato and set up threshold alerts within a few min without ever having used their python api before.

[1] http://librato.com hardware guide I used: https://learn.adafruit.com/dht-humidity-sensing-on-raspberry...


This brings up one annoying aspect of the Raspberry Pi, it's pretty difficult to get GPIO access without root.

I built a temperature sensor for a server rack [1], and went with an ATMega328 and an ENC28J60 ethernet module, and it just serves JSON of the four DHT11 sensors connected to it.

[1] https://jacklew.is/arduino-temp-sensor/


Cool project, and great write up of the experience!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: