Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Motor Position Control Problem

Status
Not open for further replies.

YAN-1

New Member
Hi everyone. I know this is a bit long but please bare with me and try to help :oops:
I am working on a project in which I have to control the steering mechanism of a car so that it is driven without a human driver and is controlled remotely. I have installed a geared DC motor at the steering shaft and when I connect the motor directly to the battery, it easily rotates the steering in both directions. Then I built an H-bridge circuit so that the motion of the motor can be controlled through a PIC 16F877. I used TC4427 MOSFET Drivers as well and everything was working fine. The thing is I was always switching either phase of the H-bridge fully (100% duty cycle) and the motor always rotated fine. I got feedback of the steering position through a linear sliding potentiometer that moves with the rack of the steering mechanism and so I had on/off (or bang-bang) control (if there is an error in position, rotate the motor at full speed until it gets to the desired position). I am now attempting to improve the controlling technique (make it more professional!) by trying to program a PID controller instead of on/off control. This means that I have to obtain a mathematical model of the system as a whole and then find a suitable controller for it by designing it with MATLAB. Since there are many unknown parameters in this system (like friction, inertia,....), I wanted to devise an experiment in which I would give the system a step input and then capture the output and apply these input/output relationships to the the system identification toolbox in MATLAB. So I adjusted the program on my PIC so that I can choose to give 3 values of duty cycles (100%, 75%, and 50%) to represent three different step inputs of voltages to the motor and in each case I would note the response. I tested the system with LEDs instead of the motor first and everythign was fine (the brightness of the LED changes with the duty cycle) and then I connected the motor for the real thing! At 100% duty cycle, everything was fine as before. But whenever I switch to either 75% or 50% duty cycle, the motor struggles to move the steering (as if it is trying real hard) and it is very slow and then all of a sudden, my H-bridge MOSFETs get cooked! (there is smoke and sometimes even light!). I can't understand why this is happening. At a lower duty cycle, the motor should have a lower voltage and hence lower current, so I understand that it will be weaker and slower. But why do the MOSFETs get damaged? Is it trying to draw too much current? But the voltage is lower than before now (by 75% and 50%). And some other weird thing happens. When I connect the motor to the H-bridge, I also keep the LEDs as another load so that I know in which direction the motor is turning depending on which LED is on. But when the motor tries to move at 75% or 50 % duty cycle, both LEDs appear to be on at the same time and then there is smoke out of the circuit!

Please help! I know my system was fine the way it was (on/off control) but I would really like to design a propper position controller for it. Even if the motor cannot move the load at less than the full voltage, then I wouldn't mind staying with the old controller but I would really really love to know what is going on here! Please note that the motor is rated at 11 amps. The MOSFETs I'm using are the IRF640N (N-channel) and the IRF9540N (P-channel). Thank you very much. I appreciate your help.

Nichola Victor Abdo
 
It sounds like your h-bridge isn't working properly?, there are a number of h-bridge designs about which while being OK for simply switching direction of a motor won't work with PWM. This is because they won't switch ON and OFF fast enough, there are a number of threads on these forums about this.
 
Yeah your switching time is too slow. A MOSFET dissipates no power when off and only a small amount of power when switched all the way on. But there's always a time in between where it is half on. It has a lot of voltage AND current across it which makes a lot of heat.

Need your schematic to help. Did you use a MOSFET driver or run it off the PIC's 5V output? For the transistors you mention they won't turn on strongly with 5V. A "logic level" transistor will however.

Microchip's dsPIC30 line has models specifically designed for motor control. There's also a lot of support for the application of modelling a motor's response and making a very smooth motion with it. Such tech may not be necessary for a motor of relatively slow speed such as this.

Now keep in mind that a steering wheel's resistance, even in a power steering app, depends on what the vehicle's doing. That can substantially increase the complexity. If the vehicle's tires begin to slip the wheel can do some crazy things too and you don't want it to, for example, run the motor so hard on a steering wheel with little resistance that it overshoots.
 
I have feeling there is lot of current shoot-through going on when you're running at 75% and 50% duty. Could you post the schematics?
 
Hi. Well thanks a lot. I'm sorry but I don't have a circuits-drawing program installed at my pc at the moment but I sketched the circuit with word. Hope it's clear enough. I only presented one of the gate drives as the remaining three gates are driven in the same way. The TC4427 is a dual MOSFET driver so 2 of it are used for the 4 MOSFETs. It provides the gates with 12 volts as you can see. The 'signal' I am referring to is the PWM signal, which comes from an opto-coupler, which comes from a hex inverter, which comes from a PIC. The hex inverter is used because one PWM signal is used for each phase of the H-bridge so that when the P-channel receives a '0', the N-channel receives a '1' while the other phase is completely switched off. The frequency of the PWM signal is 4.88 KHz. Please tell me what is wrong with this arrangement.
 

Attachments

  • cct_406.jpg
    cct_406.jpg
    38.7 KB · Views: 700
By the way, I've noticed that in most PWM-controlled H-bridges, the top MOSFETs are turned on (100%) while the lower ones receive the PWM signal. What I did, however, was give the N and the P the PWM signal at the same time (each is the inverse of the other of course). Could that cause a problem? Thanks a lot.
 
YAN-1 said:
By the way, I've noticed that in most PWM-controlled H-bridges, the top MOSFETs are turned on (100%) while the lower ones receive the PWM signal. What I did, however, was give the N and the P the PWM signal at the same time (each is the inverse of the other of course). Could that cause a problem? Thanks a lot.

Yes it can! Once you've selected either the forward or reverse leg, there's no reason to be switching both transistors and it will likely increase switching losses.

Typically the N-mos is easier to drive and can be made to switch faster, thus they're the one you would apply a PWM signal to. The appropriate PMOS for the direction you need will get turned on by a different non-PWM driver and left on until you need to change directions.
 
Hmmmmm..Well I will try that then. But before I solder the circuit one more time and witness some smoke and sparks, is there anything else that could be wrong in my circuit? What about the switching frequency? Should I increase it? Thanks.
 
YAN-1 said:
Hmmmmm..Well I will try that then. But before I solder the circuit one more time and witness some smoke and sparks, is there anything else that could be wrong in my circuit? What about the switching frequency? Should I increase it? Thanks.

If the switching frequency is already too fast, why would making it faster help?.
 
Oznog said:
Yeah your switching time is too slow. A MOSFET dissipates no power when off and only a small amount of power when switched all the way on. But there's always a time in between where it is half on. It has a lot of voltage AND current across it which makes a lot of heat.

Sorry. Guess I misunderstood that one. So I should make the switching time slower to make sure the MOSFETs are actually fully ON and fully OFF. Maybe 1 KHz. I just thought that 5 KHz is something a MOSFET can handle very well. Anyways, I appreciate your advice. I'll take it you don't find anything else fundamentally wrong with the circuit or the components. I'll just add a capacitor between the source and the ground to absorb the spikes and adjust which MOSFETs take the PWM signal and I'll build it again. Thanks.
 
Just remember that timing is critical. If the NMOS and the PMOS on one side of the bridge are both on at the same time, even for a short time during switching, a lot of current can flow directly from +12V to GND. This can damage your transistors in a very short time. You need to program in enough dead time when switching to avoid this situation.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top