Go Down

Topic: DC MOTOR with L298N Beep Sound on Low PWM (Read 288 times) previous topic - next topic

sempera

So i have a dc motor and l98n h-bridge and external power sup with 7.2V. When i try to create a loop with different pwm signals, i got beep sounds on low pwm's. Here is my simple code:

const int pwm = 2 ;  //initializing pin 2 as pwm
const int in_1 = 8 ;
const int in_2 = 9 ;

//For providing logic to L298 IC to choose the direction of the DC motor

void setup()
{
pinMode(pwm,OUTPUT) ;   //we have to set PWM pin as output
pinMode(in_1,OUTPUT) ;  //Logic pins are also set as output
pinMode(in_2,OUTPUT) ;
}

void loop()
{
//For Clock wise motion , in_1 = High , in_2 = Low
analogWrite(pwm,10);
digitalWrite(in_1,HIGH) ;
digitalWrite(in_2,LOW) ;
delay (3000);
analogWrite(pwm,200);
digitalWrite(in_1,LOW) ;
digitalWrite(in_2,HIGH) ;
delay(3000);

 }



So the problem is when i use 200 as a pwm there is no problem. My dc motor is working correctly but when i try do it with my low pwm like 10-20 (to 80 actually). a beep sound only i got. Why is that or anyone know the solution ? Thx for helps.

ardy_guy

The 298 loses at least 2V, and at higher current that's about 4V iirc. You have not much more than 3V or so at the mptor. On top of that you're pwm-ing that away to about nothing.... not enough to get the motor started.

298's not much good for low vlotage motors, where relatively speaking the voltage loss is more than in a higher voltage case.

[irishAccent]Have you tried turning it off and on again?[/irishAccent]

sempera

Actually my main goal is moving my motor slowly so i can park my car prototipe, i used 100 as pwm but its too much for me. Do you think 3v power sup gonna be the solution for me. I mean if i use 3v psu and 50-100 pwm thats gonna be a solution for me ?

ardy_guy

If you put 3V in and throw over 2 away in the 298 you'll have nothing left at all

[irishAccent]Have you tried turning it off and on again?[/irishAccent]

sempera

The 298 loses at least 2V, and at higher current that's about 4V iirc. You have not much more than 3V or so at the mptor. On top of that you're pwm-ing that away to about nothing.... not enough to get the motor started.

298's not much good for low vlotage motors, where relatively speaking the voltage loss is more than in a higher voltage case.


oh sorry now i got it. So i  need more voltage right ? I have 27V psu maybe it can be enough :D

TomGeorge

Hi,
What model Arduino Controller are you using?

Thanks..  Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

sempera

Hi,
What model Arduino Controller are you using?

Thanks..  Tom... :)
Arduino mega 2560

Wawa

#7
Mar 22, 2017, 09:36 pm Last Edit: Mar 22, 2017, 09:40 pm by Wawa
You could be hearing the PWM frequency (motor acting as a loudspeaker).

Try changing the PWM pin from pin2 to pin4 (wiring and code).
That pin should have twice the PWM frequency.
Leo..

sempera

You could be hearing the PWM frequency (motor acting as a loudspeaker).

Try changing the PWM pin from pin2 to pin4 (wiring and code).
That pin should have twice the PWM frequency.
Leo..
Why is that, i mean is this about frequency of pins ? or something else. If it is how can i learn about all pins frequencies ?

Wawa

Google "Arduino PWM frequency".

Did you try a different pin?
Leo..

sempera

Google "Arduino PWM frequency".

Did you try a different pin?
Leo..
i have tried pin 4. Actually its better but not enough for me. Is there any higher frequency pins or can i change pins frequency manually.

Wawa

That was just a try to see if the PWM frequency was the problem.
If you want the motor to be silent, you have to move the PWM frequency outside of your hearing range.
<30Hz or >20kHz.
Leo..

TomGeorge

Hi,
What DC motor are you using, what are its ratings, voltage, max speed and does it have a gearbox?
What size are the wheels?

If it is a hobby motor rated at 3000rpm or more and it has no gearbox, you will have very little chance of getting it to run slow and provide any decent torque.

Can you post a picture of your project please.
Everything runs on smoke, let the smoke out, it stops running....

sempera

Hi,
What DC motor are you using, what are its ratings, voltage, max speed and does it have a gearbox?
What size are the wheels?

If it is a hobby motor rated at 3000rpm or more and it has no gearbox, you will have very little chance of getting it to run slow and provide any decent torque.

Can you post a picture of your project please.
Ofc i can even post a video about it.

https://www.dropbox.com/s/jav8xo0csdgumtk/IMG_4064.MOV?dl=0

here is my video about my project. left one is my dc motor. As you can see sometimes it sounds like beep and not moving efficiently. Thats my real problem. And since i am trying to do automatic parking car i need to make my car slow.

TomGeorge

#14
Mar 26, 2017, 01:17 am Last Edit: Mar 26, 2017, 01:21 am by TomGeorge
Hi,
You are using a RC car that is setup motor wise for SPEED, if you want LOW SPEED you will need more gearing I would say,

Does your motrt have any part numbers on it, it will be rated in the 1000's of rpm.

Can you rotate your motor by hand and tell us how many turns it needs to rotate your driver wheel one revolution?
What is the diameter of your driver wheel/tyre?

Thanks.. Tom... :)
PS.Have you run the RC Car on the floor to see how it runs under load?
Everything runs on smoke, let the smoke out, it stops running....

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy