I want to build a kinetic wall (servo motors are just for the prototype. in later times of project control linear actuator or something else). In this project computer send a message like 0 or 1 to specific adress on matrix. Adafruit PCA9685 is an option but there is too much cable in that scenario. I want more like expandable solution for different dimensions. Therefore i want a build daisy chain bus, one master(computer) and expandable slaves connected to each other(signals and power). Distances between modules maximum 1 meter.
Until now i am trying at 3 arduinos different types of networking
With canbus(mcp2515) protocol i have succeed. canbus support 29-bit addresses and its enough for me but i dont know how many nodes connect them in physical layer.
With rs485(max485) i succeed but again i dont know how many nodes usable max.
with i2c(onboard arduino a4 a5 pins) connection 1024 adresses capable but somebody told i2c is not enough for that project.
Are there any suggestions about this project like new networking protocol, new controller or something else.
You may need something like an Arduino board for each group of servos it can handle (12?). Then the master controller can send commands down a master tx line to the servo Arduinos to tell them to do what they need to do with the servos.
zoomkat:
You may need something like an Arduino board for each group of servos it can handle (12?). Then the master controller can send commands down a master tx line to the servo Arduinos to tell them to do what they need to do with the servos.
I'm building a system like that to control servos for turnouts and uncouplers on a model railway. It is designed so all the slave boards have identical programs and hardware and are identified by a jumper that is read at startup. All the intelligence about what servo does what and how far it should move is on the master (a Mega). Communication is via a daisy-chained serial connection but something a little more sophisticated (RS485?) might be desirable if there is a large number of slaves.
The "how do I control 400 servos for an art project" and similar request stimulate thinking on the subject. If the rx buffer is limited to 64 bytes, then there has to be some thought on data management. I think the buffer is sufficient to hold a command packet for12 servos with some addressing characters included.
zoomkat:
then there has to be some thought on data management.
Using writeMicroseconds() the range of values has to be between about 400 and 2500. Numbers up to 4160 (64 * 64 + 64) can be encoded into two ASCII characters - and, perhaps more importantly very quickly decoded (much faster than atoi() ). Using ASCII data makes debugging much easier as the received messages can be printed
If it was appropriate to send a series of numbers for every servo so that the position in the message identifies the servo then 64 bytes could carry info for up to 30 servos with a few bytes to spare for start and end markers.
However to my mind it would make sense to send a separate message for each slave board that includes an identifier for the board and the data for the servos on that board. That should easily fit into 64 bytes.
Another very different approach, which may improve performance, is only to send data for a servo that needs a new position.
"However to my mind it would make sense to send a separate message for each slave board that includes an identifier for the board and the data for the servos on that board. That should easily fit into 64 bytes."
I'd probably use a character at the start of the packet, a-z, to identify the target slave board. All boards capture the the packet, and if the character does not match the board, the board empties the input buffer and waits for the next packet. I think there is a parsing function that will simply handle parsing the rest of the packet and make the data assignments. I think this would probably work for basic projects. It might be a little more involved on the sending end where the packets are developed if the input id dynamic vs. static preset conditions.
zoomkat:
I'd probably use a character at the start of the packet, a-z, to identify the target slave board. All boards capture the the packet, and if the character does not match the board, the board empties the input buffer and waits for the next packet.