In electronics and digital logic, an octal is a base-8 numbering system using digits 0 through 7 where each digit maps perfectly to a three-bit binary sequence, though on the physical workbench, the word also describes standard 8-pin relay packages.
If you are reading a microcontroller datasheet or programming a legacy PLC, 'octal' refers to the mathematical base-8 system. If you are wiring an industrial control panel, 'octal' refers to the physical 8-pin socket you plug a DPDT relay into. Confusing the two is a common rite of passage for junior technicians, but understanding both is mandatory for reading schematics and debugging I/O logic. This guide breaks down exactly what the octal system changes in your code, how to map it, and how to wire the physical hardware that shares its name.
The Core Definition: Base-8 Math vs. 8-Pin Hardware
To understand what an octal is, you have to separate the software theory from the bench hardware. In digital systems, we use binary (base-2) because transistors are either ON (1) or OFF (0). But reading long strings of 1s and 0s is impossible for humans. We group them.
- Hexadecimal (Base-16): Groups binary into 4-bit nibbles (0-F). This is the standard for memory addresses and 8/16/32-bit registers.
- Octal (Base-8): Groups binary into 3-bit clusters (0-7). This is used when hardware naturally groups in threes, or in legacy systems with 12-bit/24-bit word lengths.
What people commonly confuse octal with is hexadecimal. Hex uses 16 symbols (0-9, A-F) and maps to 4 bits. Octal uses only 8 symbols (0-7) and maps to 3 bits. If you see a number prefixed with 0x, it is hex. If it is prefixed with a leading zero like 0755 or 0o326, it is octal.
How Octal Mapping Works (Worked Numeric Example)
Let us look at a real-world scenario where octal saves you from mental math fatigue. Suppose you are reading an 8-bit PORT register on an AVR microcontroller, and the pins are connected to three sets of RGB LEDs (which naturally group in 3s: Red, Green, Blue).
Your multimeter or logic analyzer reads the PORTB register as binary 11010110.
Step 1: Pad the binary string to a multiple of 3.
Since 8 bits do not divide evenly by 3, we add a leading zero:
011 010 110
Step 2: Convert each 3-bit cluster to its decimal equivalent (which is identical to its octal digit).
| 3-Bit Cluster | Binary Math | Octal Digit |
|---|---|---|
| 011 | 0 + 2 + 1 | 3 |
| 010 | 0 + 2 + 0 | 2 |
| 110 | 4 + 2 + 0 | 6 |
Step 3: Combine the digits.
The octal value is 326.
If you used hexadecimal, you would group by 4s: 1101 (D) and 0110 (6), giving you 0xD6. While 0xD6 is great for memory addressing, it completely obscures the 3-bit hardware boundaries of your RGB LEDs. Octal preserves the physical grouping of the hardware in the software representation. For a deeper dive into base conversions, the All About Circuits Digital Textbook provides excellent foundational tables for binary, octal, and hex mappings.
Where You Meet This in Practice
You will encounter the term 'octal' in three distinct areas of electrical and electronic work. Knowing which one applies to your current task prevents costly wiring errors and debugging dead-ends.
1. PLC I/O Addressing (Legacy and Modern)
In industrial automation, Programmable Logic Controllers (PLCs) map physical inputs and outputs to memory addresses. Legacy Allen-Bradley PLCs (like the SLC 500 series) famously used octal addressing for I/O. An input card with 16 points would be addressed as I:0.0 through I:0.7, and then jump to I:0.10 through I:0.17. Notice there is no I:0.8 or I:0.9. If you try to force an address ending in 8 or 9 in an octal-mapped PLC, the compiler will throw a syntax error. Modern IEC 61131-3 systems lean toward decimal or hex, but you will still see octal in older plant retrofits.
2. Physical 8-Pin 'Octal' Relays
On the jobsite, an octal relay refers to a plug-in DPDT (Double Pole, Double Throw) relay with 8 pins. The gold standard here is the Omron LY series or generic 10A 8-pin equivalents. The pinout is strictly standardized:
- Coil: Pins 2 and 7
- Pole 1: Pin 1 (Common), Pin 4 (NC), Pin 3 (NO)
- Pole 2: Pin 8 (Common), Pin 5 (NC), Pin 6 (NO)
3. Microcontroller and Unix Permissions
If you are writing firmware that interacts with a Linux-based embedded system (like a Raspberry Pi), you will use octal to set file and GPIO permissions. The command chmod 755 uses octal. The '7' means Read(4) + Write(2) + Execute(1) = 7. Because permissions are grouped in threes (User, Group, Others), base-8 is the mathematically perfect system for representing them.
Decision Path: Should You Use Octal, Hex, or a Physical Base?
When designing a system or reading a schematic, use this decision tree to determine which 'octal' concept applies and what your concrete next step should be.
| Your Scenario | What Changes in the System | Concrete Pick / Action |
|---|---|---|
| Reading 3-bit grouped I/O sensors (RGB, 3-phase status) | Mental math load and code readability | Use Octal (Base-8). Format your C/C++ printf statements with %o to view registers in 3-bit clusters. |
| Addressing memory, 4/8/16-bit registers, or I2C addresses | Pointer arithmetic and memory alignment | Use Hexadecimal (Base-16). Stick to 0x prefixes; octal will cause misalignment on 8-bit boundaries. |
| Wiring a standard industrial control panel relay | Physical pinout and terminal torque | Buy an Omron LY2N-J. Wire pins 2/7 to the coil, and use 14 AWG ferrules for the 1/8 and 3/6 NO/NC contacts. |
| Setting Linux/Microcontroller file or GPIO permissions | Access control and security boundaries | Use Octal. Execute chmod 644 for read-only files, or chmod 755 for executable scripts. |
The Default Recommendation: If you are purely writing embedded C code for standard 8-bit or 32-bit microcontrollers (like an STM32 or ATmega328P), default to Hexadecimal for all register manipulation. Reserve Octal strictly for Unix permissions or when interfacing with legacy 3-bit/12-bit hardware. If you are holding a physical component with 8 pins, you are holding an octal relay—grab the Omron datasheet and wire pins 2 and 7 to your coil supply.
Frequently Asked Questions
Why did early computers use octal instead of hex?
Early mainframes like the PDP-8 used 12-bit word lengths. Because 12 divides perfectly by 3 (yielding four octal digits) but not by 4 (which would yield three hex digits), octal was the most efficient way to represent the entire word length without wasting digits. When the industry standardized on 8-bit, 16-bit, and 32-bit architectures (which divide cleanly by 4), hexadecimal took over.
Can I plug a 14-pin relay into an 8-pin octal base?
No. A 14-pin relay (typically a 4PDT configuration) requires a 14-pin socket. The physical keying and pin spacing on an octal base are designed specifically for 8-pin layouts. Forcing a mismatch will bend the pins and destroy the relay.
How do I test an octal relay coil with a multimeter?
Set your multimeter to the resistance (Ohms) setting. Place the probes on pins 2 and 7 of the unplugged relay. A standard 24VDC Omron LY2N coil will read approximately 650 ohms. A 120VAC coil will read much higher, typically around 4,000 to 5,000 ohms. If your meter reads 'OL' (Open Loop), the internal coil wire is broken and the relay must be replaced.
Is octal still used in modern PLC programming?
While modern IEC 61131-3 environments like CODESYS or TwinCAT rely heavily on decimal and hex, legacy Allen-Bradley RSLogix 500 systems still enforce octal I/O addressing. If you are maintaining a plant built in the 1990s or early 2000s, you must understand octal to map physical I/O to software tags correctly.






