Home Board Details Example Video Example Application

Application Example
Security Camera (student project)

Submitted by Brian M

For my school, level 2, science project, I decided to try an automation project that was suggested by our teacher. He had already obtained a control board (Ed: ConText board) which was considered suitable for this. The project objectives were to implement an automated security camera system which reacted to the movement of people within its range. The idea was to photograph anyone entering a room and track and photograph their movements. I had initially considered using a computer video cam with the possibility of capturing full video of any motion but this would have meant having a laptop computer running all the time. This version simply used an old digital camera which had sufficient storage capacity for several thousand photos of reasonable resolution.

The sensors that would detect human movement were PIR (passive infrared) detectors EKMC1601111. This sensor (made by Panasonic) is a standard detection type passive infrared motion sensor in TO-5 package. It detects change in infrared radiation which occurs when there is a movement by a person or object by the change in surrounding temperature. I decided to use three of them to allow coverage over a wide angle.

The first task was to make the outputs of the PIR sensors compatible with the inputs on the control board. Fortunately this was very easy and only involved a small transistor and one resistor as shown below...

The PIR sensors were connected in this way to inputs IP1, IP2 and IP3 on the ConText board.

The next step was to provide a rotating platform for the camera. This was made using a small piece of MDF and mounted on to a stepper motor as shown. The stepper motor was then wired to the ConText board and to its 12v (battery pack) supply as shown below... (diagram copied from  Context manual)

One  output was needed to control the camera shutter. To be on the safe side I decided to use a relay which would provide simple contacts to activate the camera shutter. It may have been possible to connect the camera directly to one of the Context board outputs as these are switching type but it was unclear as to the nature of the camera shutter control and whether this would be compatible.  A small 5v relay was used and connected to output 1 on the ConText board. The normally open contacts on the relay were connected to the small DIN plug which plugged into the camera remote shutter control socket.

After some initial testing, I decided to add a small tube collimator (modified pen top) extension to the middle PIR sensor. I found that the PIR sensors had quite a wide angle of detection and it was not possible to point the camera accurately enough. The collimator on the middle PIR narrowed the detection angle down significantly. The intention was to use the two outer PIRs to detect any initial human movement and then rotate the camera in that direction until the middle one also detected it. That way a more accurate pointing of the camera could be achieved.


The next step was the most interesting. It was to create the control text that would govern how the project operated. Other control boards, which our teacher considered, meant using some form of programming language. Although I was willing to learn these it would have taken some time before I could have started on the important bit of the control logic for this project. With the "text" control option on this board I could get started on the interesting bit straight away. Although I intended to have the final version operate "standalone" I had the board connecetd to a laptop while I developed and tested the text.  The first working version of my text is shown below. I have since added some more features such as an extra input which is connected to a small limit switch. This allows me to return the unit to a known "datum" point  but the version below shows the most important bits.

Text Description
PLACE 10
WAIT 5 SEC
IFINPUT 1 ON GOTO 100
IFINPUT 3 ON GOTO 200
GOTO 10
PLACE 100
LOOP 50 TIMES
STEPMOTOR 1 FORWARD 1
WAIT 10 MS
IFINPUT 2 ON GOTO 400
ENDLOOP
STEPMOTOR 1 REVERSE 50

GOTO 10
PLACE 200
LOOP 50 TIMES
STEPMOTOR 1 REVERSE 1
WAIT 10 MS
IFINPUT 2 ON GOTO 400
ENDLOOP
STEPMOTOR 1 FORWARD 50
GOTO 10

PLACE 400
OUTPUT 1 ON
WAIT 300 MS
OUTPUT 1 OFF
GOTO 10
END
Start line named 10
Slow down the loop to every 5 seconds
if PIR 1 detects movement  goto place 100
if PIR 3 detects movement  goto place 200
nothing detected, go back to start (place 10)
place named 100
start loop for rotating motor clockwise (toward PIR 1)
rotate clockwise 1 position (1.8 degrees for this 200 ppr motor)
wait 10 milliseconds for motor to complete its small step
if PIR 2 detects the movement then goto photo taking (place 400)
stepper motor not there yet, go back for another step
nothing detected, return motor

go back to start (place 10)
place named 200
start loop for rotating motor anti-clockwise (toward PIR 3)
rotate clockwise 1 position (1.8 degrees for this 200 ppr motor)
wait 10 milliseconds for motor to complete it small step
if PIR 2 detects the movement then goto photo taking (place 400)
stepper motor not there yet, go back for another step
nothing detected, return motor
go back to start (place 10)

place named 400
activate the camera shutter
short wait (300 milliseconds)
de-activate shutter
go back to start


Once I had a working text version I had to configure the board to operate without the laptop connected. This simply meant fitting a small link (jumper) to the board and connecting a 6v battery pack. The battery packs were eventually replaced with a DC power supply.


Now that the project has been tested, enhanced and proven to work, the school are going to provide extra bits and pieces to let me mount it better and enclose it within a dome to make it suitable for outdoor use, where another section want to use it to capture wildlife that are known to visit the school during the night. It should prove interesting !

The video below shows the initial testing of the security camera.

 

 

Ed: Thanks for the article Brian and many thanks to EGD  for giving us permission to publish it on our website.