Control servos using Orangutan Mega168 and Orangutan-lib

Hello all,

I am trying to use the Orangutan Mega168 to control my newly acquired robotic arm, and when I run the example to try and get the base to return to mid position, I don’t get any response. Just a blank screen. and no motion. I have tried PC0 and 1 as well as PD0 and 1, with no avail.

int main(void)

	// Two servos
	unsigned char left, right;

	// Some loop variables

	// Initialize the servo system

	// Define our servos to use PC0 and PC1, respectively
	left  = servo_define(_SFR_IO_ADDR(DDRD), _SFR_IO_ADDR(PORTD), 0);
	right = servo_define(_SFR_IO_ADDR(DDRD), _SFR_IO_ADDR(PORTD), 1);

	// Turn them both on

	// Our endless loop
		servo_set(left, 1500);
		servo_set(right, 1500);

Got it working, forgot to put the i/o pin voltage jumper in.

Another question, how many servos can the orangutan actually power? Mine seems very weak in this department, to the point where I am considering a discrete servo controller. Anyone else use servos with the orangutan before, or have an opinion?

BTW. I need to control 5 servos.


The Orangutan has a 100 mA regulator, so that’s good for about half of a small servo that’s not doing much. If you use a 5-cell battery, you could power the servo directly off that. Otherwise, you can wire power and signals separately, so you don’t need a dedicated servo controller merely for power distribution purposes (it’s not like the servo controllers have some high-power regulators, anyway). 5 servos is certainly doable on the Orangutan, but you might want to free up time with the dedicated controller.

- Jan

OK, thanks. I’ll rewire it tomorrow. You guys have been a huge help.

OK, so i wired up the servos power seperately, to 4 AA battery’s as I don’t have a 5cell battery handy. But whenever I connect the signal to my orangutan, it just goes to the max and tries to keep going until I frantically unplug it. The code is the servo-test from orangutan-lib, so It should just go forward and back, not to its max. It also does this when I try to send it a command to go to 1500.

Can you post a clear picture or diagram of how you have everything wired together?


Here you go:

Can you add your Orangutan and its connections to your diagram?

Specifically, is the Orangutan being powered by another separate battery or power supply, and if so, do you have a connection between their two grounds? A ground connection is necessary, and leaving it out could definitely cause the behavior you’re seeing.


crap, yeah, that’s gotta be it. I’ll check and get back to you, thanks.

Sure enough… :blush:
Thanks, guys. :mrgreen: