Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate PWM signal with 6602 utilizing load cell feedback

Hi Everyone,

 

I am new to LabVIEW so I apologize if this question is elementary but I really need some help with the coding. First of all, I need to generate 8 independent PWM signals to control 8 separate linear acuators using the NI 6602 board. I have each actuator wired to their own COUNTER OUT pins and ground on the SCB-68 that is connected to the 6602. The specs for the actuators state that it will take an input of "RC input range of 1.00 to 2.00msec pulse widths @ 55Hz. Bandwidth=.44to160Hz. Period from 6-23  msec". How can I code for these PWM signals given the specs from the manufacturer?

 

In the end I need to be able to not only control these actuators based upon duty cycle, but based upon the load each actuator is applying. Each actuator has a load cell in series measuring the tensile force through the load cell (the actuators will be pulling on strings). Each load cell is wired to a NI 9237 in a NI 9074 block that is connected via USB to the same computer. So first comes first, how can I code for the load cell output to be brought into the LabVIEW environment?

 

My last question is pulling this all together. How can I code so that I can input a specified load into LabVIEW and then based upon the value the load cell is reading, the duty cycle of the PWM will be adjusted until the the desired load is achieved?

 

Thanks in advance for any help! Also, I know that this is quite a complex questions so if you can even point me in the direction of resources that would be helpful, I would greatly appreciate that too!

 

Thanks,

Ryan

0 Kudos
Message 1 of 5
(6,502 Views)

Hello Ryan,

 

Here's a tutorial on generating PWM with LabVIEW:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x1P0CAI&l=en-US

 

How are the load cells outputting the data? Is it an analog signal? If so, you can read that in using an analog input task, and run that in parallel with the PWM task. Then you can modify the frequency and duty cycle inputs that you're giving you the DAQmx write inside the PWM code based on the analog input. By putting the DAQmx read and the DAQmx write in the same for loop, you can read from one and modify the other at the same time.

Here's a tutorial that shows a lot of useful information for using DAQmx within LabVIEW:

https://www.ni.com/en/support/documentation/supplemental/06/learn-10-functions-in-ni-daqmx-and-handl...

 

If you're interested in getting better at LabVIEW in general, NI has some learning materials available here:

https://learn.ni.com/learn/article/labview-tutorial

 

Let me know if you have any further questions once you've gone through those first two tutorial links.

 

 

 

 

Colden
0 Kudos
Message 2 of 5
(6,488 Views)

Thanks for the help. I'll see what I can get accomplished with these resources.

0 Kudos
Message 3 of 5
(6,476 Views)

First of all, thanks again for the help.

 

I have successfully generated the appropriate PWM signals, however I discovered that I was not able to use duty cycle modulation, instead I had to use "High Time" modulation (between 1-2 msec) with a fixed low time (9 msec). The motors are running fine now. The load cells provide an analog input that ranges from 0 to 20 mV that scales linearly with the load applied (0-150 lbs). They are connected using an NI Compact DAQ chasis and two NI 9237

 

Now I am left to create the feedback that will allow me to control the motors by inputing a desired load instead of a desired high time. My first idea, although rudimentary, is to create a feedback loop where in each iteration of a while loop the up time is altered by a small amount (1 usec) until the load value from the load cell reaches the desired value.

 

Is there a more sophisticated solution to this problem? I only ask because I imagine this is a very common application for Labview based motor control.

0 Kudos
Message 4 of 5
(6,457 Views)

We have a toolkit that does PID control.

 

If you don't have that toolkit and don't want to purchase it, then your solution sounds reasonable. If you want to have faster convergence, you can try using proportional control (alter the up time faster the farther away you are from the target load). 

Colden
0 Kudos
Message 5 of 5
(6,449 Views)