Arduino Nano/DC motor/L298N

Hi everyone,
I am having the same error pop up when I try to run a basic DC motor with an arduino nano and L298N motor driver. If I use my regular arduino it works fine in the same setup, it's only when using the nano and when I switch my program to recognize the nano. Please note that my I bought the arduino 5V nano so I would think it could work without a side power source? (See attached for error shown).


// Motor A

int enA = 9;
int in1 = 8;
int in2 = 7;


// Motor B

int enB = 3;
int in3 = 5;
int in4 = 4;

void setup() {
  // put your setup code here, to run once:


  pinMode(enA, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(enB, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);


  // Make motor A spin clockwise then stop
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  analogWrite(enA, 200);

  delay (3000);

  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
    

  // Make motor B spin clockwise then stop
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
  analogWrite(enB, 200);

  delay (3000);

  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);

  
}

void loop() {
  // put your main code here, to run repeatedly:



}

I don't see an attachment and only see code with no error messages.

Important a Power Supply the Arduino Is Not! Post a schematic that shows all the power and ground connections. Your attachment did not show up.

Hey Marco, sorry let me know if this shows up!!
Capture|690x62

1

Hi Gilshiltz, I've been following a youtube instruction video. It's exactly the same setup as this image beside the Uno being a Nano. Is this helpful? Or are you referring to something else?

Hello, the error is being caused by not finding com3.
Does the nano also use com3?
Connect the Nano and check in the IDE which "com" appears.

RV mineirin

Hi, @johannej1138
What OS and what version of the IDE are you using.
When you went to upload, did you still have the Serial monitor open?

@ruilviana good point.

Have you selected the correct COM for the Nano?
Usually if you have both controllers connected to the PC at the same time, they will have different COM port assignments.

Tom... :grinning: :+1: :coffee: :australia:

Then it is not exactly the same. You do not show all the power and ground connections. The picture is pretty but not complete. A lot of people get in trouble powering hardware with the 5V output of the Arduinos. Try a seperate power supply and prove me wrong!

Helllo Tom and Ruilviana,

Thank you for your responses I believe your questions are on the right path as I found that my usb port is on COM 4, not COM 3 (see attached). Is there a way to change this recognition or how would I fix this?

Thank you again!

What USB chip does your arduino have?
Atmega8U, FTDI, CH340t, etc.
Did you install the correct driver for your USB interface?

RV mineirin

Hey everyone,
I changed my COM port to 3 in my device manager but it still is showing the same error as above. Unsure if there is a secondary place I need to change it?
Thanks,
Evan

Morning Ruilviana,
I believe I have yes, the arduino Nano uses the ATmega328 and the processor is set for this. Do I need to install the driver information somewhere else?

Thanks,
Evan

Hi, @johannej1138
Yes, the arduino Nano has an Atemga328, but the interface of the Atmega328 with the USB is made through an FT232RL chip.
see the diagram in:

On the PC it is necessary to install the driver for this chip.
Sometimes this driver may be installed, but there is a problem.

When installing the Nano on your PC, go to the device manager of the operating system.
If it is marked with the yellow triangle, click on it and try to reinstall.

RV mineirin

Evening Ruilviana,
Thank you for the insight. I have tried to uninstall and reinstall my port but I continue to get a yellow warning triangle next to my COM 3 port. I am unsure how to proceed.

Hi.
Have you changed the USB cable yet?
RV mineirin

Only the 'classic' Nano has.
All newer ones don't.
Leo..

Hi,
Can you please post a picture of the top and bottom of your Nano?

If you are using a USB hub/extender, try connecting directly to the PC?
Have you tried plugging the USB plug into a different USB socket on your PC?

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

You do not have the appropriate driver installed.
You have already been asked in post #10 to give the type of your USB-UART converter or a photo of both sides of your Nano board in post #17.
If you would like help, please give us detailed information.

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