Things used in this project

Hardware components:
Chip%20v1
C.H.I.P.
×1
Any kind of Reed sensor / Magnetic switch
Any normally open sensor or switch will work.
×1
Speaker with 3.5mm earphone plug
×1
Software apps and online services:
monit (Tildeslash Ltd)
I use monit to poll the gpio via a bash script. Monit can be installed via apt-get: "sudo apt-get install monit"

Code

Proxy script called by monitSH
Wrote this script to call Jeff Larkin´s shell function from monit.

First it registers the shell functions and later I call them to enable input for pin 8, and read it´s state. Then I exit with success if the door is closed or with an error (1) if it is closed.
#!/bin/bash

. /home/chip/gpio/gpio.sh

gpio_disable 7
gpio_enable 7
gpio_mode 7 in
retval=$(gpio_read 7)
echo $retval
exit $retval
Monit check-program configPlain text
I wrote this config to make monit execute the shell script that reads the sensor state. I included put this file in /etc/monit/conf.d so it as automatically included.

This check calls the shell script to determine the status of the door. If it is "open" 10 times in a row, then we play a wav-file through the speaker. Note that I have set the monitoring interval of monit to be once every second. So this config gives me 10 seconds to close the freezer door.
check program freezer_door with path /home/chip/gpio/check_freezer_door.sh
       if status != 0 for 10 cycles then
#alert
exec "/usr/bin/aplay /media/chime.wav"
Shell function library for gpio by Jeff Larkin
Found this on github after making my own, but ended up using Jeff´s as it more clean and nice

Credits

261467 10150232452318743 5565414 n
Patrik Norrgård

Coder/Maker with too little time on my hands.

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

CHIP on Smartphone
Easy
  • 1,747
  • 12

Full instructions

A portable computer for your smartphone.

C.H.I.P.-play Speakers! ♪ (⌐■_■)♪
Easy
  • 24,886
  • 113

Full instructions

Use C.H.I.P. to make any old speakers AirPlay speakers. Use several C.H.I.P.s to make a network for a multiroom audio experience!

CHiP-hole: Network-wide Ad-blocker
Easy
  • 13,683
  • 29

Protip

Block ads for your entire network by connecting your C.H.I.P. to your network and installing the Pi-hole software. Vanquish advertisements!

Blinky LED with C.H.I.P. and BASH
Easy
  • 8,818
  • 32

Protip

Every evil genius has to start somewhere, so let's start by blinking an LED with a C.H.I.P. and a BASH script.

C.H.I.P. RADAR
Easy
  • 12,346
  • 45

Full instructions

Track local aircraft traffic in real-time

Connect a Mobile Application to your C.H.I.P. Using BLE
Easy
  • 13,040
  • 39

Protip

This article shows how you can build a mobile application that connects to your C.H.I.P. using Bluetooth Low Energy.

Add projectSign up / Login