Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

help controling a rc servo with a cRIO

HI I am using a cRIO 9012 and a NI 9474 to try and control an HiTEC HSR-5995TG servo.  I have been using the example code for PWM found on this site to guide me so far.  However, I am not having much success and I was wondering if anyone could guide me in the right direction.  I am very new to all this and trying to learn as I go.

Thanks much,

sopraa
0 Kudos
Message 1 of 15
(5,264 Views)
Hi sopraa,

Can you tell me where you have found the example code and how you are modifying it work with your application? 

Also, I have attached a link to a cRIO tutorial to help you get on your feet.

Thanks!
0 Kudos
Message 2 of 15
(5,243 Views)
hi,

The two LabVIEW codes that I was looking at are linked here.
 
http://zone.ni.com/devzone/cda/epd/p/id/1726

http://zone.ni.com/devzone/cda/epd/p/id/979

I would say that my real question is what would be the best way using LabVIEW to control a servo?  I plan to have a slide bar on the screen and when i move it the servo responds by turning one way or the other.

Thanks
0 Kudos
Message 3 of 15
(5,237 Views)
With this particular motor there will be three wires: power, ground, and signal.  Every pulse you send to the motor will cause it move one tick.  You must therefore know how many ticks is required for a full revolution and then use that to compute how many pulses you should send to the motor.
0 Kudos
Message 4 of 15
(5,205 Views)
Thanks for the help so far,

I am making some good progress so far, would I use the equations in the PWM example I showed you above to calculate the number of ticks? Then how would I apply the calculated number of ticks to my code? 

I hooked up an oscilloscope to my 9474 and have been using that to see the signal I am getting out using the cRIO pulse generator which I linked above.  I have have been getting the frequency and period that I think I want, however it is not translating to the motor.  Am I using the wrong code?


Thanks agian,

Andy Soprano

0 Kudos
Message 5 of 15
(5,201 Views)
Hi Andy,

The first example is a bit of code that just generates a pulse train.  The second example is PWM.  You'll have to look at the spec for the servo and find out the type of signal it is expecting and to confirm that it is wired correctly.  Using the pulse train example, you should be able to get some results, regardless if they are the desired results or not.
0 Kudos
Message 6 of 15
(5,185 Views)
Thats what I thought however I can not seem to get any response from the servo using the pulse train code or the pwm code.  I tested the servo on a signal generator and the servo is working, the manual also says it used standard pulse for Radio Control

I have a ~6v supply which can provide up to 5 A going into Vsup, and COM of the 9474, then I have the power and ground wires for the servo coming out of the Vsup, and COM.  Lastly I have a wire coming out of the DO0 going to the control port of the servo.  The servo is getting a signal because it provides resistance when i try and turn it while the program is running.

Thanks,

Andy
0 Kudos
Message 7 of 15
(5,181 Views)
I have a link to Hitec's website.  You will see under the downloads section a link to the manual.  There is some timing information on the signal.  Use a scope to verify that you are producing the signal that you think you are generating.  You may also want to use a scope to check this signal against the signal that your radio is producing. 
0 Kudos
Message 8 of 15
(5,151 Views)
Thanks Brian,

I did some test today and the signal that I am creating is the same.  I ran my code using hte cRIO and a GWServo (S03N 2BB) servo and that worked just fine.  However the Hitec servo does not seem to work.  When I hooked the scope up while running the program the pulse is generated with a peak to peak voltage at 7V.  When I connect the Hitec servo to the cRIO the scope shows a pulse being generated however it does not go from zero to 7 volts but rather about 2.5 V to 7 Volts.  I read the manuals of both the servo and the 9474 and I am not sure if this is the problem but the 9474 says something about using sinking-input devices.  Could the problem be that my servo is a not sinking-input device?

Thanks,

Andy
0 Kudos
Message 9 of 15
(5,148 Views)
What you are seeing sounds consistant with what is happening before.  If the voltage is only dropping to 2.5 V, the servo will not recognize edge changes and thus will not move.  However, it will try to hold position, which is why it wouldn't move when it was hooked up before. 

Maybe its best to try a little hardware troubleshooting.  Can you try running 5 V through Vsup and see what voltage output the 9474 sources?
0 Kudos
Message 10 of 15
(5,129 Views)