L298 driver module problem

Hi guys! Help me please to find a solution. I am using a fez cerbuino bee and l298 motor driver (connected to 3rd socket of mainboard). I am trying to run two dc motors but with no success. My scenario of connection is:
1)Fez cerbuino bee mainboard connected to PC with USB
2)Visual studio 2012 runs on NET micro framework v4.3
3)Maineboard updated with the last bootloader and firmware v4.3
4)Two DC motors are connected to the L298 motor driver (M1 and M2 pins). Full charged 9v battery also connected to the driver module
5)In Visual Studio i run the folowing code under “debug” mode


DriverModule298.Setspeed(DriverModule298.motor1, 1.0);
DriverModule298.Setspeed(DriverModule298.motor2, 1.0);

6)The code compiles and transfers to mainboard successfuly
7)But the motors doesn,t run at all
8)When i connect 9v battery directly to motors they works perfect.

I need your help!!

From the source-code of the driver:

/// <summary>
        /// Used to set a motor's speed.
        /// <param name="_motorSide">The motor <see cref="Motor"/> you are setting the speed for.</param>
        /// <param name="_newSpeed"> The new speed that you want to set the current motor to.</param>
        /// </summary>
        public void MoveMotor(Motor _motorSide, int _newSpeed)
        {
            // Make sure the speed is within an acceptable range.
            if (_newSpeed > 100 || _newSpeed < -100)
                new ArgumentException("New motor speed outside the acceptable range (-100-100)", "_newSpeed");

I guess you need to try some higher numbers :wink:

BTW, I dont understand your code compiles, as the 4.3 dont have the setspeed function as I see it???

Thank for reply. When i put 100 the code compiles with error : dutySycle

v 4.3 doesn’t have MoveMotor function, instead it has SetSpeed function

You are completely right. Sorry for messing things up. Looked in some downloaded driver files from before 4.3 release, which had the 4.3 label on them…:whistle:

Your code should work fine as I see it. Can you take a picture of the setup with clear wiring, so we can study the connections…?

I really apreciate your help and your time!!! I wil upload the pictures in a couple of minutes.

P.S.
I read the specifications on the official thread of this module is says:

[quote]Introduction

This motor driver module controls the speed and direction on 2 DC motors with a rating up to 40V 3A. The module itself is powered and controlled from a Gadgeteer mainboard but the motors are powered from a separate power source. Make sure to properly connect a power source to the green connector on the board so that the motors can receive power.

The motors are marked M1 and M2 on the pcb, and the enum MotorControllerL298.Motor is matched to the pcb. Make sure to match your wiring and code to get the desired result.[/quote]

Doest it mean that i have to supply power source not only to driver module itself, but to motors too??? I will do a picture and everything would be clear…

It seems like i provided a power to module itself… but still doesnt work. I have no idea what to do?

Looks good to me, have you tried to swap the poles for the battery?

What does the indicator LEDs on the driver module tell you, maybe a close-up picture?

When you run your code is there anything that indicates activity?

Maybe two motors are too much, tried only one?

Hmm, as I remember it, your code might need some initialization stuff?
EDIT: Code is now deleted, guessing your saw that yourself?

  1. When i swap the poles for battery the red light of power is not active - poles is good.
  2. I3 pin is active (Green light)
  3. Visual studio run the code, transfer it to device, and tells everything is ok
  4. I have already tried. I tried M1, tried M2 separately, but no success.

I even try a multimetr stuff… and it seems like something goes wrong. When i measure power supply input it shows 9v, then i measure motor outputs without the motors wireds and it seems like the code works perfect (the almost 9 v on two outputs), but when i put the motor’s wires on one or another output, motors will not start… the red light of input power supply getting smoother and i try the outs with multimetr and it’s a miracle (something like a 1,5 v on output only). Maybe some GND problem???

i deleted previous message with code and put the picture in other…
Please take a look… what kind of initialization staff??

Question is still opened! I’ve tried to downgrade to 4.2 version… the same thing.
I dont belive that module is dead… i hope somebody help me with my problem…

Datasheet on motors?

it’s your battery. Those batteries are woefully poor power sources. At the moment I suggest you find a 9v wall wart / power supply and connect that.

1 Like

I will try your suggestion and let you know!

Can anybody tell me what are the limitations of input power supply for this module in volts? 5v like in datasheet or anything else?

After 2 days of “war” with L298 module i notice following problem:

  1. When i set 5v power source to module power input and measure M1, M2 (Motors) outputs with multimetr it shows 47 mA
  2. When i set 5v power source directly to M1,M2 (Motors) and measure power output in the chain it shows 560 mA.

What the matter??

How about you help the forum out by adding a proper name to your user profile ? That’s what is messing up the quoting here !

2 Likes

https://www.ghielectronics.com/docs/84/motor-driver-l298-module

That’s where the “external power source” comment comes from, and you can see the 40v / 3A Max.

Please note the measurements you did aren’t really that helpful. It’s unlikely to be “power output” but more likely “current draw” :slight_smile:

1 Like

Official information from ghi site tells that this module can control 2 dc motors up to 40v 3A, but specification of module tells that power limit is 5v (see attached picture). Which info is true?