Easy way to identify the PCB version electronically (i.e. by the onboard micro) - Page 1
Forum section: electronics / projects

author: ricko_uk
author_rank: Super Contributor
timestamp: March 17, 2022, 06:34:01 pm
content: Hi,I would like to have the variant and version of a PCB to be identifiable by the micro that is on the board itself (so it can be displayed on the LCD part of the system). Without need to custom program that info in the micro itself and without using more than one pin?The simplest way I thought of was to have a voltage divider fed into the micro's ADC and with every variant and version having a different/unique value.Any other suggestion?Thank you

author: wraper
author_rank: Unknown
timestamp: March 17, 2022, 06:36:52 pm
content: Quote from: ricko_uk on March 17, 2022, 06:34:01 pmA lot of commercial hardware does exactly this. For example GPU in graphics cards often detect what type of VRAM is used by resistance value of a resistor soldered. And if during repair you change RAM to another vendor, you need to change the resistor as well.

author: Swake
author_rank: Frequent Contributor
timestamp: March 17, 2022, 10:40:33 pm
content: That one pin could also read pulses, with a different patern or frequency indicating a different board. Extra bonus points if you implement a PWM with a 555.Alternative to a voltage divider is a zener.

author: ricko_uk
author_rank: Super Contributor
timestamp: March 18, 2022, 01:01:36 am
content: Thank you Wraper and Swake

author: DavidAlfa
author_rank: Super Contributor
timestamp: March 19, 2022, 05:38:01 am
content: Unless you're going to have a lot of revisions, just make a voltage divider and read it using the ADC at boot.Have a lookout table with ranges, knowing which ADC values match each revision.Then just change the divider ratio in the pcb.

author: ricko_uk
author_rank: Super Contributor
timestamp: March 19, 2022, 11:52:27 pm
content: Thank you DavidAlfa and barycentric

author: firehopper
author_rank: Frequent Contributor
timestamp: March 20, 2022, 12:56:35 am
content: could also use a one wire eeprom maybe. could store other info in it as well.

author: MegaVolt
author_rank: Frequent Contributor
timestamp: March 21, 2022, 12:18:52 pm
content: To expand the number of options, you can use the drawing on the board, the same as for the divider. Further on each of the 2 positions you can bet:- Leave position empty- put a resistor- install a capacitorIn total, even for identical elements, we have more than 2 easily distinguishable options. You can create:- pullup- pull down- RC- CRThese circuits are easily detected digitally.Changing denominations will create 2 new variants. Just as easy to detect digitally.But I would advise to put the memory. This is very convenient and you can store not only the type of board, but also its personal number. And perhaps personal settings, constants and other information.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 21, 2022, 03:31:46 pm
content: Interestingly, the resistor/divider method is quite old: Tektronix has used this since the 60s(?) to identify scope probes. This is how the on-screen display automatically changes to x10, etc.(Or more recently, probes with actual data pins flanking the BNC. This might be anything from a 1-2 wire EEPROM to a full on power supply and serial bus for the more complicated probes. I forget what all they use in 'em these days; you'd have to look up the manuals.)And yeah, have seen plenty of things with jumpers or placement options to do this. Not uncommon at all, it's a preferred method I'd say.On the more esoteric side, I've contemplated putting structures into the PCB itself for identification -- also for DRM purposes if you will, to frustrate reverse-engineering of the system, say. Unfortunately, there's only about three or four ways to use a PCB for anything sensible:1. DC resistance. Copper is quite conductive, relative to the currents and voltages used by MCUs. You could sense a few mV here or there and perhaps identify the thing; but these are also very close to the LSB sizes, or offset voltages, of typical ADCs, so you might be making a lot of duds, too!2. Inductance or capacitance. Trace length or pad/pour area can accumulate capacitance, and this can be sensed as above (e.g. pull-up resistor + input threshold voltage as a crude time constant). Conversely, trace length and loop area can accumulate inductance, which is harder to sense as the impedances are again pretty low relative to bare MCUs, but some methods would still be practical.3. Transmission lines. The width and length of a trace corresponds to impedance and time, which can be read out directly in transient or frequency domains. Bonus points for making the TL structure your logo, so it's critical for device operation as well as visual identification!And of these, the first two are very limited in degrees of freedom: a resistor, capacitor, inductor, or network thereof, is one value for each element, and around... oh I don't know, probably circa N^2 values for N pins, including coupling factors between things? The last one has arbitrarily high degree of freedom, but is extremely bandwidth intensive, obviously (anything board-sized will take mere nanoseconds to propagate along!); you basically need a whole-ass TDR tester on the board itself. Good luck implementing that with an ordinary MCU and no suspicious (let alone expensive) circuitry!Also that most of these options will take up considerable board area, not at all suitable for compact / high density things. Also, long traces snaking their way through a board stack, are prone to picking up interference or coupling it to other things, making for an ever more difficult layout as density goes up.So, using assembled components, and not trying to enforce DRM or product selection through these means, is generally the best way to go.Tim

author: fchk
author_rank: Frequent Contributor
timestamp: March 21, 2022, 03:36:42 pm
content: Just to give you other ideas:Apple used 1-Wire devices for identifying Magsafe power supplies - serial number and wattage. The used a custom version of the DS2413 with Apple specific information programmed into the ROM.https://www.maximintegrated.com/en/products/interface/controllers-expanders/DS2413.htmlThe Macbook's system management controller could control the red/green led on the magesafe connector with the two GPIO pins that the DS2413-variant provides and can signal charging state or error states.There are many 1Wire devices that have EPROM, OTP and EEPROM storage.Microchip has got a 2kbit UNIO EEPROM with preprogrammed MAC address, which might also be useful for you. Microchip can also preprogram the user storage space of these chips for you if you buy a certain quantity.http://ww1.microchip.com/downloads/en/DeviceDoc/11AA02E48-11AA02E64-2K-UNIO-Serial-EEPROMs-Data-Sheet-20002122E.pdffchk

author: free_electron
author_rank: Super Contributor
timestamp: March 21, 2022, 03:50:36 pm
content: Quote from: T3sl4co1l on March 21, 2022, 03:31:46 pmcapacitive touch principle. they are essentially a relaxation oscillator driven by a gpio pin. depending on the size of the capsense surface the base frequency is different.your 'logo' is etched in copper and a specific size... muck up the logo and the oscillator is off.

author: wraper
author_rank: Unknown
timestamp: March 22, 2022, 07:10:28 am
content: Quote from: barycentric on March 19, 2022, 05:21:02 amNo, board revision is programmed into Broadcom SoC. EEPROM is only used in Pi4 for storing bootloader.

author: ricko_uk
author_rank: Super Contributor
timestamp: March 22, 2022, 04:12:00 pm
content: Thank you all!!

author: philpem
author_rank: Frequent Contributor
timestamp: March 22, 2022, 06:52:40 pm
content: One project I worked on had a 3x3 pad array. Three inputs to the MCU, each with three possible connections:- High- Low- FloatingThe STM32 chip we used had configurable weak pull-up and pull-down resistors. So on boot, it toggled the pull-ups on, read the pins, then did the same with the pull-down active.If the line is pulled high you'll see a '1' in both readsIf the line is pulled low you'll see a '0' in both readsIf the line is floating you'll see a '1' with the pull-up and a '0' with the pull-down.Once you have that, you convert the single pin value into either 0, 1, or 2 -- call it Vpin.For every version pin, calculate: Version = (Version * 3) + Vpin [Version starts at zero]It's an essentially zero-cost way of doing it -- and really is zero-cost if you do the versioning with PCB traces.I love the idea pitched elsewhere in the thread of fitting a capacitor - what a grand idea! Either way it gives you 3 states. Charge the capacitor, switch to input, wait a moment, see if the pin stays at '1'. Discharge it and repeat for confirmation. There's your third value - short high, short low, or capacitor.

author: ricko_uk
author_rank: Super Contributor
timestamp: March 23, 2022, 12:17:34 am
content: Thank you philpem,another interesting idea

author: DavidAlfa
author_rank: Super Contributor
timestamp: March 23, 2022, 12:42:29 am
content: Noobs. Connect a capacitor with a series resistor to an ADC pin. Set the pin as GPIO, output.Discharge it by setting the pin low for some time, then set it high, wait for a few uS, set pin as analog, read the ADC, then it's just matter of:

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 23, 2022, 11:14:38 am
content: Quote from: DavidAlfa on March 23, 2022, 12:42:29 amWhy waste your limited supply of ADC pins when you can use the input threshold itself as a 1-bit ADC?The downside being, the accuracy is shite (a combination of variations of input threshold and pullup/down resistances), but it's still enough to get a few bits of signal out of it: say, a decade per bit, logarithmically. So, from 100pF to 100nF say, that's six levels or about 2.5 bits.The method can be used for much more sensitive purposes, if self-calibration is allowed -- for example, using nothing but an LED (okay and maybe a current limiting resistor) as an entire communication system:https://www.merl.com/publications/docs/TR2003-35.pdfhttps://github.com/ChrisMicro/LedDataTransmissionTim

author: wraper
author_rank: Unknown
timestamp: March 23, 2022, 11:25:57 am
content: Quote from: barycentric on March 23, 2022, 06:15:21 amI don't think HATs useOTPI2C memory as it's basically non existent. Neither it's used for internal purposes but rather for external identification, similar to PC DRAM, VGA, DVI and others.

author: DavidAlfa
author_rank: Super Contributor
timestamp: March 23, 2022, 11:53:32 am
content: Quote from: T3sl4co1l on March 23, 2022, 11:14:38 amOh c'mon It was just a joke. That would be insanely overcomplicated

author: Jeroen3
author_rank: Super Contributor
timestamp: March 23, 2022, 12:37:04 pm
content: Just put a one wire or i2c memory on there.When it is unprogrammed your board does nothing. During testing you scan the barcode and the board gets programmed with the right info, serial number, dates, macs, options, lcd protocol, all the stuff you may need in the future anyway that a voltage divider can't give you. Plus, you don't need to recompile the code when you make a new version (eg: board rev change to skip around part shortage without change in function).

author: free_electron
author_rank: Super Contributor
timestamp: March 23, 2022, 08:17:09 pm
content: Quote from: DavidAlfa on March 23, 2022, 12:42:29 amnoob .no need for a resistor or capacitor. make an embedded capacitor in the board. I wrote that several posts ago. its the principle of a touch sensor