Adding Components During Serial Processing

Hi everyone,

Relative beginner here, so excuse my ignorance if I don't know some basic Arduino capabilities. I have lots of coding experience, but I'm inexperienced with microcontrollers. I'm working on a little project in which components can be sequentially added to an assembly, and the controller will automatically incorporate the new components into the processing.

The basic setup is that each component is two rigid lengths with a servo controlled joint in the center. At first, there is one component, and so one servo, that is controlled by the Arduino along with some commands from a separate, more powerful processor (going to be doing some heavier math operations to determine commands).

I want to be able to attach another component to the top of the first one, introducing a second servo, which would then be recognized as part of the system and could be controlled by commands from the processor. Then add a third, fourth, etc. I want to do this without manually/physically adding each servo's input wire into a pin when you add the new component, but I would be alright with all the pins being initially filled at the beginning. At the moment I'm thinking that I can design the components to close a circuit when a new component is added, detected by a digital input, and then given that closure tell it to recognize the next servo. Or could all of the components be on the same circuit, and the system detects a change in resistance? Lots of options I think, I just want to make it as simple and elegant as possible.

Lastly, am I inevitably constrained by the number of pins available (no way to send separate output to more servos than you have pins)? I'm guessing not but I just want to check in case anyone had any neat strategies for that kind of thing.

My first priority is just to see if this is possible...does this sound feasible? Beyond that, does anyone have any advice or pointers that might help me out? Thanks for your time and help.

Designing the interface between the components seems to be the critical part. Have you figured out what this will be like yet - how many terminals will be connected, how the controller will discover which components are connected (and in which order, if that matters) and how you're going to carry commands to the relevant component?

I suppose you could do it either by having an Arduino in each component that generates the servo control signal, and then have some sort of communication bus that supports discovery, or by having one master Arduino and simply wire each component's servo back to it via the various connections. The first approach seems more elegant and more scalable, but I have no idea whether either of these criteria are important to you.

I think the only scalable way is to have a processor at each servo and a bus to communicate with the "more powerful processor". Any other way and you run out of pins real quick.

Each node doesn't have to be a full "Arduino" but that would be the easy way to do a proof of concept.

As for the physical hook up and protocol, that's something to think about if you decide to go that route but a daisy-chain topology saves you from having to set addresses on every node and allows the master to easily discover the number of nodes that exist.


Dynamixel servos do this, with bus-oriented communication, and an embedded processor in each servo. They are expensive, but incredibly well engineered and designed servos. Probably worth checking out just for ideas on how to do it.

I haven't designed the interface exactly, but I have some idea of what it might require given one master Arduino. If that was the case, each interface would basically need the elements to close the new servo circuits, as well as the wiring to accomodate the next component and every subsequent one beyond that. Could get a bit hairy if not done cleverly. Detection is a bit tricky, but I think there are a good number of simplistic "if statement" type methods I could use, for at least a limited number of additional components.

But I hadn't thought of just giving each servo a processor and having a more flexible communication system, which sounds exactly what I might need. I'd like it to be as scalable as possible, hence my worry about pins adding limitations to the assembly, so it seems a distributed system would be ideal. I'll check out the price of these Dynamixel servos and the "daisy-chain" idea, both of which sound very useful.

Thanks everybody, great advice! Exactly what I needed.

A lot must depend on the size of the add-on devices - how much room is there for extra electronics - and on your budget.

You might like to consider the Moteino DelTino devices which are Arduino compatible devices in a small package. The DelTino is by far the smallest. Both include radio transceivers that might be used for controlling them. All you would need to do is ensure that as each device was added its power supply was connected.

I am using the DelTino devices to control model trains and my plan is to allocate an ID number to each device and, using a separate DelTino as a transmitter my PC will be able to control several locos. This seems similar to your idea of adding extra devices and expecting them to be recognized without manual intervention.

Both the Moteino and DelTino could also be used to send data from the device back to the PC.

I started a separate topic about the DelTino devices,174358.0.html