I don't know about you guys but I constantly catch myself wondering whether I have locked my apartment door or not. I never actually forgotten to turn the key but I did come back just to make sure a bunch of times. Usually it is when I am in a rush trying to catch a bus knowing the next one won't be soon. Anyway, I wanted to do it for a long time, but I finally got some time this evening and I came up with a simple device that will do the job of remembering for me.
Basically this is an ATtiny13 chip with two reed switches and a buzzer:
The chip stays in power-down mode using just 4 uA including the shorted door switch (via 1M + 10k resistors). When the door gets opened it activates, powers up the second switch via PB3 and waits for the door to be closed again checking PB1 level. It then checks the lock status and keeps beeping until you lock the door (PB4 level). Once you do that it returns to the power down mode waiting for another door opening. Some energy could be saved by using sleep instead of delays while active, but I guess the door won't be open for too long anyway so it doesn't really matter. One thing I will fix later is the lock & unlock scenario where you lock the door and then unlock it leaving the door closed. It will not be detected and therefore you can still leave it unlocked. But for now it is just what I needed.
The door sensor is a typical alarm type of reed switch and the for the lock I used a magnet glued to one of the lock "bolts" (what are they called?) the lock switch is glued inside the door frame.
The reason it took so long to get it done is that I wanted to make a PCB for that and I hate making them ;) Luckily, my sister sent me a few cool small solderless breadboards from China 5RMB each ( less than 1 USD !! ) so there will be no PCB for that, I'll just put it into a small box and glue it to the door frame. I would have done it now but it's already past 22 and I need to drill a hole in the frame to hide the cables.
The "final" device looks like this:
Attached is the source code if anyone wants to use it.



