Showing results for 
Search instead for 
Did you mean: 

Why won't half my servos work? (LabVIEW, Arduino & Linx)

Go to solution

@kathmonkey wrote:

Hi GovBob, thank you for replying to my problem!


I've had to split the error wire because I need to be able to control the servos simultaneously.

I wish I knew what your end goal was but what are your expectations? LINX uses the Arduinos' UART port which means that you are limited to one command followed by the next command etc.. It does it fast but not exactly simultaneous. You also have a hardware limitation using a Arduino. It can't do things in parallel. LINX works but it abstracts the details of the Arduino IDE C/C++ from you. You have to understand the timing limitations. 

Now Using LabVIEW 2019SP1 and TestStand 2019
0 Kudos
Message 11 of 28

Uh, this could present a major problem...


I'm trying to build a guitar-playing robot. The strings will be plucked by six individual servos (much like this project:, while the chords will be formed using three more (It's a mainly mechanical setup, each servo represents two chords. 90 degrees to the left forms one chord, 90 degrees to the right forms another). The user interface will have three modes: Lesson mode (some text & pictures, and a button that plays a particular chord), Free-play mode (the user can change chords and pick individual strings at will) and Song mode (The machine will play a pre-programmed song).


I've got two weeks to get this done. If it's not possible with LabVIEW then I'm in serious trouble. 


I do have more Arduinos, would that help?

0 Kudos
Message 12 of 28

Your project looks very interesting.Two weeks is a pretty aggressive timeline. First of all LabVIEW is not the limiting factor here as it is very easy to do things in parallel with it. The limitations come in the form of the communication buss and hardware. I would say it is time to experiment. I linked earlier a LabVIEW Makerhub solution that used 2 arrays to control the servos in a while loop. Try that and see if it works and gives you something that appears simultaneous.

In the videos on that page/project you linked he does not pluck the strings in a simultaneous fashion. He is using a PI computer and some python programming to talk to the arduino through the serial port. His C/C++ sketch on the arduino listens for these commands and reacts accordingly. He also included manual control in that same sketch. You are doing the same kind of thing using a computer with LINX/LabVIEW instead of python. The sketch on your arduino was uploaded using LINX and is a bit general purpose. You might want to take a deep dive into all of the content on the LabVIEW MakerHub site. It is pretty well documented and the LabVIEW tutorials are pretty good. If you don't know how to program the arduino using its IDE I would encourage you to at least learn the basics (as I barely know them). Adafruit is my favorite site for that but there are many others. In fact one of the options you could consider is using a piece of hardware that is made to control servos via I2C and an arduino. You would then send the commands to a sketch using LabVIEW (no LINX involved) mimicking the arduino's serial monitor which in turn would contact the motor controller vie I2C. Of course that would involve more expense which might not be an option. 

As to multiple arduinos that is another option. I've never controlled more than one at a time but it is possible if you have the serial ports (via USB) available on your computer. This is where LabVIEW would really shine as you would have independent loops for each arduino. They would not share the resource wire or error wire and run independently. In your architecture you would just call each independent loop at the same time. 

Like I said earlier it is time for some fun experimentation. 


Now Using LabVIEW 2019SP1 and TestStand 2019
0 Kudos
Message 13 of 28

Yeah, it's pretty ambitious, but I'm confident I can get it working if I can just get this code to work!


Sorry, I should have been more clear when I said "simultaneously". I was previously having timing issues (see here:  that wouldn't allow me to control the servos in a pre-programmed order. The lovely people here helped me solve that, but now I'm still struggling to get more than three servos to work at all. 


I considered the possibility that there were just too many subvi's, so I tried a single Servo Write VI with N channels, but no luck. Channels 7, 8 and 9 just aren't doing anything. I've rewired, changed the power setup, swapped battery sets, exchanged servos, even tried a different Arduino, but it's just not happening and I cannot understand why. 


Servo & Motor Power Test 2.PNG

0 Kudos
Message 14 of 28

You are at the point where you need to see if it's a hardware issue or a software issue. Change your software to only talk to one servo at a time. Make sure each one works well if you're only telling it to do one thing.


I haven't ever done this with an Arduino... but I suspect your issue is that you're trying to drive servos on the wrong pins. Your picture is a little too small to see which pins are working, but let me guess- the motors attached to 5,6, and 9 are working, and the others aren't?


Most servos use PWM-style timing to control their position, and you're hooked up to 4,5,6,7,8, and 9. Arduino Uno's can only output PWM on 3,5,6,9,10, and 11:


There may be other ways for Arduinos to command servos (bitbanging, for instance, which could work on most any digital pins).


0 Kudos
Message 15 of 28

Hi Bert, thank you for replying to my problem!


I'm afraid not. Pins 4, 5 & 6 work fine, it's 7, 8 & 9 that are giving me trouble. The servos don't need the PWM output specifically (see here:

0 Kudos
Message 16 of 28

Hi Bert, thank you for replying to my problem!


I'm afraid not. Pins 4, 5 & 6 work fine, it's 7, 8 & 9 that are giving me trouble. The servos don't need the PWM output specifically (see here:


I've just done a simple VI, running only 1 channel at a time, running it, then changing the channel number and running it again. 


Everything worked. Now if I could just figure out how to make them all work together...

0 Kudos
Message 17 of 28

Ooooh, a development!


The only servos that work are whichever are the first three inputs. If it's 4, 5, 6, 7, 8, 9, then only 4, 5 & 6 work. In the instance shown below, only 7, 8 & 9 work. Doesn't matter which order (and merging the error lines didn't make a difference), only the first three work.


Does this give anyone any ideas about what to do next?



0 Kudos
Message 18 of 28

Ah, so they are bitbanging them. Glad to see it all works! Can you try writing all 6 servos at once? It sounds like some background communication buffer may be filling up or something.

0 Kudos
Message 19 of 28

Hi Bert,


Did you see my reply about the "Servo Open" subVIs?

0 Kudos
Message 20 of 28