Jump to content

Physical world problem


Yorn
 Share

Recommended Posts

I need to have a trigger so that when a door is opened, a particular AutoIT script is run. The setup is a webcam and I have all the software aspects covered except for how to trigger it. I can't do motion detection as the camera is a wireless camera and constantly flickers, ruining any motion detection software I've tried. Additionally, I don't want to record myself walking around inside my apartment so much as I want to record who is coming through the door or leaving through the door. The webcam need only trigger for one minute when the door is opened or closed.

This is a physical world problem in that I have considered multiple solutions, but there is no bluetooth or usb door alarm software out there. (Unless you know of any!)

Ideas I've considered:

1) A USB->serial device, but I've never done soldering before. Also, I'd have to use the Serial UDF which is still new.

2) An RFID reader and RFID chip, which could be expensive and might not be Auto-IT scriptable. Still, all I need it to do is be able to come up with a physical world to software trigger.

3) Constantly checking the CD-drive to see if it was opened or closed and having the opening of the door close the tray. The computer won't be close enough, though.

4) Using microphone cable that would normally be disconnected but temporarily connected to create static as the door was opened. The problem is there doesn't seem to be any audio-trigger software or UDFs for AutoIt out there.

5) Professional webcam software that doesn't record flickers. This would be both expensive and would trigger when I walk by the camera/door. I live inside and walk by all the time, I just want to record who is coming in and out is all.

I'm really at a loss for what I should do, but I would welcome any suggestions you may have for me.

Edited by Yorn
Link to comment
Share on other sites

Use sound to detect entry. Set the $VoiceActivationLevel fairly low, and you can have something done when it reaches this level, aka, a knock, or touching something, where it does: Send("{MEDIA_PLAY_PAUSE}") Is where you could run a program to make a siren or whatever, this is just a idea.

;~ -----------------------------------------------------------------
;~ MusicStarter TestVersion
;~  By Nemcija (BlackShadow3@web.de)
;~  With UDF's by CyberZeroCool
;~
;~ Just call it crap 
;~ -----------------------------------------------------------------
#region Settings
$VoiceActivationLevel = 65 ; Use Debugmode to determine this
$SleepBeforeCheck = 1 ;Seconds bevor start checking the microphonelevel (time to leave the room )

$Debugmode = False ;To determine the activation level
#endregion Settings
#region Includes
#Include <string.au3>
#endregion Includes
#region Functions
Func _mciSendString($lpszCommand, $lpszReturnString, $cchReturn, $hwndCallback)
    Return DllCall("winmm.dll", "long", "mciSendStringA", "str", $lpszCommand, "str", $lpszReturnString, "long", $cchReturn, "long", 0)
EndFunc

Func _mciShowError($mciError,$add = "test")
    Dim $errStr
    $errStr = _StringRepeat(" ", 256)
    $Result = DllCall("winmm.dll", "long", "mciGetErrorStringA", "long", $mciError, "string", $errStr, "long", StringLen($errStr))
    MsgBox(0, "MCI "&$add, "MCI Error Number " & $mciError & ":" & $Result[2])
EndFunc   ;==>_mciShowError

Func _LevelCheck()
    Global $lpszCommand,$lpszReturnString,$cchReturn
    $mciError = _mciSendString($lpszCommand, $lpszReturnString, $cchReturn, 0)
    If $mciError[0] <> 0 Then 
        _mciShowError($mciError[0])
    EndIf
    _AddToLastLevels($mciError[2])
EndFunc

Func _AddToLastLevels($level)
    Global $LastLevels,$LevelTime,$Debugmode
    $LastLevels[$LastLevelsSet] = $level
    $LastLevelsSet += 1
    If $Debugmode Then ToolTip($level)
    If $LastLevelsSet = $LevelTime+1 Then $LastLevelsSet = 1
EndFunc
#endregion Functions
#region Startup
$lpszDevice = "new type waveaudio"
$lpszOpenFlags = "alias mywave"
$lpszFlags = ""
$lpszCommand = StringFormat( "open %s %s %s", $lpszDevice, $lpszOpenFlags, $lpszFlags)
$lpszReturnString = _StringRepeat(" ", 256)
$cchReturn = StringLen($lpszReturnString)
$mciError = _mciSendString($lpszCommand, $lpszReturnString, $cchReturn, 0);
If $mciError[0] <> 0 Then 
    _mciShowError($mciError[0],"Startup Error")
    Exit
EndIf

$lpszDeviceID = "mywave"
$lpszRequest = "level"
$lpszFlags = ""
$lpszCommand = StringFormat( "status %s %s %s", $lpszDeviceID, $lpszRequest, $lpszFlags)

$LevelTime = 15  ; *100ms

Dim $LastLevels[$LevelTime+1]
For $i = 1 To $LevelTime
    $LastLevels[$i] = 0 
Next

$LastLevelsSet = 1

AdlibEnable("_LevelCheck",100)
#endregion Startup
#region Runtime
Sleep($SleepBeforeCheck*1000)
While 1
    Sleep(100)
    $Active = False
    $i = 0
    While (($i <= $LevelTime) And (Not $Active))
        $Active = $Active Or ($LastLevels[$i] >= $VoiceActivationLevel)
        $i +=1
    WEnd
    If $Active Then
        Send("{MEDIA_PLAY_PAUSE}")
        Exit
    EndIf
WEnd
#endregion Runtime
Link to comment
Share on other sites

Thanks guys! Believe it or not, all of these, even the think geek toy, have given me ideas on how to do this. Since I'm not typically using the mouse, I was talking to my cousin who suggested I set it up so that it hovers over the door and then on a mouse position move, it kicks off the webcam to record for a minute.

Also, R6V2's option seems to be the cheaper one, but when I end up making something a bit more professional I might go with what weaponx has suggested.

Very good ideas, thanks!

Link to comment
Share on other sites

  • 2 weeks later...

Hello,

Just wondering if you have looked at the parallel port?

I use a battery PIR coupled to a wireless doorbell sender to tell my devices that someone is about.

If you have any questions please post back.

All the best,

Si.

Perilous to all of us are the devices of an art deeper than we ourselves possess.

Link to comment
Share on other sites

  • 1 month later...

I ended up coming up with a few ideas, but I did get the motion detection to work (sort of). I also had an old mouse attached to the doorway and set it to "onmousemove". I also got the microphone option to work so that "onmic" would sound off and start the capture.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...