Simple LSD Motor Drive Problem

Thread Starter

cl10Greg

Joined Jan 28, 2010
67
Hello Everyone,

So this goes along with my scooter project that I have been working on. I have been going back and forth with LSD design and had some issues. Initially I was using a BJT to drive a NMOS on the High side of both but that would result in a battery short if I plugged the motor in before the controller since there was always a voltage on it. So that is why I am at my current design.

The current design is to use a PMOS to pull the NMOS gate to the 12V signal. The PMOS is controlled by a PWM signal from the arduino. I have attached a drawing of the circuit. Now the problem is that no matter what the load is on when I turn the switch on. I am not understanding why this is happening. I have a 10K pull up resistor to keep the PMOS off when not in use. I alter the PWM with a pot to control the voltage to the NMOS gate. No matter what I do the load is on. I am using a simple LED to verify control before I use the motor. I am unable to change the brightness of the LED by altering the PWM. Can someone please look over my schematic and verify I have the right intention and maybe give me an idea of what might be wrong? When I get home I am going to scope the signals of the PWM and check the voltages but for now we will go on theory of what I have setup.
 

Attachments

shortbus

Joined Sep 30, 2009
10,045
The Nmos should not be getting a 'variable voltage" on the gate. The PWM should be a on-off square wave to the gate. A variable voltage on a mosfet gate will just cause it to heat up and soon fail, it will basically be a big resistor instead of a switch. You also need to use the correct voltage on the gate, for most mosfets this is ~10V, unless it's a "logic level" mosfet. On the first page of a mosfet data sheet, the term to look for is - VGS, voltage gate to source.

For something like this, why a uC? School project that you have to use one? Much easier ways to do it.
 

Thread Starter

cl10Greg

Joined Jan 28, 2010
67
I am using a micro because I have other logic for the motor drive and more functionality that I am using and it would be complicated with multiple gates and ICs. The goal of the design is to supply the NMOS with a 12V PWM (well 12V minus the voltage drop through the NMOS). The PWM is set by the micro and pulls the NMOS to the 12V as a PWM signal. The VGS for the NMOS is something around the order of 2V so if everything is working right is should 10V PWM signal on the gate (12V - 2V for threshold) which should result in a nice low resistance. Am I missing something or is there an error in how I have this setup?
 

Thread Starter

cl10Greg

Joined Jan 28, 2010
67
Well scoping around I see that putting 12V on the source and the drain has a 10K resistor to ground and putting a 0V signal on gate will not turn on the PMOS. Why does the 0V or even a 5V signal turn on the PMOS anyone?
 

Thread Starter

cl10Greg

Joined Jan 28, 2010
67
Could I possibly use a ULN2003A to take the 5V PWM signal from the arduino and convert it to a 12V PWM? Would I hook the COM port up to 12V?
 

shortbus

Joined Sep 30, 2009
10,045
I wish they had never put the 'threshold voltage' on a data sheet. It is only used in audio amplifier circuits, it is the effective turn-off voltage for the mosfet. Should not be considered for any switching circuit. And PWM is a switching circuit. Took me a long time to get it to register in my mind, but when it did it made things easier.

For your PWM signal from the micro to the Nmos, do your self a big favor and get a' "low side mosfet driver chip" this will allow you to switch the Nmos from the micro with the least amount of trouble. The ~10V (12V is fine) can then come from one of the batteries(assuming that your using two 12V batteries). Or you could use a voltage divider from 24V to supply the driver.

Or you could just get a Nmos that is "logic level". But with that I don't know how much amperage is available from a micro to drive the gate.

You should really change your personal information to include the country you live in, it helps us to help you. :)
 

Thread Starter

cl10Greg

Joined Jan 28, 2010
67
Well I gave in and bought some TTL nmos transistors off digikey. I bought 3 of each of the following: IRLB8743PBF, BUK9507-30B, PSMN3R4-30PL. I need a fuse holder and fuses anyways so we shall see when they come in if I have any issues. The only thing I have concern about is driving the gate from the arduino and only being able to supply 20mA because of the output limitations. I will have to see if this affects the switching time and if I will have to use a slower frequency to allow it to work.
 

Thread Starter

cl10Greg

Joined Jan 28, 2010
67
Another interesting item that I just remembered to check. I have been using timer 0 of the arduino which runs at 62.5 kHz. The others run at half of that. I will try to switch out to the other timer. I may have been switching too fast for the gates to keep up.
 

shortbus

Joined Sep 30, 2009
10,045
Carrier frequency for motor PWM is usually ~20kHz. I didn't know what the output was on a micro, cause I don't use them, but knew it couldn't be too high. This is what makes mosfet drivers a good idea, they have more amperage to switch the mosfet faster. With only 20mA you still might need a driver.

What duty cycle have you been using on the PWM? Its the duty cycle that controls the motor speed.
 

Thread Starter

cl10Greg

Joined Jan 28, 2010
67
The frequency I was using was 62 kHz. The duty cycle varied depending on the pot analog input on a 10 bit channel. The software takes the signal and varies the duty cycle depending on the analog input. This is used to control the first FET that is hooked up to a 12V load that will drive the FET for the motor. So the PWM duty cycle of the first FET will be the same that the second FET will see.

My TTL FET's come in tomorrow as well. Hopefully they make this a lot simpler since I can drive them with a PWM from a 40mA channel on the controller. I believe that should be enough for the 31 kHz channel that I plan on using.
 

Thread Starter

cl10Greg

Joined Jan 28, 2010
67
Hello everyone,

So I did get my TTL NMOS in. I am able to control the 24V LED with the 5V arduino signal. There is a interesting issue that I am having though. I can turn the pot and increase the PWM to the LED which makes it get brighter but when I get to about 80% on it cuts out and the LED shuts off. Does anyone know what could make this happen? I see in the arduino that the analogRead value goes to 0 shortly after it goes below 0. The analogRead value is 1023 when the PWM is off and 0 when the PWM is on. So for some reason there is a jump from the analog read signal. Is this a pot read problem or maybe a current draw problem from the NMOS? Any ideas?
 

Thread Starter

cl10Greg

Joined Jan 28, 2010
67
Hello Everyone,

I made some progress but I am resurrecting this post. I am having a weird response now for my system. So I had two different issues. One was the analog read and the potentiometer problem the other is the actual MOSFET problem.

I have the pot problem solved and working for reading. I used a pull down to make it is not floating and I have two checks to make sure that it is not floating and that the throttle on the motor is not on during start up.

The next problem is why I am asking for help now. I am using the TTL BUK transistor that is mentioned above. I have a 100-200 ohm going to the gate to limit the current and also a 1K resistor going to ground to pull the gate down when off. I am testing a LED hooked up to a 24V source with a current limiting resistor to make sure that the PWM is working. It works ok but the first weird issue is that it seems to be working backwords. That is when the duty cycle from the arduino is 100% the LED is off and when it gets down to about 5% it is all the way on. The second weird issue is that when it is at 100% the DC voltage seen across the VDS is 5V while when it gets down toward 0% it is roughly 24v. Now I understand that this could just be the way the transistor is in saturation. So when it is active and passing current there is a low voltage and when it is off there is no current and it is blocking all the voltage. But how am I suppose to drive a motor with a FET? I know it has been done so its possible. I just been banging my head against the wall with these problems and could really use some help. I attached some drawings below. One shows the setup, another shows the 100% ish duty cycle with the small DC value and the other shows when its almost off and the high DC value.

I have taken the analogRead variable out of these test. I just run a for loop with decreasing duty cycles to observe the signal.
 

Attachments

shortbus

Joined Sep 30, 2009
10,045
While this will not address your problem, using a gate resistor of that value is not a good idea. It just slows down your gate turn on-off, which is not what you want. A gate resistor of ~4 - 50 ohms is normally used. A gate resistor is not used to limit current but to stop ringing/oscillating of the gate. Since a mosfet gate is basically a capacitor, the more current the merrier.

Post your new schematic showing how you NOW have every thing wired.
 

Thread Starter

cl10Greg

Joined Jan 28, 2010
67
I have attached the schematic. Here is a brief description.

Arduino powered by a 12V battery that is hooked to the VIN pin
The 12V battery has a cap to help smooth the output.
Timer1 (32kHz) is used from the arduino to drive the gate.
The gate capacitance is 3300pF and is TTL logic
The gate also has a 10K pull down resistor when the gate is off.
The load is a 3.3V drop LED that is connected to the 24V supply and has a current limiting resistor.
The 12V and 24V grounds are tied together.
The 12V source has a key switch that is used to start it.
I didn't include the analogRead part of the circuit since that is a different issue that I am working. This is solely to understand the transistor and its response.

The software starts with the PWM to be fully on (255) and decrease to off (0) by steps of 5.
The LED is initially off when the PWM is fully on and slowly turns on while decreasing then it hits around 10% duty cycle and flashes and shuts off.
This should be the exact opposite response that I would expect.

I have tried different timers on the arduino.
I have tried different Atmega328 chips
I will try to supply the gate with constant 5V tonight to see if it reacts to that.
I will replace the PWM resistor with a smaller value
I have tried different NMOS transistors of TTL logic with the same response.

Hope that clears a few things up.
 

Attachments

Last edited:
Top