LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie needs help with PWM, DAQ, good reference guides, and life

Hey everybody,

THE SETUP:
I am a senior electrical engineer at the University of Alabama who is in the middle of a senior design project, trying to balance an inverted pendulum. I have been given labview as my programing environment; I have a PCI 6229 M DAQ card (that has yet to be installed on my machine by the powers that be.) What I will soon have to do is take the information off 2 encoders, run that through my DAQ card, through a contoller, and send out a PWM singal to drive a motor back and forth.

THE PLEA:
I do not know where to start. I have been through some of the startup materials and I can happily convert Fahrenheit degrees to Celius degrees, but I need a little more than that. I have to program a PWM algorithmn and convert the encoders signals into meaningful information. Where can I find examples that might point me in the right direction? Can anyone recommend any good reference materials on the basic (or advanced) LabVIEW applications? Any help will be greatly appreciated.

peace

Eric
0 Kudos
Message 1 of 27
(5,526 Views)
I would recommend that you buy this book :

"LabView 7 Express" by Robert H. Bishop, NI

and use Express VIs for analog input and analog outputs.

it's not really that hard, just keep reading and experimenting.

good luck,

Ed
0 Kudos
Message 2 of 27
(5,501 Views)
Eric,
Some general info that might be of some help.
Installation should be in this order:
1) Software (LabVIEW)
2) Driver (NI-DAQ 7.3.1 is the most recent version) If you don't have it on a CD, you can get it free here:
http://digital.ni.com/softlib.nsf/webcategories/85256410006C055586256BBB002C128D?opendocument&node=132060_US
3) Hardware (6229)
If LabVIEW is installed before the driver, NI-DAQ will automatically install DAQ examples into LabVIEW's Example Finder (Help>>Find Examples). You will probably want to take a look at some of the DAQmx counter examples. There are already examples that perform frequency and period measurements, as well as pulse train output. Good Luck!
-Alan A.
Message 3 of 27
(5,489 Views)
Eric,
1. Stay on the folks who are going to install the DAQ for you. It is a simple process - I just did it myself and I'm relatively clueless when it comes to PCs, take it over yourself if you must. Don't let others bottleneck your process, take the lead whenever necessary. If you step on someones toes, politely say "excuse me, I was just trying to help." 😉
2. Read all the spec sheets on all of your equipment, be mindfull of your equipment's limitations. 🙂 It will save you valuable time later . . .
3. Read the manuals on your DAQ, be mindful of its limitations (what can I say, it was worth repeating). It will save you valuable time later . . .
4. Work on it everyday, especially in the beginning of the project. You have some formidable learning curves ahead, get moving now! Tell your friends and loved ones you care about them but that you will be busy for the next couple months and can't be as much fun as you used to be. My wife was beside herself when I did my senior project . . .
5. Know when the point of diminishing returns has been reached and take a break. I like walking best. And above all else drink lots of pure, fresh water. Avoid fast food, don't smoke anything, don't drink alchoholic beverages more than once a week and then in moderation, wash your hands often. These kinds of things are easy to forget when you are working on a project, but you don't want to get sick, its a waste of valuable time.
6. I think you might need to study PID stuff, control loops and the like and how LabVIEW can help you. Sounds like Alan's post will get you started. For the most part, you will fall into a groove and what you need will come to you when you need it physically and intellectually. Any technical advice or personal ideas should be analyzed in detail, if you don't understand it, it could hurt your project.
7. Don't be afraid to start over . . . its always easier the nth time.
8. If you get stuck, post to this group. You'll probably figure it out as you try to explain it textually, that's what always seems to happen to me. 😄
9. Press on!

-Rick
Message 4 of 27
(5,468 Views)
Eric,

Encoder signals: your board has 2 counters and both can interface directly to a quadrature encoder. The "measurement" you get can be a signed quadrature position, including scaling into physical units like mm, rad, deg, or whatever.

PWM: your board can use a counter to generate a PWM signal. It's possible to load in a new set of freq & duty cycle parameters on the fly to change the duty cycle without interruption of the pulse train.

The rest of this post is kind of an early warning. You've got some weeks of learning basics about LabVIEW syntax and DAQ programming before these things would be an obstacle. But they'll probably be rearing their heads eventually.

Problem: Your board only has a total of 2 counters. If you use them for the 2 encoders, you can't also generate PWM. Maybe part of the project is for you to design and build some interface circuitry. I think you'll be best off if you use the counters of the 6229 for the encoder measurements and find another way to generate your control signal. Analog output seems natural if that's allowed.

Other problem: this is supposed to be a real-time control system. Unless you're using LabVIEW Real-Time, you'll be running under Windows. So your control loop will *not* always run at a constant rate, and is at risk of becoming unstable as a result.
Personal experience: I had a motion system designed for LabVIEW real-time that needed to track a smooth periodic signal (not exactly a sinusoid, but not too far off). The device moved about 3-4 feet on a linear track at a 1-2 Hz rate. Under LabVIEW RT, it controlled nicely with a 500 Hz control loop rate. When I tried running the same program under standard LabVIEW in Windows, the motion would become erratic -- smooth for a while, then a hesitation and an extreme adjustment. I doubt it could have kept an inverted pendulum from falling.
I didn't need or try to optimize it for running under Windows so I suspect there were ways to improve it significantly. But there'd probably always be a risk of the motion going erratic or unstable at any time. At a minimum you'd want to close other applications, keep your actual control loop in a high priority thread, and put your user interface (inputs, display) in a separate thread.
There's a bunch of info on threads, priorities, and execution systems here on ni.com when you are far enough along to need it, but that'll probably be a few weeks.

Good luck with the project. You'll be able to find quite a bit of info by searching both the forums and the official support resources here on ni.com, then posting specific questions you can't find answers for.

-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 5 of 27
(5,452 Views)
I am also a NEWBIE. I have a PCI 6025E DAQ card. I am trying to generate and control a PWM signal of between 0 to 10 Volts. I have been through numerous examples. All of them are complicated. Can you give me a very basic simple easy PWM for me. I just need a SIMPLE PWM that generates and control 0 to 10 VOLTS. THANKS!
0 Kudos
Message 6 of 27
(5,384 Views)