Arduino Nano works on laptop but not on psu

I got a massive problem with my projekt which no one i know can help with.
I got an Arduino Nano that gets the signal of an IR reciever and gives the signal to an L298n which depending on the state of the ir signal moves an linear actuator. now the funky part is that when the nano is powered via a laptop to the usb c port it does work just fine but once i try to power it by a powersupply it just does not send any signal to the L298n or hence does not recieve the signal from the ir reciever. I have tried basically everthing to troubleshoot it at this point but nothing seems to work. I'll include a visualisation and the code, i hope anyone here is able to help me find the problem


const int motorIn1 = 2;       
const int motorIn2 = 3;    
const int irReceiver = 4;     
const int irSender = 5;      


bool irStatus = false;       
const int fullExtendDuration = 3000; 

void setup() {
  
  pinMode(motorIn1, OUTPUT);  
  pinMode(motorIn2, OUTPUT);  
  pinMode(irReceiver, INPUT); // 
  pinMode(irSender, OUTPUT);  //
 
  digitalWrite(irSender, HIGH);

  
  Serial.begin(9600);

  
  Serial.println("Initialer Start: Motor full extend");
  motorForwards(fullExtendDuration);
  stopMotor();
}

void loop() {
  
  irStatus = digitalRead(irReceiver);

  if (irStatus == HIGH) {
    
    Serial.println("IR not closed Motor stays out");
    stopMotor();
  } else {
   
    Serial.println("IR Closed Motor is moving");
    delay(3000);
    motorBackwards(600); 
    delay(500);
    motorForwards(fullExtendDuration); 
    stopMotor();
  }

  delay(100); 
}


void motorForwards(int duration) {
  Serial.println("Motor forwards");
  digitalWrite(motorIn1, HIGH);  
  digitalWrite(motorIn2, LOW);
  delay(duration);               
  stopMotor();                  
}

void motorBackwards(int duration) {
  Serial.println("Motor Backwards");
  digitalWrite(motorIn1, LOW);   
  digitalWrite(motorIn2, HIGH);
  delay(duration);              
  stopMotor();                   
}

void stopMotor() {
  Serial.println("Motor stop");
  digitalWrite(motorIn1, LOW);   
  digitalWrite(motorIn2, LOW);
}

where is your power supply connecting to your Nano? It is supplying +5V directly to the +5V pin of the Nano? Or is your Power supply supplying 6-9V on Vin?

You need to make sure all your grounds are connected together as well.

1 Like

Can you clarify the connectors involved? First, does your Nano have a built-in USB-C connector, or is it a USB-mini connector like the typical clone Nano?

And which port on your laptop are you connecting to - is it USB-C?

And finally, what connector does the power supply have?

Well, I'm just wondering if this might have something to do with USB-C requiring resistors from a couple pins to ground before it will supply any current. Those resistors could be in the Nano if it has a USB-C connector, or they could be in the cable.

Powering the motor with the Nano is setting it up to be destroyed. The Arduinos are NOT power supplies. What power supply are you using and can you post a link to its technical specifications?

I hope there’s more than one conductor coming in from the laptop and 12V supplies.

All of the grounds are connected via wago clamp and running to the ground of the L298N. Power is going to the usb c port of the nano but we have tried everything else you asked as well with multiple power supplys

you do realize the motor is fed by the externally powered L298N and the nano is just telling the driver what to do?

Yes, the Nano has a build in usb c connecter to which the power is supplied.
I have tried multiple ports on multible Laptops, both usb c and usb a with the same working result. Tried multible power supplys as well with mutlible cables both usb c to c or a to c but to no avail

Hi! Welcome to the forum.

Basically the first 3 people that answered to your call asked for the same information, and you didn't provide it yet.

What are the "multiple power supplies" that you tried and how were they connected to the Nano. Examples of answers:

  • a power bank connected to the Nano USB-C port
  • a 9V battery connected to Nano Vin pin
  • a 5V font connected to Nano +5V and GND pins
  • yours...?

And what Nano are we talking about? There are a lot very very different ones by now.
You should answer all the questions to get help.

You have D4 and D5 backwards.

i have tried: 9v Battary to VIN, Power bank to USB C, 5V out from the L298N to Arduino, ANY 5v Charger with 1A; 1,5A; 2A; 2,5A and 3A i could find and multiple of our universitys lab power supplys. Hope that answers your question

AtMega328PB is the controller if thats what you need to know

drawn from memory...

If IR send is the sender and IR receiver is the receiver then it's backwards and will not work on any power supply

It is connected right, i maybe just drew it wrong from memory. otherwise it wouldnt work when connected to laptop like it does

So it's a nano ESP32 and not a classic nano, is that correct?


its this one

It does, but unfortunately doesn't solve your issue. There´s something else missing.

(and Nano GND)
It could work for a few time. A 9V battery is a poor choice because it gets drained quickly.

A good option, but some Powerbanks turn themselves off when below a certain load.

Probably not enough because it relies on the L298N regulator to decrease 12V to 5V (if the jumper is in place). It would allow too few current before overheating.

That was the best option and should be working.

Jim, there are already some Nano V3 being sold with USB-C on the market.

1 Like

Ah, one of the funny clones.
Hopefully someone here may have one just like it and can give a definitive answer as to why it does not work.