I want to build network (electrical circuit) which contains hundreds of elements (with unique IDs) based on some microcontroller.

Good example of that kind of network but much more expensive (and advanced) is Internet. For example I have main server (in my case microcontroller), nodes (computers with ethernet cards) and cables (e.g. cat 5e) which connect server with nodes. We can assume that network has star topology.


Requirements according to above graphic:

  • I have x numbers of C (C could be circuit, cable or connection)
  • I have numerous number of elements with unique IDs which can be connected in to any place (C)
  • Element with unique IDs can be swap with another element, remove or add (if there exist C with no element)
  • I need to know ID of element which was connected to certain C.
  • I need to set ID by myself or can buy "element" that I know what is it's ID.

What are the easiest/cheapest way to make network like I explained above?

  • \$\begingroup\$ What's wrong with Ethernet? \$\endgroup\$ – Eugene Sh. Jan 13 '17 at 22:02
  • \$\begingroup\$ you have to be more precise in your application description \$\endgroup\$ – User323693 Jan 13 '17 at 22:03
  • \$\begingroup\$ Ethernet is great but I don't need all of it's capabilities. I'm looking for the cheapest way and I think that they are some cheap electrical components on which I can save ID in order to identify them when they connect to network. \$\endgroup\$ – trojek Jan 13 '17 at 22:07
  • \$\begingroup\$ I image that I have small element and when I connect it to the network "it" sends information to arduino (or PC) that element with ID x is connected but if I change this component to another (with ID y) but it is in the same place in circuit, arduino should know that is was changed. \$\endgroup\$ – trojek Jan 13 '17 at 22:09
  • \$\begingroup\$ I don't you think you will get anything cheaper than Ethernet, as it is a standard and has many ready to use solutions of the shelf. But of course, you better describe your problem, rather than the assumed solution, as it sounds like XY-problem. \$\endgroup\$ – Eugene Sh. Jan 13 '17 at 22:10

This is what Dallas One-Wire is for.

The basis of 1-Wire® technology is a serial protocol using a single data line plus ground reference for communication. A 1-Wire master initiates and controls the communication with one or more 1-Wire slave devices on the 1-Wire bus (Figure 1). Each 1-Wire slave device has a unique, unalterable, factory-programmed, 64-bit ID (identification number), which serves as device address on the 1-Wire bus.

  • \$\begingroup\$ Plus, there are I/O chips, RAMs, EEPROMs, and number of homebrewn devices for that bus as well. Downside: It's single-master only. \$\endgroup\$ – Janka Jan 13 '17 at 22:52
  • \$\begingroup\$ Yes, 1-wire occurred to me but it's not actually what 1-wire is for, though you could make it do it by running two 1-wires to get bidirectional. But 1-wire is slow and hardware bus masters for it aren't common in MCUs, whereas CAN and I2C are common, bidirectional and faster. I know we could rig up all sorts of arrangements but it's simplicity that'll get made and working...be fun to have as a work/paid project, though :-) \$\endgroup\$ – TonyM Jan 14 '17 at 0:42

You might be looking for something like this: http://www.mouser.com/ds/2/268/21952b-70868.pdf

Assuming your "network", as you described, is just opening and closing a circuit, you can get I/O expanding ICs that can address GPIO lines using fewer pins on the MCU (similar to a mux). Then on the node side, just create simple circuitry that will raise/lower a line when a node gets put in/taken out.

That said, you will need to program the IDs on the MCU - you will not be able to get the the IDs from the devices themselves. (i.e. you will know which pin goes high or low, but you have to map it to an ID value yourself)

  • \$\begingroup\$ Thank you for your answer. It partly solves my problem because I still don't know which (ID) element was connected to certain circuit. I can map ID to circuit elements but the elements can changed in certain circuit. For example in Internet network I know that I connect to cable x PC1 with MAC address z and if I swap PC1 with PC2 I will know that MAC address changed from z to c but the physical place (cable) is still the same. \$\endgroup\$ – trojek Jan 13 '17 at 22:24
  • \$\begingroup\$ @trojek are you restricted at all by the types of devices you're connecting? what about cost constraints? If you're making the "nodes" yourself, you can add an MCU to them, program each to have an ID, and use any communication protocol (I2C, SPI, etc.) to get the ID. If these are pre-existing devices, then it would help to know how you plan to identify them \$\endgroup\$ – skobovm Jan 13 '17 at 22:30
  • \$\begingroup\$ I will make nodes by my own. What MCU can you recommend? \$\endgroup\$ – trojek Jan 13 '17 at 22:52
  • \$\begingroup\$ It really depends on what else you want the nodes to do and what your distance and speed requirements are. The short answer: pretty much any MCU will do at the nodes for simple communication. If your main MCU/PC is somehow restricted in peripherals, then make sure it's compatible with your nodes \$\endgroup\$ – skobovm Jan 13 '17 at 22:59
  • \$\begingroup\$ distance between MCU/PC will not exceed 10m. From nodes I want to control turn on/off LED but I thought that I will make another circuit (connected to power supply and relay) to each node. All information about network I need to keep in DB on PC. \$\endgroup\$ – trojek Jan 14 '17 at 9:46

Assuming I have your requirements clear (network of microcontrollers connected to single microcontroller, proprietary network design allowed, small, simple, cheap)...

Could you consider a CANbus network, with multiple multidrop CAN busses linked together by CAN switches (such as ONSemi AMIS-42770 Dual High Speed CAN Transceiver)? This doesn't line up with your star topology, unless you go for it with the CAN switches. But CANbus is cheap and available on many microcontrollers. Devices can announce their presence using a single message ID to the server microcontroller when they power up. Each can have a 1-wire or I2C unique serial number IC.

I could also imagine a sea of I2C-linked microcontrollers with an FPGA in the middle to act as a router. That gives you lots of point-to-point I2C links in a cheap IC but is a good-sized pile of work to design and prove in VHDL/Verilog.

In light of this, is there more you can say about your specific requirements?


You can use a serial number IC.

If you need to mass produce PCBs that all have a unique ID without requiring you to individually program them, then you should add a component with a unique serial number, sometimes called a Silicon Serial Number.

If 64-bits is enough for you, then something like this IC would do the job for you. You can use that ID directly or as a way to generate your specific format of unique ID.

  • \$\begingroup\$ I really don't think it is answering anything the OP asked... \$\endgroup\$ – Eugene Sh. Jan 13 '17 at 22:23
  • \$\begingroup\$ @EugeneSh. It seems they are looking for a way to have each element have a unique ID. That's my take on the question, as the title seems to indicate. You suppose they're looking for a protocol rather than hardware? \$\endgroup\$ – Samuel Jan 13 '17 at 22:25
  • \$\begingroup\$ A hardware implementing a protocol I guess... \$\endgroup\$ – Eugene Sh. Jan 13 '17 at 22:26
  • \$\begingroup\$ @EugeneSh. Well, I suppose we can wait for clarification. If it ends up I'm off the mark I'll remove this answer. \$\endgroup\$ – Samuel Jan 13 '17 at 22:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.