Servo Control Issue | Arduino Compatible Compiler for LabVIEW Discussions | Forum

Avatar
Please consider registering
guest
sp_LogInOut Log In sp_Registration Register
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSS sp_TopicIcon
Servo Control Issue
March 14, 2016
3:26 pm
Avatar
findingthingsout
Member
Members
Forum Posts: 10
Member Since:
March 11, 2016
sp_UserOfflineSmall Offline

 I am a Labview/ Arduino Novice attempting to write a simple program to control a servo. The goal is to be able to have the motor sweep from 0 - 180 and back, every 15s, with a switch connected to a digital input to start and stop as needed. 

I am using a Tower Pro MG958 high torque metal gear servo. I was able to accomplish the sweeping with a delay via the Arduino IDE, although it doesn't always move. I want to be able to use labview to add some extra control that I was not able to accomplish through the IDE. Sometimes the motor just ticks and won't move much at all. I can manually line it up if I give it a 1.5ms pulse every 20ms and rotate it to center, and then it will hold its position even with my attempts to turn it. 

I have tried several approaches from a series of flat sequences with varying pulse widths to state machines and even a basic while loop with one pulse width given.

LabVIEW 2015 32- bit
I can verify the pulse widths with an ocilloscope.

Whats the recommended way to post an img of my code?

Any tips on setting this up? 

March 14, 2016
5:04 pm
Avatar
findingthingsout
Member
Members
Forum Posts: 10
Member Since:
March 11, 2016
sp_UserOfflineSmall Offline

To be clear, I am using the Arduino Compiler for LabVIEW and utilizing the Servo Palette. I initialize outside of the loop, write a pulse width within the loop, waiting for a high on pin 2, which will take me out of the loop and close the servo. 

I have now tried this on multiple servos with minimal success when running the embedded labview program. I can switch it over to the IDE and load the sweep program with success, most of the time.

The non-working state involves the servo ticking in place, advancing very slowly at times, other times only clicking in places.

Is there something as far as centering the shaft position so it starts in a known-good position? I have little servo experience as well but have read a lot this past week.

March 14, 2016
5:09 pm
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

Can you post your VI?  Sounds like part of your issue may be hardware since you are experiencing issues where it is not moving both in the Arduino IDE and LabVIEW.  Since it is a high torque servo, are you providing a direct, high current power source to the motor?  Remember that the Arduino boards have a voltage regulator with very limited current output depending on the board.  Please let us know what your hardware configuration is as well.

March 14, 2016
6:50 pm
Avatar
findingthingsout
Member
Members
Forum Posts: 10
Member Since:
March 11, 2016
sp_UserOfflineSmall Offline

Hi,

How do I post it so that its view-able in the post? Still learning the basics.

 I did try this with an external power supply set to 6V and 1.2A, limited to 1.4A. Connected the grounds from the supply to the servo and then on to the Arduino Uno. The power supply was only displaying around .01 - .1A.  I am not sure what is typical with these servos, looks like <.5A.  Still no desired movement, just clicking.

Also I have tried to use a seperate 9V supply to the 3.5mm on the Uno, still struggles.

Let me know how to post the VI, tried to snip it and paste. No luck.

 

Thanks,

Adam

March 14, 2016
6:55 pm
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

Go ahead and zip your code and just post the zip.  There is an upload attachments button at the bottom of the post.  But first please save as LabVIEW 2014.

Sounds like you should be fine on the current.

March 14, 2016
7:23 pm
Avatar
findingthingsout
Member
Members
Forum Posts: 10
Member Since:
March 11, 2016
sp_UserOfflineSmall Offline

OK, I tried this with a third servo and of a different type. As mentioned in other posts during my search the Tower Pro MG958 is a hit or miss, and mine are the Actual Tower Pro, not TowardPro. I received a HiTEC HS-645MG and have been able to power it via external power supply and through the UNO on its own. Seems more responsive with the external at 6V.

Still not sure why the other Tower Pro servo is intermittent. I did run it over a long weekend stirring ice with the servo sweep program from the Arduino IDE "basics" palette. Even ran it off the UNO. I guess it just degraded over time.

But this is good to know that it wasn't the servo VI or y amateur G coding skills.

Basic-servo-position.PNGImage Enlarger

 

The first "script" was to just set a position and hold to test functionality. ^

The zipped file was with several positions to stir the ice in the ice bath that i am building. I skipped 2014 and am running 2015, maybe there is a way to still save it as a 2014?

Thanks

sp_PlupAttachments Attachments
March 15, 2016
12:18 am
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

Ok.  Yes, some servos are cheap and break after a few uses or are inconsistent.  Took a look at your VI, seems ok.  What problems are you having?  One observation is that you are using "Time Delay", however this is not on the ACC4LV palette.  You get lucky and it probably works.  But you should be using only what is on the included palette, which is "Wait (ms)".  Also, you are using Servo Write Pulse Width, but for a simple angular move you should be using Servo Write Angle. This is what Write Angle translates to in Arduino, which is what I think you want, and what the included example is based off of.

March 15, 2016
3:37 pm
Avatar
findingthingsout
Member
Members
Forum Posts: 10
Member Since:
March 11, 2016
sp_UserOfflineSmall Offline

The HiTEC servo is now working smoothly. The other servos either seem to stutter in place, advance slowly while jittering, and sometimes it will work as desired. I did try the servo write angle as well during my troubleshooting but did not have success. I'll try it some more though, would be a more intuitive approach. 

Thanks for the tips. I'll apply them.

Forum Timezone: UTC 0
Most Users Ever Online: 100
Currently Online:
1
Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
miche91: 33
scottj: 28
scadao: 23
Member Stats:
Guest Posters: 5
Members: 202
Moderators: 0
Admins: 3
Forum Stats:
Groups: 1
Forums: 2
Topics: 266
Posts: 1222
Newest Members:
pujacontrol
Administrators: geadmin: 22, filipealtoe: 96, Steffan: 356