3:26 pm
March 11, 2016
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?
5:04 pm
March 11, 2016
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.
5:09 pm
March 12, 2015
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.
6:50 pm
March 11, 2016
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
7:23 pm
March 11, 2016
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.
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
12:18 am
March 12, 2015
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.
3:37 pm
March 11, 2016
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.
23
1 Guest(s)