Go Down

Topic: Can i use this l298 version with servo library? (Read 1 time) previous topic - next topic


Hello everyone. i am planning on building a 4wd object avoidance bot and because of the chinese new years coming up, there will be some bad delays. (im in Australia) I have located an online shop from india (i have bought from them before) and as i was reading the manual it gave hints that i can control it via servo library on two of the pins it says "pwm1" and "pwm2"
Here is the motor driver:

Here is the manual.

as for price range im willing to pay $6 for each as this is a budget build.

Here is the second one i just found.
can i control this one with servo library too?

Any thoughts? Thanks guys


The drivers can set the direction and pass on the amplified PWM signal to the motor. That's all.

For a servo motor, there is no need to have a lot of current for the pulsed signal, since the signal can be provided with the Arduino. A servo motor just needs (a lot of) current on the 5V pin.

The drivers are typically used with a PWM output of the Arduino. The default PWM output is about 450Hz, which could cause a whistling/whining sound in the motors. That's why some software libraries use the internal timers with different frequencies to avoid that.

What kind of motors do you have ?


They are geared 25mm motors. each with a stall torque of 1.85A (tested and proven) with the second one do i just for example connect 1a and 1b to lets say pin 9 on my arduino uno? how would i interface the second one with arduino uno and would it be easier to use than the first one?


The driver (L298) can do 2A, and the stall current is 1.85A. It's close, but it is okay.

I tried to find the schematic or a good description how to connect it, but I can't find it.

To be able to control the speed of the motors, you need PWM mode.
The jumpers "EN1" and "EN2" has to be removed for PWM mode.

The red connection strip:
VCC = Voltage to the motors. The maximum voltage could be 18V or 50V or 55V, I'm not sure.
GND = GND for motors.
MOTOR1 = to motor 1
MOTOR2 = to motor 2

The header with TTL level input signals:
GND = to Arduino GND
VCC = 5V output if you need it. Leave it unconnected.
M1-1 = direction for motor 1
M1-2 = direction for motor 1
M2-1 = direction for motor 2
M2-2 = direction for motor 2
PWM2 = PWM for motor 1
PWM1 = PWM for motor 2

Connect a PWM capable Arduino output to the PWM signals.
Use analogWrite() for the PWM signal.
Connect the other signals (M1-1 and so on) to outputs of the Arduino to set the direction.
See the datasheet of the L298 : http://www.st.com/internet/analog/product/63147.jsp

The 'enable' of the L298 is connected to the PWM signal.
The other signals set the direction:
M1-1 HIGH, M1-2 LOW = forward
M1-1 LOW, M1-2 HIGH = backward

Go Up

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

shortcuts: alt+s submit/post or alt+p preview