Electronics by James S

Introduction

WARNING: While I've made every effort to ensure that the information presented on this and related pages are error-free, I will NOT be held responsible for any damage caused by use of this information. Electronics should be fun but there is also a very serious side to it, so please take care when using tools and when dealing with high voltage and current circuits.

I have one of my older brothers, Matthew, to thank for helping me and inspiring me to pursue electronics as a hobby, which includes both hardware and software. Over ten years later, electronic technology has changed dramatically, it has improved to save people's lives when used as equipment in hospitals, or to entertain us wherever we are and to provide a wealth of information at our fingertips.

I would like to use this moment to mention a few significant electronics products and related services that were first released within the past ten years or became very popular during that time; yet, today they're so common that we probably couldn't imagine a life without them.

CD Player: They are old news thanks to MP3 players and the like but I remember being at school one day and my friend having a portable CD player, which was probably the first time I had seen one up close at the time. I don't know how much he payed then, or who bought it for him, but they are dirt cheap today yet provide clear, digital sound that was like a revelation for users of the cassette and record player once upon a time.

Multimedia Computers: At school I was introduced to a new way of using a computer that was made possible because of CD-ROM's. They did turn out to be a bit of a novelty these point and click programs where little animations would be played as demonstration of the interactivity, but at the time it was more advanced than the BBC computers they had in addition to the PC's at my school.

DVD: Digital Versatile Disk or Digital Video Disk, compared to videotapes DVD's were amazing but expensive, especially the players, when they first came out. But as with all types of electronics which become popular, DVD players and the actual disks dropped in price and today DVD-ROM drives are a standard that are included with computers, but even without a computer DVD players and recorders are nothing new in the home.

DVD's have evolved, the next generation is all about High Definition (HD), providing even clearer audio and video thanks to the increased storage capacity compared to non-HD DVD's. And thankfully Blu-ray DVD's defeated the other form of HD DVD, meaning that we will get the very best in quality in our games and movies.

Internet: Some people seriously believed that the internet wouldn't last long but it is more popular than ever before and is used by millions of people around the world every day, whether for sending emails, researching, or playing games with someone far away. As the price of PC's and laptops dropped along with the cost of ISP's, more people went online and with broadband so cheap nowadays we can enjoy the networking of computers at speeds that grant a very enjoyable experience.

Of course it's not only consumers who use the internet daily, for many businesses they have managed to sell and advertise their services to a greater range of people; speaking of which, I remember some while a go when businesses first started to have their own website and email but now it's something we expect.

MP3 Palyer: One of the greatest examples of how electronic components have reduced in size over the years and how new technology has made possible portable devices that were unheard of some time in the past. At the time, when me and my family went on holiday, my oldest brother Daniel would take with him his faviourte music to listen to, on cassettes. In later years however, instead of what was now old news, Daniel took with him his CD's but there was still a lot to take. And recently, when Daniel goes on holiday with us he only needs to take with him just one music item: his ipod. All those songs stored inside a device smaller than one of his CD's; it's just another example of the wonders of modern electronics.

New: Model Traffic Lights (24/5/22)

Variable Speed Fan Controller (23/9/19)

StarPlay (23/5/18)

LED torch projects (7/5/18)

Create your own game console (16/2/17)

Christmas Lights (6/12/16)

Power Supply Circuits (15/5/16)

Valve Projects (17/4/2016)

Electronic Repairs (1/4/2015)

LED flower (1/3/2015)

It's your turn! player indicator (31/10/2014)

Electric charge game (24/10/2014)

Electronic Component Database(10/10/2014)

Inside Manufactured Products (05/10/2014)

Update: LED torch reviews (25/03/2014)

You can email me at james.boshikoopa@gmail.com

Audio Electronics

Please go to Audio Electronics.

Motors

Please go to Motors

Op-amps and comparators

Please go to Op-amps and comparators

Interfacing

Please go to Interfacing

Christmas Lights

While LED Christmas lights are readily available it's a lot more fun and a better learning experience to make some lights yourself, which can be done with a few components. The circuit, which can be seen below, flashes four groups of LED's, two groups at one frequency and the other two groups at a different frequency. It is based around two transistor astable multivibrators, each multivibrator consisting of a pair of 2N2222 transistors (other general purpose NPN transistors will also work).

An astable multivibrator will continually change state at a rate determined by timing components R5, R6, C1, C2 for the left multivibrator and R15, R16, C3 and C4 for the right multivibrator. Because we have 4 LED's in each group they cause the multivibrator to switch quicker than if just one LED had been used for each output. For the LED's, use a mixture of red, green and yellow but note that the limiting resistors R1-R4, R7-R10, R11-R14 and R17-R20 have been chosen to limit the LED current to about 20mA. I measured the overall current draw for the circuit to be around 60mA.

For more information about the transistor astable multivibrator please have a look at:

http://www.buildcircuit.com/multivibrator/

You can view a video I did about the circuit at:

https://youtu.be/xUiUfQxAtpA

LED Faces Project

Please go to LED Faces Project.

Designing and Building Circuits

Please go to the Designing and Building Circuits page.

Digital Electronics

Please go to the Digital Electronics page.

Electronic Components Explained

Please go to Electronic Components Explained page.

Basic Tools

Please go to Tools for working with electronics page.

Active and Passive Components

Passive: A component which is able to operate on a signal without any additional power and cannot amplify. This includes resistors and capacitors.

Active: As an opposite to passive, active components require power other than that provided by the input or control signal and produces power gain of some sort. A good example is the transistor.

Power

When we are dealing with high voltage or high current circuits the components we use must be able to handle a high amount of power. Generally, high power components are much bigger than their low power counterparts. Take a look at the resistors in the following photo:

In the top-left hand corner is a common 1/4W resistor and to the right of it and below are increasingly higher power resistors; 1W, 3W, 5W and 10W. With the 1W and higher resistors shown they are a different shape to the 1/4W as well as being bigger. Rather than use colour bands on the high power resistors the resistance and wattage are written on the resistor's body. It is vital that a resistor's power rating isn't exceeded otherwise it may be harmed and could possibly cause a fire.

Components that get too hot will stop working or not perform as well as they should or will suffer damage; even components designed to handle a lot of power. To safely get rid of this heat from certain types of components, heat sinks are used, large pieces of metal attached to the surface of a component usually by a bolt and nut, and often with heat transfer paste or pad. A number of different heat sinks can be seen in the photo below, some of which have components attached to them:

Some heat sinks that are on the big side are shared by more than one component, an example of which can be seen in the picture above. Small and large heat sinks are also shown in the photo, with holes to screw power components on to.

Since heat sinks are made from metal they will conduct electricity as well as heat and this can be used as an advantage. Components such as transistors and some IC's have an area of metal exposed as part of their body which is internally connected to one of its leads. If this makes contact with the heat sink, the metal of the heat sink can be used to make an electrical connection with other components mounted to the heat sink. But, if this should not happen in the case of what would be a short, an insulator such as plastic must be placed between the component and the heat sink, using a plastic screw as well. Some heat sinks are painted black (as to help dissipate the heat) so those types should not conduct electricity. Some heat sinks which are used as a conductor of electricity as well as heat have 'feet' which are soldered onto the circuit board as you would do with a component like a resistor, for example.

You may be surprised at how big some of the heat sinks are compared to the actual component but even small devices can get very hot as current passes through them so they must be kept cool. With some components using a heat sink isn't enough so a fan is also used to help pull the heat away. This technique is commonly seen in computers where the main processor has a heatsink attached to it which itself has a fan directly mounted on it.

4011 Astable Oscillator Light Flasher

One way to build an astable oscillator, which can be used as a light flasher, is by using two of the four NAND gates of a 4011 IC, but wired as inverters (NOT) gates. Have a look at the circuit diagram below:

This is a simple enough circuit but be sure to connect the LED right way round, as well as the capacitor which must be rated for at least the power supply (in this case 9V) but an even higher maximum voltage rating for the capacitor would be even better. Also check that you have connected the 4011 IC correctly, which has the four unused inputs of the other two NAND gates (connections 8,9,12 and 13) wired to ground to make sure the 4011 behaves as intended.

When you are sure you have connected the circuit right you can apply power which should cause the LED to flash, if not, remove the power and double-check your wiring before trying again. As soon as you have got the circuit working, you can adjust the flash rate of the LED by varying one half of the timing, that is, the variable resistor (working together with the fixed resistor). The other half of the timing is the capacitor which remains constant, but of course you can try a different value capacitor to change the timing.

You may be wondering what the benefit is of using NAND gates as opposed to a 555 timer IC or even discrete transistors. Well, imagine that you are building a logic circuit using lots of gates and you need an astable oscillator and you so happened to have a couple of NAND gates spare, then this circuit would save you having to add more components (the timing resistor and capacitor would be needed anyway).

LED Display Modules

Please go to LED Display Modules.

LCD Display Modules

Please go to LCD Display Modules.

The PC Parallel Port

The Universal Serial Bus (USB) has become the standard form of interfacing devices to a computer but once upon a time the parallel port had anything from printers to external harddrives connected to it. Parallel ports are great for people into electronics as they are fairly simple to use and have a good number of inputs and outputs to use. However, most computers nowadays are made without a parallel port thanks to USB's popularity but you can buy a USB to parallel port adapter, but they aren't that cheap and because they are designed with printers in mind they lack the bidirectional capability of the original parallel port. So an old computer will be sure to have a parallel port, and if you have a printer cable for it you can use that for your parallel port projects.

The PC parallel port was originally designed for printers exclusively and despite some changes over the years, there remain a number of inconveniences to make note of. One of which is that the parallel port provides no power other than that which can be obtained from the outputs, only enough to light an LED. This means for some projects you'll need to use a battery or wall adapter to provide the extra power; only the power supply's ground (OV) is connected to the parallel port's ground connection as to act as a common.

The parallel port is controlled on the software side by use of three I/O ports at the CPU's command. The port address is different depending on the hardware configuration, but it is assumed here that the base address for the first (and possibly only) parallel port you're using is at port address 0x378. This is where you'll find the parallel port's data port, which has 8 bits that can be programmed to act as either all inputs or all outputs.

0x378 (Base address) Data Port

Bit # Use

7 D7

6 D6

5 D5

4 D4

3 D3

2 D2

1 D1

0 D0

Whether the data port's bits act as inputs or outputs depends on the state of bit 5 of the control port (see below).

The status port is read to learn the state of the six inputs to the PC provided by the parallel port, the status port also contains two reserved (unused) bits that can be ignored.

0x379 (Base address+1) Status Port

Bit # Use

7 Busy

6 /ACK

5 PE

4 Select

3 /Error

2 /IRQ

1 (Reserved)

0 (Reserved)

In case you're wondering, the names assigned to the bits are those used for printers such that PE stands for Paper Error but you can use them how you like with the one exception of /IRQ which does trigger an IRQ, if enabled. The '/' before a bit name means that that bit is active low, it is inverted by hardware but you can easily remedy that in your program, or it may actually help. The reason for the active low signals is so that when a printer wasn't connected to the PC's parallel port or was turned off, the inputs would default to safe conditions (i.e. no errors since the printer isn't on).

Last we have the control port that has two reserved (unused) bits, 2 control bits and 4 outputs from the PC via the parallel port.

0x37A (Base address+2) Control Port

Bit # Use

7 (Reserved)

6 (Reserved)

5 Direction

4 IRQ enable

3 /Select In

2 INIT

1 /Auto Feed

0 /Strobe

The direction bit (5) when set forces all the bits of the data port to function as inputs. When the direction bit equals zero, the data port goes into output mode. As for the IRQ enable (4), IRQ for the parallel port is enabled when the bit equals one, but IRQ is disaled if this bit is zero.

Build Your Own Arcade Machine

This may seem a difficult and expensive task yet it's not too hard provided that you have a spare computer and the skill to work with both software and hardware. Video game consoles today are very much computers, the X-Box was just a modified PC in a different case and that's the general idea here (those booths that take your photo are just a PC and not much more).

To those who play your arcade machine it will appear just that, but open it up and you'll be exposed to the computer that you use to program the games machine. It will require you to be able to put a computer together which can be placed inside a custom case, one made out of wood shouldn't be too difficult to put together or you could get someone else to make it for you (as was the case with me).

I advise that you use a wireless keyboard and mouse, that way you can keep the arcade machine as just that but still be able to program it, remotely. That way the receiver can be hidden inside the arcade machine's cabinet and the people who play it will be none the wiser.

You'd think that using a PC would mean that all the hardware is done and that you only have the software to write, well you're wrong! To give as real feel to the arcade machine as possible you'll need to connect the joysticks, coin detector, credits display and so on to the computer and that will be challenging. You'll have to look at the ports available to you on the computer and determine the best ways to interface them, that's when you will have to design and build a fair amount of circuitry.

For my arcade machine it contains the motherboard, PSU, floppy, and CD-ROM (all within the tower) and monitor that make up the actual computer. All but the monitor are hidden but are accessible when programming the machine, you can cut out a hole in the front to expose the monitor's screen. Remember to use fans to cool the motherboard (if there aren't any in the case) and at least cut holes to allow the heat from the monitor (especially if CRT) to escape from the case. If you want your arcade machine to have sound then you'll need some computer speakers (i.e. amplifiers), mine are actually built into the monitor which saves space and a power cable.

You don't want several mains power cables trailing from your machine so you'll need an adapter of some sort to have just the one powere lead. Some computers allow you to connect the monitor to the PSU but even so unless the speakers are part of the monitor or have a special connector to be used at the PSU, another cable will be needed.

It would be ideal if you use a motherboard that has the graphics and sound adapter built in otherwise you'll have to connect them as card adapters, although that generally gives better performance. But, the disadvantage of the all-in-one type of motherboards is that they can be a pain to get drivers working for them and older versions of Windows don't help with this (assuming you're using Windows).

To make a sensor that can detect different types of coins is something that most of us won't be able to manage, of course if you can get your hands on an actual arcade coin detector then it's done for you. A simple way, though it won't be able to tell the difference between different types of coins, is by using a slotted opto-switch which the coin passes through briefly. The coin, or anything opaque which passes through the coin slot, will briefly block the infra-red beam produced by the opto-switch which then can be sensed to increase the credits; this will act like a clock pulse.

You'll only need a simple transistor switch for the slotted-opto switch, the circuit I use I've seen in coin pusher machines at the arcades as to activate a sound when the coin passes, with the difference that the slotted-opto switch is used more like a traditional switch for some of the coin pusher machines. If you want to be able to give yourself free credits without inserting a coin you can use a normally closed microswitch which disconnects the photo diode part of the slotted-opto switch since that will have the same effect as the coin blocking the infra-red beam from the photo diode. Just remember to hide the switch inside the machine otherwise no one will pay! For test purposes it's a good idea to include an LED (with limiting resistor) at the output of the coin detector circuit; the LED should blink whenever a coin makes its way through the slotted-opto switch.

The signal from the coin sensor can then be fed to the computer, perhaps to one of the parallel port's inputs. You could then display the player's credits on the computer's monitor but to get a more arcade look a couple of LED displays would be better for showing how many plays are left. I've seen real fruit machines that use a monitor that have LED displays for showing the remaining credits. And nothing looks better than giant LED displays, if you can get your hands on one or two (but be aware that larger LED displays work on a higher voltage, say 5V per segment, instead of 2V for a standard LED).

Just one LED display isn't enough as that will only allow for up to nine plays, but two is fine as they will handle a maximum of 99 credits. For each credit display you will need a BCD-to-7 segment decoder/driver and a BCD counter that can count up (when a coin is inserted) and down (after a play is used). It may seem obvious to connect the coin detector to the first counter but it's actually better to allow the computer to clock the counter. For one thing, after a play the counter needs to be clocked down so that will have to be done by the computer. Secondly, by granting the computer control over the counter it can award credits to players perhaps for completing a game without loosing a life, for example.

The first counter, which will be responsible for the least significant digit for the credits needs to clock the second counter that takes care of the most significant digit (assuming two displays). Depending on the counters you use this can be done using the carry out and carry input signals that most counters have while having the clock signals connected together.

So, the computer needs to be able to reset the counters (so that they start up in a known state for one thing), it has to clock the counters and finally it has to be able to select whether the counters count up (increase credit) or count down (decrease credit). There are a few output only signals from the parallel port that you could use to reset, clock and select if the counters count up or down. If the counter you are using doesn't have a reset input but preset selections instead then you'll need to connect all the presets inputs to 0V and use the preset enable (maybe called parallel enable/load or something similiar) to reset (to zero).

I recommend using 4029 counters as they can count up and down, and 4511 decoders for the 7-segment LED displays. Speaking of which, if you are using large LED displays then you may have to run them off a higher voltage (with suitable limiting resistors) so you can use the 12V that a PC provides. So using CMOS IC's such as the 4029 and 4511 is a good idea as they can cope with 12V.

If you are using something like a slotted-opto switch to detect a coin then you'll need to 'debounce' it otherwise as the coin passes through the sensor it will be detected multiple times. You could debounce the sensor in hardware but it's easy enough to do in software.

The method is the same as what you would do to stop a character in a game from continually jumping if the jump button was held, you'd wait for the jump button to be released first before making the character jump again. For the coin, make sure that first no coin has been detected (or that one has passed the sensor) and when a coin has been detected, increase the credits and set a flag so the credits aren't increased again until no coin is detected. If coins are inserted too fast they might not both be detected so it's a good idea to wait a couple of seconds before putting in the next coin (this is because two coins might go in next to each other front and behind, and seem like one coin to the sensor).

I have a joystick that is styled very much like what you would expect to see on a classic '80's arcade machine, when I can get a second just like the first I can do two player games. You could use the PC's game port connector (if it has one) but I decided to use the parallel port instead as it's simple to use. The joystick has the usual four directions plus two independent fire buttons and also for player one there are two extra trigger buttons mounted separately to the joystick. This totals to 8 buttons which is just right for connecting to the parallel port's data port, though if you have two joysticks you will have to multiplex them or switch between the two.

But there is a slight problem, the parallel port's data port defaults to output before any software can change it to input (most likely because the parallel port was originally designed with printers in mind). If someone was to press a button or the joystick before the data port was changed to input, the port signals would be shorted to ground and could damage the parallel port.

The work around is to connect a resistor of around 330R (a higher value won't allow you to detect multiple button presses) between the switches' common connection and ground. If a button was pressed while the data port was in output mode the resistor would be connected to 0V and limit the current, protecting the parallel port. Then your software can change the data port of the parallel port to input to read the state of the joystick switches.

The advantage of connecting the joystick and fire buttons to 0V is that there is no need for connection to +5V which isn't provided by the standard parallel port. However, this means that the switches will be inverted, that is, a button press will be detected as logic 0 and no button press as logic 1 but that can easily be changed with software. The parallel port's data port set as inputs float to logic 1 so there should be no need to add your own pull-up resistors.

Above you can see what my arcade machine currently looks like. It has a wooden case with metal air vents at the top, two giant LED displays for credits, the joystick on the left, and not visible in this picture is a key switch lower down for free credits.

Recycling

You may not be aware but loads of electronics is wasted all the time, unused and harming the environment when a lot of it could be reused. Sometimes people throw out a perfectly working TV, for example, just because they are upgrading to a better model. And even when somethng electronic has stopped working or has been damaged it may be possible to repair it or re-use some of the components.

It has taken time but now some companies will recycle your unwanted electronics, usualy for free. Or, you could give that item to someone you know could make use of, or you have the option of donating it to charity. For those who build electronic circuits, in addtion to buying new components you can salvage components from unwanted devices. That is something I have done for many years and continue to do so today.

There are two main advantages to recycling electronic components, and they are that you can get them very cheaply or even free and, you may just get your hands on some rare gems that aren't even sold anymore or are but at high prices. Of course second hand components means they won't have as long life as they would have if bought new but that's a small set back and provided you're careful when desoldering, it's not much of a problem especially if they're obtained for free. Additionally, the components will most likely have shorter leads than when they were new but having said that, there are times when the length of some of the component's connections are kept close to the original size.

Often the older goods are better since the circuits aren't so integrated and therefore there are more usable components, and a lot more wire! It can be harder to desolder components from circuit boards which have tracks both sides because there is solder on each of the sides but this is not usually too much of a problem as heating up the solder one side will often melt the solder at the other side. But that said, new electronics still have plenty to offer, it's up to you what you are able to use with the tools and skill you have.

When desoldering, you may come across some components that you are unsure of what they are by just looking at them (for example, inductors can look like resistors when they use colour bands but the rest of their body is often green not grey or white used for resistors).

A component analyzer helps greatly but they're aren't cheap and are often limited to semiconductors. Fortunately, on the circuit board will be markings that give a clue as to the identity of the device, and as for transistors and other components, the manufacturer might have been kind enough to provide a pin-out. Sometimes you will find labelled connections on a circuit board for connected wires, for example.

It always pays to look online or in books for information about the components you come across or even for the complete system as sometimes service manuals are available online which include circuit diagrams.

Some examples of the abbreviations used to reference components on a circuit board are:

T For transformer or could be transistor.

TR or Q for any type of transistor.

D for diode even an LED, otherwise LED or just LD for an optical diode.

C for capacitor, polarized or not.

R for a fixed resistor.

VR for a variable resistor and PR for a preset variable resistor.

J or JP for a jump link, a small length of wire with or without insulation to connect two tracks together on a circuit board (as to avoid running into another track that would otherwise cause a short).

IC for an integrated circuit, better known as a microchip.

VC for a variable capacitor.

C or CN for a connector.

L for an inductor.

So, D56 would be the 56th diode which would then be referenced to on the circuit diagram (if you had access to it). However, sometimes the numbering doesn't start at 1 for a particular type of component so in that case it couldn't be used to count how many there are of a particular type.

So, where can you get your hands on electronics to recycle? One place for sure is at a carboot sale as you can buy cheap devices to use or salvage the components from. And if you're lucky, you may find something chucked out that couldn't be sold that you can use. This reminds me of a saying, "What's one person's rubbish is another person's treasure."

There are some unwritten laws about carboot sales:

* People who sell computer parts are always located on the last rows (worth the walk I guess).

* There will always be sellers trying to get rid of old scanners, printers, black & white TV's and CRT monitors at prices that you would associate with nearly new products.

* When browsing at a particular stall the owner will joyfully comment that if you had arrived earlier there would have been even better things for you to buy (I'll just go back in time...)

Some examples of great finds at carboot sales I have been to are a large number of computer ribbon cables (IDE, floppy, SCSI) and strangely a collection of connectors that had been cut from PC PSU's, but still usable. And a very heavy power supply unit with multiple outlets that for some reason was branded 'fragile,' this being a large metal box!

You'll need to be good at desoldering to reuse components and how much of a hard time you have depends on what the item is. Components with two legs are simple to remove, you can get rid of the solder with a solder sucker and then pull out the component; it helps to carefully push the component back and forward several times to loosen since the smallest amount of solder can cling to the component's leads (like a loose tooth). Another technique is to heat up one leg as you pull on the component at the other side (helps to have someone hold the circuit board for you) and then do the same for the other connections.

Remember to use a heatsink on the leads of components (as close to the body as possible) sensitive to high temperature (desoldering requires even more heat than when soldering), the heatsink can just be a metal clip. But for components that have far too short leads to attach a heatsink to you'll have to do without and be as quick as you can (a few seconds). Semiconductors such as IC's, transistors, diodes including infra-red and visible LED's are the ones that need to be protected when soldering or desoldering. It is possible to remove sockets and IC's soldered directly to the circuit board, you'll need to suck up the solder from each connection using a soldering iron and solder sucker pump.

An unwanted printer or scanner may be something you would ignore yet they have quite a few parts that can be put to use in your projects and include ordinary and stepper motors, and optical components like slotted-opto switches, often on long leads with connectors.

Above is a picture of an HP printer that was somewhat difficult to pull to pieces but was worth the effort when I had worked out the right order of removing the parts and fortunately I had a star shaped screwdriver. Unfortunately there was not many components that I could use from the main board and there's all that metal to go to waste, but a great find nonetheless for the motors and optical parts that I can use.

What about a CD or DVD-ROM drive? They are great for parts you can use for your own projects, a typical optical drive contains two 'normal' motors, a stepper motor, switches, optical sensors and LEDs as well as other components. Many of these drives have flash or other type of rewritable memory in the form of a chip that can be removed.

Generate your own electricity

Electricity can be generated from the sun using solar panels and from motors by turning the spindle yourself. Traditional motors aren't that good when used to create electricity but stepper motors, which contain many coils, are much better for producing electricity for their size.

Only a few components are needed in addition to a stepper motor to generate electricity and they are a bridge rectifier (four diodes arranged in a bridge network) to convert the AC current from the stepper motor to DC. You will also need one or more capacitors for smoothing and storing the generated electricity.

Unless the load (which is to be powered by the generated electricity) uses very little current, more often the electricity that is produced by the stepper motor is used to recharge a battery which then powers something.

LED torch projects

Please go to LED torch projects.

LED torch reviews

Gone are the days when we had to rely on torches that used lightbulbs; never mind if the battery would last, how about the lightbulb?! LED's are so much more efficient and less power hungry than traditional lightbulbs so it's just as well as LED technology continues to improve that they are replacing lightbulbs, however, even LED's aren't perfect.

For one thing, torches that use a lightbulb have usually a much simpler circuit than those that use LED's and there are several reasons for that. Firstly, although too high voltage or current will blow a lightbulb they can be made to withstand more power than LED's which typically operate on 2V 20mA for the colours like red and as for blue and white, they need no more than 4.5V at a similiar current rating. So, a limiting resistor is used to protect the LED from too high voltage or current that would destroy it.

This means, for example, if you wanted to replace the lighting in your house with LED's you would need a circuit to step down and rectify the mains voltage for the LED's or you would have to use batteries. Then comes along another problem, that LED's cannot produce as wide beam of light as lightbulbs, so many LED's have to be put together (often in a circular shape)-known as LED lamp or LED bulb-which increases power consumption and complicates wiring. LED's of size up to 20mm can be bought yet they are actually made up of many smaller LED's internally, hidden by the plastic casing.

You might think that connecting several LED's shouldn't be a big problem but you must take into consideration if you should wiring them in series, parallel or a combination of both. Connecting LED's in series will allow them to be used on a higher voltage with each LED getting the same amount of current so that, for example, two LED's in series that work on 2V each can use 4V together (i.e. double).

Parallel connected LEDs differ in that every LED will get the same voltage but the current drawn will increase with each LED added to the circuit. Because of the increase in current required from the power supply, if a limiting resistor is needed it may have to be of higher wattage rating (due to the increase in power demand) than what would be needed with only one or two LED's.

When buying an LED torch you should look for the following:

* Power supply: is the torch powered by batteries, and if so, how many and of what type (AA, AAA, C, and so on)? Some torches can be powered by shaking them or using wind up power, which is possible thanks to the advantages of LED's over lightbulbs (such as lower power consumption), so stored up power will last longer.

* Colour of LED(s): this may seem stupid but as with the cheaper energy saving lightbulbs, the not so bright so-called white LED's have a hint of blue about them (since blue is used to create the white light).

* Number of LED's: you may think that more LED's will be better but although LED's grouped together should increase how wide the beam of light is, that doesn't mean the overall light is very bright. One or two super bright LED's could equal the brightness of many more less bright LED's but with a smaller light beam.

Before I review various LED torches that I have bought I must mention that since LED torches will likely contain a number of LED's clustered together, you could use the LED's for your own projects. You will save money and the LED's will already be soldered in place, all you will need to do is connect wires to the circuit board. So that torch could become a desk lamp or provide illumination for the displays on equipment you have made, and so on.

Ok, now for the reviews, starting with a slim, silver, metal torch shaped in a traditional way that I got from Poundland. So that's £1 for the torch which uses 3 AAA batteries (despite it saying AA on the packaging) and has 3 very bright LEDs grouped together in a triangle formation.

Then there's the LED headlight that I bought in QD for £2.50 that is coloured silver and black with straps to secure it across your head as you would expect. It has a removable battery holder in which to put 3 AAA batteries, to turn the torch on you press the button to cycle through the states of middle LED on only, three horizontal LEDs on only, all seven LEDs on and off.

Next we have an odd shaped torch from Poundland that requires 3 AA batteries and uses a sliding switch in which to select the ten LED strip on, flashing orange light, 2 LED's at front on and off. This torch is much more worth the money for what you get and especially the LED strip light is very bright.

Now in more detail, the 10 LED strip current is approx. 400mA, the flashing LED current is approx. 40mA and the 2 front LED's current is approx. 140mA. The high current drawn from the batteries is due to the LED's being connected in parallel, with the exception of course of the single flashing LED. Speaking of the flashing LED, it appears that a two transistor (S8050) multivibrator oscillator causes the LED to blink which is actually white but made to look orange using a filter.

From the 99p store I bought a so-called solar powered LED torch made by Everstone, since I needed one which had multiple LED's. The torch is key-chain size and features a solar panel on the top, 3 white LED's on the side and a push button switch to turn on the LED's. Upon opening up the torch-which is easy to do-I found that the torch is NOT solar powered. For one thing, a CR2032 battery was used, which is non-rechargeable. Secondly, there are no connections to the solar panel; in fact, the solar panel has no metal contacts. The circuit is simply 3 LED's connected in parallel with the switch in series.

The packaging says 'Battery included but not replaceable' when actually the battery is easily replaced so the message most likely was intended to deter people from opening up the device. Note that nowhere on the packaging does it say that there is a rechargeable battery, even though it would need one (or even a capacitor) for the torch to be solar powered.

Electric charge game

This game takes inspiration from the 'Thundering Dynamo' mini game from the Pokemon stadium video game that was on the N64. The aim of this electronic version is to press a button quick enough that a meter needle moves to the right of the meter before the time runs out as signalled by a buzzer sounding. You can view the circuit diagram below:

The circuit runs off a single 9V battery (such as PP3) and is turned on by switching SW1 into position A which starts the timer consisting of TR1, R1-R3 and C1. Depending on actual component values the buzzer will sound after about 10 seconds; for a longer delay a better timer circuit will be needed. After the time delay, TR1 activates the buzzer driver which is made up of TR2, D1 and the buzzer.

When SW1 is put in the B position capacitor C1 is discharged which resets the timer so that when SW1 is returned to the A position the timer will start again. This method should not be used with high voltage capacitors.

Next up is the charging of capacitor C2 which powers the meter, M1 (a meter that has a numeric scale and a red area to one side is ideal). It would be too easy to simply connect the capacitor to power via a switch as the switch could be held down, thus charging the capacitor very quickly. The way I got around the problem was to force the player to keep pressing and releasing SW2 which is achieved using a small transformer, T1 (the ratio isn't too important as long as the secondary voltage isn't too low).

If we put DC through a transformer's primary windings, no current flows in its secondary windings until SW2 is released. Which means you have to press and release SW2 for current to appear at the transformer's secondary side. This current is then rectified using D2 and used to charge C2 through a combination of variable resistor VR1 and R4. VR1 controls the difficulty, that is, how quickly SW2 is pressed to deflect the meter needle to the other side as higher the resistance the longer it will take to charge C2. The reason for putting R4 in parallel with VR1 is to convert VR1's range from 0 to 100K to 0 to 180 as I did not have a lower resistance variable resistor at hand. As for the other variable resistor (VR2), this is a preset used to limit the current to M1 and along with VR1 and R4 sets how quickly SW2 is pressed to completely deflect the meter needle.

It's your turn! player indicator

Often when playing boards games it is required that someone remembers whose turn it is which can easily be forgotten while trying to remember the rules of the game. To solve this problem I devised a gadget which keeps track of which player's turn it is for any game involving 2 to 4 players. It does this by lighting up a group of 3 LED's for each player when it's their turn and automatically lights the next group of LED's when a switch is pressed. Another switch picks whether there are 2, 3 or 4 players.

Take a look at the circuit diagram that follows:

The 555 timer (IC1) is wired as a switch debouncer so that when SW2 is pressed to move to the next player the 555 outputs a clean clock pulse to the 4017 (IC2) decade counter. For every clock pulse the 4017 turns on each of Q0 to Q3 in turn when there are 4 players; for 3 players only Q0 to Q2 are used and for 2 players just Q0 and Q1. The number of players is selected using SW3 which limits the number of outputs by resetting the 4017 whenever it reaches a certain output.

The 2 diodes (D1-D2) function as an OR gate so that the reset button (SW4) can reset the 4017 as well as one of the 4017's outputs. While on the subject of reset capacitor C5 and resistor R9 form a simple power-on reset so that the 4017 always starts with Q0 high when the power is turned on.

As a single 4017 output can only provide about 10mA and a typical LED needs about 20mA, to drive the 3 LED's in each group a simple transistor driver (consisting of TR1 & R4, TR2 & R5, TR3 & R6, TR4 & R7)) has been used to give the extra current needed. Each LED group is made up of three same colour LED's in parallel; if you want to use different colour LED's in each group it would be best to use a limiting resistor for every LED.

LED flower

Most people are only too happy to be given flowers and they can really cheer someone up but why not put a twist on the classic gift by making your own flower that lights up. You can follow the instructions in the video linked below and I have included a copy of the circuit diagram under the video link:

http://youtu.be/PtjXsNGfHrI

A summary of the steps to make the LED flower:

You will need:

Coloured foam

Plant pot

Wire

LED

Plastic tube

Battery holder

Switch

For the plastic tube I used the outer insulation from a telephone cable and then painted it green.

Cut out of the foam the flower head and glue it together-if you are stuck for ideas look online or outside your house; there are loads of flower types.

Cut leaves from green foam, make holes in them and push through the stalk, which is the plastic tube.

Solder wires to the LED, insulate (use heat shrink if possible) and push through the stalk. When soldering, protect the LED with a heat sink otherwise you may destroy the LED from too much heat.

Make a hole in the flower head and push the LED through before gluing in place.

Cut a circle of foam the same size as the plant pot to form the base; I used green foam but you may want to use brown to look like dirt.

Make a hole in the base, push the stalk through the hole and solder the rest of the circuit as shown in the circuit diagram above which gives the calculation for the limiting resistor. As the LED I used has a voltage drop of 3V I did not need a limiting resistor but if you do need one you can either solder it direct to the LED or further down the circuit. Just be sure to insulate everything so there are no shorts when you put the circuit in the plant pot.

Put a hole in the side of the plant pot and secure the switch using the hole.

Next, put batteries in the holder, place the complete circuit into the pot and position the foam base inside the pot.

Switch on and check the LED turns on. If not, take everything out and check over your wiring and make sure your batteries work.

Model Traffic Lights

At the age of 13, back in April 1999 I had published my model pedestrian traffic light circuit in the UK edition of Electronics World magazine, which still goes today (as of 2022). I was awarded a £35 cheque (~£54 in today's money) for my submission and a copy of the magazine. An archived copy of the April issue can be found at:

https://worldradiohistory.com/UK/Wireless-World/90s/Electronics-World-1999-04-S-OCR.pdf

My design is at the bottom of page 344. I can recall that after sending off the design I was asked to redraw it to make it clearer, which I did. Unfortunately, having built the circuit recently it doesn’t function correctly and as I don’t appear to have an original copy of the circuit I cannot confirm whether I made mistakes in the design (which is very possible) or there were errors when it was copied to the magazine. The Electronics World staff certainly didn’t just scan in my design and must have at least partially recreated it as, for example, they used the zig-zag resistor symbol whereas I always use the rectangular version.

It’s very possible I got the circuit working back in ‘99 (I’m sure I would have tested it) but perhaps under very tight circumstances or I just made a silly error when drawing up the circuit. The design may seem a little odd, such as using pin 7 of the 555 (IC1) to enable/disable it but this technique does actually work, provided the pin is connected also in the usual configuration with the timing resistor and capacitor (which, I didn't do). Thus it’s clear I did at least make a mistake with that error as I’ve used a very odd arrangement to create an astable.

Nevertheless, recently I decided to make a new version of the traffic lights but keeping it similar to the original design, in being based on a flip-flop approach and keeping to two ICs only, and no microcontroller! Note that the original design used the then more common pedestrian traffic lights sequence that feature flashing amber and flashing green, which can be viewed in the following video from 13:54 to 15:10:

For the new design I opted to use the modern traffic light sequence, which is slightly easier to implement since there is no need to flash any lights. The sequence can be seen in the video above from 0:10 to 1:49.

My new design gets close to emulating the modern traffic light sequence very closely.

You may want to check out a video I did showing of the traffic lights in action before reading on how it works:

Please refer to the schematic (below) as I explain how it works; for a large version you can download it from the bottom of this page, titled 'Model Traffic Lights 1V2 Circuit Diagram.png'.

The circuit is powered from 12V but can be run from 18V maximum as that is the typically maximum rated voltage for a 555 and 4017 but you should consult the datasheets for your specific parts.

A 555 timer (IC1) is wired as an astable oscillator, producing square wave pulses of frequency between approximately 0.7Hz to 0.07Hz, adjustable using variable resistor PR1 (trimmer/preset type). The timing sets how quickly the traffic lights change from one state to another as part of the lights sequence.

A 4017 decade counter (IC2) is used to handle the traffic light sequence but before getting into detail about that let’s start with how it’s reset. A very simple reset mechanism consisting of capacitor C4 and resistor R3 generates a reset pulse lasting about 1.9ms. You may want to replace the power-on reset components with a better, more reliable solution, but from my testing the reset has always worked upon power up.

The output of the 555 (pin 3) is fed to the clock input (pin 14) of the 4017 but the IC will not advance count while its EN (enable, pin 13) is held high. The enable input is controlled by a two transistor bistable latch based around transistors TR1 and TR2 (both BC547 but any general purpose NPN transistors should be suitable) and resistors R9 to R12.

Pressing S2, the pedestrian switch, causes the latch to change state, and the 4017 will now respond to clock pulses. Each of its 10 outputs will turn on in succession and when Q9 turns on and then off, a roughly 2ms pulse is created using C5, putting the latch back to its previous state and stopping the 4017 from responding to further clock pulses. Note that after the latch is disabled the 4017 will stop on Q0 high. The convenience of generating a pulse using the 4017 output and capacitor C5 is that it also sets the latch to a known state at power up.

Diodes D1 to D20 form essentially 5 multi-input OR gates which decodes the 4017 outputs to ensure the correct vehicle (‘cars’) and pedestrian LEDs turn on. It shouldn't be too difficult to change the arrangement of diodes to handle an alternative light sequence. The number of diodes could be reduced slightly by putting some of them in series to not duplicate repeated OR gates but then the LEDs would negatively be affected by the voltage drop of two diodes in series. Alternatively, these diodes could be replaced with IC OR gates, but would require many logic ICs, or a ROM or PLD (Programmable Logic Device), but as previously mentioned I aimed for a two IC solution.

Five LEDs, LED1 to LED 5, are used for the pedestrian and vehicle traffic lights; LED1 to LED3 for the vehicle green, amber (or yellow, if you like) and red lights and, LED4 and LED5 for the pedestrian red and green lights. Unfortunately the 4017 doesn’t have much current available at its outputs so some form of buffer would have been a good option and can be added if desired. As the circuit is, I’ve chosen LED limiting resistors R4 to R8 such that the LEDs have similar brightness taking into account their different requirements but do feel free to experiment with the values and change them as required by your LED specifications.. A side effect of this approach to driving the LEDs is that you will see a change of brightness depending on which LEDs are on at a given time.

To test the circuit apply power and you should see that the vehicles (cars) green light and the pedestrian red LEDs are on. Press S2 and after a brief amount of time the LED sequence will run but don’t forget there will be a delay before the sequence changes - adjust PR1 to set the timing. As the 4017 won’t advance its count until its clock input goes low to high, depending on when you press S2 the lights will take slightly longer to change, which adds some realism.

For reference, here is a list of what lights should be on when each 4017 output is on:

4017 O/P Cars G Cars A Cars R Ped. G Ped. R

Q0 On Off Off Off On

Q1 On Off Off Off On

Q2 Off On Off Off On

Q3 Off Off On Off On

Q4 Off Off On On Off

Q5 Off Off On On Off

Q6 Off Off On Off Off

Q7 Off Off On Off On

Q8 Off Off On Off On

Q9 Off On On Off On

Note that when the 4017 Q6 output is on both pedestrian lights are off and this is indeed correct, as to signal that it’s not safe to start crossing.

If the circuit isn't behaving as it should be sure to check that each main stage is working - astable, counter and latch - and that they are connected to each other correctly.

As for improvements, something that is missing is a ‘wait’ indicator that lights up when a pedestrian presses the button but would require more logic to include it, so if you feel up to it, see if you can add it. Another feature that could be added is some kind of bleeping to indicate it’s time to cross, though some real life crossings are quiet (supposedly, if it’s located somewhere the sound would be a nuisance or could be confused for another, nearby crossing).

Variable Speed Fan Controller

Recently it was very hot where I live (England), in fact, we hit record temperatures for the time of the year so I needed a way to help keep me cool. Unlike in other countries where ceiling fans are standard that is not the case in England which has a brief time of high heat. Of course I could have just popped out and bought a mains powered fan or even a portable battery powered fan but it's always more fun to build your own.

The circuit I came up with uses a PC system (case) fan and is very simple and hardly the best way to drive a fan since it uses a linear regulator which wastes energy through heat but it gets the job done. While you could just stick a variable resistor in series with a power supply and a fan, a lot of current would pass through the variable resistor requiring it to be rated for high power. With the design I settled on based on an LM317 variable voltage source a low power variable resistor can be used to control the voltage across the fan.

You can view the circuit below:

A 15VDC non-regulated power supply is fed into the circuit via a power on/off switch (SW1), which could be part of the variable resistor if it has a switch built in and is uitably rated. There is no polarity protection so if you would like you could add a diode in series with the switch but you may have to use a power supply rated at a slightly higher voltage. This is because there will be a voltage drop across the diode but the LM317 needs about 3V higher at the input than the output voltage (so to get 12V output the input must be at least 15V after the diode).

Resistors R1, VR1 and R2 control the voltage across the PC fan with adjustments to the variable resistor VR1 allowing the voltage to be altered; R2 acts as a minimum resistance so that even if VR1 is turned all the way down the fan should still spin. However, I found with my particular fan if I turned on the power with the variable resistor at the minimum setting the fan would not spin unless I helped it start but it continued to spin even after turning up the speed and then reverting back to the minimum setting. Feel free to change the resistor values to suit better the fan you are using.

To make it easy to calculate the resistor values you need to use there is a handy online calculator:

https://circuitdigest.com/calculators/lm317-resistor-voltage-calculator

With the variable resistor turned to minimum we only have 1K (and slight resistance of the variable resistor) and 820R so that should give us an output voltage of roughly 2.8V (not surprising the fan struggled to spin) which is exactly what i measured with my multimeter. With the variable resistor turned to maximum we have around 11K (10K variable resistor plus R2) and 820R which in theory should give us 18V but we don't get anywhere near that at the input to the LM317. A 6K variable resistor would have been better as that would have given us almost 12V but I only had a 10K variable resistor at hand and even with the 10K variable resistor the fan voltage gets limited to a little over 13V which is a little high for the fan but should do it no harm. As for the current going through the fan, at minimum setting just 20mA flows through the fan and at maximum value of the variable resistor 130mA is drawn by the fan. The fan that I used has 4 blue LEDs which adds a little to the current consumption but has the nice effect of their brightness increasing with the fan speed.

If you use a standard TO-220 LM317 there should be no need for a heatsink even when the fan is running at full speed.

Create Your Own Computer

Please go to Create Your Own Computer page.

Inside Manufactured Products

Please go to Inside Manufactured Products

Electronic Component Database

Please go to Electronic Component Database

Electronic Repairs

Please go to Electronic Repairs

Also, Repairs.

Valve Projects

Please go to Valve Projects

Power Supply Circuits

Please go to Power Supply Circuits

StarPlay

Please go to StarPlay

Create your own game console

Please go to Create your own game console

All content of this and related pages is copyright (c) James S. 2007-2022