Cam TILT servo

Post Reply
m00se
Posts: 54
Joined: Sat Jan 21, 2012 10:09 pm

Cam TILT servo

Post by m00se »

hi
I am starting out on a build and i have some trouble with the camera tilt servos, i was wondering if anyone could help me.

arduino pro mini using atmel 328p 5v 16mhz
i have original wmp, original nk, wmp and nk working fine, currently all on a bread board.

i have the servo neg lead onto the GND that the WMP is using,
the servo pos is on pin 12
servo signal lead is on pin A0

when i power the board on the servo just clicks, if i move the signal lead to any of the motor esc pins it clicks in the same way. i have uncommented the neccesary lines in arduino and i have enabled it in the GUI

does anyone know whats happening?
ps , its powered from usb, but i have powered from a lipo and the same happens

thanks in advance

m00se
Posts: 54
Joined: Sat Jan 21, 2012 10:09 pm

Re: Cam TILT servo

Post by m00se »

im looking at diagram two here,
http://www.rcgroups.com/forums/showthread.php?t=1340771

i have everything hooked up as per the diagram, i have servo signal to A1
servo GND to GND and servo +ve to RAW

i should get servo roll compensation, but nothing,
seriously can anyone help ?

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Cam TILT servo

Post by PatrikE »

Code: Select all

 #ifdef SERVO_TILT
    if ((rcOptions1 & activate1[BOXCAMSTAB]) || (rcOptions2 & activate2[BOXCAMSTAB])) {
      servo[1] = constrain(TILT_PITCH_MIDDLE + TILT_PITCH_PROP * angle[PITCH] /16 + rcData[AUX3]-1500 , TILT_PITCH_MIN, TILT_PITCH_MAX);
      servo[2] = constrain(TILT_ROLL_MIDDLE  + TILT_ROLL_PROP  * angle[ROLL]  /16 + rcData[AUX4]-1500, TILT_ROLL_MIN, TILT_ROLL_MAX);
    } else {
      servo[1] = constrain(TILT_PITCH_MIDDLE  + rcData[AUX3]-1500 , TILT_PITCH_MIN, TILT_PITCH_MAX);
      servo[2] = constrain(TILT_ROLL_MIDDLE   + rcData[AUX4]-1500,  TILT_ROLL_MIN, TILT_ROLL_MAX);
    }
  #endif


Use AUX1 or AUX2 to switch mode.
3 & 4 controls the angle.
Active is controlled by Aux3 & 4 and Angle from acc.
Inactive is only controlled by Aux3 & 4.

Dont forget to set the checkbox in the gui on AUX1 or AUX2.

m00se
Posts: 54
Joined: Sat Jan 21, 2012 10:09 pm

Re: Cam TILT servo

Post by m00se »

patrick
thanks for your reply.
im new to all this, i guess i just paste that into the code in arduino ? in which tab do i post it¿?

also is it possible to test the servo tilt without having the rc ? im waiting for my tx rx to arrive and only have the arduino, gyros,acc and a few servo s to do some tests with while i wait

thanks,

User avatar
Th0rsten
Posts: 65
Joined: Mon Oct 31, 2011 10:28 am

Re: Cam TILT servo

Post by Th0rsten »

Hello!

I'm not sure that PIN12 can supply enough power to drive a servo and RAW is input only (IMHO).
Try connecting the servo direct to a 5V source.
BTW: PIN12 is no longer used to power the WMP. You can connect the WMP to 5V, too.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Cam TILT servo

Post by PatrikE »

The code is already included in the code in the output tab.

Check all three boxes for CAMSTAB and stabmode will work without a radio.
Image
Pin 12 can not supply the servo!
You will overload the arduino and risk to destroy it!
You need to power the servo with 5V battery or from a Speedcontroller!

m00se
Posts: 54
Joined: Sat Jan 21, 2012 10:09 pm

Re: Cam TILT servo

Post by m00se »

Image
Image
http://www.freeimagehosting.net/c3h85
http://www.freeimagehosting.net/jm86n

ok i hope the images work, one is of how ive got the GUI set,
one is of how ive got things conencted, but i still cant get the servo to work, i know that there is no common ground between the servo +ve -ve and the signal. so i have tried conencting the ground from the servo to the ground rail on the arduino, but the same,

i know the lipo is one cell, its at 4v and should be enough to power the servo a bit, at least for a test,
the arduino is powered from usb.

im really eagre to get the servo working so that i can get things ready for the arrival of the motors,

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Cam TILT servo

Post by PatrikE »

OK.....
One problem if thats your setup.. :?
You must have a Accelerometer for the camstab to work!... :o

From the last setup in http://www.multiwii.com/connecting-elements

Pure stabilized gimbal system
For this setup, you need a GYRO + ACC setup (not possible with a gyro only setup)
A RC system is optional for this setup.

m00se
Posts: 54
Joined: Sat Jan 21, 2012 10:09 pm

Re: Cam TILT servo

Post by m00se »

i have the nunchuck connected directly to the original wmp port,

it shows up in the GUI and i can see the readouts from it

m00se
Posts: 54
Joined: Sat Jan 21, 2012 10:09 pm

Re: Cam TILT servo

Post by m00se »

i suppose that my question is .... . . . . . .

do i have to change the code for the tilt servo to work? i have read that i need to uncomment certain lines. but i cant find them.

i have the system working with acc and gyro. but the acc is conencted to the original wii port, maybe i need to hard wire it. i notice that two pins are shown as bridged, would this be my problem?

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Cam TILT servo

Post by PatrikE »

Uncomment #define SERVO_TILT in config.

Code: Select all

/* The following lines apply only for a pitch/roll tilt stabilization system
   On promini board, it is not compatible with config with 6 motors or more
   Uncomment the first line to activate it */
//#define SERVO_TILT

m00se
Posts: 54
Joined: Sat Jan 21, 2012 10:09 pm

Re: Cam TILT servo

Post by m00se »

it works!!
is there a way to invert the direction? i think it is bad because my wmp is upside down, i will move it and test again

thank you

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Cam TILT servo

Post by PatrikE »

A couple of lines further down.... :o

Code: Select all

#define TILT_PITCH_PROP   10      //servo proportional (tied to angle) ; can be negative to invert movement

m00se
Posts: 54
Joined: Sat Jan 21, 2012 10:09 pm

Re: Cam TILT servo

Post by m00se »

thanks, i was too quick to ask, i found it just after asking,
the number changes the speed of the adjustment right?
is there a way to make the servo stay if you incline the board and it stays inclined. it normally just comes back to the same angle as the sensors and then the next movement is inverted until it adjusts.

i think if the cuad was flying in wind and constantly inclined that this would make a bad gimbal.

Post Reply