3

I am currently designing a hexapod with a total of 18 servos. I come from a computer science background and know little about electronics, so there is one thing which puzzles me. Adafruit is selling this servo shield. It can power up to 16 servos while only using two pins. But it's quite expensive as it would cost me ~30€. Add the cost of an Arduino Uno and you are at >50€. At the same time I could just buy an Arduino Mega and power all Servos for a lower price.

I like to think that Adafruit wouldn't sell a uselessly overpriced product, so would there be any advantage to using this shield?

Bonus question: If I'd end up buying the shield, could I just power 16 Servos with the shield and 2 via the Arduino? Would there be any problems with that? Like a delay in the 16 motors or similar issues which could through my kinematics over bord? Would I have to buy two shields (which is not really an option at that price)? Any other suggestions I have not heard of are also very welcome!

If it is of any relevance, I am planning to buy these servos as they are pretty strong and come super cheap in bulk.

3

The idea of that particular servo shield is that it provides 16 PWM (pulse width modulation) channels. These are all operated simultaneously with no additional processing overhead on the Arduino.

The Arduino Uno itself does not offer 16 (or 18) hardware PWM channels but only 6 (see here). So driving 18 servos without an additional shield would require software PWM which requires some of the Arduino's ressources to be devoted doing the calculations. This may or may not interfere with the rest of your program.

Furthermore the Uno does only provide 14 dedicated digital GPIO pins in total (+6 multiplexed digital/analog pins, as ZS6JMB's answer points out), so additional hardware would* be required either way - or using an Arduino with more pins (such as the suggested Mega). The Mega however offers only 15 hardware PWM channels, leaving you with soft PWM again. (* assuming some pins will be needed for sensors or user interfacing).

An alternative is this board or, uhm, well, cheaper clones if you like. It features the same chip as the shield but with a PCB half the size and thus skipping the "free use area". I expect it to behave the same way like the shield and operate with the same libraries as the both the shield and this board communicate only via I2C. Both can be chained (or stacked for the shield if you will) for up to 992 PWM outputs (62 boards).

  • you absolutely nailed my question! thanks a lot! just one little thing: what is the difference between the board you linked and the shield? is it just more expansive because it is a shield? – Neuron May 1 '17 at 18:14
  • 1
    @Neuron from the docs I would say that there is little difference. Both have the same chip and communicate via I2C. I dare say it will work the same way as the shield. – Ghanima May 1 '17 at 18:35
1

Most of those pen controllers or shields are o.o expanded or own generators. In this case, the resolution maxes out to be just shy of 8 bits.

There are better ways to do it. I can post the link later but I explored quite a few ways to drive multiple servos off of a timer on a pic or avr. The number of servos it can drive is determined by the length of off-duration a servo can tolerate, and number of gpio pins on a mcu.

here is the link: https://dannyelectronics.wordpress.com/2017/02/18/driving-multiple-servos-off-a-pic-timer2-ranged-extended/

it provides a few examples for its implementation on PIC and AVR. But the basic concept is the same.

No shield used and it runs in the background so it is full transparent to the user code.

  • The linked adafruit board claims 12 bit PWM. Do you have details to substantiate the claim it really does not? – Ghanima May 2 '17 at 18:02
0

I need to correct an earlier poster: the number of PWM pins is irrelevant, since the servo library can control servos on any pins, even analog. That said, the servo library can only control 12 servos, but that has nothing to do with servo pins being PWM or not.

Same poster is also wrong on the number of pins, since the analog pins are fully capable of digital io just like the so-called digital pins. So an Uno has the 14 pins mentioned (0-13, although personally I never include 0 and 1 in that count since life's easier if they are left for serial) and 6 analog pins for a total of 20 (or 18 if you discount the serial Tx and Rx pins).

  • Thanks for the update on the pins, one should always read the full schematics instead of a simplified table as I did. Sure, all GPIO and multiplexed analog/digital pins can be used for software pwm but hardware pwm does offer a real benefit as in less complex code and reduced computational effort needed on run time. That might or might not be an issue depending on the complexity of the rest of the intended program - a question only the OP can answer. – Ghanima May 2 '17 at 18:00
  • I would in any case strongly argue that one should not start a project that needs 18 I/O for servos alone on a 18 I/O controller - what about user interface and sensors? So there is imo nothing wrong in designing this using either a "bigger" board or with additional hardware such as the I2C driven PWM extension. – Ghanima May 2 '17 at 18:01
  • thanks for the correction. but dont post these as new answers, as answers on stackexchange should answer the question asked. you could post a comment to the answer or edit it if you think there was a mistake! cheers – Neuron May 2 '17 at 22:07
  • the hexapod is going to be developed further once the hardware is set up. but eventually at some point i will have to add a raspberry pi for more complex planning and decision making while the arduino will deal with all the low level stuff. but since i found super cheap clones i will just use those either way – Neuron May 2 '17 at 22:45

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.