How Do I use PWM without Arduino on L298 Motor Driver?

Thread Starter

Utkarsh Verma

Joined Oct 30, 2016
102
I want to be able to control the speed of my motors when they are run through L298. I looked up the internet and found that it can be done through the usage of PWM on the ENABLE A and ENABLE B pins. But since I'm using the L298 in a hectic project and can't afford to use an Arduino there, I require a small yet sufficient solution. I tried to find things about PWM and found out that NE555 can be used. But I couldn't understand it. So, please help me understand it and implement it with the L298 module. I'm using the same module shown on this website.
 

crutschow

Joined Mar 14, 2008
23,797
Here's a typical 555 PWM circuit:
The 555 is connected as an astable multivibrator which causes C1 to alternately be charged through R1, D1, and the left side of Pot P1, and then be discharged by pin 7 through D2 and the right side of pot P1.

The pin 3 output is high when C1 is charging and low when C1 is discharging.

By adjusting the pot, the relative resistance between the right and left side of the pot to the wiper is varied which changes the relative charge and discharge time of C1.
This, in turn, causes a variation of the ON time versus the OFF time at the output of pin 3, which is a variation in the duty-cycle with the pot adjustment, giving the desired PWM signal.

Thus with the pot to the left, the OFF time would be short, and with the pot to the right the ON time would be short.

Since the total pot resistance is constant, changing the pot position varies only the duty-cycle of the output, not appreciably the frequency.

For your application Q1 is replaced by the L298.

 

Thread Starter

Utkarsh Verma

Joined Oct 30, 2016
102
Here's a typical 555 PWM circuit:
The 555 is connected as an astable multivibrator which causes C1 to alternately be charged through R1, D1, and the left side of Pot P1, and then be discharged by pin 7 through D2 and the right side of pot P1.

The pin 3 output is high when C1 is charging and low when C1 is discharging.

By adjusting the pot, the relative resistance between the right and left side of the pot to the wiper is varied which changes the relative charge and discharge time of C1.
This, in turn, causes a variation of the ON time versus the OFF time at the output of pin 3, which is a variation in the duty-cycle with the pot adjustment, giving the desired PWM signal.

Thus with the pot to the left, the OFF time would be short, and with the pot to the right the ON time would be short.

Since the total pot resistance is constant, changing the pot position varies only the duty-cycle of the output, not appreciably the frequency.

For your application Q1 is replaced by the L298.

I like your solution. It's short and simple. By the way, which pins of L298 are equivalent to G,D,S of Q1?
 

crutschow

Joined Mar 14, 2008
23,797
The L298 is a bridge circuit and is not equivalent to the Q1 MOSFET.

The L298 can control two motors.
One motor is connected between OUT1-OUT2 and the other between OUT3-OUT4.
What you want the motor to do determines how the inputs are connected.

The logic levels at the Inx inputs control the motor direction.
IN1-IN3 high, IN2-IN4 low for one direction (making OUT1 & OUT3 positive with respect to OUT2 & OUT4).
IN1-IN3 low, IN2-IN4 high for the other direction (OUTx polarities reversed).

You connect the 555 pin 3 Out PWM signal to the ENx inputs, which switches the motor voltage on and off to vary the motor speed.

upload_2017-5-21_9-45-19.png
 
Last edited:

Thread Starter

Utkarsh Verma

Joined Oct 30, 2016
102
The L298 is a bridge circuit and is not equivalent to the Q1 MOSFET.

The L298 can control two motors.
One motor is connected between OUT1-OUT2 and the other between OUT3-OUT4.
What you want the motor to do determines how the inputs are connected.

The logic levels at the Inx inputs control the motor direction.
IN1-IN3 high, IN2-IN4 low for one direction (making OUT1 & OUT3 positive with respect to OUT2 & OUT4).
IN1-IN3 low, IN2-IN4 high for the other direction (OUTx polarities reversed).

You connect the 555 pin 3 Out PWM signal to the ENx inputs, which switches the motor voltage on and off to vary the motor speed.

View attachment 127299
Thanks for the correction. Will try it out on a breadboard and post the results!
 
Top