04-20-2013
04:13 PM
- last edited on
02-07-2024
02:41 PM
by
migration-bot
Hi. I am really new in LV and I need a help. I did this basic control http://www.ni.com/white-paper/11197/en to generate PWM and control DC engine. But I need to control it in both directions in Scan interface and I need a graph of PWM which I generate. I have H-bridge connect to Rio. I´ve three 9041 and one 9215 modul. I know, it´s easy, but I need some tutorial.
Thank you.
04-23-2013
04:59 AM
- last edited on
02-07-2024
02:44 PM
by
migration-bot
Hi zabloros!
Since you wrote, that you are really new to LabVIEW please allow me to recommend some getting started material:
Unit 1 - Getting Started with LabVIEW: Lesson 1: http://forums.ni.com/t5/forums/replypage/board-id/240/message-id/12483
(Please tak care on the Next Step links, where you can continue learning)
In my the best guide for cRIO is this: https://www.ni.com/en/shop/compactrio/compactrio-developers-guide.html
I found some solutions for your application:
Servo motor (RC) control using LabVIEW
https://forums.ni.com/t5/Example-Code/Servo-motor-RC-control-using-LabVIEW/ta-p/3535211
In LabVIEW Example Finder (Help>> Find Examples..) search for:
- NI 94xx Out -PWM -ScanMode
- PWM Out, Simple - cRIO (this project uses FPGA mode as well)
In my opinion the white paper you mentioned is a very good guide for this project.
Where did you get lost? Do you have any questions related to that material?
Best Regards,
04-23-2013 12:37 PM
Hi!
Thank you for replay. I´ve already studied some materials. For Servo motor (RC) control using LabVIEW I don´t have analog output modul. I don´t need so sofisticated control. Now I have two problems. First - I did exactly this control http://www.ni.com/white-paper/11197/en and analog input is connected to speed sensor (tachodynamo) as feedback to PID regulator. BUT the speed is unstable! Speed of DC motor increases and then decreases.It´s still repeating when I have constant set point. I don´t know why. Is there some problem with PID regulator or feedback or another settings?
The second problem is with reversation of the speed. I want to generate two PWM connected to H-bridge for the reversation as you can see in the attachment. If I set SETPOINT bigger than zero I should generate first PWM. If I set lower value than zero I should generate second PWM for reversation. With one PWM I have the same problem like above. And with second PWM i don´t have any signal. There is probably some problem with my script.
I hope you will help me.
Thank you very much.
Rostislav
04-30-2013 03:54 AM - edited 04-30-2013 03:56 AM
Dear zabloros!
Sorry for the late reply.
It's hard to say why is the speed of your motor unstable. It would be good to see a connection diagram, to get more familiar with your system.
It would be also good to know how big this instability is (in RPM for example)
I have a feeling, that you may use the output of the 9401 as PWM signal to drive the H bridge. (or the motor?)
In the Whitepaper you linked, NI 9472 module is used, that has 24 V output, that is enough to drive a small DC motor. Of course duty cycle of the PWM signal will determine the speed of rotation.
In this solution, there is no H bridge, the direction of rotation is not reserved.
Your system, and needs are different from this solution. Of course in manner of CRIO programing, using PID and setpoint this whitepaper is very useful.
Since you have a H bridge, (http://en.wikipedia.org/wiki/H_bridge or http://www.hvlabs.com/hbridge.html), you can set which coils of the motor are connected to VCC and to the ground. (It would be useful information, if yoo could specify the type of H bridge IC you are using.) For this purpose no PWM, just simple digital high and low level signal should be enough, on the specific inputs of the H bridge IC, that are controlling the switches inside.
Of course speed of motor depends on the voltage connected to the coils of the motor. For this you have to change the VCC, and that could be done with a PWM signal. NI 9401 is not powerful enough for this purpose, I would recommend NI 9472 (power supply can be connected to the module, so it't powerful enough).
I summarised my recommendations in the attached picture.
I hope it will make clear the usage of 9401 and 9472.
If you have any questions, please don't hesitate to post them.
BR,
04-30-2013 04:34 AM
Thank you for reply. The reversation already works. I did in the same way how you described. It´s laboratory H-bridge, but now I probably know where is the problem but I am not able to fix it. It seems that problem is with PID regulator precisely with integration constant. When I set integration constant of PID regulator to zero, I can control speed fluently in both directions and it works vry well. (D constatat is permanent zero). But i this case I´m just changing duty cycle of PWM. But I need to set speed, not duty cycle. Am I right? Because when I set f.e. integration constant to 0,01 the problem with unstable speed is back. I´ve got idea, that I need to set longer integration time, but I don,t know when. I could not find it. Is it possible? And also I have one small problem due to my unknowledge. How can I make a graph of PWM which I generate in LV? Not from the H-bridge, but I just wanna see graph of PWM and how duty cycle chynges.
Thanks a lot for any advice.
Ross