LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Servo Motor Reverse Direction

Hello everyone. I recently asked a question in another thread about changing the direction of servo motor. I was able to initialize the servo and have it rotating but I am not able to get it to rotate the oposite direction.

Nathan_B. respond by saying

     >>A servo should go backward when it is given anything less than 50% duty cycle and it should go forward when given more than 50% duty cycle.

     >>Also, since your question is about servo's, it needs it's own thread so that we don't hijack the discussion about stepper motors.

I'm not exactly sure what the duty cycle is. Can you change this setting in the initialize servo block?

0 Kudos
Message 1 of 7
(29,374 Views)

I don't have LIFA availabe to me at the moment but if I remember correctly, now that I think about it, the servo VI has a terminal for "angle" which is proporitional to the duty cycle (in the applications that I've used it for).  Play around with the angle and you should get it.

If you are unable to get it working, tell us exactly what servo motor you are using and attach the VI that you created to control it (save it for LabVIEW 2009 so others without the latest version can view it and try to help).

0 Kudos
Message 2 of 7
(21,944 Views)

You control a servo by telling it what position to go to.  Servos use the duty cycle of a PWM signal to determine what positino to hold.  Most servo's do not allow continuous rotoation.  That is they can only rotate 180 degrees for example.  Other servos do provide continuous rotation (ie 360 degree rotation).  This type of servo can be 'spun' like a wheel by always telling it to move a little past its current location.  You cannot simply tell it to move a full roatation or 3/4 of a rotation because it will take the shortest path to the target position.

In LIFA the angle parameter determines the PWM duty cycle and therefore the postiion the servo will hold (as Nathan suggested above).   As Nathan mentioned if you cannot get it to work we'll need to know what servo you are using and what commands you are sending it that make it move in the working direction.

Thanks,

-Sam K

LIFA Developer

0 Kudos
Message 3 of 7
(21,944 Views)

Ok thanks for the tips. I'm not sure if it matters but I am using the Arduino Toolkit program to program the servo.

0 Kudos
Message 4 of 7
(21,944 Views)

I have attached my program to this post. Also the servo im using is "HSR-1425CR Continuous Rotation Servo"

Ok I have two question since the last time I posted.

1. I could not find LIFA.pde so I used LVIFA.pde . My questions is where can I download LIFA so I can upload that onto my Arduino Uno.

2. Also I am now getting Err. 5002 and cannot figure out what the problem is for the life of me.

0 Kudos
Message 5 of 7
(21,944 Views)

I don't see any reason why that server shouldn't work but it seems you actually have more immediate problems and when you fix those you will likely have little issues.  Also, I would strongly recommend that you set the default value of your angle control to 90 so that it will start stationary.

Your other issues:

  • There are no files that should have the .pde extension in the latest version of LIFA.  Also, any file with a "V" in "LIFA" is an outdated file.
  • You should install the latest version of LIFA from the VI Package Manager.
  • The firmware files to upload to Arduino arein the following directory:  C:\Program Files (x86)\National Instruments\LabVIEW 2011\vi.lib\LabVIEW Interface for Arduino\Firmware\LIFA_Base (or something very similar).
  • To install the files, first open the Arduino IDE.  Then, in the IDE, open the LIFA_Base.ino in the directory listed above (this should bring up several files in tabs in the IDE).  Choose the appropriate settings for your Arduino and then upload the files to Arduino.
  • If something doesn't work then you need to make sure that the Arduino is actually registered by the OS in the Device Manager.

Anyways, there are several documents for getting it all hooked up correctly (links on the Overview tab) but I'm not sure how updated they are to reflect my first bullet point above.

0 Kudos
Message 6 of 7
(21,944 Views)

i have the same problem with Chris_Y, except that i used a manual control..

i have a question regarding with the servo motor. I removed the limiter of my servo motor so that it will rotates to 360 degrees. What would be a possible problem for my rotation? does it affects the forward and reverse direction of my motor? pls do comment on this...tnx

0 Kudos
Message 7 of 7
(21,944 Views)