Author Topic: AXON2 and SD21 servo controller  (Read 3607 times)

0 Members and 1 Guest are viewing this topic.

Offline teoxanTopic starter

  • Full Member
  • ***
  • Posts: 49
  • Helpful? 2
AXON2 and SD21 servo controller
« on: May 13, 2010, 03:23:58 PM »

I interfaced the Devantech SD21 servo controller with the Axon2 using Webbotlib.

The SD21 accepts 21 RC servos, uses I2C interface and it's great for animatronics.

It requires separate power ( 6V-7.2V), it has a socket for a Picaxxe or BS2 microcontroller and it offers 3 I2C sockets so you can plug other I2C devices from Devantech.

For more info please check: http://www.robot-electronics.co.uk/htm/sd21tech.htm

Below is the code I used. I plugged a simple "no name' servo" and I just sent a "speed" command.

You controll a servo by using its address and "speed" command, that may be different depending on the servo.

Code: [Select]
#include "sys/axon2.h"
#include "rprintf.h" //use for UART
#include "i2c_master.h" //use for I2C
#include "myhardware.h" // user includes

uint8_t address=0xC2; // I2C address for SD21
uint8_t ser[1]={0x3F}; // address of first servo

void appInitHardware(void)

    rprintfInit(USB_ACTIVATE);   // just to write a little output-you don't need that actually

TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
rprintf("\nAxon Initiated.\n\n");

return 0;

TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart)
i2cMasterSend(address,128,ser); //send 128 to center the servo- may differ in other servos

if (i2cMasterReceive(address,128,ser)) //all is ok?
rprintf("servo 1 centers"); // servo 1
     rprintf("No responce\n");


Next project is to interface the ultrasonic sensors  SRF02 and SRF08.



Get Your Ad Here