Articles

What is the step-by-step procedure for designing an electronics or electrical circuit?

This is a fairly broad question. I'm going to answer it in terms of an example.

I was thinking of a project that might be interesting to do. I've got a nice pair of speakers that I built many years ago, from a company called SpeakerLab. It would be nice to stream audio from my smartphone to them. Turns out one can buy Bluetooth-enabled amps, but let’s see what it would take to build my own front end.

The first step in designing something is to come up with a specification for what you are trying to do. If this is just a project of your own, this may be something you can keep in your head, or write down as a few bullet points. If you are doing this for a company, you might have to write out a fairly detailed written specification, and have it approved before starting. If you are doing this for a class project, you will also want to have a detailed specification.

As part of the spec, you will usually find that you have broken up the project into several blocks, such as power management, input, processing, and output. The processing block may involve a microcontroller if you are building an embedded system. For a strictly analog circuit, it might be some op-amps.

If it is an embedded system, and management has not already dictated what processor is going to be used (which is too often the case), then you need to decide what processor family is appropriate for the job.

Usually this will be a decision between an 8-bit microcontroller or a 32-bit; 16-bit micros are not as popular anymore. The market for 8-bitters is still about the same as 32-bit; namely because they usually cost about 20% less (given the same memory requirements), and use less power.

The processor decision will be largely based on much much data processing needs to be done inside the chip. A simple appliance with just a few buttons and a couple of outputs (LEDs and motors) doesn’t need a 32-bit processor. But a complex project, say one needing to do voice recognition, would need as much horsepower as possible, perhaps benefiting from DSP instructions.

Program memory might range anywhere from the 265 12-bit words of a PIC10F200, with 16 bytes of SRAM, to the 2 MB flash in a PIC32MZ2064DA, with 512KB of SRAM and 32 MB of DDR2 RAM on chip.

See Quora User's answer to How do engineers pick microcontrollers for a project? for more about picking a microcontroller.

Then the rest of the system has to be designed. Is the circuit all digital, all analog, or a combination of the two?

Battery or plug-in power? What kind of display, if any? If a display, is it touch-screen? In any case, what buttons may be needed? What are the other I/O requirements? Is the device wireless? Does it need USB or an SD card interface? Etc., etc.

In my example project, the specifications are something like this:

  • Stream audio from a smartphone using A2DP over Bluetooth.
  • Audio interface between Bluetooth module and DAC will be digital (I2S).
  • Will use a 32-bit microcontroller.
  • Microcontroller will control Bluetooth module via UART connection.
  • One button to initiate pairing.
  • Output to be line-level from a DAC, for input to an stereo amplifier.
  • Powered from 5V DC using a USB charger or similar power supply

So this is an all-digital project. There is no user interface except the one pairing button; everything else will be controlled from the smartphone.

So the first step, after deciding what you want to design, is to look for similar projects that already exist, and see what you might be able to copy.

It turns out I have already written an demonstration application like this, which is essentially the guts of what goes into a pair of Bluetooth headphones, except it has a small LCD display and five buttons to control playback locally. We don’t need that. It’s available as part of the MPLAB Harmony framework for PIC32 devices from Microchip.

Here’s the block diagram I created for the Help Guide. It uses a BM64 Bluetooth module. I’ve X’ed out the parts we don’t need for the example project:

Rather than use the PIC32MX470F512L or PIC32MX270F512L, which are surface mount parts, I’m going to choose the PIC32MX270F256B which comes in a more hobbyist-friendly 28-pin DIP package. It has the same speed (50 MHz) and RAM (64 KB) as the other PICMX270, and has an I2S interface, so it should require minimal firmware changes. The program space is only half as much, but it’s still enough according to my notes which show I’m using 40% of the larger part’s flash. Plus I don’t need the code for the display.

The DAC is only available in a surface mount package; because I don’t want to deal with that I’m going to buy a evaluation board that has the DAC on it. Sometimes that’s the easiest way to go for do it yourself projects. It has a set of header pins that will be easy to wire to.

These evaluation and demo boards usually come with a user manual that you can download free of charge, even if you don’t buy the board. They will have the schematic of the board which will give you a good example of how to wire up the part in question.

My block diagram doesn’t include a power supply; so I’ll need to provide a LDO regulator to drop the 5V from my USB 5V charger input down to 3.3V.

Once a block diagram is complete, the next step is to flesh out the system by beginning a schematic and choosing parts to go into a BOM (bill of materials). If doing this for production, it only makes sense to choose parts that are going to be available in the quantities needed. For a one off project like this example, that is not important.

Depending on the difficulty of a circuit, after completing the schematic (perhaps on paper), you might want to first simulate it (or parts of it) using a program like LTspice, or build it up on a solderless breadboard. The latter will be too fragile to serve as a prototype, but allows one to make changes wiring quickly and try different values of components.

I typically use one of these two techniques for any analog circuitry (including switched power supplies); digital circuitry is usually straight-forward enough I can defer building it until I actually hard wire something together. If you’re not sure about your digital logic, there are simulators you can use for that also.

When designing a digital circuit, it is important to include 0.1 µF bypass capacitors on all Vdd pins. There might be several around a microcontroller or microprocessor.

Try to keep the number of power rails (voltages) as few as possible. I once had a circuit that had 12 different voltages; half were needed by the LCD. What a madhouse. It is often good to include a zero-ohm resistor at the output of your power supplies so you can test them before they are connected in circuit.

If you are designing a circuit for production, you will need to enter your schematic into a schematic capture program, like EAGLE or Altium. If you haven’t done this before, there is a steep learning curve. The good news is AUTODESK has significantly reduced their EAGLE prices, going with a subscription model, just $15/month or $100/year.

After completing your circuit, the next step may be to build a prototype. See Quora User's answer to How do I build a hardware prototype? for more info about this stage.

For more information on getting a PCB ready for production, see Quora User's answer to What does an embedded systems engineer actually do in a job?

© Voyager Vault·Home·Privacy·Not Found