500 binary is the base-2 representation of the decimal integer 500 (111110100), a 9-bit sequence that frequently serves as a critical mid-scale threshold in 10-bit Analog-to-Digital Converter (ADC) readings and Pulse Width Modulation (PWM) duty cycle registers on microcontrollers. When you write this value to a hardware register, it directly changes the physical output of your circuit—specifically, it sets a PWM duty cycle to roughly 48.8% or maps to an analog input voltage of approximately 2.44V on a standard 5V system. Beginners most commonly confuse 500 binary with standard 8-bit register limits (which cap at 255 and cause data truncation) or with Binary Coded Decimal (BCD), which represents the digits 5, 0, and 0 in separate 4-bit nibbles rather than as a single continuous mathematical value.
The Math and Registers Behind 500 Binary
To understand how a microcontroller processes 500, you have to look at the silicon level. The decimal value 500 requires exactly 9 bits to represent. Because microcontrollers process data in 8-bit, 16-bit, or 32-bit chunks, a 9-bit value must be housed inside a wider register.
On an 8-bit architecture like the ATmega328P (the chip on the Arduino Uno), the 10-bit PWM and ADC hardware registers are actually split across two 8-bit memory addresses (e.g., OCR1AH and OCR1AL). The compiler handles the bit-shifting, but understanding the binary layout prevents debugging nightmares.
| Bit Position | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|
| Binary Value | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 |
| Decimal Weight | 256 | 128 | 64 | 32 | 16 | 0 | 4 | 0 | 0 |
11110100) are transmitted or stored first, followed by the upper bits (00000001).
Worked Numeric Example: 500 on a 10-Bit System
Let us run the exact math for pushing 500 binary through a 10-bit system, which has a maximum decimal value of 1023 (binary 1111111111). We will assume a standard 5.0V reference voltage, which is the default for the Arduino Uno's AVCC pin.
Scenario: You want to output a specific analog-equivalent voltage using analogWrite() on a PWM pin, and your target value is 500.
- Duty Cycle Calculation: 500 / 1023 = 0.4887 (or 48.87%).
- Average Voltage Output: 0.4887 * 5.0V = 2.443V.
- Time High (at 490Hz default PWM): The period is ~2.04ms. The pin will stay HIGH for ~0.997ms and LOW for ~1.043ms per cycle.
If you measure this pin with a true-RMS multimeter set to DC voltage, you will read approximately 2.44V. If you measure it with an oscilloscope, you will see a 5V square wave with a 48.87% duty cycle. The physical hardware does not output a 'smooth' 2.44V; it rapidly switches between 0V and 5V, and the inductance of a motor or the capacitance of an LED driver smooths it out.
Where You Meet This in Practice
You will encounter the value 500 in embedded systems primarily in two domains: sensor thresholding and actuator control.
1. ADC Mid-Scale Thresholding
When reading a voltage divider connected to a thermistor or a potentiometer, a 10-bit ADC returns values from 0 to 1023. A reading of 500 indicates the input voltage is sitting almost exactly at the midpoint of your reference voltage. In code, you might use 500 as a deadband center point for a joystick axis:
int rawX = analogRead(A0);
int offsetX = rawX - 500; // Center the joystick reading around zero
if (abs(offsetX) < 15) offsetX = 0; // Apply a 15-unit deadband to stop drift
2. PWM Motor Speed Control
When driving a DC motor via an H-bridge (like the L298N or DRV8871), writing 500 to the PWM enable pin delivers roughly half power. Safety caveat: Always ensure your H-bridge has flyback diodes installed when switching inductive loads like motors, or the back-EMF will destroy your microcontroller's GPIO pins.
Common Pitfalls and Bit-Width Collisions
The most frequent way 500 binary ruins a project is through data type truncation. Because 500 requires 9 bits, it cannot fit inside a standard 8-bit unsigned integer (uint8_t or byte), which maxes out at 255.
If you accidentally cast 500 into an 8-bit variable, the compiler drops the 9th bit (the 256 weight). The math works out to a modulo operation: 500 mod 256 = 244. The binary 11110100 is what actually gets written to the hardware register. Instead of your expected 48.8% duty cycle, your circuit receives a 23.9% duty cycle. Your motor runs at half the speed you intended, or your LED is noticeably dimmer.
uint16_t (or standard int on 8-bit AVRs) when storing or manipulating ADC readings and PWM values that exceed 255.
Another collision happens when migrating code from an Arduino Uno to an ESP32. The ESP32-WROOM-32 features a 12-bit ADC (0 to 4095). If you port a threshold check that triggers at 500, you are no longer checking for a mid-scale 2.44V. On the ESP32's 12-bit scale (assuming 11dB attenuation and a ~2.5V full-scale range), a reading of 500 represents roughly 0.30V. You must scale your thresholds by a factor of 4 (i.e., change 500 to 2000) to maintain the same physical voltage trigger.
Frequently Asked Questions
Why does my 8-bit microcontroller output the wrong value when I write 500 binary?
This is caused by integer overflow and truncation. An 8-bit register can only hold values from 0 to 255. When you force the decimal value 500 (binary 111110100) into an 8-bit space, the most significant bit (the 9th bit, representing 256) is chopped off. The remaining 8 bits are 11110100, which equals 244 in decimal. Your hardware executes 244, not 500. Always use 16-bit variables (uint16_t) for 10-bit ADC and PWM operations.
How do I convert an ADC reading of 500 to actual voltage?
Use the formula: Voltage = (ADC_Value / Max_ADC_Value) * Reference_Voltage. For a 10-bit system with a 5.0V reference, the math is (500 / 1023) * 5.0 = 2.443V. For a 12-bit system (like the ESP32) with a 3.3V reference, the math is (500 / 4095) * 3.3 = 0.402V. Always verify your microcontroller's specific bit-depth and VREF pin voltage before calculating.
What is the difference between 500 binary and 500 BCD (Binary Coded Decimal)?
Standard 500 binary is a single mathematical value represented as 111110100. BCD, however, encodes each decimal digit into its own 4-bit nibble. In BCD, the number 500 is written as 0101 0000 0000 (where 0101 is 5, 0000 is 0, and 0000 is 0). BCD is used in real-time clock (RTC) modules and 7-segment display drivers, but it will yield completely incorrect results if fed into a standard PWM or DAC register expecting pure binary.
Can I use 500 as a threshold for a 12-bit ESP32 ADC?
You can, but it will not represent the mid-scale voltage it does on a 10-bit Arduino. On an ESP32, the ADC ranges from 0 to 4095. A threshold of 500 represents the lower 12.2% of the scale. If your goal is to detect when a sensor crosses the halfway point of its voltage range, you need to change your threshold to 2048 (or roughly 2000, accounting for the ESP32's known ADC non-linearity at the extreme high end of the scale).






