Whistle with 2 motors dc connected to l289n driver

Hi.

I'm developing an obstacle avoiding robot car. The problem is that when I test the motors, and I connect the USB cable from the Arduino UNO board to the PC to upload the code, there's a whistle. But the motors work correctly. I'm supplying the driver with 3 batteries of lithium ions of 3,7 V each. I touched the driver and the Arduino UNO board, and they weren't hot. But I'm afraid if this whistle is something dangerous and if it could break my project. I would be really grateful if you could help me, I'm at a standstill with this problem and I can't continue.

Hi, @ir3neee

Can you please post your code?

Can we please have a circuit diagram?
An image of a hand drawn schematic will be fine, include ALL power supplies, component names and pin labels.

Can you please post a link to data/specs of your motors?

Can you please post some images of your project?

What are you using for a power supply?

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

The whistle is likely from the PWM frequency used for speed control.
If you have used pin 5, 6 for that (assuming Uno), then it's about 1KHz.
Harmless, but it can be annoying.
You can try moving to different PWM pins.
Pin 3,9,10,11 default to about 500HZ.
Leo..

A good rule is to turn off all power before connecting or disconnecting any cable. Many members use breadboards and even getting close to it has the risk of accidentally causing accidents by moving/removing another cable, removing the wrong cable etc.

image
It's basically like this, but I connected IN1 to pin 13, IN2 to 12, IN3 to 11, IN4 to 10, ENA to 6 and ENB to 5. The battery is 11,1 V.

As I was just testing the motors and the directions, the code was just to change and try different configurations of LOW and HIGH to guess the directions. (I removed the "//" of some parts of the code depending on the direction I wanted to test).

int IN1 = 13;
 int IN2 = 12;
 int IN3 = 11;
 int IN4 = 10;
 int ENA = 6;
 int ENB = 5;

void setup() {
  
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
  pinMode(ENA, OUTPUT);
  pinMode(ENB, OUTPUT);

}

void loop() {
  
  //turn left
 //   digitalWrite(IN1, LOW);                
   // digitalWrite(IN2, LOW);
  //  digitalWrite(IN3, LOW);                                
  //  digitalWrite(IN4, HIGH);  
  //  analogWrite(ENA, 140); 
  //  analogWrite(ENB, 140); 

//straight
   digitalWrite(IN1, LOW);                
    digitalWrite(IN2, HIGH);
    digitalWrite(IN3, LOW);                                
    digitalWrite(IN4, HIGH);  
    analogWrite(ENA, 140); 
    analogWrite(ENB, 140); 

//forward
    //digitalWrite(IN1, HIGH);                
   // digitalWrite(IN2, LOW);
   // digitalWrite(IN3, HIGH);                                
   // digitalWrite(IN4, LOW);  
   // analogWrite(ENA, 140); 
   // analogWrite(ENB, 140); 
//turn right
    //digitalWrite(IN1, HIGH);                
    //digitalWrite(IN2, LOW);
    //digitalWrite(IN3, LOW);                                
    //digitalWrite(IN4, LOW);  
    //analogWrite(ENA, 200); 
    //analogWrite(ENB, 200); 

}

The motors are the typical arduino motors DC of 3-6V.

I've just tried this and the whistle has disappeared. Thank you so much!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.