flippant
Posts: 31
Joined: Wed Aug 07, 2013 7:28 am

For the Wine Cellar: Concept Critique Please!

Wed Aug 14, 2013 3:04 pm

Hi there.

I plan to build a Rpi box that will sit in a wine cellar. It will perform a number of tasks, and I'm curious as to the feasibility of using a Model B Rpi for this.
  • Monitor and log temperature and humidity with a DHT22 sensor
  • Log visits by time, date and duration
  • Log visits with Raspivid (at 2-4fps) using the Rpi Camera module, triggered on and off by light level/movement(?)
  • Log everything to an SQL database
  • Run a web server to collate and present statistics and logs graphically, as well as e-mail weekly summaries
  • Offer warnings if temperature or humidity go outside given bounds, to twitter or e-mail
  • Offer warnings if the light is on for too long
  • Be voice controlled (no display or other input) through a microphone and speaker
I think I have most of this figured out, but there are a few niggling issues and concerns.

The web server right now is apache2/php5/mySQL/phpmyadmin and Wordpress. Not the lightest solution, and truthfully, quite slow to use, but I'm familiar enough with php and Wordpress to be able to code something quite usable.

Writing the SQL to log the environmental metrics should be relatively easy, once I've figured out how to pull the data from it (it hasn't arrived yet). The warnings when out of bounds shouldn't present much trouble either. A cron job that checks the DHT22 sensor every minute for rapid change and writes a 15/30 minute average to the SQL dB (I don't expect much change, honestly!) will give me enough data to compile rolling averages (1 day, 1 week, 1 month, 3 months, 6 months, 1 year).

The video recording, however, presents a challenge. Essentially, there will be three sensory inputs on the device: a microphone, a temperature and humidity sensor, and the Rpi camera.

I need to detect whether or not anyone has entered in the last couple of seconds. Two things happen when someone enters: the latch on the lock clacks audibly, and the light is turned on.

Using the microphone to listen for sounds above a certain threshold could work, but runs the risk of causing false alarms: people stomping down the stairs; laundry being done in the adjacent room, etc.

The camera, then, seems to be the most solid alternative. And here there seem to be two alternatives: capture luminance, or movement.

Luminance: Run a script to poll the luminance of a distributed number of pixels in the frame to check whether or not the light is on. Even if someone forgot to turn the light off when leaving, a maximum duration of, say, 15 minutes, would ensure that 99% of all visits are logged correctly. Unfortunately, it is impossible to have two processes that use the camera running at the same time, and terminating the luminance process to do the recording presents the problem of how the recording can then terminate itself based on luminance.

Movement: Apparently, it is possible to use the raw feed of the camera to check for movement and capture individual frames when something moves (or x amount of pixels change position from one frame to the next). This would naturally set off the frame captures (or video recording, perhaps?) once the light is turned on, and stop naturally once things stop moving—and there shouldn't be any movement when the cellar is empty, regardless of whether or not the light is on. If video recording (and the termination thereof, should movement cease) isn't possible, using avconv to compile all the images into an .mp4-wrapped slideshow is possible, but highly inefficient resource wise, compared to raspvid.

A third option would be to add a luminance sensor, but I would prefer to stick to the three inputs I have so far (due to space concerns).

And through all of this, I need a way to record the duration.

Voice control should be manageable through either of the packages available. The device will have constant internet access and a decent, but not fantastic, upload speed.

It should be able to tell the user its IP address, current temperature and humidity, when the visit prior to this was, and so on and so forth—as well as a few easter eggs!

This is my current equipment list:
  • Raspberry Pi Model B
  • Raspberry Pi Camera
  • Breadboard, wires and resistors
  • DHT22 sensor
  • Small, USB-powered speaker
  • Microphone (jack)
  • USB sound card
  • USB Wi-fi dongle
  • 5V 2A power adapter
  • Unpowered USB hub (for positional flexibility)
  • 16GB class 10 SD card
A few questions:

—Any idea how the cellar entry/exit could be triggered? It is a very static environment, and the camera/device will be at a fixed point.
—How would I go about generating a graph as a .png file and overlaying that onto a requested snapshot of the cellar?
—Should I be concerned about the humidity in the cellar as far as the electronic components are concerned?

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: For the Wine Cellar: Concept Critique Please!

Wed Aug 14, 2013 5:00 pm

I don't know most of what you're asking for, but there is an easy light sensor you can do without even an A-D converter:

http://learn.adafruit.com/basic-resisto ... ll-reading

Very cheap and only uses one GPIO pin. That should help with the "left your lights on" warning and maybe for entry detection too.

lomsdalen
Posts: 9
Joined: Thu Dec 29, 2011 12:39 pm
Contact: Website

Re: For the Wine Cellar: Concept Critique Please!

Fri Dec 20, 2013 10:07 pm

Have you succeded in building this concept?

flippant
Posts: 31
Joined: Wed Aug 07, 2013 7:28 am

Re: For the Wine Cellar: Concept Critique Please!

Sun Feb 09, 2014 12:17 am

lomsdalen wrote:Have you succeded in building this concept?
Am still working on it—on and off.

toxibunny
Posts: 1382
Joined: Thu Aug 18, 2011 9:21 pm

Re: For the Wine Cellar: Concept Critique Please!

Sun Feb 09, 2014 10:30 am

Frontpage-worthy project. Get it done!
note: I may or may not know what I'm talking about...

flippant
Posts: 31
Joined: Wed Aug 07, 2013 7:28 am

Re: For the Wine Cellar: Concept Critique Please!

Wed Feb 12, 2014 2:51 pm

I'm still waiting on an arduino nano to use for the analogue sensors (I'll be polling a light sensor/setting up an interrupt when the light comes on to trigger the script).

Without the actual sensors available to me yet, I've been working on the data collection and generation side of things. I can now generate a text image video 'slideshow' to prepend to the actual video, showing relevant information, upload it to YouTube and then post to a remote wordpress site. I am also pretty far along in making a real time twitter-based control system.

At some point, I'll get a hold of the wine dB and do some interesting search functionality with Python and SQL.

Oh, and text to speech, too - of course!

Daveawalker
Posts: 20
Joined: Fri Apr 26, 2013 3:26 pm

Re: For the Wine Cellar: Concept Critique Please!

Thu Oct 30, 2014 5:39 pm

http://www.adafruit.com/product/189 this will sort out your startup!
I will be using it.

wayner
Posts: 84
Joined: Thu Oct 25, 2012 1:40 am
Location: Toronto, Ontario, Canada

Re: For the Wine Cellar: Concept Critique Please!

Tue Dec 02, 2014 10:06 pm

I am thinking of doing something similar as well - however my wine cellar is a double size cabinet rather than a walk-in cellar. I am planning to use a different temperature sensor - the waterproof version of a DS18B20 sensor - there is a lot of info here that could be useful. I was only going to worry about temperature figuring that as long as the cooling unit is keeping the temperature cool then humidity should be in line as well.

In terms of sensing when someone comes into the room - why not use a simple magnetic door sensor like those used for security systems? They are very cheap and should be very simple to hook up to the GPIO pins of a Pi. I am planning to attach these on the doors of my unit.

I was also considering using a small LCD screen to display info like the temperature, etc. And I was also thinking about doing something creative for a case, like putting it into an old wine bottle or a wooden single bottle case. Maybe something like this but making it look more like a wine case:
Image

As a "really nice to have" would be to use a camera that would scan UPC labels to do inventory management of the wine - or use your phone to do this. I use a cloud inventory program called cellar tracker. It would be great to be able to add/delete the wine to that software automatically and/or to send you an email the next day to remind you to enter tasting notes.

User avatar
aTao
Posts: 1093
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: For the Wine Cellar: Concept Critique Please!

Wed Dec 03, 2014 12:06 am

The web server right now is apache2/php5/mySQL/phpmyadmin and Wordpress. Not the lightest solution, and truthfully, quite slow to use, but I'm familiar enough with php and Wordpress to be able to code something quite usable.
Certainly not the lightest, but possibly one of the heaviest.
Dump MySQL, phpmyadmin and Wordpress. PHP is quite up to the job. Lighter still would be a simpler server and use the sensor monitoring script to generate HTML.
>)))'><'(((<

johndough
Posts: 254
Joined: Sun Jan 13, 2013 2:00 pm

Re: For the Wine Cellar: Concept Critique Please!

Thu Dec 04, 2014 9:59 am

Hi

perhaps a reed switch on the door(s)?

UrosRaspberry
Posts: 40
Joined: Thu Mar 27, 2014 6:36 pm

Re: For the Wine Cellar: Concept Critique Please!

Thu Dec 04, 2014 7:15 pm

A PIR motion detector would be perfect i think ,
You can (on a model i saw ) set the light and motion as a triger and wire it to the pi throught a resistor ( to drop the 5v signal to 3.3v)

Return to “Automation, sensing and robotics”