Servo Controller

I am new to the robotic world, but a friend and I are making one. We need something that will take input from four sensors measuring the speed of four individual shafts (one sensor per shaft) and will then tell five servos what to do. However, it has to compare the speeds. What happens is two sensors are for the front wheels of the robot, the other two are for the rear wheels. If, for the fronts, the sensors indicate that one wheels is spinning faster, it has to engage one of the five servos. The same applies for the rears. However, if there is a servo that is on in the back, and a servo in the front that is on, the fifth servo has to be engaged. Is this possible from a servo controller, or is it a job for a microcontroller? How would I program it?

Thank you
Aykalper

Hi Aykalper,

A serial servo controller generates control signals for servos in response to serial commands. They are quite useful, but they’re basically just translators from serial data (digital bytes) to hobby servo signals (timed pulses), and don’t do anything all that intelligent on their own like reading sensors or making decisions.

What you’re describing is very doable with a microcontroller, which would read your sensors, and make servo position decisions based on those readings. There are plenty of microcontrollers out there, so what kind you might want to try depends on a couple of things, such as what kind of wheel speed sensor you’re using (probably a simple encoder with some number of high/low pulses per revolution, but I don’t want to assume), what (if any) programming languages you’re familiar with, and how much money you’re willing to spend.

In terms of writing code for a microcontroller, you can find ones that work with a variety of programming languages and have free development software available. You can write programs for AVR microcontrollers (like the ones used in the Pololu Orangutan boards) in C, or a simplified version of C called wiring (specifically made for Arduino boards, which also use AVR microcontrollers). Basic stamp microcontrolers use the Basic language, Javelin Stamps use Java, the OOPic compiler works with Basic, Visual Basic, C, and Java. If you have experience with any of these programming languages you’ll probably want to pick a microcontroller that supports it. If you don’t have any programming experience, I would reccomend starting with either an Arduino or a Basic Stamp microcontroller.

As for how to actually get your code on to the microcontroller once it’s written and compiled, some microcontrollers require special programming hardware which you also have to build or purchase, but many of the “beginner” boards (Arduino, OOPic, Basic Stamp Board of Education or Homework Board) come pre-programmed with a bootloader, essentially a small program that lets the microcontroller download your programs to itself with no extra hardware other than the serial or USB cable you use to connect them to your computer. If this is your first robotics project I would recommend going with one of these programmer-less boards to start.

Also, a servo control signal is essentially a simple timed pulse, which you can easily generate with a microcontroller. Doing other things, like checking sensors frequently, can make generating these precisely timed signals more complicated, especially if you’re trying to generate several of them at once. Still totally doable, but more complicated. In these situations it’s very nice to have a serial servo controller (which is itself a board based on a microcontroller of some sort) taking care of the precision signal timing for you. Even if you end up getting a microcontroller from another company, I would recommend picking up a Pololu Micro Serial Servo Controller (I would link this but Pololu’s main site seems to be having trouble), which is in my oppinion both the best and strangely also the cheapest serial 8-servo controller money can buy, and will work with any of the microcontrollers I’ve mentioned here. You can buy directly from Pololu, or find a reseller that stocks both the servo controller and the microcontroller board you decide to try.

Good luck!

-Adam