| Here is an example of how to use system blocks. We will construct an electronic alarm. We start with the power block – using 4 AA batteries to give 6v, but we could use 4.5v with AA or even AAA batteries. All of the blocks are standard system blocks. Your GCSE project should use standard blocks as far as possible. The arrangement of blocks used here is just one possibility – there are other ways of doing things. |
|
| This module uses an LDR and variable resistor as a light sensor. Because the resistance of the LDR is quite low in the light you can use a 10k variable. It supplies a high output to the PICAXE chip when it detects light - either light from a burglar's torch or light when the lid of your tuck box is opened. You will need to make sure the output is sufficiently low when off and sufficiently high when on so that the PICAXE detects it properly. Or you could use one of the analog inputs of the PICAXE, which is what we are doing. See the PICAXE Inputs page for sample code. |
|
| This 4 key matrix is used to enter the correct code to arm and dis-arm the alarm. It uses input pins 0,1,6,7 in the order shown in the PCB layout. Input pin 2 is not used but is connected to the central input of this block so that it is available for the light sensor. There is a 1M pull-up resistor indicated on input 2, but this does not need to be used in this case. Just becase there are only 4 keys does not mean that the code has to 4 numbers long - it can be any length the PICAXE chip can cope with. See the PICAXE Inputs page for sample code. |
|
|
The PICAXE18 microcontroller is a special version of the 16F627 by Microchip. It is capable of in-system programming thus avoiding the dangerous procedure of repeated removing and re-inserting of the chip for programming in a special burner. My experience is that the legs soon fall victim and drop off. A simple serial to stereo jack cable is required for programming. Software is available free from Revolution Education.
This block is used to process the 4 key code input and check it against the required code. It also checks the light level from the light sensor to see if it is over the threshold level allowed. |
|
|
All 8 outputs are connected to a 7 segment display although output 0 is going to be used for the next block. The 7 segment display is a common cathode type so that the segments are lit if the PICAXE outputs are high. This makes it easier to work out which segments make which number. Outputs 1 to 7 match segments a to g of the 7 segment display. If you use a high efficiency display then you can use much higher resistor values – say 1.8k. See the PICAXE page for sample code.
This block is used to give a count down to the alarm going off, to give the legitimate user time to input the code. |
|
|
The PICAXE system can automatically create noises of different frequencies by use of the sound command. The first number provides the pin number. The next number is the tone, followed by the duration. See the PICAXE page for sample code. It won't be terribly loud so you might want to use a siren circuit or a specially made loud alarm perhaps using the high power driver.
That completes this project although for your GCSE you would need to fully investigate various possible designs and the use of each of these blocks. You will also need to develop the PICAXE program which I have not given you. See the PICAXE pages on this site and elsewhere for help. |
|