'Smart' Front Door
This project started out as a simple 'networked door bell', so we could know if someone had called whilst we were out. This got us thinking as to what else we want our 'front door' to be able to sense and also what useful actions could it take in response. It's an experiment to see what works and what doesn't. We have now had our new front door fitted, so we are in position to do the final wiring and installation. We have now proved that the Raspberry Pi is a perfect way to implement this and will minimise the amount of wiring required to the front door. This project is now progressing quickly :-) We also have some other related pages on the Raspberry Pi:
Our initial thoughts on what a 'smart front door' could do for us are:
- Know whether it is dark outside or not. This is driven by our twilight sensor sensor. This will then be used to:
- Restrict when convenience lighting is active (manual over-ride aside).
- Restrict when IR lighting is activated, to support the camera.
- Safety lighting - low level lighting over the door at night time (very low current LED).
- Courtesy lighting - PIR driven lights that light up to welcome anyone at night time.
- Capture door bell presses and capture image or video when pressed.
- Detect if something has been put through the letter box and also capture image or video.
- Capture front door open and close events using a door contact sensor and report them back to our Home Control System (HCS)
- Audio announcements and notifications on opening front door, e.g number of new phone messages. This will be done using a Java Text-To-Speech engine.
- Capture still a series of still images of people coming to the front door (using a PIR sensor) and make them available whilst at home or away from home via cloud storage and associated mobile apps.
- Capture video on movement detection and other events.
Some secondary features that we are also looking at, though these may also become separate projects:
- Capture door vibrations.
- Enable local and remote locking using both keys and access codes entered on a keypad, with logging.
- Interrogation of door lock status. Support personal keys and personal access codes.
- Speech recognition.
And these are now definitely separate projects:
Instead of having loads of wiring from the front door to the Home Control System (HCS), we plan to use input capability and local processing capability next to the front door, in the form of a Raspberry Pi. We ill use the Ethernet network to get I/O updates back to the Home Control System (HCS). This will simplify the wiring a lot.
Our current design is looking something like this:
Local Inputs, Outputs & Feeds
The current design assumes the following local input and outputs. The number is important as it affects the implementation options, e.g. does a Raspberry Pi have enough I/O capability to implement this? Our initial view is that it does.
We currently plan the following digital inputs in total:
Door locked sensor may be covered in our front door lock project. Other inputs (not digital) identified include the video camera and microphone.
The inputs will all be 12V signals and buffered into the GPIO pins using opto-isolators (ILQ74). We are updating our optical-isolated input board design to work with the Raspberry Pi. The electronics are covered in more detail in our digital input & output feature.
We currently plan 2 digital outputs in total but we have developed an output board that supports four.
- Convenience lighting - the GPIO pin connects directly (via the switch) to the solid-state relay (SSR) which can be controlled by the 3.3V output and draws very little current.
- IR lighting - this would require a high current output capability.
In practice it may be simpler to drive these via the PIR sensor, using some simple logic and a retriggerable monostable to give a decent delay.
The following wires and connections are required from our existing Home Control System (HCS) down to the front door:
- The twilight sensor feed could be sent over the LAN as a message to the smart front door processor but, it could also be fed down to the front door over a wire. We have yet to decide on the best approach.
- Safety lighting
- Emergency lighting
- Internal alarm
- Alarm strobe
- HCS audio
Our initial thoughts were that the convenience lighting and the IR camera lighting would both operate at the same time, when the PIR detects movement and it is dark outside. Having given it further thought this remains the case but, we can a situation where the convenience lighting remains on for a set time period and the IR camera lighting will be on for a much shorter period, e.g. only when capturing video or stills. For this reason we have kept them as separate outputs for now.
We are currently construction a stylish front porch light which contains 40 warm-white LEDs for the convenience lighting and 28 IR LEDs for the IR camera lighting. These will sit behind a white Perspex, curved panel and the PIR sensor will also be out of sight behind this. Both lights are designed for 12V power but, a local mains transformer could be used to power them from mains power supply.
This was a previous project and as part of it, the 12V safety lighting power feed is routed to the front door. This adds some low level ambient lighting over the front door at night time. The plan is to use a single warm white LED, as we have done in other parts of our house. It's hard to describe just how useful this is.
Convenience lighting is lighting that is activated by people approaching the door or opening the door (at night time only). It is activated by the PIR sensor and the door contact sensor. The processor uses the PIR and door contact sensors as inputs into a retriggerable delay timer. We are also considering using the door bell and the letter box sensor to trigger this.
The processor outputs a control signal to the convenience lighting and this is routed via a 3-way light switch (auto, off and on), to provide an overlay layer of manual control. This isn't strictly necessary but, is our preferred way of doing home automation.
Because all the signaling is 12V dc, this control signal could be used to drive low-voltage convenience lighting via a relay or mains lighting via a solid-state relay (SSR).
We also plan to have some IR lighting in place to improve the quality of the images captured by camera. This would only be activated at night time and ideally only activated when the camera is capturing images or video (to save power). We would like this to be very subtle but, there are two types of IR LEDs:
- We have used LEDs that output at a 850 nm wavelength and these are visible and have a dim red glow to the human eye. These are much better for illumination when used with digital cameras.
- There are also invisible IR LEDs and these are best used in IR remotes and similar devices. They output light with a 950 nm wavelength and are not as good for illumination with digital cameras.
We picked up 100 LEDs on eBay for less than £5 delivered. These IR LEDs are rated at 1.5-1.6 V forward, 60mA continuous, 120mA peak.
It is very difficult to actually photograph an IR LED because most digital cameras are responsive to IR light and don't see what the human eye sees. This photo gives you an idea of what an IR LED looks like when lit up though. It has a faint red glow, which is dimmer than this photo implies.
Note: This IR lighting is not designed to light up large areas and long distances. It is purely for the IP camera over our front door and we have a separate camera and lighting system to cover our front drive area.
We already have an internal alarm sounder next to the front door. This is used to remind us that the alarm has been armed or triggered before the external sounder goes off. This could also be done as a voice announcement though.
This is replicated by the front door to give a clear visual indication that the alarm has previously been triggered. The external sounder is switched off after a set time delay but the strobe remains on until the alarm is reset.
The PIR sensor needs to be external type with short range and wide beam. Most internal ones used for alarm systems are 12V dc but, external variants tend to be mains powered and used to control external lighting. They also often include a light level sensor. This makes it harder to find an external 12V dc PIR sensor at a reasonable price.
We require 12V operation and don't require a light level sensor so have decided to take a standard PIR sensor and modify it for external use. Protecting it from the elements is less of an issue in our case, as it is located under a porch and is not subject to direct sunlight and rainfall. We have used a standard internal PIR sensor and clear silicon sealant to ensure the case is sealed from dust and water. We will see how well it survives over the coming months.
Our current door bell is a stainless-steel, waterproof (sealed to IP66 BS5490 1977), vandal proof switch mounted in a bespoke housing. We used this switch because it looks good, is very high quality and very reliable. This is from Maplin (part no. MG75S).
With our new front door fitted, this is what it looks like from the outside. This is the vandal-proof, stainless-steel switch recessed into the door frame, so that it sits flush. The surround is a large washer that we have spray painted gloss black. The wires come out of the frame at the back and are hidden inside, running up to the top right corner of the door frame and into an enclosure. The enclosure is hidden behind a curtain.
IP Network Camera
Our Raspberry Pi IP camera project using a USB webcam covers this part in more detail.
It would be a lot easier to implement in a house where the letter box is to the side of the front door and not mounted in it. This would make it easier to route wires and to hide wiring. It might then even be possible to have a collection cage for the mail that could weigh its contents. Having it not mounted to the side of the front door would also make it less susceptible to vibrations from the door opening and closing.
We initially looked at using a tilt switch mounted to the external letter box flap but, this was at 90º to the way the tilt switch operates.
A more reliable solution is a tiny reed switch mounted on the inside of the letter box and a small magnet stuck to the letter box flap. We use these things on every door in our house.
Door Contact Sensor
This is a reed switch as shown above with a magnet hidden in the door and the frame, to signal when the door is open or closed.
Door Vibration Sensor
This is probably over-kill but, for the sake of a vibration sensor and a pair of wires, we are interested in understanding if this is a useful thing to do. The purpose of this sensor is to see if anyone is knocking or banging on the door (or trying to break it open!). The vibration switch works at any orientation and contains some mercury. Any vibration causes the contacts to close very briefly. A fast response input is required to work reliably and fortunately our testing shows the Raspberry Pi works plenty quick enough, especially when using interrupts.
Internal Alarm Panel
As part of this project, we are updating the alarm control panel or keypad next to the front door.
This is now a separate lock project.
Audio Announcements & Notifications
Our house currently makes voice announcements using Java TTS (text to speech) library and some pre-recorded announcements (better quality). These are for very important events only, so as not to become annoying. An example of this is announcing mains power failure and restoration.
With a speaker above the front door, it would be quite easy to add audio notifications when the front door is opened. A useful one we can think of is to announce when there are answer machine messages for the PSTN and VOIP phone lines (another project under way).
As part of our home security system, we also have a panic button by the front door. This activates the alarm system and sounders, as well as sending out SMS and other messages.
We can track members of the household coming and going by using a Bluetooth dongle to detect proximity of mobile phones. This is now separate project.
This project is still being designed. A lot of our effort is focussed on the Raspberry Pi, to see how suitable it is for this application.
We are also still building the lighting.
We have ordered an A4 sheet of 2mm thick acrylic plastic on which to mount the LEDs and PIR sensor. Our layout results in the use of 40 warm white LEDs, each driven in groups of 4 in series with a current limiting resistor.
We initially designed a template for the LEDs, using Microsoft Powerpoint.
We cut and drilled the acrylic as shown here.
We have used 28 IR LEDs, also in groups of 4 in series with a current limiting resistor. Initial test show these LEDs to be quite directional, so we have angled them within the light unit. These LED are rated at 60mA continuous but throw out a decent amount of light from 25mA up. Because you can't actually see the light IR light output, these are tested with an IP netcam.
So far progress has been pretty good. We have the Raspberry Pi working as an IP netcam and have also got it capturing high resolution still images.
Our current focus is on the I/O capability and we have ordered the required components to connect this up very soon. It is looking like networked I/O capability close to the front door is going to make life much simpler, than routing all the wires required to do this between the front door and our Home Control System (HCS). The trick is going to be to maximise the benefits of that local processing power, in order to minimise the impact of the power required.
We have just had our new front door fitted, so we are now able to start the final stages of this project.