Building a Resistor Color Code Calculator and Ohmmeter with Arduino

For this project, I built a handheld resistor color code calculator and ohmmeter using the ATmega328 microcontroller and a 1.8-inch color LCD display. For our project, we will create an Arduino-based ohmmeter that can also serve as a resistor color code calculator, visually mimicking the popular online resistor color code calculator from All About Circuits.

PART

1

Project Overview

The brain of the system is an ATmega328 microcontroller (Arduino UNO). We will also use:

1. A small TFT LCD display.

2. Six buttons for interacting with a simple GUI,

3. CD4051 multiplexer/demultiplexer

4. Eight different resistors for switching between measurement ranges.

Similar to several of my previous projects, I created a dedicated All About Circuits branded PCB for this device; however, you can also replicate this project using a breadboard or perfboard.

This project is intended to be both fun and educational. There are more accurate and reliable ways to test your components, as even the cheapest multimeters may give you better results. The typical tolerance for resistors is 5%, and the resolution of the ATmega328’s ADC is only 10 bits. So, our accuracy will be less than that of a good ohmmeter.

PART

2

Resistor Color Code

The resistor color code system was originally developed by the Radio Manufacturers Association in the 1920s to provide a visual indication of resistor values and ratings (Figure 1).

Building a Resistor Color Code Calculator and Ohmmeter with Arduino

Figure 1. Resistor color code chart. Image provided by EEPower

The color code calculator we will build in this project only covers four-band resistors. For these types of components, the first two bands represent the two most significant digits of the resistor value, the third band represents the decimal multiplier, and the fourth band indicates the tolerance value expressed as a percentage.

PART

3

What is an Ohmmeter?

An ohmmeter is an essential tool in every EE lab; it is an instrument used to measure resistance, which can be either a standalone unit or part of a multimeter. It requires an internal voltage source to produce the necessary operating current, as well as appropriate range resistors to effectively measure the device under test.

While there are various types of ohmmeters, this project uses a simple voltage divider. A voltage divider is a circuit where the input voltage across two resistors connected in series is proportional to the ratio of the two resistors.

We will switch between multiple known range resistors connected in series with the unknown resistor (the one being measured), and use Ohm’s law to calculate its value based on the measured output voltage and the known input voltage.

PART

4

Circuit Design

Figure 2’s schematic shows us how to connect all the components of this project’s breadboard or PCB version together. If you are using a development board, ensure that your components match the pin configuration in the code.

Building a Resistor Color Code Calculator and Ohmmeter with Arduino

Figure 2: Schematic of the resistor color code calculator and ohmmeter.

Since I am not using a voltage regulator, it is best to use a device that plugs into a regulated 5V power supply. My PCB uses a dedicated USB B port that can be plugged into a computer, phone charger, or power bank, making it portable.

Graphical Display and User Interface

Our system uses a series of seven nested screens (dedicated functions) that can appear on a 128×160 TFT LCD as its basic graphical user interface (GUI). The illustrations for these screens are generated by directly drawing alphanumeric characters and basic shapes on the display using Adafruit’s GFX and ST7735 libraries. The ST7735 is the display driver chip embedded in the 1.8-inch TFT LCD module used in this project.

Note: The shapes are combined into graphics because using bitmaps converted to Arduino code would impair system performance.

Control

Each screen of our GUI can respond to up to six tactile buttons. On the dedicated PCB, the outer two are labeled ‘Select’ and ‘Back’, while the inner four are marked with left, right, up, and down arrow symbols. These buttons form the controls for navigating the menu, selecting menu items, and returning to the previous screen.

Main Menu

Initialize the screen as its main menu. This part of the GUI prompts the user to choose between one of two main functions—ohmmeter or color code calculator (Figure 3). For this menu, I decided to place an All About Circuits logo above the two menu items, recreating it using several interconnected rounded rectangles.

Main Menu for the Ohmmeter and Resistor Color Code Calculator Functions

Select

Building a Resistor Color Code Calculator and Ohmmeter with Arduino

Figure 3. Main menu for selecting the ohmmeter and resistor color code calculator functions

Navigation and Selection

Each screen of our system contains multiple selectable menu items displayed as rounded rectangles. To navigate these items, each menu has an additional outline rectangle that can be moved up or down using the four navigation buttons.

By clicking the ‘Select’ button in the menu, our code determines what item the user has selected from that menu by checking the current position of the outline rectangle and the corresponding outline item.

Switching between menus is implemented internally using a flag variable that tracks what needs to be displayed on the LCD based on the user’s selection. That is, in the next iteration of the Arduino code loop, it determines which of the seven screen functions needs to be called.

Ohmmeter Application

The second screen in our system is a self-contained ohmmeter application, as shown in Figure 4. The top of this screen displays the value of the measured resistor and the selected measurement range. The bottom of the screen shows eight selectable ranges, corresponding to the values of each range resistor connected to the output of the CD4051 chip.

Main Screen of the Ohmmeter

Building a Resistor Color Code Calculator and Ohmmeter with Arduino

Figure 4. Main screen of the ohmmeter

In our project, we use the CD4051 as a demultiplexer and address it using three pins from the ATmega328. Doing so allows us to digitally select one of the eight output channels from the CD4051, physically connecting the range resistor to the unknown resistor at its input, completing our voltage divider circuit.

Once a range is selected from the GUI, the microcontroller addresses the multiplexer and measures the output voltage of the voltage divider on one of its analog pins. From here, it calculates the unknown resistance based on the formula discussed earlier and displays its measurement value on the system’s LCD.

To understand how to correctly select or calibrate the measurement range, you should refer to AAC’s Intro Lab—How to Measure Resistance with an Ohmmeter article.

Resistor Color Code Calculator Application

The third screen in our system is the resistor color code calculator application (Figure 5). This screen is divided into three parts, leading the user to four additional nested menus.

Main Screen of the Resistor Color Code Calculator

Building a Resistor Color Code Calculator and Ohmmeter with Arduino

Figure 5. Main screen of the resistor color code calculator

The top of this screen displays a four-band resistor based on All About Circuits’ resistor color code calculator, recreated using a series of differently sized and colored rectangles. On this image, the four rectangles representing the resistor color bands can dynamically switch colors based on user input.

The bottom right section contains four menu items, one for each color band, leading the user to additional menu screens, while the bottom left section contains the application title and the calculated results of the selected color band sequence (resistor value and tolerance).

To set the color bands, the user must first enter one of the four additional menu screens. These screens consist of an appropriate title and a series of colors or menu items (as shown in Figure 6). Each time the user selects a color from these menus, the system saves it to that specific band, returns to the previous screen, changes the color of that band on the resistor illustration, and inputs its value into the color code calculator formula.

First Band Selection Screen of the Resistor Color Code Calculator

Building a Resistor Color Code Calculator and Ohmmeter with Arduino

Figure 6. First digit color band selection screen of the resistor color code calculator

In this way, the resistance and tolerance of the currently depicted band sequence on the displayed resistor will be calculated and shown in the lower left corner of our resistor color code calculator screen.

Uploading Code

Once you have everything connected, you will need to upload the code to your microcontroller. If you are using a standard Arduino or similar development board, this process is straightforward—simply plug in the USB connector, select your board and the corresponding COM port, and click the upload button. You can download the Arduino code from GitHub.

On the other hand, if you want to recreate this project as a standalone system using my PCB design, you will need an additional USB to serial module to program the ATmega328 IC according to the breadboard article from Arduino.

PART

5

Bill of Materials and PCB Files

Table 1 contains the bill of materials (BOM). You can download the PCB board files.

Building a Resistor Color Code Calculator and Ohmmeter with Arduino

Table 1. Bill of materials for the resistor color code calculator and ohmmeter

Follow the Video Account – EEPW Chip Perspective

Building a Resistor Color Code Calculator and Ohmmeter with Arduino

Understand chip trends and insights

Building a Resistor Color Code Calculator and Ohmmeter with Arduino
↓↓↓↓ ClickRead the original text, viewmore news

Leave a Comment

×