Software Feedback-b​ased PWM Motor Control

Hi all, I'm trying to design a software based feedback controlled motor using the USB 6009 (which does not have hardware pwm capability).  I will be actively detecting the rotational speed of the motor and adjusting the software PWM in response, so the PWM does not have to be very acurate.  The user will input a desired RPM value - this value will be compared with the detected RPM and the software will adjust the PWM.  There doesn't need to be any PID control, just a linear stepping of PWM until the detected RPM of the motor is within a certain range of the desired RPM.
The output of the 6009 controls the motor digitally using an H-bridge and I will need to be able to reverse the rotation of the motor.  1 line on the digital output goes to 1 "side" of the H bridge and the other line goes to the other "side."  Only a single side should be active at a time and the other side should be kept at LOW.  I figure this should be easy to implement once I get the PWM-feedback figured out. 
I am currently hung up on a good method of how to implement PWM using manual software methods and construct the actual feedback mechanism.
Here is the VI I have so far (crude PWM using mod-n of the output loop iteration counter (which isn't a linear stepping)).
Thanks 
Message Edited by gastro54 on 04-14-2009 06:07 PM

here is the VI
Attachments:
motor control.jpg ‏148 KB

Similar Messages

  • FPGA PWM Motor control

    Hi, This is my first post on these forums i hope this is the right place.
    Over summer i'm developing a self balancing ballbot for use as a demonstrator at my university. So far i have completed the vehicle dynamics, simulink/matlab model and build a labview model which works. Now i have to implement it in reality on the robot which has already been built.
    The robot uses a 5 state IMU to give feedback to a controlrio unit consisting of an anolgue i/o module and 2 motor driver modules to control an x and y motor.
    I have looked at countless articles and forums etc for information on the fpga and i think i understand everythign about it now but i still have some issues. Mainly, can i create a labview Vi that will generate a PWM signal to the motors in realtime?
    Someone suggested opening a reference to a FPGA bit file which turns the motor on and off and then creating a PWM signal in the realtime Vi and then writing it back to the FPGA? In the realtime vi there is a control loop using a klamn filter and LQR to give the desired output voltages to the motors based on the state of the robot (that is ball angle, body angle, ball speed, body speed and current).
    I take it i can read the analogue acceleration and rol signals directly into the real time vi then simply apply the control theory to it, and then with the final voltage output simply produce a PWM to send to the FPGA?
    Does it have to be converted to the FPGA as the frequency of real time will be too low to allow the quick switching of motor voltages? Could i do it all in the FPGA module?
    Sorry for all the questions, i will be very grateful for any help on the subject.
    Sam Jackson 

    You can do all your calculations in the FPGA, but the FPGA module does not currently have a native floating point library.  You will need to either implement your own floating point or use integers or fixed point.  Implementing your own floating point takes a lot of FPGA fabric, but can be high performance.  You are usually much better off using the native fixed point or integers, although it may mean algorithm changes.  Unfortunately, I am not the person to help you here.  I have never tried to do this.  However, lots of people have.  Search these forums and ni.com for examples and you can probably find something that is close to what you want to do.
    You are correct in that a lot of the functionality of LabVIEW is not available on the FPGA.  But that should not stop you from writing your own.  The difficulty in porting the full LabVIEW functionality to the FPGA is that it would need to work in all circumstances, leading to a lot of inefficiency in many circumstances.  You, as a developer, do not have this issue.  You can write something that works efficiently for your application, but lacks functionality that would be needed in the general case.
    Good luck and have fun!
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • FPGA programming for motor control using free downloadable IP cores for PWM and Quadrature encoder interfacing

    Hi,
    I have a cRIO-9014 with a NI9505 DC brushed servo drive module, and I would like to program the FPGA for PWM and Quadrature encoder interfacing using the intellectual property IP functions mentioned in the "CompactRIO Motor Control Basics Tutorial":
    Quadrature Encoder dX Method (FPGA, Use in SCTL).vi
    Pulse Width Modulation (FPGA, Use in SCTL).vi
    I made a search at ni.com/ipnet but I couldn't find them.
    Where can I find free downloadable IP cores for PWM and encoder blocks to include them in my FPGA interface program?
    Thanking you in advance,
    Manuel
    Solved!
    Go to Solution.

    Found by myself (google search!) at:
    https://lumen.ni.com/nicif/us/codepowelecguide/content.xhtml

  • Accelerometer sense tilt then interface with USB-6008 and generate PWM to control M995 servo motor

    hi everyone,
    currently im doing a final year project in LabVIEW using USB6008. my project involve of sensing the tilt from accelerometer and convert the tilt into PWM to control the turning of servo motor.
    accelerometer that im using is ADXL322 which has Dual axis ±2g sense range
    servo motor that im using is M995. when the servo motor in neutral position it required 1500microseconds, while it turns 90degree it requires 2200microseconds and whilw it turns -90degree, it requires 800 microseconds.
    currently im facing problem in generating the PWM signal to control the operation of servo motor.
    attachment is my VI design that i have done to date.
    the program is about attracting tilt range from accelerometer using USB NI 6008 and then convert the tilt into angle in degree, and after that generate PWM to control two servo motor.
    hopefully there is somebody can help me on this. thanks.
    Attachments:
    FYP.vi ‏253 KB

    currently i need to generate PWM to control servo motor model MG995. but i am facing problem in generating the PWM in between 800usec to 2200usec to control the rotation of the servo motor. is there any example for me to refer.
    below is my VI that i have done to date.
    hopefully somebody can identify my mistake because my VI is not able to turn the servo motor.
    Attachments:
    pwm.vi ‏128 KB

  • Can I use SoftMotion to simulate a PID motor control loop using a Solidworks model?

    Hi
    I'm not a labVIEW user yet. But I probably will become one when I can do the following:
    I have a Solidworks model of a complex machine with multiple servo motors. Can I use labVIEW plus SoftMotion to calculate the needed motor forces and aply these forces on the Solidworks model making some parts in the model move and can I get positional feedback from the Solidworks model which I can use in labVIEW to calculate the motor forces again. This way I could use labVIEW to simulate the complete motor control loop including some PID filtering.
    I could find some posts about SoftMotion, but they all seem to handle about SoftMotion in combination with external hardware. But I would like to do a complete software simulation.
    I hope this is possible.

    Hi Melomania
    Solidworks for SoftMotion works in an interesting manner. First SoftMotion runs in labview and plots a trajectory path based off the input from the user. The generated points are controlled by speed, velocity and acceleration. These generated points are sent to SolidWorks where the physics engine takes over. SolidWorks calculates the ammount of force required to move the component the given distance and also if there are any collisions that take place. Basically the whole process is open loop with no PID being implemented. The purpose for the software is to test your motion system for collisions and calculate the required torque for your motors to move and the velocities and accelerations provided. A system prototyped with SoftMotion Solidworks will still need to be tuned when constructed in the real world.
    For your application I would look into Control Design and Simulation Toolkit.
    Thank You
    Eric Reid
    National Instruments
    Motion R&D

  • Maxon Motor Control and NI UMI7774

    Hello,
    I am using maxon motor control PWM servoamplifier ADS 50/10 for my application.I am currently working on a project that requires me to get the precise position (mesure) with an incremental encoder with 2 channels A and B. I am Using NI Motion, NI UMI-7774,NI PCI 7550, and Labview 10
    I try to connect my maxon direct with the Labview Hardware NI UMI 7774 and i don t know how to do this.
    anyone have any idea?

    Hello,
    can you please give me some more informations about the problems you see with the connection?
    Generally you have to at least connect the "Analog Output", the "Ground" and the "Enable" from the NI-7350 with the Maxon ADS 50/10.
    You can find an overview about the pins of the NI UMI-7774 here on page 16/17:
    http://www.ni.com/pdf/manuals/373359c.pdf
    The connector for the Maxon you can find here:
    http://www.farnell.com/datasheets/6244.pdf
    Please tell me, what informations you are looking for.
    Johannes

  • Quanser DC Motor Control Trainer Missing Some VI's

    Hi, my name is Ansel. I am working on a project to set up an NI ELVIS with the Quanser DC Motor Control Trainer board and create a few very simple experiments demonstrating basic mechatronic functions.
    I've been unable to utilize the VI's that came with the Quanser DC Motor Control Trainer board. The disc that was included must have been faulty because not a single file (not even simple html files) would open. I contacted Quanser about this and was directed to a website (http://www.meqtronics.com/public/requests/QCI_TEMP/QNETCDv1.20forLabVIEW8_5/) from which I was able to download the content of the disc. The files I downloaded seem not to be broken, however when I attempt to run one of the VI's, such as "04-QNET_DCMCT_Speed_Control," all but four of the sub-VI's necessary are found. The four missing VI's are "Intergrator.VI," "Integrator (DBL).VI," "Transfer Function.VI," "and "Transfer Function (DBL).VI." I have all the necessary components installed, as far as I know, and a search of my computer's hard drive returns no results for any of these VI's. I am running the full version of LabVIEW 8.5.
    I would appreciate advice from anyone concerning this issue, but I'd also like to know if the Quanser Trainer VI's are the best way to learn how to create my own very simple VI's. All of the documentation I have found on the internet has referenced the trainer VI's that were supplied, so without them I haven't made much progress. I am only interested in a very simple open-loop system for controlling motor velocity as well as a slightly more complex closed-loop system. Is it worthwhile to get the Quanser Trainer VI's working or could I build these experiments from scratch?
    Thank you for your time.
    Ansel
    Message Edited by Ansel on 04-29-2008 04:50 PM

    Ansel,
    Just to clarify, the version of the NI-ELVIS software that you may have is not the reason for the missing VIs in the Quanser program you downloaded.  The VIs in question are included as part of the LabVIEW PID Toolkit, which I'm assuming is not installed on your machine. However, these particular VIs (Integrator, Transfer Function, etc) are fairly out of date, and they are only included in the PID Toolkit to support legacy code.  I'm not sure if you have access to the PID Toolkit (it is also included as part of the LabVIEW Real-Time Module), but I would not suggest purchasing it just to get this Quanser code working.
    If you are going to be focusing on simple open-loop control of the Quanser DC Motor, you could start by looking at some of the basic DAQmx examples.  Driving the motor at a certain velocity would just require supplying a constant voltage through a DAQ output.  If you want to do more advanced closed-loop control, the LabVIEW Control Design & Simulation Module might be worth taking a look at.  Take a look at the 3-hour Control Design & Simulation course here.  It is written specifically with the Quanser DC Motor board in mind.
    Chris M.

  • New to Motor Control, Seeking best approach

    Hi...  I have an upcoming task where we want to have a LabVIEW based motor control applied to a round, rotatable table inside a coating chamber.  The table will be on the order of 20 inches in diameter, made of aluminum and I will guess that it might weigh around 10 pounds.  We will have four equally spaced quadrants where a silicon wafer will sit in each quadrant.  On command we want the table to move to one of four locations where it will hold for quite some time (minutes to hours) while that one wafer is exposed to coating material.  Then we will want it to move to the other three positions in a similar way.  We want to have feedback that the table is where we think it is and we want to be able to define and return to a "home" position when desired...   There is a possibility that we might also want small motors on each of the four individual stations, meaning we would add some planetary rotation capability for each quadrant while still having overall motion control of the larger 20" round platform..   I'm not yet sure of the desired rotation speed of the small planetary components. but let me guess at say from once per second to once per minute...  On the other side I can imagine a case where they might want these to truly "spin" at say 1000 rpm.  For the larger 20" table I would say that needs only to be able to move one quarter of a revolution in say 10 seconds but when it stops it needs to hold accurately...    
    We will have a PC running LabVIEW controlling this and other features of the process...  Certainly a PCI backplane will be available but we have budget to also buy other interface chassis if that's what is recommended... It's a one time deal so we only need to build one system.  
    I am seeking feedback on what's the best motor type, controller, interface, etc for this kind of application...  Your thoughts???   Any feedback will be much appreciated...  thanks.. bob...

    Hi Bob,
    Here are a couple of links to get you started:
    Configuring a Motion Control System
    This is a good general intro to motion control and breaks down what NI provides in the way of Motion drives and controllers as well as the pros and cons of the different types of motors we support. 
    NI Motion Hardware
    This is a break down of all the hardware we sell.
    http://www.ni.com/motion/
    Please let me know if you have questions after looking through these links.
    Message Edited by Michelle_B on 10-20-2008 02:35 PM
    --Michelle
    Instrument Control R&D
    National Instruments
    Instrument Control
    Machine Vision

  • Position drift during the stepper motor controlled back and forth motion

    Hi everyone there,
    I get a headache position drift problem during the stepper motor controlled back and forth motion. I have been wroking on the problem for the last two weeks, and still can not figure it out. So I write down here my problem in hope of getting some clues from those have some experiences in stepper motor motion control.
    My goal is to use a stepper motor to drive a beam flage fixed onto the shaft to go back and forth for a certain angle, and this back and forth motion needs to be stable and reproducible within hours. With the SMD1 stepper motor driver, I only need to send in a pulse train to control the number of steps(the pulse frequency defines the stepping rate), and another pulse to controle the direction (i.e., cw or ccw). To do this, in LabView, I used the counter of the DAQ board to produce a finite pulse train to step the motor, and used one digital line to produce a pulse to switch the direction every 500ms, the timing is contolled by the software.(I used the oscilloscope to monitor these two pulses, the pulse train produced by the counter looks very stable, and delay between the pulse edges of the direction pulse and the pulse train is also very stable within 500ms. There seems no software timing problems at such a long delay.)  And this labview controlled motor appears to work perfectly as I required, the motor steps a defined number of steps at one direction, and then steps back at the origin position. But after running for a few minutes, the back position shifts gradually(I can not observe a obvious shift at the first few minutes) with repect to the origin position(the position I start running). I looked it up at the manual and also the website, I got a clue that this might because the motor steps at the resonace frequency of the motor and hence misses or takes extral steps sometimes. So I changed the steping rate from 1Hz to 1000Hz to see if the shift disappears or gets smaller at certain frequency range, but the shift always exists.
    I did observe the shift got smaller within the same running time when change the step model from full step (1.8degree/step)to half and quarter step model. According to this, the motor did miss steps (or pulses) during running, the quarter step model has smaller shift due to the smaller steps.  But I also noticed that the motor always shift at one direction, no matter I started with clockwise or counter-clockwise, this seems really strange to me. Because the motor should shift at each direction with the same probability if we assume the motor missis steps randomly.
    There is something must be wrong, either the labveiw program or the motor, but I don't even know a clue of this weird shift problem. And because of this, I haven't made any progress in my lab for the last three weeks. So any suggestions could be very helpful for solving this headache and will be really appreciated.
    Thanks a million in advance and Merry Christmas!
    Li

    Hey, Brian Beal,
    Thanks for your quick response. "accel" and "decel" mean acceleration and deceleration, am I understanding right?
    If yes, then I don't have these in my LabView program, I just generate one TTL pulse train and one TTL pulse with LabView and send them into the SMD1 stepper motor driver.
    The pulse train steps the shaft, and the other switchs the direction.
    Yesterday, I confirmed that if the motor steer always at one direction either CW or CCW, then the stepping were very stable, no missing or extra steps happen for hours.
    And I also observed that the motor took one extra step  from time to time when the direction changes. And this only happens when the direction switch from CW to CCW. (bizarre!)
    I guess this indicates that some pulse noise happens when the motor switch the direction too often.  But I just don't have any clue for irregular extra steps.

  • CRIO motor control using AMC Drive

    Hi
    I am trying to setup a simple DC motor control system with cRIO-9081, NI 9401 and AMC PWM servo drive 12A8.  Can someone please tell me if this AMC drive is compatible with my other NI products?  Do I need anything else to setup a simple closed loop speed control for a small DC motor?  Any advice or example is very much appreciated.
    Thanks

    Hi SunnyX,
    It seems like your servo drive is expecting an input of +/-10V analog.  Are you able to confirm this in the device manual?  If that is correct, you will not be able to generate the necessary signal with the 9401.  You will need another module that you can program to output this signal such as the 9263.  
    You could also consider using the modules designed specifically for motion control and the SoftMotion Module to simplify the motion control programming.  Please let me know if you have any additional questions or comments!  Thanks.
    Regards,
    Kira T

  • Is it possible to condition a load cell signal with a 1520 SCXI and then use it as the primary analog feedback for a 735X motion control board?

    My system
    PXI 1052 chassis
    PXI 8196 RT controller
    Flexmotion 7356 motion controller
    Flexmotion 7354 motion controller
    6259 M series DAQ
    1520 SCXI
    1520 SCXI
    1314 SCXI frount mounting terminal block
    DSM strain gage load cells
    Exlar SR Brushless PM motors
    Kollmorgen servo star CD series 5 drives
    My objective:
    I want to measure the force on the load cells with the 1520 SCXI (i.e. excite the load cell then amplify and condition its output) then I want to use this analog (force) signal as the primary feedback for my motion control system (7356 and 7354 motion controller connected to my drives and motors).
    The problem:
    The motion controller boards (7356 and 7354) can be configured for force feedback control via analog feedback from a load cell.  However the boards implicitly expect the load cell signal to be amplified and conditioned with and external signal conditioner rather then using an NI SCXI module.  Currently I’m am reading the SCXI signals via the 6259 M seriers DAQ and consequentially have no way to route the signal into the 735X boards for force feedback control.  I can use softmotion to control the motors but then I loose the fast PID update rates possible with the 735X boards.
    The question:
    Is it possible to condition a load cell signal with a 1520 SCXI and then use it as the primary analog feedback for a 735X motion control board? 
    Thanks
    Patrick Aubin
    Ph.D Candidate
    University of Washington &
    VA MedicalCenter of Excellence for
    Limb Loss Prevention and Prosthetic Engineering  

    Hi GG,
    Thank you for your feedback.
    >create your own external circuitry to amplify the signal.>
    True a few op-amps could amplify and filter the signal externally but the performance of such an amateur built system will never match the accuracy and functionality of the 1520 SCXI.  That’s why we spent the $2500 for the professional version.
    >One thing that you could do is to use a UMI with your motion controller and then wire your signal from your SCXI to the UMI.>
    As I understand it the UMI is basically a break out connectivity interface for third party drives.  After conditioning and amplifying the analog force signal with the SCXI module the analog signal isn’t available to wire into a UMI.  To my knowledge the conditioned signal of the SCXI resides only in the PXI backplane (i.e. there is no physical access to the conditioned analog signal).  Can you explain how the UMI could be help here.
    Again thanks for your input GG.
    Patrick

  • 9474 motor control

    Hi together,
    i´m new here in LABview forum.
    I got the following problem.
    I got a EC-motor, which were controlled by PWM- signal.
    base:
    The interface of the motor has a "high"- Signal the whole time on it´s control- input, which is ok, because i want to interrupt it (PWM from 0-100%) with my NI card.
    I can generate the PWM- signal by NI cDAQ-9174 with NI9474 digital module from 0-100% if it´s not connected with the control-input of the interface, but í´m worry when i connect it, because then i got the whole time a "High- signal" and can´t steer this motor
    I already checked my wirements, but they are ok (same GND a.s.o)
    Thanks and the best regards
    Jo

    hi Jo,
    How do you manage to determine that your duty cycle is correct when the motor control is not connected but incorrect when the control is wired?
    Best regards 
    Florian Abry
    Application Engineer Group Leader
    NI Germany

  • Looking for reference design about motor control

    hello everyone,
    i want to design a motor control system (PMSM) based on zynq. is there any reference design for me to develop the software with vivado 2014.4.please can you reference me a link ? thanks

    According to the datasheet, digital lines are individually programmable as either input or output.  Other than the two you need to reserve for your counter tasks, all the other digital lines should be available in the normal way.
    Note too that while certain specific PFI lines are the defaults for the counters, you can program the counter tasks to use different PFI lines instead.  This may help if either of the defaults conflict with DIO that's already been wired up.
    -Kevin P

  • Advanced, Connected, Industrial Motor Control with Zynq-Take 2: The Avnet Intelligent Drives Kit II

    Avnet has just announced a revised Intelligent Drives Kit II for advanced, connected motor control based on the Xilinx Zynq Z-7020 SoC. The kit includes:
    An Avnet ZedBoard Z7020
    Xilinx Vivado Design Edition voucher
    Analog Devices AD-FMCMOTCON2-EBZ Module
    Brushless DC motor: 24V, 4000 RPM, with Hall sensors and a 1250 counts/rev indexed encoder
    8Gbyte SD card programmed with application
    Ethernet cable
    HDMI cable
    Micro USB cable
    12V ZedBoard power supply
    24V AD-FMCMOTCON2-EBZ power supply
    Linux drivers, application software, HDL source, reference designs, full schematics, and Gerber files
    MathWorks Motor Control Design Package (optional, North America only)
    Dynamometer dynamically adjustable load system (optional)
    Avnet Intelligent Drives Kit II
     

    Just to clarify one of the bullets, the MathWorks Motor Control Design Package is available from Avnet in North America, but the component products are available worldwide from MathWorks directly. Visit mathworks.com/zidk for a list of required products, getting started information, and links to tutorial webinars, or contact [email protected] for more information.
     

  • Encoder Feedback with a Servo Motor

    I want to use Encoder oder Position feedback with my servo motor in MAX or VIs. How do I do it?
    Thanks
    Solved!
    Go to Solution.

    Hi Fregue
    what LV Version and HW is in use?
    I have seen in your other posts you are using a  NI UMI-7774,NI PCI 7550, and Labview 2010 is this correct?
    If the encoder is connected to the UMI you should be able to see the signals in MAX.
    You can select the closed loop step
    then the encoder is used to control the positon.
    Please check if the microsteps from the motion devcive and the encoder steps per revolution are correct
    Then you should able to use the encoder.
    You can also use the MAX to check if the encoder is connected correct in the interactive tab.
    I hope this helps.
    best regards
    Alexander Glasner
    AE NIE

Maybe you are looking for

  • Conversion help needed.

    Hi everybody. I'm new to the forum, and need your assistance. I've recently purchased a Sony 30GB hardrive camcorder and I'm having problems editing the movies in iMovie HD. The problem is that the camera records movies in MPEG2 format, and in order

  • Reading & writing to file using ArrayList String incorrectly (2)

    I have been able to store two strings (M44110|T33010, M92603|T10350) using ArrayList<String>, which represent the result of some patient tests. Nevertheless, the order of these results have been stored correctly. E.g. currently stored in file Snomed-

  • Coding Issues making me seriously angry!

    Can anyone please tell me why the glue is not doing what it is supposed to! When the app is run, the buttons stay in the middle of the JFrame and do not change size. Therefore nothing to do with setXxxSize. Many thanks in advance, this is making me g

  • XI/PI Integration

    Hi, I am using xi for EDI transmitions and I am using both sender and receiver communication. Our transport protocol type is FTP and Adapter type and message protocol is file. My sender type communication is working fine but receiver type communicati

  • Running Widows Vista system, every time I try to copy and paste from Firefox DEP shuts down Word Works

    I am using a HP desk top with Windows Vista. When ever I try to copy and paste from Mozilla Firefox, the DEP system shuts down Microsoft Works Word Processor. I have tried turning off DEP for Works but it still shuts down the Program.