Did you ever browse a web and chat with friends, and you don't want nobody to know?
here are small instructions which will help you to automatically lock screen when somebody is going near your computer, maybe to steal your data?

Step 1: What Will You Need

You will need:
1.Photocells and some parts of mirror
3. COM port cable & connector
4. some 24VDC power supply (i used 24VDC photocells so i used this one too!)
5. Windows visiual C# express edition 08 or .net 3.5! C# fttw tho.
6. Some general electricity tools like screwdriver, snips, maybe zipties etc
7. not so lot of time

Step 2: Photocells Part

Get yourself a photocell, working one
check out for any defects, if none, proceed.
find power connections (mine was for 24vdc :D)
find 3-pin connections for relay.

photocell sends IR/laser beam to reflector which reflects it back. if it doesn't receive the beam,
it turns relay ON.

what are we going to do:
we are gonna wire photocells so somebody opens the doors, he'll broke the beam and fire up relay.
PIC1: photocell
PIC2: reflector, made from school project's alluminum :D

Step 3: Computer Part

Now, get yourself Com port cable (serial port) - warning, need some "old" computer for this - newer dont have the uber-cool, shortcut & overvoltage protected serial ports. i used serial port because it has those protections... so in case i may be wrong, noone gets hurt (excempt us, maybe.)

Ok, you got your cable?
we'll need explore the connections. find pin 1 and pin 4. those pins are CDpin and DTR pin. computer
will "feel" when somebody touches DTR and CD pin together. that's what we are going to "abuse" ;P

then, wire a RELAY as swich to those cables
i used my PLC as the power source for it, so dont look out like :O what's that box there :O
also, i used pre-swich BEFORE the relay, as override - if i "let" somebody inside ;)

PIC3: bypass swich
pic4 - PLC + box with relay + cables to COM port

Step 4: Programming Part!

Now, you need programming part, to lock off your screen.
I used M$ visio C# 2008 express edition, and all you need is to compile files which are packed up in upload. take care in file "Program.cs", find a line which contains something about COM port, and you should change line like this:
LockComputerOverSerialPort lockComputerOverSerialPort = new LockComputerOverSerialPort("COM2");

to line like...
LockComputerOverSerialPort lockComputerOverSerialPort =
new LockComputerOverSerialPort("COM[your com port number]");

note: please, i made newline there because else it was cutted out. dont make newline or you
will get horribile errors in C#.

Step 5: And You Are Done!

Now, let me show you the story how it's wired at me.
i have about 10 meters of audio (2wire) cable.
is connected to <24vdc> powersupply
relay is in off mode when photocells gets its beam back - multimeter fttw

10m cable goes here

PLC - photocells are kind of a switch, for my PLC.
wired 24v+ to photocells and back to plc, i1
when it detected 24v on input, it fired up relay (which was wired to PLC) which made contact with DTR and CD pin on com port.

let's try it out, grab some comp with xp, install C# or .net, get .exe compiled, run .exe, and just open the doors. WOOAH; this works!

Btw, C# programmers, you know what to fix if you want different effects :)

Have FUN!
img1: photocells with power supply 24vdc
img2: some aluminiom piece piece to reflect those beams from photocells
img3: bypass switch - if i want let any1 in
pic4 - plc, relay and cables for com

pic5 - schematic for PLC
pic6 - schematic for NON PLC version

bold - pics you must see.

P.S.: i made this, and it worked. for electric part, i *may* help. i am not the 100% C# programmer, i just went on it because python with pyserial on windows xp didn't work what python on linux with pyserial did.


HAX - i failed for clicking at &quot;UPLOAD&quot;&nbsp;button. everything should be up now ;)<br /> <br /> happy locking :D<br />
any C# programmers and others, if you know how to limit it's ranges so it wont abuse 100% of processor? because now it does :D
OK, new code -> no more bugging! now it works as it needs to work!

About This Instructable



More by w477s:Screen locker [Windows XP] 
Add instructable to: