Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

myRIO to drive digital servo with PWM

Solved!
Go to solution

After scouring the internet for answers, I realized I neglected this resource. 

 

I'm trying to test some small digital servos that will be used in for a senior design project. When we received the myRIO I created a simple VI to drive a servo using PWM with 50Hz frequency and varying the duty cycle between 5-10%. I used a cheap servo that came with an arduino kit, and it worked perfectly. However, the Blue Bird BMS-385DMAX servos arrived and when I tried one with the VI I made, it didn't work. I've confirmed that the servo works by running it with an arduino, it just doesn't run with the myRIO. I'm not a labview expert, and I'm new to the RIO platform; any advice would be greatly appreciated.

 

I've attached the project. Ignore the KeyDutyCycle VI and the shared variable; that was something I was experimenting with, but didn't use.

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

Hi,

 

In measuring the outputs PWM voltage levels, I find that they sit at about 3.25 volts, which may not be high enough to drive the signal line of the servo. IIRC, the Arduino pushes +5V at the ports, so you might consider doing some level-shifting prior to feeding the servo. Just a thought...

 

Edd

 

0 Kudos
Message 2 of 7
(11,708 Views)

Hey rw378,

 

How are you powering the servo?

 

Can you elaborate on what you mean when you say it doesn't work.  Is there any movement at all? Does it make noise, etc?

 

Thanks!

 

-Sam K

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

 

0 Kudos
Message 3 of 7
(11,666 Views)

I'm using MXP A/PWM0 (pin 27/DIO 8 on breakout board) to output a PWM signal to the signal wire of the servo. I connected the 5V and GND to the positive and negative wires of the servo, repectively. When I run it, the servo does not move at all. If I hold the servo, a slight ticking can be felt. 

 

I believe roboticspro is correct. I ignored that the DIO pins only output 3.3V. However, I'm not very familiar with level shifting, or many electrical-type things (being a mechanical engineer). Is there a simple way to produce a PWM signal with a 5V amplitude? 

0 Kudos
Message 4 of 7
(11,643 Views)
Solution
Accepted by topic author rw378

Are you using the myRIO +5v and Gnd to power the Servo? 

 

The myRIO +5v is limited to 100 mA output which may not be enough to power the larger servo.  Try powering the servo from another source but still using the myRIO PWM.  The myRIO PWM (and all other digial output) should be ~3.33v when 'high'.

 

-Sam K

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

Message 5 of 7
(11,634 Views)

Yes, I was using the +5V and Gnd from the myRIO to power the servo. I finally got around to trying a different power source: a wall outlet adaptor outputting 5V at 1.0A. And it worked!! Thanks for the suggestion, Sam!

 

It's difficult to find complete specs for these little hobby servos. All that's usually listed are torques at certain voltages. Although I find it peculiar that the arduino uno could run the servo even though its DIO pins are rated at 40mA, while the myRIO is 100mA.

0 Kudos
Message 6 of 7
(11,607 Views)

"It's difficult to find complete specs for these little hobby servos. All that's usually listed are torques at certain voltages. Although I find it peculiar that the arduino uno could run the servo even though its DIO pins are rated at 40mA, while the myRIO is 100mA."

 

In fact, Arduino and NI MyRIO work at the same way, Arduino allows up to 40mA for single DIO pin while NI MyRIO allows 32mA some pins (depending in its features), but both are restringed to supply 100mA in every single port, this means, in Arduino you can use up to 100mA adding every single supplied current in a  DIO or analog pin. The same situation is applied into NIMyRIO.

For example, if you use 3 DIO pins in your application and thinking that your circuitry is the same for everyone and 30mA are applying to everyone of them the total current consumption is 90mA in that port.

 

Greetings!

0 Kudos
Message 7 of 7
(6,445 Views)