Doctronics

Educational Publishing for Design & Technology

 

Biscuit Tin Alarm Project


  • 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.
 


Navigation

custard cream

Custom Search
 
DOCTRONICS home

1. Buy the Biscuit Tin Alarm construction kit

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.

BTA
 

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 doctron@btinternet.com for details of quantity pricing.

Click if you want to build the circuit now.

 
navigation DOCTRONICS home

2. First ideas

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.

Ask questions:

  • How are you going to detect when the biscuit tin is opened?

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.

 
navigation DOCTRONICS home

3. Block Diagram

Here is a block diagram for the biscuit tin alarm:

Biscuit Tin Alarm block diagram
  • How is this system going to work?

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
0 0 0
0 1 0
1 0 0
1 1 1
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 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.

 
navigation DOCTRONICS home

4. Sensor

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.

  • Which of these circuits, A, B, C, or D in the diagram, gives an increase in Vout from LOW (logic 0) to HIGH (logic 1) when the tin is opened?

Think about the voltage divider formula to help you with your answers:

voltage divider formula

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.

Build a light sensitive voltage divider circuit on prototype board, as follows:

 

down open in a new window 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.

Multimeters are decribed in detail in Using a multimeter, the Chapter 2 practical in Design Electronics Design Electronics.

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.

 
navigation DOCTRONICS home

5. Latch

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
0 0 1
0 1 1
1 0 1
1 1 0
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?

Add the latch/indicator circuit to your prototype board as follows:

 

down up open in a new window 4093 pins 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 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.

Now modify your prototype board, using the LDR/voltage divider to replace the SET switch:

down up open in a new window 4093 pins Connecting the sensor to the latch

Test your circuit:

  • Cover the LDR with you hand. Press the RESET switch. What happens to the LED?
  • Now, uncover the LDR. What happens to the LED?
  • Cover the LDR once again. What happens to the LED?

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.

  • How can you make the LED go OFF again?

Provided the LDR is covered, pressing the RESET switch will make the LED go OFF.

 
navigation DOCTRONICS home

6. Power on RESET

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:

down up open in a new window 4093 pins 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 . . .

 
navigation DOCTRONICS home

7. Astable

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

Add this circuit to your prototype board using a 10 kW resistor and a 100 nF capacitor:

down up open in a new window 4093 pins 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.

 
navigation DOCTRONICS home

8. AND gate

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

You have assembled most of the subsystems required by the block diagram. Modify your prototype board so that it looks like this:

down up open in a new window 4093 pins 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.

 
navigation DOCTRONICS home

9. Output

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

Complete the circuit on prototype board as follows:

down up open in a new window 4093 pins open PDF Completing the circuit

Click open PDF to open a PDF version of this drawing which you can print to help you with construction.

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.

 
navigation DOCTRONICS home

10. Final circuit

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.

 
navigation DOCTRONICS home

11. Building your Biscuit Tin Alarm

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.

BTA
 

Buy using PayPal
price: £ 4.50 + P&P
DOCTRONICS Biscuit Tin Alarm construction kit

Parts list

qty   component
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   BC547B transistor
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?

Construction

Before you start soldering, study the diagram of the printed circuit board:

up open in a new window 4093 pins open PDF Biscuit Tin Alarm printed circuit board

Click open PDF 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.
  • Start by locating the socket for the integrated circuit. Can you see the small notch which indicates the head end of the socket? Fit the socket so that this notch is at the top and then solder it in place. Take care not to solder any of the legs together. (Pins 8 and 9 are joined by track.)
  • Identify each of the resistors by its colour code and fit them in the board. Bend the legs of the resistor at right angles and pull gently from the underside of the board with pliers until the resistor is close to the board. Solder each leg before cutting off surplus wire with clippers. Resistors are not polarised and can be fitted either way round.
  • Polarised components which must be inserted the right way round include the 10 μF and 100 μF capacitors, the 1N4148 diode, the LED and the BC547B transistor. Long legs indicate positive terminals.
  • Fit and solder the remaining components. The wires for the battery go up through the larger hole and down through the small hole for soldering.
  • Check your circuit carefully for solder bridges and dry joints before connecting the battery.

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!)

 
navigation DOCTRONICS home

12. Links


Excellent
reference book..

12.1 Data sheets

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:

open document 4093B data sheet (NXP, 2008)

open document 4093B data sheet (ST Microelectronics, 2007)

12.2 DOCTRONICS links

Safety Lights Safety Lights Project

 

navigation DOCTRONICS home


navigation DOCTRONICS home