- Someone is stealing the biscuits! Your mission, should you choose to accept it, is to design a circuit which will give an audible alarm as soon as the biscuit tin is opened.
|1. Buy the Biscuit Tin Alarm kit||More updated pages...|
|2. First ideas|
|3. Block diagram||Discovering Digital Electronics|
|4. Sensor||1 : Beginnings|
|5. Latch||2 : Logic gates|
|6. Power on RESET||3 : Astables|
|8. AND gate||555 timer|
|10. Final circuit|
|11. Building the Biscuit Tin Alarm|
This is an excellent construction kit for beginners. The circuit uses the 4093 Schmitt trigger NAND gate integrated circuit. You can learn a lot by testing parts of the circuit on prototype board and following the explanation of how the final circuit was developed.
Buy using PayPal™ price: £ 4.50 + P&P
|DOCTRONICS Biscuit Tin Alarm construction kit||
USD, Euro accepted..
DOCTRONICS accepts official orders from UK educational establishments. Email firstname.lastname@example.org for details of quantity pricing.
Click if you want to build the circuit now.
If you haven't designed a circuit before, the mission may seem impossible, but the process of electronic design is not really difficult. Most designs start with a block diagram, in which easy to understand subsystems are joined together. The details of what goes on inside each subsystem come later.
A light dependent resistor, LDR, could be used as part of a light sensor circuit. A tilt switch could be attached to the lid of the tin. Alternatively, you might attach a magnet to the lid of the tin and arrange for this to operate a magnetic switch (or reed switch). These devices would be part of a movement sensor subsystem.
Most alarms 'remember' that the sensor subsystem has been triggered. Closing the tin won't stop the alarm. A subsystem with this 'remembering' function is called a bistable, or latch.
Once you know the names and properties of the most important subsystems, you can use these building blocks to work out how to solve the design problem in outline.
Here is a block diagram for the biscuit tin alarm:
|Biscuit Tin Alarm block diagram|
The sensor detects the opening of the tin. The output of the sensor triggers the latch so that its output goes HIGH. The reset subsystem provides some way of silencing the alarm.
An astable is a subsystem which produces pulses.
You may know about AND gates already. These follow a truth table where the output of the gate becomes HIGH only when both inputs are HIGH:
|input B||input A||output|
|AND gate truth table|
where '0' represents a LOW voltage, and '1' represents a HIGH voltage.
The AND gate is used in this system to decide whether pulses from the astable will be transferred to the audible warning device. If the output of the latch is LOW, no signals reach the audible warning device and the alarm is silent. On the other hand, if the circuit is triggered by opening the tin, the output of the latch becomes HIGH and the alarm sounds.
Suppose input A represents the astable, while input B is the output of the latch. Follow the truth table of the AND gate to make sure you understand how this part of the system works.
Design Electronics includes details of all these subsystems. It's important to start building circuits straight away, so don't worry if you don't know about or understand everything all at once. For the moment, you need to concentrate on the skills involved in component identification, building prototype circuits, making measurements and soldering.
Sensor circuits almost always involve voltage divider circuits:
|Voltage divider circuits|
To work out what is going to happen in these circuits, you need to know that the resistance of an LDR is HIGH in the dark, 1MΩ or more, and LOW in the light, 1 kΩ or less, depending on the brightness of the light.
Some tilt switches contain a blob of mercury which bridges the contacts inside when the switch is upright. Mercury is highly toxic. Whenever, you need a tilt switch, you should use a non-mercury type. These contain a conductive metal ball and work in essentially the same way. Suppose the tilt switch is arranged so that it closes, becoming LOW resistance, when the lid of the biscuit tin is opened.
Think about the voltage divider formula to help you with your answers:
Substitute a big resistance, say 1 MΩ, into the formula when the LDR is in the dark. Will Vout in circuit A be HIGH or LOW when the LDR is in the dark?
Similarly, substitute a small resistance, say 1 kΩ, when the LDR is in the light. Will
Vout in circuit A be HIGH or LOW when the LDR is in the light?
Follow through the formula again for circuit B. Circuits A and B behave differently.
What size of resistance should be substituted when the tilt switch is closed? Circuits C and D also behave differently.
|Light sensitive voltage divider circuit|
Clicking the button under the diagram moves you on to the next prototype board layout on this page. Clicking opens the drawing in a new window which you can maximise to fill the screen: you can see exactly where to put the wire links.
This layout is the same as circuit A. To measure Vout a multimeter is used, switched to one of its voltmeter ranges:
|Using a multimeter as a voltmeter|
The BLACK lead of the multimeter is always connected to the COM socket. The RED lead is connected to the VΩmA socket. Use 4 mm leads and push crocodile clips onto the ends of the leads as indicated.
As you can see, the central knob of the meter has been rotated to 20 V. With this setting, the full scale deflection, or fsd, of the voltmeter is 20 V. In other words, 20 V is the largest voltage which can be measured. Most of the circuits you are likely to investigate will have power supplies from 5-12 V, so this setting is the one you will use most frequently.
The circuit gives a LOW voltage output when the LDR is exposed to light. Confirm that covering the LDR with your hand causes Vout to increase.
This happens because the resistance of the LDR increases. Some light passes through your hand. The more effective you are in excluding light, the closer to the 9 V power supply voltage Vout will become.
Try swapping the positions of the 10 kΩ resistor and the LDR. The action of the circuit is reversed: Vout is HIGH in light and LOW in the dark.
Put the resistor and LDR back into in their original positions. There is a reason why you want a LOW output in the light which will become clear shortly.
One way of making a latch, also called a set-reset bistable, or set-reset flip flop involves two NAND gates.
The symbol for a individual NAND gate is:
|NAND gate symbol|
The truth table is:
|input B||input A||output|
|NAND gate truth table|
where '0' represents a LOW voltage, and '1' represents a HIGH voltage. How does this differ from the truth table for AND?
Here is the circuit for a NAND gate latch:
|NAND gate latch|
Pressing the SET button forces the Q output to beome HIGH. The Q output will stay HIGH until the RESET button is pressed.
To see what is happening, the NOT Q output can be used to drive an LED. Ideally, you should use a transistor to drive the LED, since this reduces the current supplied by the gate. However, provided the resistor in series with the LED is 1 kΩ or more, the circuit shown below will work:
|Adding an indicator|
Will the LED illuminate when NOT Q is HIGH, or when NOT Q is LOW?
|Adding the latch/indicator circuit|
Note the addition of the 100 μF decoupling capacitor with its connecting links. This is good practice with CMOS integrated circuits to prevent the transmission of 'spike' signals along the power supply rails. Replace the LDR once the new links have been inserted.
The latch circuit would work using a 4011 2-input NAND gate IC. However, for the biscuit tin alarm circuit a 4093 Schmitt trigger NAND gate IC is used instead. This is because you can build the astable subsystem you need using just one Schmitt trigger NAND gate, as you will discover in the next section.
The pin connections of the 4093 look like this:
|4093 Schmitt trigger NAND gate|
The special property of Schmitt trigger NAND gates is explained in the 4093 entry in the Beastie Zone.
Look again at the circuit diagram of the latch and at the prototype board. Confirm that the links produce a pattern of connections on the prototype board which is identical to the the connections indicated by the circuit diagram.
Operate the SET and RESET switches. Write a sentence or two to describe the behaviour of the latch circuit.
|Connecting the sensor to the latch|
Test your circuit:
Pressing RESET should make the LED go OFF. Uncovering the LDR should make the LED go ON. It should remain ON when the LDR is covered again. The latch 'remembers' that the circuit has been triggered.
Provided the LDR is covered, pressing the RESET switch will make the LED go OFF.
You can arrange for the latch to be RESET automatically when the circuit is first switched ON. This is done using another voltage divider:
|Power on RESET voltage divider|
When the circuit is first switched ON, Vout is LOW because the capacitor is empty.
The capacitor charges up slowly through the 1 MW resistor. If this resistor/capacitor combination is used to replace the RESET switch on the prototype board, you will find that the LED remains OFF for several seconds when the power supply is first connected:
|Adding power on RESET|
If the LDR is covered during this time, the latch will not be triggered. The LED remains OFF until the LDR is suddenly uncovered.
This is exactly the behaviour you want for the biscuit tin alarm. When the battery is first connected, the power on RESET prevents the latch from being triggered. This is when you put the circuit into the tin and close the lid. Inside the tin, the capacitor charges up and the circuit becomes ready to operate, waiting for the hungry biscuit thief. As soon as the lid is opened . . .
Astables produce pulses. One of the simplest astable circuits needs just one resistor and one capacitor together with a Schmitt trigger NAND gate:
|Schmitt NAND astable|
|Testing a Schmitt NAND astable|
You can monitor the output pulses using an oscilloscope, as indicated. The frequency of the pulses should be around 1 kHz, that is, one thousand pulses per second.
In the original block diagram, the latch and astable outputs are both connected to the inputs of an AND gate. Pulses from the astable are transferred to the output of the AND gate when the output of the latch becomes HIGH. You can think of the latch as providing a control input which determines whether the astable pulses get through.
NAND gates can be used to control the transfer of astable pulses in a very similar way. Look at the circuit diagram:
|Joining subsystems together|
|Joining subsystems together|
Move the output link to pin 11 of the 4093, as indicated. Disconnect the power supply, cover the LDR then reconnect the power supply. Wait for 30 s. If the circuit is correctly wired up, pulses will start when the LDR is uncovered.
To complete the biscuit tin alarm, you need to add a piezo transducer to provide an audible output. This will be louder when driven via a transistor. The circuit is:
|Using a transistor to drive a piezo transducer|
The transistor pin connections are:
|BC547B pin connections|
|Completing the circuit|
Test your circuit by disconnecting the power supply. Wait a few moments and reconnect the power supply. Initially, the latch is held reset and the alarm does not sound. Covering the LDR within this initial period prevents the alarm from sounding. Some time later, if the LDR is uncovered, the latch is triggered and the alarm will starts to sounds immediately.
You have done extremely well if you have followed through the design process and built your biscuit tin alarm in prototype form. It is important to note that the development of the circuit is progressive. You start with just one subsystem on the prototype board and add further subsystems one at a time, testing the circuit and making modifications as you go along.
Prototype board testing leads eventually to a complete circuit for the device being developed. You can continue to make small alterations until the circuit behaves in the way you want.
The final circuit for the biscuit tin alarm is:
|Biscuit Tin Alarm: final circuit|
Can you identify the functions of the various parts of the circuit?
Further tinkering has resulted in one or two alterations from the prototype board circuit you tested.
A 10 kW preset resistor has been included. The resistance of the preset is adjusted using a screwdriver when the circuit is first assembled on printed circuit board and allows you to change the frequency of the astable pulses. This is useful because the piezo transducer oscillates more strongly at some frequencies than others. If you 'tune' the astable pulses to coincide with one of these resonant frequencies the noise produced is much louder.
To build a permanent circuit, you need a printed circuit board. It is possible to design and make your own printed circuit boards but, for your first few projects, it is much easier to use a ready made professionally produced PCB. When you have the PCB, gather together the components you need and follow the instructions to assemble the biscuit tin alarm circuit.
Buy using PayPal™ price: £ 4.50 + P&P
|DOCTRONICS Biscuit Tin Alarm construction kit|
|1||0.25 W carbon film resistor 4.7 kΩ(yellow, violet, red)|
|1||0.25 W carbon film resistor 1 MΩ (brown, black, green)|
|2||0.25 W carbon film resistor 1 kΩ (brown, black, red)|
|1||0.25 W carbon film resistor 2.2 kΩ (red, red, red)|
|1||0.25 W carbon film resistor 10 kΩ (brown, black, orange)|
|1||ORP12 light dependent resistor|
|1||carbon preset potentiometer 10 kΩ|
|2||100 nF metallised polyester|
|1||10 μF 25 V radial electrolytic|
|1||100 μF 16 V radial electrolytic|
|1||1N 4148 silicon signal diode|
|1||5 mm red LED|
|1||4093 Schmitt trigger NAND gate integrated circuit|
|1||14-pin low profile DIL socket|
|1||miniature PCB piezo transducer|
|1||heavy duty PP3 battery clip|
|1||DOCTRONICS biscuit tin alarm printed circuit board|
Check the parts carefully to identify them. Before you start construction think about the components which are polarised. These components include the 10 μF and 100 μF electrolytic capacitors, the 1N 4148 diode and the LED. Each of these components has separate positive and negative terminals. How can you tell which leg is which?
|Biscuit Tin Alarm printed circuit board|
Click to open a PDF file with the PCB layout of the Biscuit Tin Alarm which you can print out to help you with construction. If you want to make your own PCB, use a laser printer to print the file onto acetate sheet without scaling and make the PCB using the photo etch process.
The plain side of the printed circuit board is the top and all the components are pushed through from this side. The copper track side is the bottom where you solder the legs of the components in place.
|Safety precautions: wear safety spectacles, keep the soldering iron in its stand to reduce the risk of burns, use rosin free solder.|
The piezo transducer should sound immediately, but should stop whne you cover the LDR. Once the 10 s power on delay has elapsed, the piezo transducer will stay on if the LDR is uncovered.
Adjust the 10 kΩ preset to give the loudest, most penetrating noise.
To use your alarm, first disconnect and then reconnect the battery. The 10 s delay starts from the moment that the battery is connected. Put the whole circuit in the biscuit tin and put the lid on. The alarm is set and will sound whenever the biscuit tin is opened (unless you like eating biscuits in the dark!)
The links below allow you to download documents in Adobe Acrobat ©, PDF, format. In the unlikely event that you don't already have Acrobat Reader, you can download the latest version direct from Adobe:
4093B data sheet (NXP, 2008)
4093B data sheet (ST Microelectronics, 2007)