Best way to select the ID of each board? - Page 1
Forum section: electronics / projects

author: mrburnzie
author_rank: Regular Contributor
timestamp: September 16, 2019, 12:05:18 am
content: Hi!I'm working on a project where I have 100+ boards. All of them will have unique ID (1-100).What is the best way to assign these unique IDs using hardware?My idea was to have one switch on each of them, and the master which communicates with them wirelessly sends out the "configured ID", and the node which has the switch ON will assign itself to the received "configured ID". Others won't do anything.Any suggestions?

author: SiliconWizard
author_rank: Super Contributor
timestamp: September 16, 2019, 12:13:28 am
content: To begin with, if your ID range is 1-100, how is that going to work to get unique IDs for more than 100 boards (which is what 100+ would imply)?And now that's settled, do you absolutely need to be able to set a specific ID for each board, or does it just need to be unique? In the latter case, my favorite approach is to use some kind of ID chip, like such:https://www.microchip.com/ParamChartSearch/chart.aspx?branchID=7046absolutely no individual configuration needed at production time.

author: mrburnzie
author_rank: Regular Contributor
timestamp: September 16, 2019, 12:16:12 am
content: Quote from: SiliconWizard on September 16, 2019, 12:13:28 amHaha, the testing would be done on 100 devices but it can go up to 300, so I didn't want to exaggerateThis is a one time, custom thing. These devices should be configured once, but just to be sure I want to add an option to change the ID. I would like to have them labeled as numbers

author: MarkF
author_rank: Super Contributor
timestamp: September 16, 2019, 12:19:24 am
content: Do they each have a micro-controller on them?Burn the ID into its EEPROM. Then have the program use the ID when receiving messages.The EEPROM can be changed independent from the program space.

author: mrburnzie
author_rank: Regular Contributor
timestamp: September 16, 2019, 12:21:36 am
content: Quote from: MarkF on September 16, 2019, 12:19:24 amGreat idea! The thing is that I'm giving these devices to a client who has no experience with burning EEPROMI want to give the client the freedom to easily change the ID of each device.Btw. yes on the microcontroller.

author: coromonadalix
author_rank: Super Contributor
timestamp: September 16, 2019, 12:27:47 am
content: a dallas one wire eeprom ?? you have easy and free software to do so ??

author: mrburnzie
author_rank: Regular Contributor
timestamp: September 16, 2019, 12:29:36 am
content: Quote from: coromonadalix on September 16, 2019, 12:27:47 amThe microcontroller already has its own eeprom. What do you mean by easy and free software? Easy microcontroller integration or easy program that the client can use?

author: ledtester
author_rank: Super Contributor
timestamp: September 16, 2019, 12:38:45 am
content: Quote from: mrburnzie on September 16, 2019, 12:21:36 amUse some DIP switches:Two of the hexadecimal switches can configure 256 addresses.

author: mrburnzie
author_rank: Regular Contributor
timestamp: September 16, 2019, 12:39:52 am
content: Quote from: ledtester on September 16, 2019, 12:38:45 amokay what is the best option to assign 300 different ones with dip?

author: ledtester
author_rank: Super Contributor
timestamp: September 16, 2019, 12:48:08 am
content: You can get the DIP switches in various configurations:https://irishelectronics.ie/Electronic-Components/Page-/-Category-11/DIP-SWITCHESFor 300 addresses you would need 9 bits controlled by switches. You can use three of the hexadecimal switches, or two hexadecimal switches plus a 2-position switch.For a cheaper solution use a 9 position dual row header and make connections with jumpers:But let's back up a bit... why would the customer want to change the address? Doesn't that just give them the opportunity to mess things up if they give the same address to two boards?

author: mrburnzie
author_rank: Regular Contributor
timestamp: September 16, 2019, 12:52:03 am
content: Quote from: ledtester on September 16, 2019, 12:48:08 amOkay not a bad option, will look into it more. Thanks!QuoteTotally agree with you. They requested that feature.

author: ledtester
author_rank: Super Contributor
timestamp: September 16, 2019, 01:51:46 am
content: Quote from: mrburnzie on September 16, 2019, 12:52:03 amI'd go back to the customer and figure out why they think they need to change addresses. Seems like they have a different idea of what the address is used for. There should be another mapping in software from "identity" to actual hardware device.

author: IDEngineer
author_rank: Super Contributor
timestamp: September 16, 2019, 06:05:02 am
content: Keep it simple: Solder bridges on pairs of pads on the PCB. Costs $0 and can be changed in the field, but not accidentally, not vibration sensitive, etc.

author: AndyC_772
author_rank: Super Contributor
timestamp: September 16, 2019, 07:11:26 am
content: I wouldn't fancy setting up DIP switches on 100+ boards without ever making a mistake, and certainly wouldn't want to solder that many links by hand.All you need is a way to uniquely identify one board at a time, so it can then become the only unit which responds to a "set ID" message from the master. The master can increment a counter to set IDs sequentially without repetition, or it can assign a single, nominated ID (so you can replace individual units and have the new one keep the same ID as the old one).Perhaps in this case you could have a single pushbutton, with some logic along the lines of "if the button is pushed within 10 seconds of power-up, request a new ID from the master".Then all you need is for each slave board to store its ID, and every non-trivial microcontroller has EEPROM or Flash that can be used for this purpose.My favourite design in this respect was a magnetic sensor, which used multiple, 'smart' sensor boards on a common bus. The criterion for assigning an ID to each board was "if you can see a magnet, and don't already have an ID, then request one from the master". Assigning IDs was a simple as putting the system into configuration mode, then swiping a magnet along the length of the bus. Total time required, about 5 seconds if you type slowly.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: September 16, 2019, 07:41:22 am
content: Unless the board has enough of a user interface to set IDs with a couple of buttons, I pretty much always use DIP switches.The main reason is long-term maintenance.You set up a system, and have some spare boards left on-site as part of a service kit. In 5 years' time, when something dies and needs fixing, chances are that documentation has been lost, whoever installed it can't be contacted, or if they can, doesn't remember the details, or any special-purpose setup software borks on the current version of windows etc. etc.With DIP switches, you just pull a board from the spares kit, set the DIP switches the same as the one being replaced, job done.Bonus points if you'd stuck labels at each board location ( NOT on the boards) with the switch settings for that location.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: September 16, 2019, 07:55:01 am
content: Quote from: AndyC_772 on September 16, 2019, 07:11:26 amI've used systems like this a few times, it's particularly useful where a node ID needs to be associated with a physical location, more so if the same kit needs to be re-installed multiple times.It can actually be even simpler, and also work where comms are primarily 1-way ( like LED nodes) by instead of requesting an ID from a master, the message from the master says "If you can see your local switch (or whatever) being actuated, set your ID to <xx>"Even with 1-way comms, this can be automated if there is any way for the master to detect that the ID program has been successful to increment the ID - this can often be done by looking for changes in power draw - e.g. a LED node turning on or off after it sets its new ID, or the node MCU drawing more current by temporarily changing its clock rate or going to sleep.I've done this using all sorts of local actuators including buttons, touch pads, contact pads, light sensors, accelerometers, and in one case, a high-frequency high voltage signal from a CCFL inverter on the end a long stick that gets waved near a node.The latter was used on thishttps://www.jasonbruges.com/art/#/digital-ornithology/Most nodes were addressed on the bench, but we needed the ability to fix wrong any addresses without getting a cherry-picker to access them.

author: mrburnzie
author_rank: Regular Contributor
timestamp: September 16, 2019, 09:19:26 am
content: Quote from: AndyC_772 on September 16, 2019, 07:11:26 amYes, this is exactly what I was thinking!

author: mrburnzie
author_rank: Regular Contributor
timestamp: September 16, 2019, 09:21:42 am
content: Thank you all for the suggestions, I will be going with AndyC_772 solution. That is the easiest for this specific project and for the client.