Home » Projects » LED Bar Graph Meter Utilizing the LM324 Opamp

LED Bar Graph Meter Utilizing the LM324 Opamp

Share this:
Image of a PCB

Design Goals

The diagram provided shows an LED bar graph meter circuit that utilizes operational amplifiers. The objective of this project is to design the PCB board for the circuit using EAGLE software and physically construct it. The process involves computations of values, circuit simulation on ORCAD and breadboard, and confirming the circuit’s operational principle.

ParametersValue
Supply Voltage, Vcc9V
VinVin (min)Vin (max)
0V6V
VoutVout (min)Vout (max)
0.1V4.9V
Reference Voltages: 
Vref15.31V
Vref23.825V
Vref32.835V
Vref41.08V

Design Description

The opamps are configured as comparators. Each is designed to compare the input voltage (Vin), connected to its non-inverting input, with the reference voltage applied to its inverting input terminal. Whenever Vin is equal to or greater than the reference voltage connected to a particular opamp, the corresponding LED lights up. This provides a clear visual representation of the input voltage level.

Image of a PCBFigure 1: LED bar graph meter circuit

The circuit utilizes the LM324 IC, comprising four self-contained operational amplifiers. The LM324 is a cost-effective option for quad-operational amplifiers and is capable of functioning with supply voltages ranging from 3.0 V to 32 V.

LM324
Vcc3V to 32V, 1.5mA
Output Current40mA
VIDR±32V
VICR−0.3V to 32V
Number of Circuits4
Datasheet: https://www.onsemi.com/pdf/datasheet/lm324-d.pdf

LM324 Pin Outs Diagram

schematic diagram of LM324 IC
Figure 2: LM324 DIP Package

Alternate Quad Operational amplifiers: TL074, TL084 and LM2902

Design Calculations

The four distinct reference voltages are defined by the supply voltage and five resistors connected in series, forming a voltage divider circuit, as shown in the figure below. Now, this step is aimed to determine each of these resistances.

  1. To get the resistor values, the voltage across each resistor should be calculated first.
  2. Then each resistance can be calculated using the voltage divider formula.

Bias Point Simulation Result

schematic diagram of the circuit

Note that this simulation is only intended to verify the values that were calculated earlier. This does not show the expected behavior of the circuit. To get the actual transient response, it’s recommended to use software that is more capable of doing it. This project only attempts to determine DC bias points and will rather focus on the actual circuit simulation using a breadboard.

Circuit Prototype (Breadboarding)

The purpose of breadboarding is to provide an actual simulation and real-time testing of the circuit. Verifying and testing the circuit’s operation also ensures all components work properly before final fabrication.

components assebled in breadboard
Figure 3: Constructed Circuit in Breadboard

Testing and Prototyping Steps

  1. All the electronic components needed for the circuit design are collected. This includes jumper wires, a power supply or battery, and terminal blocks.
  2. The components are strategically placed for better observation of the circuit’s behavior. The LEDs are placed to resemble a “bar graph”.
  3. Jumper wires are utilized to facilitate connections between components.
  4. The circuit’s functionality is tested by applying power (Vcc) and the necessary input parameters (Vin).
simulating the circui in breadboard

Simulation Expectation

simulating the circuit in breadboard

The circuit and the LM324 IC are both powered by a 9V battery. The battery is also connected to the series combination of R1 – R5 and the inverting input terminals of each opamp. The Vin terminal receives an input voltage that ranges from 0V to 6V. Each opamp compares this voltage with its corresponding reference voltage and should only turn ON the LED when the two are equal.

However, the LEDs turned ON with these parameters:

Ref. VoltagesMeasured Input VoltagesVoltage Difference
V1 = 5.31VVin1 = 4.8V0.51 V
V2 = 3.825VVin2 = 3.4V0.425 V
V3 = 2.835VVin3 = 2.6V0.235 V
V4 = 1.08VVin4 = 1.0V0.08 V

The input voltages are a little off from the expected values. Additionally, there are some fluctuations introduced by Vin that affect the behavior of the circuit.

However, note that the actual values of resistors and actual reference voltages were not measured and included in the circuit analysis before. Each resistor has a tolerance of ±5% which may have a significant effect on the circuit’s operation.

Normally, in more complex circuits, tolerance analysis is included to determine the circuit design margin and provide some calculations for deciding and justifying the allowable amount of discrepancy between the expected and acquired parameters (Sachs, 2020). However, in this experiment, it’s decided to not go over this lengthy process. Instead, it’s recommended to just obtain actual reference voltage measurements using a multimeter and take it from there.

While it’s normal to obtain values with some inconsistencies in the actual simulation process, it’s still a great practice to implement solutions to reduce these discrepancies as much as possible.

Suggested Solutions

  1. Proper connections should be checked, and components should be properly inserted.
  2. Use a decoupling capacitor in the input voltage (Vin) to stabilize the voltage that goes in.
  3. Try experimenting with resistors that have different properties or use resistors with a lower tolerance.
  4. Try using a stable, regulated power supply instead of a battery.

If applying all these solutions didn’t make any improvement, then a more thorough circuit analysis might be needed. This includes understanding the operation of a comparator opamp and determining the practical limitations on the actual voltage range of the op-amp device being used (Electronics Tutorials, n.d.). But in this case, there’s no need to go over it thoroughly. Moreover, while breadboards are designed for prototyping, their limitations and disadvantages should also be acknowledged (Analog Devices, 2009).

PCB Design Layout (Autodesk Eagle)

For this project, through-hole components will be utilized in a single-layer board layout. This means that all traces must be on the bottom layer of the PCB. Designing a single-layer PCB may seem daunting at first, but with practice, it becomes easier.

schematic diagram in EAGLE
Figure 4: Eagle Schematic Capture

Components Placement

Figure 5: PCB Design Components Placement

PCB Board Layout/Traces

Figure 6: PCB Design Layout
  • Board Dimension: Height = 2 inches; Width = 2 inches
  • Wire Width: 32 mills

Note that design rule checks (DRC) and electrical rule checks (ERC) are performed to ensure that there are no errors or violations in the circuit design. Design rules can be adjusted depending on the manufacturer’s requirements and capability.

PCBWAY Gerber Viewer

Figure 7: PCB Design Layers

PCB Fabrication

Normally, the Gerber files, extracted from Eagle software, can be forwarded to a PCB manufacturer or “PCB house.” These files encompass critical details such as copper layers, solder masks, silkscreen, and other important design features. For this project, the school’s in-house manufacturing facility undertakes the PCB fabrication process.

Figure 8: Actual Fabricated PCB

The problem, however, is some important details are left out, such as the solder mask and top silkscreen which indicates the proper orientation of the components. This is not a problem if the person who will solder the component knows every detail of the circuit’s PCB design.

But overall, in this project, the functionality is more important. To be fair, the board still looks professional and good for building permanent prototypes. Therefore, it’s decided to continue with the soldering process with the obtained fabricated board.

When choosing a PCB manufacturing company, it’s essential to keep factors like cost, lead time, quality, and special requirements in mind. Here are some recommended companies that produce professional-looking PCB boards.

  • JLC PCB
  • PCBWAY

PCB Soldering

Figure 9: PCB and Components for Soldering
Figure 10: Workstation

Tip: A “helping hand” tool is a great tool that holds the board and makes the soldering process more comfortable.

Figure 11: PCB Soldering Process
Figure 12: PCB Board with a helping hand

Final PCB Board

Figure 13: Final PCB Board with Soldered Components

After soldering all the components, a final visual inspection is conducted to check for component orientation, cold solder joints, and insufficient solder. Additionally, a continuity test is performed on every trace in the circuit to check if there is a complete electrical path between two points. A continuity test helps ensure that there are no unintended connections (shorts) or open circuits in the soldered connections.

Bill of Materials

QuantityDeviceDescriptionPart NamePrice
1LM324NIC OPAMP GP 4 CIRCUIT 14DIPIC$1.95
1R-US_0207/10RES 8.2KΩ 5% 1/4WR1$1.95
1R-US_0207/10RES 3.3KΩ 5% 1/4WR2
1R-US_0207/10RES 2.2KΩ 5% 1/4WR3
1R-US_0207/10RES 3.9KΩ 5% 1/4WR4
1R-US_0207/10RES 2.4KΩ 5% 1/4WR5
4R-US_0207/10RES 1KΩ 5% 1/4WR6, R7, R8, R9
4LED5MMLED RED DIFFUSED 5MMLED1, LED2, LED3, LED4$1.95
1PINHD-1X2PINHEADER 2.54MMVCC 
1W237-02PTERM BLK 2P SIDE ENT 5.08MMVIN$1.32
1C-US050-024X044CERAMIC CAP 10UFC1$1.95

Discussion of Results

This project has provided us with a detailed understanding of the operation of comparators in electronic circuits. Most importantly, it has allowed us to gain knowledge and proficiency in utilizing various software programs to simulate electronic circuits and create intricate printed circuit board (PCB) designs.

In addition, this project highlighted the crucial role of practical experience and experimentation in circuit design and implementation. For instance, we have learned that it is crucial to assemble the circuit in the breadboard initially and test it to ensure its proper functioning before proceeding to soldering and final fabrication.

The overall project was an invaluable learning experience for us. We gained insights into the behavior of electronic components in real-world scenarios.

References

MT-100: Breadboarding and prototyping techniques – analog … (n.d.). https://www.analog.com/media/en/training-seminars/tutorials/MT-100.pdf

Storr, W. (2022a, August 2). Op-amp comparator and the op-amp comparator circuit. Basic Electronics Tutorials. https://www.electronics-tutorials.ws/opamp/op-amp-comparator.html

Sachs, J. (n.d.). Tolerance analysis. EmbeddedRelated.com | Embedded Systems. https://www.embeddedrelated.com/showarticle/1353.php

Share this: