For the pololu servo controller (product code: RB-Pol-18) it says in the user guide (page 8 of 8) on setting and checking servo numbers. I have two controllers so am I correct to assume that to set each controller to its own specific code I should connect each controller individually to the arduino serial out pin, send the serial command [128, 2, ] and then I should be able to connect all of the controllers on one serial line because each has its own code representing themselves? If yes, would the arduino code be
Serial.write(128, 2, (servonums));
The link to the pdf to save time is: pololu.com/file/0J37/ssc03a_guide.pdf
Thanks,
Robert
On page six it talks about sending commands, but doesn’t it assume that the ID’s have already been set prior to that? Don’t you need to set the ID as page 8 states? Unless I misunderstand what you are saying but the .pdf file says that each servo controller has a default of 0 (they control the default servos 0-7) and that I have to set each controller to a unique ID before using the command line you posted. I checked out the link, but the poster only used 1 controller.
Also, kind of off topic but why does everyone use hex in the sequence of commands sent to the servo controller? I replaced the hex codes with the equivalent decimal and it still worked.
Thanks, I understand all of that my question has been setting the ID’s. Do I only send the command to set the ID for each controller individually connected to the Serial out pin, and then once all of the controllers have their ID’s given I can connect all of them at once to a single Serial out and distinguish different controllers by their ID. I have only two controllers so I know to leave one as the default 0 and set the other one to 1.
It’s good to know that using decimal is also accepted.
Ok thank you. I tried it out and got their ID’s set.
That is the beauty of Pololu servo controllers. You can set their ID via a serial command as described in page 8 of the manual. Once all your controllers have distinct IDs, you can connect each one of them to the same serial communication line (the same Arduino pin in your case) and simply address the servos according to the controller ID and servo number.
Sending the command in Pololu mode is explained in page 6. You need to send the following:
Start byte, command, servo number, data 1 and data 2.
you can also refer to this thread for pololu-specific arduino code:
arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1231053939
Let’s go at it in steps:
]By default the controllers some pre-programmed to ID 0. which means they address servos form 0 to 7/:m]
]If you want to control several controllers on the same serial bus, then you will need to set their individual IDs to 0, 1, 2, 3, etc. (page 8)/:m]
]Then when sending a command to the controllers you need to include their corresponding ID so the right controller knows it needs to respond (page 6). So you need to set the IDs beforehand since a controller will simply ignore a message that is not directed to it’s ID./:m]
]Hex is used since it is a convenient way of writing binary numbers. You certainly don’t need to use it and can use decimal representation if you are more comfortable./:m]
You are right. you need to individually connect the controllers and set their ID. Then once every controller has its own desired ID, you can connect them in the same serial bus.