Electronics > Projects, Designs, and Technical Stuff
Best way to select the ID of each board?
<< < (4/4)
mikeselectricstuff:

--- Quote from: AndyC_772 on September 16, 2019, 07:11:26 am ---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.

--- End quote ---

I'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 this https://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.
mrburnzie:

--- Quote from: AndyC_772 on September 16, 2019, 07:11:26 am ---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.

--- End quote ---

Yes, this is exactly what I was thinking!
mrburnzie:
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.  8)
Navigation
Message Index
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod