LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to control a servo with the myDAQ

Hi,

I have the problem that I want to control a servo with a myDAQ.
To do that I connected the servo direct to the DIO Pin 7, DGND and 5V.

Next step was to use the NI sample for LED control with myDAQ (use port was changed):

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

but the servo does not do anything 😞 I tought I have to change his angle to a maximum and with a later used PWM instead of the continuous signal its possible to change the angle. But also a short try with PWM does not change anything 😞

I would be really happy for help, because it is a very important project for me where i need a lot of controlled servos.

0 Kudos
Message 1 of 7
(11,117 Views)

Hi zerberus,

 

before connecting your servo directly with your myDAQ you should read it's manual: there you will find the note "drives just 4mA per DO line"...

 

Think about that yourself! Your servo is much more demanding than a simple LED...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(11,087 Views)

Assuming your talking about an RC servo, you could use the onboard counter of the myDAQ to generate a pulse train.  The code for that is explained here.

 

RC Servos work as follows:
Capture.PNG

 

Knowing this information and using the code in the link you can control an RC servo using the myDAQ.  The counter output is on DIO pin 3.  The attached code worked for me with my own myDAQ.

My servo is powered by the 5V output which gives:

Maximum output current.......................100 mA

Lewis Gear CLA
LabVIEW UAV

Message 3 of 7
(11,075 Views)

Hi thats really nice but i have the problem that i can not open the file because I have only Labview 2010 is it possible to convert it?

0 Kudos
Message 4 of 7
(11,038 Views)

Sure, try this one.

Lewis Gear CLA
LabVIEW UAV

0 Kudos
Message 5 of 7
(11,004 Views)

hmm, how is it possible to control a servo with every Digital Output?

0 Kudos
Message 6 of 7
(10,984 Views)

The digital outputs on the myDAQ are software timed.  That means you must generate the control signals from LabVIEW and you won't get the resolution you need to control the servos 

 

For every servo you need to control, you need to have a counter onboard your hardware.

Basically, I don't think what you are trying to do will be possible with the myDAQ.

Lewis Gear CLA
LabVIEW UAV

0 Kudos
Message 7 of 7
(10,968 Views)