Raspberry Pi fridge monitor

Raspberry Pi fridge monitor

The house is infested with cheese fairies who raid the fridge at all times of day and consume considerable quantities of tasty cheese. In this project, any fridge-door-opening activity will result in a notification email – or, if you prefer, a tweet or Facebook update – telling you the time that the fridge door was opened. This may seem a somewhat trivial example, but it really serves to show just how easy it is to hook up a sensor that will cause your Raspberry Pi to notify you of events in a variety of ways using the If This Then That framework. As you’ll see from the below list of required components, this project uses a photoresistor connected to the Raspberry Pi GPIO header using a pair of female-to-female jumper wires. This tutorial can be found in The MagPi 37 You’ll need Photoresistor (almost any one will work for this project) 2× female-to-female jumper wires USB Wi-Fi adaptor (unless your fridge has an Ethernet socket nearby) Detecting Darkness Unlike an Arduino, for example, a Raspberry Pi does not have analogue inputs that can measure a voltage. It does, however, have digital inputs; if the voltage at a digital input exceeds about 1.65V (half of 3.3V), then the input is read by the Raspberry Pi as HIGH, otherwise it is counted as LOW. So, although you can’t use a photoresistor with a Raspberry Pi to give a measurement of the light level (not without a few extra components anyway), you can use a photoresistor to tell if it’s dark or light. The digital input pin (GPIO pin 18) has its internal pull-up resistor enabled. So, while the pull-up resistor is trying to pull pin 18 HIGH, the photoresistor will try to pull it low. They are in a of tug-of-war and if the pull-up resistor is winning, the input will be HIGH; if the photoresistor is winning, it will be LOW. The more light falling on a photoresistor, the lower the resistance (the stronger it pulls pin 18 towards 0V). Typically, a photoresistor will have a resistance of a few hundred to a few thousand ohms when it’s in the light. If you make a photoresistor really dark (say inside a fridge), then its resistance rises to several mega-ohms (millions of ohms). At this point, the built-in pull-up resistor (50 to 100 kilo-ohms) will be easily winning and the input will be HIGH.…
Source: Raspberry Pi fridge monitor

댓글 남기기

이메일은 공개되지 않습니다. 필수 입력창은 * 로 표시되어 있습니다