Servo setup to Svp

Hi, using the “Pololu 3.i. Orangutan Servo Control Functions” page and example program on that page, I am not able to make my single servo, which I know works, to do anything. It is connected to servo port 0. I also tried coding it myself, here is what I got:

int main()
    set_servo_speed(1,500);set_servo_target(1, 130);

also the directions said something about pin “D5 servo pwm” how am I supposed to hook that up to a servo? I am very new at this.
Is my code wrong, did I connect my servo incorrectly?


I am sorry you are having problems controlling a servo with your Orangutan SVP. In your code, it looks like you are missing the servos_start() command which configures a timer on the AVR to generate servo pulses. You can read more about that command in the “Orangutan Servos” section of the Pololu AVR Library Command Reference guide.

You might try adding the servos_start() command to your program to see if that fixes the issue; however, it would probably be easier to troubleshoot your system if you use the “svp-one-servo” example found in the “Orangutan Servo Control Functions” section of the Pololu AVR C/C++ Library User’s Guide. Could you try loading that program again with your servo connected on Servo 0 output? Could you also tell me more about the power supply you are using to power your servo? Are you using the jumper to supply power to the servo power rail? Could you post pictures of your setup?

- Jeremy

I will get pictures later but my setup includes a JR hobby servo that is plugged into servo plug 0 with the ground pin on the outside pin of my board which is also ground, so I know my servo is plugged in correctly. However in the example code for the servo function, Atmel does not likeservos_init(demuxPins, sizeof(demuxPins)) but I read that is the older way of saying servo start. On one of your links I found the new way of saying that as:: start(const unsigned char servo_pins[], unsigned char num_pins) :: Can you please help fill out the blanks because I don’t know what goes where, ex: PD5 or my 3 prong servo plug. Please, Please include a one servo code that you know will work with my setup on atmel and Orangutain-1284. I have no idea what I am doing. Thank you in advance!

It is unclear if you are getting any errors with servos_init(demuxPins, sizeof(demuxPins)). What warnings or errors are you getting from Atmel Studio? How are you supplying power to the servo? As the example states, the servo signal is available on demux output 0, so you should connect your servo to servo 0.

- Jeremy

Atmel warns me…‘servos_init’ is deprecated (declared at c:\program files (x86)\atmel\atmel toolchain\avr8 gcc\native\3.4.1061\avr8-gnu-toolchain\avr\include\pololu\OrangutanServos/OrangutanServos.h:163) [-Wdeprecated-declarations]. when I use servos_init(demuxPins, sizeof(demuxPins)). Power is from a 5 volt battery. Which works fine for everything. I cannot even get the servo to move even if its on servo 0 or 1. Could you please write a line of c++ code that just makes the servo move? Please, as I am new to this and have NO idea about what the problem could be. It must be in the coding! I need help! Thanks

The example code in the Pololu AVR C/C++ Library User’s Guide that I mentioned about in an earlier post is the program we supply for controlling servos with the Orangutan SVP, and it should work. I suspect something in your setup is causing the issue. Could you post screenshots of the error message you are getting from Atmel Studio? Could you also post pictures of your setup that show all the connections? How do you have the servo power selection jumper arranged on the Orangutan SVP?

- Jeremy

Here is my setup. Just the servo wire plugged straight into the servo 0 pins. Do I need any jumper wires? and what about servo pulse pin PD5? And for some reason I am not getting that warning message in the Atmel IDE …

It looks like your pictures did not post correctly. Could you try uploading them again? You can upload pictures under the “Upload attachment” tab when posting a reply. If you continue to have problems uploading the pictures, you could try uploading them on image-hosting sites like Photobucket or ImageShack and then use the “IMG” tags to post them.

The jumper I was referring to in my previous post is the servo power selection jumper used to deliver power to the servo power rails on the Orangutan SVP. You can read more about it in the “Servo power selection” sub-section in the “Assembling the kit version” section of the Orangutan SVP User’s Guide.

- Jeremy

Hope this works:

From the pictures, it looks like the servo power selection jumper is only connected to the middle pin and is not supplying power to servo power rail. You will need to rearrange the jumper to select either VCC or VADJ to power the servo rail, as mentioned in the “Assembling the kit version” section of the Orangutan SVP User’s Guide. As also mentioned in the guide, it is generally advantageous to power servos and other high-power devices from VADJ instead of VCC because if the peripherals draw too much current for the power supply to handle the AVR will not be affected. If you decide to use VADJ, you will want to set it to a voltage that your servo can accept.

- Jeremy

It is now working. Also what is the difference between choosing the VCC and VADJ (You said one will and one won’t affect the AVR) why is that? Also using VADJ how do you set a voltage, is it as simple as choosing a power source that goes into the board?. Thanks again!

I am glad you got it working.

VCC is used to power the logic on the Orangutan SVP, so if the servo was powered by VCC and a large current draw causes the voltage to drop, it might affect the AVR. You can prevent this by powering the servo with VADJ. You can adjust the output voltage of VADJ with the trimmer potentiometer in the upper right corner of the board. I strongly suggest you go through the Orangutan SVP User’s Guide and read about all the features on the Orangutan SVP before using the board.

- Jeremy

I ran into a problem… I have a program that I liked and downloaded onto my Orangutan-1284. I went to further better this program and found my computer got unplugged and the program was not saved. Is their anyway the micro controller could tell atmel studio what is programmed on it and put it back on the IDE for editing(some kind of a upload)?


Although it is possible to read the HEX file off of your Orangutan SVP and use that copy to program other Orangutan SVPs, it will probably be hard to make changes to it. There might be decompilers that might be able to convert the hex file on your Orangutan to C++; however, I do not have a recommendation for one.

- Jeremy

Ok thats what I thought… Anyway thanks again for all of the help.