L'Hexapod: 64 channel servo controller...

Previously published

This article was previously published on lhexapod.com as part of my journey of discovery into robotics and embedded assembly programming. A full index of these articles can be found here.

I’ve been experimenting with the servo controller that I developed for the ATtiny2313 here and the demultiplexing chips that I mentioned here. The result is a 64 channel servo controller that seems to work pretty well. Right now I haven’t breadboarded all 64 channels, I have two of the CD74HCT238E chips connected to the ATtiny but I/O pins and he firmware would drive 8 of them if they were connected to give 64 channels. Of course this is much more than I actually need for this project, but since there were enough I/O pins and since it was actually easier adjust the code from driving 8 channels to driving 8 x 8 channels I coded it up that way to see if it would work… It does, though I’ve had to adjust the timing loops considerably and I’ve switched from guaranteeing a min 900us pulse and a max 2300us pulse to simply making sure that the middle servo position is correct; this actually seems to be a better approach as I now have a clean 180 degree range of motion from the servo and the centre position is pretty much spot on where I would expect it to be…

Of course now I’m approaching the memory limits of the ATtiny. I only have 128 bytes of SRAM to play with and I need 64 of those bytes for the servo position data and a few bytes for the serial data input buffer. This means that my plans to have a mapping table that maps the servos from the physical location of the pins on the board to a nice sensible, easy to remember, logical sequence can’t be implemented in this version as in itself it would require 64 bytes of memory to map the logical servo id to the physical servo control pin. The reason this would be handy is that with 8 demultiplexing chips on a board and all the associated connections the chances of getting the servo control pins to all end up in a nice sequence somewhere is pretty slim. All’s not lost, the firmware itself can be tailored to match the board layout but this isn’t quite as elegant as providing a simple mapping table that can be updated easily to change the mappings.

Of course I only selected the ATtiny2313 by chance as it happened to be a available for a good price and was in stock at one of my suppliers so running out of resources on it isn’t such a terrible thing for the project. However, ideally I’d like to squeeze as many of my ideas for the more advanced servo controller onto it if at all possible. This should be made somewhat easier as I only need 24 channels, which gives me around 5 bytes of storage per channel rather than the less than 2 that I have with the 64 channel controller… And if all else fails I could ‘cheat’ and switch to using one of the ATMega168’s that I have laying around…

Schematic and source will be available once I’ve worked out how Eagle works and once I’ve finished the firmware…