Designing and Building Circuits

Introduction

Whether you plan to construct a simple or complex circuit, there are a number of steps that typically are followed to get from the initial idea to the final product. These are listed below:

(1) Generate the idea(s).

(2) Draw block diagram of the circuit.

(3) Convert the block diagram into a full circuit.

(4) Prototype the circuit.

(5) Solder the circuit.

(6) Test the device.

(7) Put finished circuit into an enclosure.

We will now look at these different steps in more detail so you can get a better understanding of each one.

Please note that the images on this page can be downloaded from the bottom of the page for better viewing.

(1) Generate the idea(s).

Before you can build anything you have to, of course, think up what it is exactly you want to make. Often the circuit will either help someone in some way (e.g., a calculator to add up numbers or an amplifier to increase sound) or it will be used to entertain people (such as flashing lights or a game). Having a clear objective is very important so that you know what it is exactly you want your device to do but there's nothing to say it can't change slightly along the way.

You could also ask friends or family, ask online, or even use AI, such as ChatGPT or a similar service, if nothing else it could be the starting point for something better. Or you could look at existing devices and think up how you could make something similar but better (for e.g., to run off a battery instead of mains only) or in some other way (e.g., to use LED's instead of light bulbs). Try not to directly copy an existing product but instead put your own spin on it - want to make a better version of the electronic Simon game? No problem, but perhaps change the look, the number of buttons, have different rules, and a dissimilar name to avoid parallels with existing designs - always respect IP.

Write down your ideas and keep adding, it's better to come up with many suggestions than just a few, thinking about what you want it to do and its features but it doesn't have to be anything too specific, just keep it loose and free until you have a better idea of what the end product will be.

(2) Draw block diagram of the circuit.

Unless the circuit is very simple it is best to put together a block diagram of the circuit, which can be done on paper or a computer (it is usually easiest to draw on paper first and then do a computer version later if need be), use whichever approach is most comfortable for you. Generally, the diagram will consist of input(s), control, and output(s), traditionally located on the left, middle, and right respectively, allowing the design to flow from left to right. The block diagram will be made up of 'black boxes' which are modules that perform a definite task (such as a counter or amplifier) but at this stage we are not concerned as to what components are used to make that module (so in the example of a counter, the microchip and any other components that together act as a counter). In this way we can see the overall functionality without getting bogged down with the fine detail, such as the the individual components that make up the black boxes.

As a very simple example, which doesn't really need a block diagram but will serve to show a basic block diagram nonetheless, we will look at a night light, a child's aid in the form of a light that turns on when darkness is detected (the room light is off), to provide a small amount of light as a comfort as they fall asleep. In the following image you can see the block diagram, which I made using KiCad's schematic editor:

The light sensor feeds into the switch which controls the light; notice the flow of the arrows, taking the viewer from left to right. No specific components have been shown, nor power supply, or actual connections between systems like would be found in a real electronic circuit.

(3) Convert the block diagram into a full circuit.

When you are happy with the block diagram, you can take each module and break it into the different components that make up the module. Like with the block diagram, this can be done either on paper or a computer; whatever you're happy in using. It's a good idea if you can, especially for complex circuits, to keep the full circuit as modular as possible (i.e., you can see every component and connection but you can still see each part as identified in the block diagram); it's a good idea to enclose the modules in dotted lines and label them. From this circuit diagram you can put together a list of components but don't forget other items like wire.

The next image shows the circuit diagram for the night light, also made using KiCad:

Notice that I've highlighted each section that was present in the block diagram to help illustrate the individual 'module' parts.

A usefule feature of KiCad is the option to check the circuit connections by running the Perform electrical rules check by clicking on the shortcut button on the toolbar or from the menu option Inspect->Electrical Rules Checker. In the pop-up window click the Run ERC button, any errors and warnings will be listed and on the schematic they will be pointed out with arrows. For the night light design it complained about the power pins (+9V and GND) not being driven by output pins, which can be fixed by adding a PWR_FLAG symbol to both +9V and GND. If you are just using the circuit for reference (such as to print out) the error can otherwise be ignored.

At this stage we have all the information needed to prototype the circuit but before doing so you may like to generate a bill of materials (BOM), so you have a handy list of what components you need to build the circuit in the next stage. While you could easily write the list yourself, you can have KiCad (or other CAD software) do it for you, which is especially helpful for more complex circuits, and helps with getting a PCB made should you want to down the line.

To produce a BOM in KiCad you can follow the guide at:

https://forum.kicad.info/t/how-to-create-a-bill-of-materials-bom/12346

I already had three plugins available when I selected Tools->Generate BOM..., and chose bom_csv_grouped_by_value, and after clicking the Generate button, a csv file with the project name and csv extension appeared in the KiCad project folder. Below you can see the BOM KiCad generated for me, opened in Excel:

Of course you may prefer HTML format, as mentioned on the previously linked to site, but CSV format has the advantage of letting you more easily change the formatting, add information, and so on in a program, such as Excel.

(4) Prototype the circuit.

You could skip this step and go on to step (5) if the circuit is very simple but it's always best to at least do some quick prototyping as even something very simple can catch you out. This involves making a temporary version of the circuit, usually on prototype board (a.k.a. breadboard). This allows you to test the circuit and take measurements (voltage, current, etc.) and tweak it if necessary (for e.g., use a higher value resistor). Because of this prototyping you may have to update your circuit diagram or even the block diagram if you find it doesn't behave as you intended, perhaps a particular component doesn't perform as well as you had hoped and you need to try a different one. But it is better that you find problems before making a more permanent version of the circuit which will be more difficult to fix. There are software simulators that let you test out a circuit and indeed they are helpful but even if the software indicates there are no problems, especially for a complex circuit it would still be best to prototype on breadboard. It's similar for microcontroller based circuits, you can simulate all you want and that is indeed helpful, but once tried out in the real world you may come across an issue the simulator didn't show.

(5) Solder the circuit.

You may like to read my page Tools for working with electronics, especially the Soldering section, before reading further.

Now that you know that the circuit works as you had intended, you can solder the circuit on some kind of circuit board, such as strip board/matrix board/PCB (Printed Circuit Board) using your circuit diagram as a guide, or a rough layout of components on graph paper, or some other guide. While simple PCBs can be made 'by hand' more involved circuits require the use of software to create the layout of the circuit, whether you make the PCB yourself or send off for it to be produced. If you haven't soldered before or intend to tackle SMD (surface-mount device) components for the first time then soldering kits are a good way to practice before you tackle your more serious projects.

In the following photo you can see a Rapid Electronics amplifier kit I put together, one of a number identical kits I bought cheaply second hand, which took me about 40 minutes to solder:

On the left is an unpopulated version of the kit, the soldered version to the right, and the instructions underneath. After checking over my soldering and cleaning the PCB I tested the circuit, which worked as expected.

Whenever soldering circuits, take your time and check carefully that you haven't made any mistakes, such as soldering the wrong component in the wrong place, or the wrong way round for certain components (i.e., diodes, transistors, etc.), or causing a short through too much solder or something similar. I always check for continuity between power, input and output connections as well as shorts between adjacent connections. For example, if a circuit uses multiple IC's I check that there is a good connection between the power connector and the IC power pins.

For complex circuits solder and then test each part systematically and only move onto the next section when you are happy with the previous section. If a particular module is dependent on another then you can simulate the signals that it needs, if at all possible. If you are soldering a large number of LED's or LED displays you can use a multimeter set to diode test to check each LED although the LED's will only light dimly (and some not at all).

(6) Test the device.

After soldering, before you even power up your circuit there are a number of things to check:

* One of the worst faults is a short circuit between the power supply connections; a power supply short circuit can be very dangerous, especially if the circuit has no fuse. A related issue, although usually not quite as severe, is when the power supply connections are reversed (concerning DC powered circuits). Again, this is one of the critical things you need to check before the power is turned on. Especially with battery operated circuits where there is chance for the battery (or batteries) to be connected the wrong way round, often a diode is used to protect the circuit from reversed polarity.

* Look for other shorts, often caused by solder shorting across tracks (in the case of strip board and similar boards) or connections of a component (transistors, IC's, and so on). A desoldering pump is handy for removing excessive solder but double check with a multimeter that the short has indeed been removed. With strip board, be sure that tracks you have broken have indeed been broken-again, use a multimeter to check; don't rely solely on sight.

* Another cause of faults is for polarity sensitive components to be connected the wrong way round-diodes (including LED's and photo diodes), transistors and IC's, for example. In the case of diodes, 'wrong way round' doesn't necessarily mean reverse biased as in some circuits that is the correct way round for a diode. When chip holders are used with IC's (which is a good idea so that the IC can easily be replaced if it is damaged) make sure the IC is inserted into the chip holder the correct way round. If a component, such as a transistor or IC, gets very hot then it could be an indication that it has be connected wrongly.

After powering up if your circuit does not work how you had designed it to then further checking will be required. If you smell burning immediately turn off the power and then look for any damaged components-be careful if you touch any part of the circuit as there could be hot components because of the fault. If your circuit includes a fuse then that should be checked; if it has blown then it is a clear indicator of a serious fault. Have another look for shorts and polarity sensitive components that have been connected the wrong way round. Never power up again until the fault has been fixed if there has been burning or the fuse had blown when you first powered up (unless it can be confirmed that an abnormal power surge had caused the fuse to blow).

With complex circuits it can be even more of a challenge to locate and fix the fault or faults. Try to use as much of a modular approach as possible. For example, if your circuit consists of an astable oscillator and a counter clocked by the oscillator but the counter's outputs aren't changing, first check the oscillator. If possible, connect some form of output (e.g. an LED with a limiting resistor) to the oscillator to test it; this won't be helpful if the oscillator is high frequency so another form of output may be necessary, such as an oscilloscope). If it turns out the oscillator was working then it stands to reason that either the connection between the oscillator and counter is the problem or the counter itself is at fault. If possible, clock the counter without the oscillator connected to test if the counter is working. If you suspect a particular IC to be faulty and it is located in a chip holder, remove the circuit's power supply, take the IC out and breadboard the IC as part of a test circuit.

When you are confident there are no faults in how the circuit has been put together then you can check that the circuit operates as intended.

I will now share with you some of my experiences in case you stumble upon something like I have and it could be that my solution will work for you.

* I had soldered a quite complex circuit consisting of mainly IC's that comprised of a counter, timer and logic sections. The logic, however, was not working as it should but I traced the fault to a single NAND gate (by connecting an LED to its output). The NAND gate was acting kind of like a buffer (but was wired as an inverter); the LED would be dimly lit when the output was off and fully lit when the output was on. I could not see a short between the NAND gate's inputs and output yet the multimeter showed there was a short. Even though I could not see the short I removed some of the solder from the NAND gate's output and repositioned the wire connected to the output. When I tested again the short was gone and the circuit worked correctly.

* In the same circuit mentioned above I had another fault in that the monostable timer would always trigger when the power was connected even though it had a pull-up resistor to prevent false triggering. The monostable used one half of a 556 and after some research I found that it was a common fault of some types of the 555/556 to trigger when power is connected. I tried additional bypass capacitors but that did not help. The only fix seemed to be to involve the 556's reset in a resistor and capacitor arrangement but in preparation to do so I moved the trigger pull-up resistor straight to +V (instead of to the reset pin that was connected to +V). This, for whatever reason, stopped the triggering when the power was connected. 

(7) Put finished circuit into an enclosure.

If the soldered circuit is working correctly, it is likely you will want to put it in some kind of box or other enclosure, but that is not the case for all projects at they may be part of a more complex system or the end user will put it into something themselves. The enclosure could be made of wood or plastic or some other material, you need to consider the intended 'feel' (wood for homely feel, for e.g.) and its intended use (metal to give it strength, for e.g.). Enclosures, such as boxes, can be purchased or you can put together your own from individual pieces, just make sure it's big enough to house everything you intend to put inside it.

 If the circuit has controls, such as buttons and dials, these can be fixed to a side or some other part of the enclosure. But there are a couple of things you have to be very careful about for reasons of safety. Firstly, if the enclosure is metal that isn't painted it will conduct electricity, so the circuit board must be raised above the sides of the enclosure or some insulating material (paper, card, etc.) can be placed between the bottom of the circuit board and the metal to prevent shorts. If the circuit contains static sensitive devices (microchips and transistors, for e.g.) then using plastic isn't a good idea unless it doesn't generate static electricity. For mains powered devices, the enclosure MUST be earthed if the enclosure is metal, to protect against electric shock in case the enclosure becomes live. Something else to consider is that if the circuit creates a lot of heat, even if cooling fans have been used, it may be that the enclosure will need holes to allow the hot air to escape or to let cool air in.

The size of the enclosure must also be considered as not only will it need to house the circuit board but additional parts too, such as controls, connectors (for headphone, remote control, etc.), lights, speaker and battery. Plastic boxes (sometimes called project boxes) can be bought that have a bottom that can be screwed into place so they are a good option. However, be sure to shop around as they can cost a fair amount.

3D printing is a good option for producing enclosures, although it can take time to create the model but then you can precisely set the size and shape of the enclosure, how it fits together, the holes for controls, LEDs, etc., supports to hold the PCB(s), and so on. There may already be an existing enclosure available online to download that can be modified if not exactly suitable. Even if you don't own a 3D printer it's worth asking around if anyone local can print what you need or you could use an online service instead.

Firmware

The above steps assume that the circuit you are building does not use any form of firmware; the program code and other data used by a microcontroller or similar IC. If you have written the firmware yourself then it is very important that it is tested as much as possible as incorrect firmware can make the difference of your circuit working or not, and can even harm components (for e.g. if I/O is wrongly configured as output and is shorted to a power rail).

If possible, first test the firmware in some form of software simulator which will help find bugs that you may not have spotted. The problem with these simulators, however, is usually they have little or no support for emulating input and output devices. This is where testing the circuit on breadboard after having flashed the firmware onto the device (or devices) will help you better see whether the system is working as it should.

It is helpful to provide a means of updating the firmware should there be any problems after you have soldered the circuit, should you suspect a software problem, and some devices can be debugged in-circuit through the same programming connections. You could provide such a connector on the circuit board for programming and debugging but not include it should you solder another version of the circuit once the software has been fixed. If need be, the device can be removed and updated in the programmer (if a chip holder has been used), but removing and inserting chips increases the chance of their connections becoming bent or even breaking. Unless there is very little space on the circuit board or because of cost reasons I would advise to always include a programming/debugging connector.

Have debug indicators (such as LED's) included in the circuit can be very helpful to find faults especially if the device cannot be debugged in-circuit through its programming connection, although if there aren't many I/O pins you may have to use one temporary for debugging purposes. A serial port (often provided by microcontrollers) is even more useful as not only can it give detailed information but can also accept commands. It's worth including support for such debug facilities when writing your firmware; they can always be removed later on through a software update.

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