Projects

Kids' Basics - Automated Foghorn

Daniel Koch

Issue 75, October 2023

Using a type of sensor that has wider applications, this foghorn sounds automatically when conditions are right.

Ships take a long time to stop or turn, because of physics. By marine standards, low visibility could still be less than a kilometre or so (but conditions often get much worse than that). Light does not shine well through fog, and white light, in particular, can scatter and reflect back. To make sure ships have time to stop or turn, a sort of sound signal is required in these conditions. Fog signals were once, until not too long ago, an essential part of navigation near coastlines or at sea. Ships had strong horns that could sound in fog when in known busy shipping lanes to help avoid collisions when visibility was low, and lighthouses often had them too because light doesn't shine through fog well. Originally these were manually operated by lighthouse keepers but from the early 1900s or so, automation began in various forms.

This circuit is designed to go with last month's lighthouse project. It is stand-alone, but an automated fog horn doesn't mean much outside of the lighthouse situation. So if you are building it without the lighthouse, you might like to build the sound section without the sensor, and mount it as the sound maker on a toy boat or ship, triggered manually, or something like that. Importantly, you can also build the sensor section and connect it to a different alarm, like your own smoke detector. Like last month, we have split the build into an electronics section and a craft section.

The fog sensor we are building has applications beyond this signal, too. It is similar in principle to how modern smoke detectors work, but it is much simpler. You can probably find other ways to use the sensor, too, so it is work reading even if you have no interest in building a fog horn.

SOME HELPFUL HINTS

We encourage you to read all the way to the end of the article before you build. Not only will you then have a better feel for the overall picture as you build, but we sometimes discuss options or alternatives that you will need to have decided on. You will need some basic hand tools for most builds. Small long-nosed pliers and flush-cut side cutters meant for electronics are the main ones. Materials like tape or glue are mentioned in the steps, too. We always produce a tools materials list if you have to go shopping, but anything that is lying around in most homes is just stated in the steps.

As always with Kids' Basics, we avoid soldering to make the build more accessible to more people, but having an adult around can still be helpful. You won't need any particular skills besides being able to identify components at a basic level, and even then, we help as you go along. If, for example, you don't already know what a resistor is, you'll probably be able to work it out from the photos and description in each step.

We do provide a schematic or circuit diagram but this is just helpful if you already know how to read one. Don’t stress if you have never learned, but take the chance to compare the digital drawing of the breadboard layout (which we call a 'Fritzing' after the company that makes the software) to the schematic and see if you can work some things out. You can make this project from the Fritzing and photos alone. You might also like to check out our Breadboarding Basics from Issue 15.

The Electronics

Parts Required:IDJaycarAltronics
1 x Solderless Breadboard-PB8820P1002
1 x Packet Breadboard Wire Links-PB8850P1014A
2 x Plug-to-plug Jumper Wires*-WC6024P1022
1 x 10Ω Resistor*R6RR0524R7510
1 x 150Ω Resistor*R11RR0552R7538
2 x 1kΩ Resistor*R7, R8RR0572R7558
1 x 10k Resistor*R2RR0596R7582
1 x 27kΩ Resistor*R9RR0606R7592
1 x 82kΩ Resistor*R5RR0618R7604
1 x 270kΩ Resistor*R4RR0630R7616
1 x 10kΩ TrimpotR10RT4360R2480B
1 x 1MΩ 25-turn TrimpotR1RT4658R2394A
1 x Light Dependent ResistorR3RD3485Z1621
2 x 100nF Capacitor*C2, C4RM7125R3025B
1 x 470nF Capacitor*C3RM7165R3033B
1 x 47µF Electrolytic CapacitorC2RE6100R5102
1 x 100µF Electrolytic CapacitorC5RE6130R5123
1 x BC327 PNP TransistorQ1ZT2110Z1030
1 x LM311 Comparator ICIC1ZL3311Z2516
2 x NE555 Timer ICIC2, IC3ZL3555Z2755
1 x High-brightness White LEDLED1ZD0290Z0877B
1 x Small Speaker-AS3000C0610
1 x 4xAA Battery Pack-PH9200S5031 + P0455
4 x AA Batteries-SB2425S4955B

Parts Required:

Step 1:

Take two plug-to-plug jumper wires, cut them in half, and bare the ends. Also, cut two lengths of twin-core hookup wire, and bare both ends of both cores. The wire length will vary depending on your design, but we made ours around 20cm. They are the same length. One is for the LED, while one is for the Light Dependent Resistor (LDR).

Step 2:

Twist the two halves of one plug-to-plug jumper wire onto the two cores of the end of one wire. Tape the joins, but we left them exposed for you to see. On the other end, twist the cores of one length of cable around the LED legs and then bend them with small pliers so the wires do not slip off. Tape these joins too. More twin-core wires have a trace down one core, so use this to remember which is the long (+) leg of the LED and which is the short (-) leg.

Step 3:

Twist the two halves of the other plug-to-plug jumper wire onto the two cores of one end of the other twin-core wire and tape the joins. On the other end, wrap the wires around the legs of the Light Dependent Resistor (LDR) and bend the legs like the LED. Tape these joins too. The LDR is not polarised so you do not have to remember which side is which later.

Step 4:

Place the breadboard in front of you with the outer red (+) rail away from you and the outer blue (-) rail closest to you. Add the two wire links, one to join the two red (+) rails and one joining the two blue (-) rails. These wire links are usually not the right length and may need to be cut down. We coloured ours with paint marker to help.

Step 5:

Insert the LM311 Comparator IC1 into the breadboard toward the left-hand side. Add three wire links: One connects pin 8 to the upper red (+) rail; one connects pin 1 to the lower blue (-) rail; and one connects pin 4 to the lower blue (-) rail.

Step 6:

Install three wire links. One goes from pin 2 of the LM311, toward the left, to the row beside the IC. One goes from pin 3 of IC1 toward the right, to the row beside the IC. The last goes from the row beside that to the lower red (+) rail. Also, install a 10kΩ resistor (BROWN BLACK BLACK RED SPACE BROWN) between the lower red (+) rail and the end of the left-hand wire link.

Step 7:

Place the 1MΩ 25-turn trimmer potentiometer (Trimpot) marked 105 on the case, with one outer leg in the same row as pin 4 of IC1, the middle (wiper) leg to the end of the wire link from pin 3, and the other outer leg to the wire link from the lower red (+) rail. Also plug in the wires from the LDR: One to pin 2 of IC1, and one to the lower blue (-) rail.

Step 8:

Insert an NE555 IC into the board as IC2. Add a wire ink from pin 8 to the upper red (+) rail; one from pin 1 to the lower blue (-) rail, and one from pin 4 to the lower red (+) rail. Also add a long wire link between pin 6 of IC 2, back to pin 7 of IC1, which is the LM311.

Step 9:

Install a 270kΩ resistor (RED VIOLET BLACK ORANGE SPACE BROWN) between the upper red (+) rail and pin 7 of IC2. Add a 82kΩ resistor (GREY RED BLACK RED SPACE BROWN) between pin 7 of IC2 and a row to the right-hand side.

Step 10:

Place three wire links to join pin 6 of IC2 around to pin 2. Notice that they are spaced out from the right-hand side so they meet the other end of the 82kΩ resistor. Add a 100nF capacitor (100n, 0.1, or 104) between pin 5 of IC2 and the upper blue (-) rail, and a 47µF electrolytic capacitor with its negative (striped) lead in the lower blue (-) rail with its positive (unmarked) lead to pin 2 of IC2.

Step 11:

Insert a wire link from pin 3 of IC2 off to the right, and a 1kΩ resistor (BROWN BLACK BLACK BROWN SPACE BROWN) across the gap in the board. Add a BC327 PNP transistor with its middle (base) leg to the 1kΩ resistor and its flat side facing away from you. Be careful that the left-hand (emitter) leg is in its own row and not the row with the pin 6 wire link and 82kΩ resistor. Add a wire link between the left-hand (emitter) leg of the transistor, and the upper red (+) rail.

Step 12:

Install an NE555, IC3, right next to the 1kΩ resistor so that pin 8 ends up in the same row as the right-hand (collector) leg of the BC327 transistor. Add the three wire links that join pin 6 around to pin 2, again spaced out from the right-hand side by a row. Insert the 100nF (100n, 0.1, or 104) capacitor between pin 5 and the upper blue (-) rail.

Step 13:

Place a 1kΩ resistor (BROWN BLACK BLACK BROWN SPACE BROWN) between the upper red (+) rail and pin 7 of IC3. Add a 27kΩ resistor (RED VIOLET BLACK RED SPACE BROWN) between pin 7 and the other end of the wire link from pin 6.

Step 14:

Insert a wire link from pin 1 of IC3 to the lower blue (-) rail and another from pin 4 to the lower red (+) rail. Also add a 470nF capacitor (470n, 0.47, or 474) between pin 2 of IC3 and the lower blue (-) rail. This will probably require careful bending of the legs because these capacitors are often supplied with short leads.

Step 15:

Install a 10Ω resistor (BROWN BLACK BLACK GOLD SPACE BROWN) between pin 3 of IC3 and a row to the right. Add a 100µF electrolytic capacitor with its positive (unmarked) lead to the end of the 10Ω resistor, and its negative (striped) lead in the next row along.

Step 16:

Cut a plug-to-plug jumper wire in half (or use two and cut the plugs off the one end of each for more length) and bare the wire ends. Twist them through the terminals of a small speaker, and tape the joins securely. We left one join untaped so you can see it. Plug one speaker wire into the negative (striped) lead of the 100µF capacitor. Plug the other wire into the lower blue (-) rail.

Step 17:

Insert a 10kΩ (10k or 103) trimpot into the breadboard in the remaining space. Add a small wire link to join the wiper (middle leg) to the left-hand outer leg. Add a longer wire link to join the left-hand leg to the upper red (+) rail. Also, add a 150Ω (BROWN GREEN BLACK BLACK SPACE BROWN) resistor in between the lower blue (-) rail and a spot on the board.

Step 18:

Take the LED on its extension wire and double-check which one is the wire on the long anode (positive, +) leg. Plug this wire into the right-hand leg of the 10kΩ trimpot. Check again that the remaining wire is wrapped around the short leg of the LED, and plug it into the end of the 150Ω resistor.

SETTING IT UP

Set up has to happen after the craft build, but in terms of electronics, it helps to put it here so the important bits are fresh in your mind. The first task is setting up the LED. Plug the red wire of a 4xAA battery pack into the upper red (+) rail of the breadboard, and the black wire into the lower blue (-) rail. Turn the 10kΩ trimmer potentiometer (trimpot) at the right-hand end of the board fully anticlockwise (that's from the right, over the top to the left, if you have set it up like we did in the photos). Apply 6V by adding four AA batteries to the battery pack, and the LED should be very dimly lit. If it is not, rotate the trimpot all the way clockwise, to see if the LED lights, then turn it back again. If the LED did not light, check the connections including the long and short legs of the LED, before trying again.

Turn the trimpot again until the LED just lights if it did not already. Some LEDs are more sensitive than others, so some will light even with the full 10kΩ of potentiometer and 150Ω of safety resistor. When you have a very soft light, move on to the trimpot near the LM311. Temporarily remove the wire link between pin 7 of the LM311 and pin 6 of the left-hand NE555, which is the grey link in the steps above. Temporarily set up a 150Ω resistor between the upper red (+) rail and the row next to the LM311, and an LED with its long (anode, +) leg in the same row as the resistor, with its short (cathode, -) leg to pin 7 of the LM311.

With the test LED in place, turn the 25-turn 1MΩ trimpot all the way until you hear a very soft clicking sound. These do not stop rotating at the end of their travel. When it clicks, if the LED is on, it is ready. If the LED is off, rotate it all the way to the other end. Again, listen for the clicking. If the LED still is not on, check connections around the LED and LM311. Now, adjust the trimpot slowly until the LED just turns off. This is set so that any interruption of the LED and light-dependent resistor (LDR) in the sensor we made earlier, results in triggering of the LM311. At this setting, it should be sensitive enough that mist or water vapour, or at least a reasonable amount of it, will trigger the LM311.

To find out if this is true is not always easy. That is because water vapour does not form all the time, but only under some conditions. However, the idea with this project is that 'steam' from a really hot shower filling the room should trigger this sensor. DO NOT use a kettle, as the steam from this is hot enough to burn you, and badly, too. Other sources of fog are the smoke machines made for party use. These are getting cheaper and cheaper, and many people have a small one now if they have kids around. Failing that, smouldering leaves or paper, or enough incense, would also work, but both must be used with the help of an adult.

Adjusting the LED to be brighter by turning the 10kΩ trimpot determines how much smoke or fog that is needed to block light between the LED and the LDR. Turning the 1MΩ 25-turn trimpot sets the sensitivity of the sensor overall. Often, you will need to adjust both to get the behaviour you want. After it does behave the way you want, replace the wire link between pin 7 of the LM311 and pin 6 of the first (left-hand) NE555 (middle IC) and take away the resistor and LED so it does not consume current that will drain the batteries sooner.

HOW IT WORKS

This section is very long but if you're new, it's not as scary as it looks. It is deliberately over-explained so that people with very limited knowledge should be able to follow along.

The circuit has three sections. The first section is the fog sensor, based on a Light Dependent Resistor (LDR) and an LM311 comparator. The light dependent resistor is a form of variable resistor, as its resistance changes depending on the amount of light falling on it. They differ in how much resistance they have in the dark, and how much in good light. This is really important later on. Of the two we had on hand, one had a dark resistance of over 10MΩ and a light resistance of between 50kΩ to 150kΩ (depending on light strength and component tolerance). The other type we had, however, has a dark resistance of around 500kΩ and a light resistance between 2.5kΩ and 10kΩ depending on light and component tolerance. This is the one we went with.

The LDR R3 and 10kΩ resistor R2 form a voltage divider. For an in-depth look at voltage dividers, including maths with M&Ms, check out Classroom Issue 51. In simple terms, the 6V supply voltage is split across R2 and R3, according to the amount of the total resistance that each makes up. Let's say that the LDR is at 10kΩ right now. R2 and R3 add to 20kΩ, and each makes up half of that. So, half the supply voltage drops across R2 and half across R3, meaning the voltage at the junction is half the supply, or 3V.

Now, imagine that R3 was 90kΩ, and R2 is still fixed at 10kΩ. Now, the total is 100kΩ, and R2 is one tenth of that, while R3 is nine tenths of that. Therefore, one tenth of the voltage drops across R2 and nine tenths across R3. That's less than 1V on R2 and the rest on R3, so the junction of R2 and R3 sits at over 5V. That becomes really important shortly.

IC1 is an LM311 comparator. A comparator is a device with two inputs, an inverting (-) and a non-inverting (+). The comparator compares the voltages at its two inputs. If the voltage at the non-inverting input (In+) is greater than the voltage at the inverting input (In-), the output is high. If

the voltage at the non-inverting input (In+) is less than the voltage at the inverting input (In-), the output is low. We use a separate voltage divider, a variable one this time made by connecting the two ends of a 1MΩ trimpot R1 to the supply rail and the wiper to the inverting input. The wiper of a potentiometer moves across the length of the resistor inside it, changing the amount that is before and after the wiper. So, it also changes how much of the supply voltage is dropped across each section.

So, we have two variable voltage dividers connected to the comparator. In strong light, the resistance of the LDR is low, as low as 2.5kΩ depending on component tolerance. Therefore, around 4V drops across the 10kΩ resistor and the rest over the LDR, giving around 1V at the junction connected to the non-inverting input of the comparator. However, we rarely have strong light and, in fact, have adjusted the light to be as dim as practical. Therefore, the voltage at the non-inverting input is quite high, because the resistance of LDR R3 is high and therefore the percentage of the total R2/R3 resistance it makes up is higher.

The voltage at the inverting input is adjusted with the trimpot R1. It is set to be slightly higher than the voltage from the R2/R3 junction with the dim LED light. At this point, the output if the comparator is low. When anything obstructs the light between the LED and the LDR, the resistance increases further still, and pushes the voltage up above the reference set by the trimpot R1. That switches the output high. The exact point at which this happens can be adjusted by turning R1 one way or the other.

The output of the LM311 is not directly connected to the pins of the IC. Instead, it is connected to the base of an internal NPN transistor. When current is provided to the base of an NPN transistor, it flows out the emitter to ground and allows a much larger current to flow from the collector to the emitter. In the case of the LM311, both collector and emitter are broken out to pins, so you can control how the transistor is connected. In this case, we use it to ground the connection between pins 6 and 2 of IC2. However, to understand what that does, it helps to first explain what is going on with IC2.

IC2 is an NE555 timer IC. It is set up in the 'astable' configuration, which means it has two states that it alternates between on its own. Inside the NE555 is a voltage divider made from three identical resistors, so that there are two voltages, one at one third of the supply voltage (V+) and one at two thirds of V+. The voltage divider is connected to the inputs of two comparators, much like the LM311 we use in the first section of our circuit. The comparator with the one third V+ connection has its other input connected to the trigger pin, pin 2. The comparator with the two thirds V+ connection has its other input connected to the threshold pin, pin 6.

The outputs of the comparators are connected internally to another component, a flip flop. This changes its output state based on the inputs. The output of the flip flop is connected to pin 3, but also to an inverter, which is connected to a transistor between pin 7 and ground. The inverter means that when the flip flop output is high, the discharge transistor is off. The NE555 starts this way when power is applied. Because of that, current flows through the 270kΩ resistor R4, and the 82kΩ resistor R5. R5 is connected to pin 6 and pin 2, which are also connected to a 47µF capacitor, C1. The other side of this capacitor is connected to ground, so it charges with the current through R4 and R5.

When the voltage across C1 has reached two thirds V+, the comparator attached to pin 6 is triggered, which changes the flip flop inside to 'off'. The output at pin 3 goes low, but the inverter makes sure the discharge transistor between pin 7 and ground is now on. So, the current through R4 goes straight to ground, and the charge in C1 discharges through R5 and pin 7 to ground. When the capacitor voltage has fallen to one third V+, pin 2's comparator trips the flip flop back, so that the output goes high again and the discharge transistor turns off, allowing the capacitor to charge again.

The 'on' time for an NE555 cannot be shorter than the 'off' time. The 'on' time, which is also the charging time of C1, is controlled by the current through R4 and R5. However, the 'off' time, when the output is low, is controlled by R4 only. So, we can set the total time as well as the individual on and off times. If R5 is much, much larger than R4, we get a nearly equal on/off time, because R4 adds little to the total during charging. However, R5 is much smaller than R4 in this case. Therefore, we have an on time of around 11.5 seconds and an off time of around 2.7 seconds.

The output of IC2, pin 3, is connected by a 1kΩ resistor R7 to PNP transistor Q1. By the way, the components are named by their position in the circuit diagram from left to right, top to bottom, not their electrical position in the circuit. Sometimes the circuit is rearranged a bit to fit on the page after this text gets written based on the original paper diagram. So, sometimes the component names may not seem logical. That aside, R7 just limits the current to a safe level for the base of Q1.

PNP transistors work when current can pass from the emitter, out the base and to ground. During the high time of IC, pin 3 is high and therefore, there is no voltage difference between pin 3 and the base of Q1. No current can flow without a voltage difference. So, during the 'on' time of IC2, Q1 is off. The NE555 has a 'source/sink' output, which means when it is high, it sources current but when it is low, it can sink it, or carry current to ground. Not all IC outputs are like this, as some just 'float' or are open circuit in the low state. When IC2's output goes low, there is a current path from Q1's emitter, through its base and R7, to ground via the low pin 3 of IC2. Therefore, during IC2's low periods, Q1 is conducting and 'on'.

We use Q1 to control power to IC3, another NE555. When Q1 is conducting, IC3 is powered. It functions the same way as IC2, with capacitor C3 charging through R8 and R9, and discharging through R9 only. The differences are the values. C1 is only 470nF, R8 is 1kΩ and R9 is 27kΩ. As noted before, because R9 is a lot larger than R8, the timing is nearly equal, and the smaller capacitor and resistors give a nearly square wave with a frequency (number of on/off cycles per second) of 56Hz, calculated. Actual values will vary with component tolerance. That's a very low sound! The output pin 3 feeds to a speaker through R6 at 10Ω for a little bit of current limiting, into C6 which helps block DC current and ensures a rise/fall wave to the speaker as it charges and discharges from and into pin 3's on/off cycle.

Finally at the far right is the LED and its dimmer. The dimmer is made from R10, a 10kΩ trimpot with its wiper connected to one of its outer terminals to make a variable resistor. This limits the current through the LED, with R11 providing a safety buffer if the trimpot is turned to zero.

The effect of all this is that LEd provides faint light to the LDR, holding the output of IC1, the LM311 comparator, low. This provides a ground path for the current through R4, which does not charge the capacitor because the path to ground through the transistor inside IC1 is easier. When the light falling on the LDR decreases, the resistance increases above the voltage set by R1, and the output goes low, turning the transistor off. Now, C2 can charge by R4 and function as described above, with the output high for 11.5 seconds and low for 2.7 seconds. In the low periods, Q1 conducts and provides power to IC3, which is a noise maker circuit at 55Hz.

Therefore, under foggy (or smokey) conditions, the comparator starts a timer which allows 2.7 second bursts of sound with 11.5 second gaps of silence in between. This is how our fog signal has its 'signature'.

Building the housing:

Some steps may not make sense when you read them on their own. Read them all and look at the finished product before you build, so that you have an idea of what it all means when you read each step again.

NOTE: The building steps involve a craft knife and hot melt glue gun, so please do this with the help of an adult or at least a responsible teenager.

Craft Materials:

  • Foam-Core or Cardboard sheets
  • Craft Knife
  • Hot Melt Glue and Glue Gun
  • Ruler
  • Pencil
  • Scissors
  • Additional craft materials of choice for decoration, see text.

Step 1:

On a sheet of cardboard or foam core board, mark out a piece big enough to take your circuit board, and battery pack. Don't worry about the speaker. Mark two more pieces the same size. Cut them out with a craft knife and ruler. We'll call these floor panels on the next few steps.

Step 2:

In one of the floor panels, trace around the speaker and cut out the hole slightly smaller, so the speaker sits just on top. Here, we put the speaker to the side so you can see the cut, and line. You will need a craft knife for this and an adult for help, because cutting out the inside of the circle is hard and can be dangerous. Also, cut a notch 10mm side and 5mm deep at one end.

Step 3:

Mark out two end walls, for the short sides of the housing. They need to be the width of the short side, and high enough for the speaker, circuit board and batteries, and three floor panels to fit. Cut them out. You can do the same for the side walls, which are the same height as the end walls but the length of the longer sides of the floors, plus the thickness of both ends.

Step 4:

Glue one side wall to one end wall, then glue on the floor piece with the speaker hole in it. Notice that the end wall sits on the side wall, and that the speaker floor is flush with the bottom edge of both.

Step 5:

Glue on the speaker, making sure that the rim is completely sealed with glue. Also make sure the join between the floor and walls is sealed, too. Also add four scraps of foam-core or cardboard to lift the base of the housing off the table. This lets out sound from the speaker.

Step 6:

Fit the upper floor, but do not glue it. Cut six scraps of card, and glue one in each corner and one in the middle of each long side. They are glued the thickness of the card below the top edge, for the flat piece to sit on. This allows the circuit and batteries to be accessed. Cut a notch at each end of the top panel.

Step 7:

Glue the middle panel into the housing so that the batteries, circuit, and top floor panel will fit on top. Make sure it is glued thoroughly so that the joins are air-sealed. It needs to leave room for the batteries and circuit but also not sit directly on the speaker.

Step 8:

Place the circuit on the middle floor, and cut a small notch just big enough for the speaker wires. Stick the circuit board and batteries in place with Blu Tack or similar, then glue on the end wall. Be careful to add enough glue to the middle and lower floor edges so that these are air-tight. Also glue around the speaker wires.

Step 9:

Glue on the side wall, again ensuring that there is plenty of glue around the speaker enclosure joins.

Step 10:

Now set the enclosure upright and drape the LDR and LED wires over each end wall. Take the remaining floor piece and cat a finger-sized notch in one side. Place it into the cardboard scraps glued in earlier, so that it sits inside the top edge of the enclosure, with the LED and LDR wires in their notches.

Step 11:

Roll two tubes from thick paper or thin cardboard. Black works best but if you do not have any, you can either colour it black or just use many layers of white paper. One tube should be 5mm in diameter to fix the LED, and the other tube needs to be the size of your LDR. The tubes should be around 3 to 5 cm long.

Step 12:

Fit the LED into its tube and glue it at the back. Also, fit the LDR to its tube and glue it. Make sure that each is facing down its tube, and not a little to the side. Also, you can cover the back with glue or Blu Tack to help keep unwanted light out of the LDR and in for the LED. The LDR is not sensitive on the rear face but the clear coating sometimes allows light to travel enough to make a difference.

Step 13:

Glue the LDR tube onto one side of the top floor panel, just near its notch. Make sure it is pointed up the middle line of the floor panel. On the other side, do the same with the LED. However, you may need to lift the LED up with scraps of thin card, match sticks or anything else, so that it points to the middle of the LDR. The LDR will often be a larger diameter than the LED, so the LED needs to be lifted to point at the middle of the LDR.

Step 14:

Measure the length of the widest side of the enclosure, add 4 cm to it, and mark the line on a sheet of thick paper. Measure the width of the enclosure, halve it, and add 4cm to that, too. Then, mark this line at right angles to the first, in the middle.

Step 15:

Mark a line parallel to the first, on top of the second, that is 4cm less than the length of the enclosure. Join the ends of this line with the ends of the lower line to make a trapezium. Cut two of these out of the thick paper. Tape the two shorter sides together.

Step 16:

Hold the cut pieces over the enclosure so the taped sides are centred. Look to see if you like the shape of the roof, and note any adjustments that you want. Repeat this process until you are happy with the look.

Step 17:

Use the paper shapes as templates to cut the same ones out of card or foam board. Use hot melt glue to join the two smaller edges in the same place you put tape on the paper ones. Don't glue anything else yet, just hold the pieces until the glue sets.

Step 18:

Fill the roof ends by using the roof as it is now to mark pieces onto more card or foam board, and cut them out. You may need to shape the sides with a craft knife to make the lines fit. Gue the ends of the roof onto the sides.

Step 19:

Cut four pieces of foam core or cardboard, 2cm by 1.5cm. Glue them in each corner of the top floor piece, not to the side walls. The 2cm side gets glued down, the 1.5cm side is the height.

Step 20:

Glue the roof over the small pieces from step 19, so the roof and top floor piece come off together. Add paper strip as a ridge cap to hide the joins in the roof pieces. That's it, you can now lift off the roof, fit batteries, and set up your circuit as described at the end of the electronics build.

OTHER USES FOR THE SENSOR

The main use of this type of sensor would be in DIY smoke detector projects. Please know that you should NEVER trust your life to a DIY project like this, and smoke detectors in buildings should always be commercial ones that comply with Australian standards. That does not mean you cannot explore, however. You could make your own like this and see if you can make it as sensitive as the real ones. It would make an interesting bushfire detector, too, or an air quality alert.

BETTER OPTIONS

For the sensor, real ones often feature two identical light sources and two light sensors. The light sensors may be LDRs but are often more precise phototransistors, where light activates the base of the transistor rather than a current. These twin sensors feature a clear tube over one sensor so that fog cannot get into it.

The circuitry connected to this is set up so as to measure the changes in light, but also compare both sensors. Think of the situation on a cloudy day: it is very hard to shield the light sensor from all ambient (surrounding) light, so the sensor will be affected by the difference between a sunny day and a cloudy day if it is sensitive enough.

Having the comparison to the sealed unit means that both sensors will experience a change due to ambient light, but the one in the tube will not be affected by fog or smoke, so only when there is a difference between the two would the circuit determine that conditions are foggy (or smokey). We did not go down this road because the circuit would have been twice the size and complexity of the current circuit, which is already pushing it as far as Kids' Basics criteria are concerned.

For sound, the square wave is a harsh sound and it is a monotone, too. That means there is only one frequency involved, though there are harmonics in square waves. Real air horns have several dominant frequencies in them. A better circuit can be made from a quad op amp, with each set up as an oscillator with a different frequency and a sine wave output. They are mixed together to form a much more realistic sound. However, that would fill a breadboard and then some, and the circuit would still need room for the comparator and timer. We might cover that in a future Kids' Basics, perhaps as a truck or train horn.

WAVELENGTH AND LIGHT SCATTERING

Air contaminants like water vapour, smoke, or synthetics like smoke machine fog, all scatter different colours of light in different ways. This may influence your LED colour choice and help make a sensor selective. Blue light, for example, penetrates smoke far better than white light, which is why firefighters and rescue workers, as well as tactical police, are sometimes seen with blue lights or filters.

Fog lights on cars are often yellow but this is not to help them penetrate fog, as is commonly believed. It is because of how our eyes process blue light, and fog reflects a lot of any light. Blue light scatters the most off fog, which is related to why the sky, via our atmosphere full of water vapour, appears blue in the day.

Conversely, red light is absorbed the most by smoke so a red LED would be a better choice for a smoke detector, and blue for a fog detector. This topic is worth some further reading if you really want to optimise your sensor.

A VERY BASIC HISTORY AND PRINCIPLES OF FOG SIGNALS

Fog signals have been around almost as long as lighthouses have.

The earliest were bells, manually struck with a hammer by the lighthouse keepers in foggy conditions. In fact, bells continued in some cases until the 1970s! However, bells had been automated by this time with solenoid-based hammers so the keeper did not have to ring them manually. In many cases, the bell was to be rung with a certain pattern:
A given number of rings, a given time apart, with a given pause between the groups. This let mariners know which lighthouse they were near, to help navigation.

Bells are only so loud and the sound only carries so far. You can make a bigger bell, but these are expensive, heavy, hard to transport and install on remote lighthouses, and take even more effort to ring. Other signals were needed. Some lighthouses or marine authorities installed cannons at some lighthouses, which the keeper would load and fire at given intervals. The problem with this was that it involved the supply and storage of gunpowder. In remote lighthouses, that meant a lot of gunpowder at first, because resupply times could be far apart. It was also dangerous, and lighthouse keepers were not trained artillerymen.

A better solution came in the form of the fog horn. Fog horns can be powered by steam, or compressed air. There are several systems, with some powered by air moving through reeds like a woodwind instrument; others air moving over a tuned cavity, like a wind instrument (think how deep-sounding a trombone can be), or by moving a diaphragm like many modern air horns still used today in the transport industry. All of these found favour in the lighthouse scene. They could be manually activated, and at first, they were. However, they lend themselves to automation, too. Electrically-operated air or steam valves were already invented, and there were even non-electric options too. This was very useful in some of the early automation attempts from the 1920s onward for the most dangerous and remote lighthouses.

There is one interesting side-development of air horns, and that is the diaphone. In it, a piston moves up and down in a vented cylinder, and 'shops' the air flow to make the sound. These have one note when powered, and another, deeper note when the air is cut off but pressure is still in the system. They could also be steam powered but the principle remains the same. These are responsible for the distinctive two-tone, low-the-even-lower fog horn sound many people know.

Powering these fog horns was an issue on some really remote or hard-to-reach lighthouses. Compressors and steam engines both took a fair amount of fuel to fun, and this was not always available or practical. It was much easier for onshore lighthouses or those that could be resupplied regularly. So, although the sound of a fog horn carried further than a bell because of both its volume and pitch, bells were retained on some lighthouses just because of supply issues.

WHERE TO NEXT

You could fiddle with the sound of your fog horn by changing the values of R8 and R9, the 1kΩ and 27kΩ resistors respectively, and the 470nF C3, which are the timing components for the right-hand NE555 IC3. These will change the frequency of the sound. You can also change the 270kΩ R4, 82kΩ R5, and 47µF C1 around the NE555 in the middle, IC2, to change the timing. You can change the time in between pulses of sound, the length of pulse, or both.

You could also add an amplifier to make the sound louder. We have used the LM386 in several Kids' Basics previous projects and you can scroll through these on our website. This would make the sound much louder. In addition, there are circuits around that will add white noise into the sound, as is often heard in air- and steam-powered horns. There are ways to soften the start and stop of the sound, too, like a horn where airflow builds up and then fades away as the valve is opened and closed. However, these will be the subject of a future circuit.

The idea of the roof structure is to allow fog to drift under the roof, hence the standoffs, but not allow too much ambient light in. You might need to cut the 1.5cm high standoffs we fitted in steps 19 and 20, and make them higher if you are having trouble getting the sensor to trigger. Air may not be moving well enough under the roof.

The main thing you have to do from here is decorate your fog signal enclosure! Many lighthouses were white, and their external buildings were too. This was both for visibility, and cost because lime whitewash was a common and cheap paint of the times. However, look around at lighthouse images online, including the support buildings, and you will find some had much more homely colour schemes and even sometimes fake windows! It's up to your imagination.