Board Hardware Revision using one ADC pin (REV1️⃣, REV2️⃣, REV3️⃣)
Summary
When you design a board mostly you have several iterations, when you fix bugs and make improvements 😄
But if board has programming side you might want to have only one firmware for all released boards (especially if it's not just engineering samples, but already
Electrical Schematic
As you can see it's just a voltage divider, that can be connected to the same power rail voltage, as you MCU (e.g. 3.3V).
The required voltage could be easily obtained using standard E24 5% resistors.
| Tip: For battery powered-device connect it to the switchable bus (load switch or LDO with EN pin) to turn off during low power mode and enabling only when do revision reading) |
For this purposes you can use this simplest high-side load switch: https://refcircuit.com/articles/842-high-side-p-channel-load-switch-on-discrete-components.html
![]() |
Simulation
Using Microcap 12 (really powerful schematic simulator) you can see how different resistor values affect on output voltage, that represent board revision.
REV5, ADC=1016 | REV8, ADC=1737 | REV14, ADC=3325 |
Board
If you use two 0603/0402 resistors doesn't take up much space (approximately 1.89 mm x 1.86 mm with using 0402 (1005 metric) resistors):
Code implementation (C language)
|
Code implementation (C++ language)
|
The difference between C and C++ only in included libraries.
| Tip: load ADC value (0-4095) to getHwRev function and it return revision number. |
Code tests
It works good, you can test it with any online code service, even without MCU:
| Test 1 (REV5) | Test 2 (REV8) | Test 3 (REV14) |
![]() | ![]() | ![]() |
Real device example
LCR Meter (UPD: 09/10/2025)
This is a LCR meter LT1 from ALIENTEK:
BMS (UPD: 01/21/2026)
Conclusions
- Using hardware revision give a chance to clearly and easy identify board version using code, which is could be very useful for the programming (especially remote).
- Hardware revision give a chance to maintain different board revisions (releases) using only one firmware
- Connection resistors divider to the controlled power bus to give a change of turn off it from powering, when device powered from battery
- Comments








