Introduction: Garage Monitor 3k
Need to know if the garage door is open? Need to know if you pulled in far enough for the door to close without hitting your bike? Need to know all this with web access... I present the garage monitor 3000.
When the car reaches the right spot, the LED turns from green to red.
This is a work in progress, this is just version 1.0, I think it will go through a few changes to make it even better.
When the car reaches the right spot, the LED turns from green to red.
This is a work in progress, this is just version 1.0, I think it will go through a few changes to make it even better.
Step 1: Parts
Wire
1 Mercury switch
1 220 ohm Resistor
1 10k ohm resistor
2 x 1k ohm resistor
1 Red LED
1 Green LED
1 Parallax Internet Kit (PINK from parallax www.parallax.com)
1 BS2 Micro Controller (from parallax www.parallax.com)
1 PIR Motion Detectorr (from parallax www.parallax.com)
1 ds1620 temperature chip.
1 5v power supply
1 cardboard poster tube
I had no network drops in my garage, which I obviously had to fix, so I bought a linksys WET11 off of ebay for $20.
1 Mercury switch
1 220 ohm Resistor
1 10k ohm resistor
2 x 1k ohm resistor
1 Red LED
1 Green LED
1 Parallax Internet Kit (PINK from parallax www.parallax.com)
1 BS2 Micro Controller (from parallax www.parallax.com)
1 PIR Motion Detectorr (from parallax www.parallax.com)
1 ds1620 temperature chip.
1 5v power supply
1 cardboard poster tube
I had no network drops in my garage, which I obviously had to fix, so I bought a linksys WET11 off of ebay for $20.
Step 2: Bread Board It Out.
So I obviously need too make a wiring diagram...
But you can't go wrong if you follow the examples in the PDFs that come with all of the parallax parts.
The wiring for the switch comes from the PDF Whats a micro controller
The wiring for the PIR comes from the PIR Documentation PDF
The Wiring for the DS1620 comes from the PDF Applied Sensors.
The wiring for the PINK from the PINK PDF
P0 - for the pir
P1 - Mercury switch
P5 - 1620
P6 - 1620
P7- 1620
p12 - For PINK
P13 - For PINK
P14 - Green LED
P15 - Red LED
But you can't go wrong if you follow the examples in the PDFs that come with all of the parallax parts.
The wiring for the switch comes from the PDF Whats a micro controller
The wiring for the PIR comes from the PIR Documentation PDF
The Wiring for the DS1620 comes from the PDF Applied Sensors.
The wiring for the PINK from the PINK PDF
P0 - for the pir
P1 - Mercury switch
P5 - 1620
P6 - 1620
P7- 1620
p12 - For PINK
P13 - For PINK
P14 - Green LED
P15 - Red LED
Step 3: Now That It Works on Your Breadboard...
You should probably program the bs2, here is the code. Most of this code is closely based on examples in the various PDF available on the parallax site. You pay more for the BS2, but the documentation is great.
' {$STAMP BS2}
' {$PBASIC 2.5}
'
' -----( I/O Definitions )-------------------------------------------------
PIR PIN 0 ' I/O Pin For PIR Sensor
LEDONE PIN 15 ' I/O Pin For Green LED
LEDTWO PIN 14 ' I/O Pin For Red LED
' -----( Variables )-------------------------------------------------------
counter VAR Byte ' Trip Counter
x VAR Word ' define a general purpose variable
sign VAR x.BIT15 ' sign bit of x
degC VAR Word ' define a variable to hold degrees Celsius
degF VAR Word ' to hold degrees Fahrenheit
' -----( Initialization )--------------------------------------------------
DEBUG CLS ' Clear DEBUG Screen
SEROUT 12,396,("!NB0W07:", "Warming Up",CLS) 'Tell the PINK whats up
FOR counter = 10 TO 0
HIGH LEDONE ' Flash the LEDS
LOW LEDTWO ' Wait 20 Seconds For PIR Warm-Up
DEBUG HOME, "Warming up:", DEC2 counter
SEROUT 12,396,("!NB0W07:Warming up:", CLS)
PAUSE 1000
LOW LEDONE
HIGH LEDTWO
PAUSE 1000 ' Display Counter Every Second
NEXT
LOW LEDONE
LOW LEDTWO
counter = 0 ' Clear Counter Variable
DEBUG HOME, "Waiting"
SEROUT 12,396,("!NB0W07:Waiting...", CLS)
HIGH LEDTWO
HIGH 5 ' select the DS1620
SHIFTOUT 7,6,LSBFIRST,(238) ' "start convertions" command
LOW 5 ' do the command
' -----( Program Code )----------------------------------------------------
Main:
DO
'Motion detector
IF PIR = 1 THEN ' Motion Detected?
counter = counter + 1 ' Update Trip Counter
HIGH LEDONE '
LOW LEDTWO ' Light Red LED
DEBUG HOME, "TRIPPED...", DEC3 counter
SEROUT 12,396,("!NB0W07:", "Tripped...",CLS)
DO : LOOP UNTIL PIR = 0 ' Wait For PIR To Clear
DEBUG HOME, "CLEARED...", DEC3 counter
SEROUT 12,396,("!NB0W07:", "Cleared...",CLS)
LOW LEDONE
HIGH LEDTWO ' Turn Off Red LED
ENDIF
'Temperature
HIGH 5 ' select the DS1620
SHIFTOUT 7,6,LSBFIRST,(170) ' send the "get data" command
SHIFTIN 7,6,LSBPRE,(x\9) ' get the data, including sign
LOW 5 ' end the command
x.BYTE1 = -x.BIT8 ' extend the sign to 16 bits
degC=x*5 ' convert to 'C*10 (resolution 0.5 'C)
degF= degC+2732*9/50-459 ' conver to F
DEBUG ? degF, CR, CR ' Show on debug
SEROUT 12,396,("!NB0W06:", DEC degF ,CLS)
'Garage Door detector.
IF IN1 = 0 THEN
SEROUT 12,396,("!NB0W08:", "Open" ,CLS)
ELSE
SEROUT 12,396,("!NB0W08:", "Closed" ,CLS)
ENDIF
PAUSE 1000
LOOP
' {$STAMP BS2}
' {$PBASIC 2.5}
'
' -----( I/O Definitions )-------------------------------------------------
PIR PIN 0 ' I/O Pin For PIR Sensor
LEDONE PIN 15 ' I/O Pin For Green LED
LEDTWO PIN 14 ' I/O Pin For Red LED
' -----( Variables )-------------------------------------------------------
counter VAR Byte ' Trip Counter
x VAR Word ' define a general purpose variable
sign VAR x.BIT15 ' sign bit of x
degC VAR Word ' define a variable to hold degrees Celsius
degF VAR Word ' to hold degrees Fahrenheit
' -----( Initialization )--------------------------------------------------
DEBUG CLS ' Clear DEBUG Screen
SEROUT 12,396,("!NB0W07:", "Warming Up",CLS) 'Tell the PINK whats up
FOR counter = 10 TO 0
HIGH LEDONE ' Flash the LEDS
LOW LEDTWO ' Wait 20 Seconds For PIR Warm-Up
DEBUG HOME, "Warming up:", DEC2 counter
SEROUT 12,396,("!NB0W07:Warming up:", CLS)
PAUSE 1000
LOW LEDONE
HIGH LEDTWO
PAUSE 1000 ' Display Counter Every Second
NEXT
LOW LEDONE
LOW LEDTWO
counter = 0 ' Clear Counter Variable
DEBUG HOME, "Waiting"
SEROUT 12,396,("!NB0W07:Waiting...", CLS)
HIGH LEDTWO
HIGH 5 ' select the DS1620
SHIFTOUT 7,6,LSBFIRST,(238) ' "start convertions" command
LOW 5 ' do the command
' -----( Program Code )----------------------------------------------------
Main:
DO
'Motion detector
IF PIR = 1 THEN ' Motion Detected?
counter = counter + 1 ' Update Trip Counter
HIGH LEDONE '
LOW LEDTWO ' Light Red LED
DEBUG HOME, "TRIPPED...", DEC3 counter
SEROUT 12,396,("!NB0W07:", "Tripped...",CLS)
DO : LOOP UNTIL PIR = 0 ' Wait For PIR To Clear
DEBUG HOME, "CLEARED...", DEC3 counter
SEROUT 12,396,("!NB0W07:", "Cleared...",CLS)
LOW LEDONE
HIGH LEDTWO ' Turn Off Red LED
ENDIF
'Temperature
HIGH 5 ' select the DS1620
SHIFTOUT 7,6,LSBFIRST,(170) ' send the "get data" command
SHIFTIN 7,6,LSBPRE,(x\9) ' get the data, including sign
LOW 5 ' end the command
x.BYTE1 = -x.BIT8 ' extend the sign to 16 bits
degC=x*5 ' convert to 'C*10 (resolution 0.5 'C)
degF= degC+2732*9/50-459 ' conver to F
DEBUG ? degF, CR, CR ' Show on debug
SEROUT 12,396,("!NB0W06:", DEC degF ,CLS)
'Garage Door detector.
IF IN1 = 0 THEN
SEROUT 12,396,("!NB0W08:", "Open" ,CLS)
ELSE
SEROUT 12,396,("!NB0W08:", "Closed" ,CLS)
ENDIF
PAUSE 1000
LOOP
Step 4: Upload the File to the Pink
I used this for my web page. You can upload to the pink via FTP
<html>
<head>
<title> Garage Monitor 3000. </title>
</head>
<body bgcolor=white link = black vlink=black alink=#000000
onLoad="if (self != top) top.location = self.location">
<style>
A:hover { text-decoration:underline; color:#336633; }
</style>
<center>
<h3> Garage Monitor </h3>
<hr>
</center>
The temperature in the Garage is: <Nb_var06>
Car Parking alingment thing: <Nb_var07>
The Garage Door is: <Nb_var08>
[http://pink refresh]
<hr>
</body>
</html>
<html>
<head>
<title> Garage Monitor 3000. </title>
</head>
<body bgcolor=white link = black vlink=black alink=#000000
onLoad="if (self != top) top.location = self.location">
<style>
A:hover { text-decoration:underline; color:#336633; }
</style>
<center>
<h3> Garage Monitor </h3>
<hr>
</center>
The temperature in the Garage is: <Nb_var06>
Car Parking alingment thing: <Nb_var07>
The Garage Door is: <Nb_var08>
[http://pink refresh]
<hr>
</body>
</html>
Step 5: Close the Field of View for the PIR
So the PIR has a crazy wide field of view, I closed that down by using a 5" piece of poster tube, I got this idea from a post on the parallax forums, they used a wider tube, but it was still a really slick Idea.
I secured the PIR to the tube by putting a hole in the cap of the tube and hot glueing it.
I connected this pack to the breadboard by using phone cord, I had tons of it laying around. I found a 3 prong connector on an old CPU fan that I used as a plug for the PIR.
I secured the PIR to the tube by putting a hole in the cap of the tube and hot glueing it.
I connected this pack to the breadboard by using phone cord, I had tons of it laying around. I found a 3 prong connector on an old CPU fan that I used as a plug for the PIR.
Step 6: Secure to the Wall
I secured this to the wall right where my car needs to stop to clear the door. I used a zip tie and a staple gun.
Step 7: Freddie Mercury
I attached a mercury switch to the bottom of my garage door, using phone cord again because I had so much of it...
Step 8: Put It All Together
I attached all of this to a piece of sintra just to keep it clean. I need to cut a shorter ethernet cable but I don't have a crimper at home.
Next steps...
Does it really need to be on all the time? Maybe I should have it power on when the garage door opens and the light turns on. That way I could have it update a table in a database with the last status? I guess having it run all the time is just kind of wasting electricity...
Maybe I should put it in a project box!
Next steps...
Does it really need to be on all the time? Maybe I should have it power on when the garage door opens and the light turns on. That way I could have it update a table in a database with the last status? I guess having it run all the time is just kind of wasting electricity...
Maybe I should put it in a project box!