Arduino uno unable to work with external power supple

im trying to make a obstacle detection robot car using :
arduino uno r3 + 3x hc sr04 ultrasonic distance sensors + L298n motor driver + 6xAA battery external power supply + 2x dc motors/wheels (connection below)

my code (attached below) works fine when it is connected to my pc (all 3 sensors can sense distance, wheels rotate forward & reverse according to my code), but once i disconnect it the wheels stop functioning according to my code (it just keeps turning forward forever even with different input from the sensors).

i have tried some solutions suggested here before such as connecting the RX pin to ground and i have already commented out the "serial" communication functions in my code.
however, nothing solves my issue of the wheels not working as it should.

problem: code (wheels) work fine when connected to my pc, but doesnt work properly when connected to external power supply (via the l298n)

would appreciate any and all help & suggestions. thanks

connection:

code:

int t0 = 12;
int t1 = 10;
int t2 = 8;
//declare int var t0 at pin 8 to activate/trigger ultrasonic wave

int e0 = 13;
int e1 = 11;
int e2 = 9;
//declare int var e0 at pin 9 to receive the ultrasonic echo wave
//t = trigger pin, e = echo pin, 0 = 1st ldr position, a = analog, b = boolean value, c = calibrated value



int ObstacleDist = 5;
//change this value to change obstacle detection distance



int time0;
int time1;
int time2;
//store time taken to register echo for 1st uds

int dist0;
int dist1;
int dist2;
//store distance value for 1st uds 

bool obs0;
bool obs1;
bool obs2;
//obstacle detection for 1st uds, obstacle = 1, no obstacle = 0


int obst;
//store total value/readings of all uds to set if condition
int stp;
//declare int var stp to store value 0, stops the while loop when 1
//used to stop the while loop that holds the if else logic to determine wheel movement
//while loop is used to make the if else statement be repeatedly verified until stp = 1
//when robot moves to the end of the course obst = 000, make stp = 1 or any number since it is int data type



//initialise L298N driver that controls DC motors/wheels
//l298n driver draws in high voltage required to power the dc motors as the arduino cannot supply enough power that the dc motors require   
//l298n driver reduces the high voltage drawn in from the batteries & decreases it to supply the arduino with power when it is disconnected from the monitor   
//pin 2 > ena, pin 3 > in1, pin 4 > in2
//pin 5 > enb, pin 6 > in3, pin 7 > in4

int enA = 2;
//declare int var enA to store value of 2, it outputs values from pin 2 of the controller to enA pin of l298n driver
//enA sets the speed for the left wheel
int in1 = 3;
//declare int var in1 to store value of 3, it outputs values from pin 3 of the controller to in1 pin of l298n driver
//in1 drives the left wheel forward when it is high & reverses the wheel when low
int in2 = 4;
//declare int var in2 to store value of 4, it outputs values from pin 3 of the controller to in2 pin of l298n driver
//in2 drives the left wheel forward when it is low & reverses the wheel when high

int enB = 5;
//declare int var enB to store value of 5, it outputs values from pin 5 of the controller to enB pin of l298n driver
//enB sets the speed for the right wheel
int in3 = 6;
//declare int var in1 to store value of 6, it outputs values from pin 6 of the controller to in3 pin of l298n driver
//in3 drives the right wheel forward when it is high & reverses the wheel when low
int in4 = 7;
//declare int var in2 to store value of 7, it outputs values from pin 7 of the controller to in4 pin of l298n driver
//in4 drives the right wheel forward when it is low & reverses the wheel when high




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

  //Serial.begin(9600);
  //begin serial communication with controller at 9600baud



  pinMode(t0, OUTPUT);
  pinMode(t1, OUTPUT);
  pinMode(t2, OUTPUT);
  //set t0 trig pin 8 to output mode, activates/triggers the ultrasonic wave to be sent
  
  pinMode(e0, INPUT);
  pinMode(e1, INPUT);
  pinMode(e2, INPUT);
  //set e0 echo pin 9 to input mode, receives the ultrasonic echo wave 


  stp = 0;
  //initialise var stop program to store value 0 so while loop doesnt stop



  pinMode(enA, OUTPUT);
  //set pin 2 to output data, controls speed of left wheel via enA
  pinMode(enB, OUTPUT);
  //set pin 5 to output data, controls speed of right wheel via enB



  //reset all motors to off it 
  //turn off dc motors/set initial state/clear all previous memory
  digitalWrite(in1, LOW);
  //sends digital output signal to controller to set in1 to low
  digitalWrite(in2, LOW);
  //sends digital output signal to controller to set in2 to low
  digitalWrite(in3, LOW);
  //sends digital output signal to controller to set in3 to low
  digitalWrite(in4, LOW);
  //sends digital output signal to controller to set in4 to low

}



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

  //set speed of dc motor
  analogWrite(enA, 230);
  //send analog output signal from controller to set left motor speed in enA to be 100
  analogWrite(enB, 250);
  //send analog output signal from controller to set right motor speed in enA to be 100



  while (stp == 0) {
  //while stp = 0, continue running the while loop, if stp = any other number, stops the while loop


    //clear trigger pin for 2 microseconds (2x10^6)
    digitalWrite(t0, LOW);
    //store analog detected value from 1st ldr at pin a0 in var ldr0a
    delayMicroseconds(2);
    //pause for 2 microseconds, higher freq than delay()??
  
    //send ultrasonic pulse to detect obstacles within 4cm
    digitalWrite(t0, HIGH);
    //trigger/send the ultrasonic pulse
    delayMicroseconds(10);
    //continue sending pulse for 10 sec
    digitalWrite(t0, LOW);
    //turn off the ultrasonic pulse
  
    //read ultrasonic wave echo
    time0 = pulseIn(e0, HIGH);
    //turn e0 echo pin on to listen for the ultrasonic wave reflection
    
  
    
    digitalWrite(t1, LOW);
    delayMicroseconds(2);
  
    digitalWrite(t1, HIGH);
    delayMicroseconds(10);
    //continue sending pulse for 10 sec
    digitalWrite(t1, LOW);
  
    time1 = pulseIn(e1, HIGH);
    
  
    
    digitalWrite(t2, LOW);
    delayMicroseconds(2);
    
    digitalWrite(t2, HIGH);
    //trigger/send the ultrasonic pulse
    delayMicroseconds(10);
    //continue sending pulse for 10 sec
    digitalWrite(t2, LOW);
    //turn off the ultrasonic pulse
  
    time2 = pulseIn(e2, HIGH);
    //turn e0 echo pin on to listen for the ultrasonic wave reflection
  
  
  
    //calculate distance
    dist0 = time0 * (0.034/2);
    dist1 = time1 * (0.034/2);
    dist2 = time2 * (0.034/2);
    //speed of sound  = 0.034 cm/microsecond
    
  
  
    //MIGHT NEED TO BE RECLAIBRATED to adjust distance
    //change obstacledist if changing object detection alarm distance
    //obstacle detected = 1, no obstacle = 0
    
    if (dist0 <= ObstacleDist) {  //if dist0 is less than or equal to 4, obstacle detected at 1st uds
      obs0 = 1;   //set obs0 to 1/high/yes
    }
    else {  //if dist0 is not more than 4cm = no obstacle detected
      obs0 = 0;   //set obs0 to 0/low/no
    }
  
    if (dist1 <= ObstacleDist) {  //if dist0 is less than or equal to 4, obstacle detected at 1st uds
      obs1 = 1;   //set obs0 to 1/high/yes
    }
    else {  //if dist0 is not more than 4cm = no obstacle detected
      obs1 = 0;   //set obs0 to 0/low/no
    }
  
    if (dist2 <= ObstacleDist) {  //if dist0 is less than or equal to 4, obstacle detected at 1st uds
      obs2 = 1;   //set obs0 to 1/high/yes
    }
    else {  //if dist0 is not more than 4cm = no obstacle detected
      obs2 = 0;   //set obs0 to 0/low/no
    }
  
  
  
    obst = obs0*4 + obs1*2 + obs2;
  
  
  
    //display results
    /*
    Serial.print("\ndist0: ");
    Serial.print(dist0);
    Serial.print(" cm, dist1: ");
    Serial.print(dist1);
    Serial.print(" cm, dist2: ");
    Serial.print(dist2);
    Serial.print(" cm, \n obs0: ");
    Serial.print(obs0);
    Serial.print("   ,  obs1: ");
    Serial.print(obs1);
    Serial.print("   ,  obs2: ");
    Serial.print(obs2);
    Serial.print("\n");
    Serial.print(obst);
    */

    
    switch (obst){  //stop

      case B000:

        //stop left wheel
        digitalWrite(in1, LOW);
        //send digital output signal to in1 to high to stop left wheel
        digitalWrite(in2, LOW);
        //send digital output signal to in2 to low to stop left wheel
      
        //stop right wheel
        digitalWrite(in3, LOW);
        //send digital output signal to in3 to high to stop right wheel
        digitalWrite(in4, LOW);
        //send digital output signal to in4 to low to stop right wheel
        
        Serial.print("end of line: stop both wheels");
        stp = 6;
        break;
      
    
      case B001: //turn L
  
        //stop left wheel, or can reverse it too
        digitalWrite(in1, LOW);
        //send digital output signal to in1 to high to stop left wheel
        digitalWrite(in2, LOW);
        //send digital output signal to in2 to low to stop left wheel
  
        //move right wheel
        digitalWrite(in3, HIGH);
        //send digital output signal to in3 to high to make right wheel move forward
        digitalWrite(in4, LOW);
        //send digital output signal to in4 to low to make right wheel move forward
  
        //Serial.print("obstacle on right: move left, forward left wheel & stop/reverse right wheel");
        continue;


      case B010:  //turn left for 0.5 sec
        
        //stop left wheel, or can reverse it too
        digitalWrite(in1, LOW);
        //send digital output signal to in1 to high to stop left wheel
        digitalWrite(in2, LOW);
        //send digital output signal to in2 to low to stop left wheel
  
        //move right wheel
        digitalWrite(in3, HIGH);
        //send digital output signal to in3 to high to make right wheel move forward
        digitalWrite(in4, LOW);
        //send digital output signal to in4 to low to make right wheel move forward
  
        //Serial.print("obstacle in front: turn left for 2 sec until no more obstacles");
        delay(500);
        continue;


      case B011: //turn L
  
        //stop left wheel, or can reverse it too
        digitalWrite(in1, LOW);
        //send digital output signal to in1 to high to stop left wheel
        digitalWrite(in2, LOW);
        //send digital output signal to in2 to low to stop left wheel
  
        //move right wheel
        digitalWrite(in3, HIGH);
        //send digital output signal to in3 to high to make right wheel move forward
        digitalWrite(in4, LOW);
        //send digital output signal to in4 to low to make right wheel move forward
  
        //Serial.print("obstacle on right: move left, forward left wheel & stop/reverse right wheel");
        continue;
      
    
      case B100: //turn right
  
        //move left wheel
        digitalWrite(in1, HIGH);
        //send digital output signal to in1 to high to make left wheel move forward
        digitalWrite(in2, LOW);
        //send digital output signal to in2 to low to make left wheel move forward
  
        //stop right wheel, or can reverse it too
        digitalWrite(in3, LOW);
        //send digital output signal to in3 to low to stop right wheel
        digitalWrite(in4, HIGH);
        //send digital output signal to in4 to low to stop right wheel
  
        //Serial.print("obstacle on left: move right, forward right wheel & stop/reverse left wheel");
        continue;


      case B101:  //move forward
  
        //move left wheel forward
        digitalWrite(in1, HIGH);
        //send digital output signal to in1 to high to make left wheel move forward
        digitalWrite(in2, LOW);
        //send digital output signal to in2 to low to make left wheel move forward
  
        //move right wheel forward
        digitalWrite(in3, HIGH);
        //send digital output signal to in3 to high to make right wheel move forward
        digitalWrite(in4, LOW);
        //send digital output signal to in4 to low to make right wheel move forward
  
        //Serial.print("no obstacles in front: move forward");
        continue;


      case B110: //turn right
  
        //move left wheel
        digitalWrite(in1, HIGH);
        //send digital output signal to in1 to high to make left wheel move forward
        digitalWrite(in2, LOW);
        //send digital output signal to in2 to low to make left wheel move forward
  
        //stop right wheel, or can reverse it too
        digitalWrite(in3, LOW);
        //send digital output signal to in3 to low to stop right wheel
        digitalWrite(in4, HIGH);
        //send digital output signal to in4 to low to stop right wheel
  
        //Serial.print("obstacle on left: move right, forward right wheel & stop/reverse left wheel");
        continue;
      
      
      case B111:  //turn left for 0.5 sec
        
        //stop left wheel, or can reverse it too
        digitalWrite(in1, LOW);
        //send digital output signal to in1 to high to stop left wheel
        digitalWrite(in2, LOW);
        //send digital output signal to in2 to low to stop left wheel
  
        //move right wheel
        digitalWrite(in3, HIGH);
        //send digital output signal to in3 to high to make right wheel move forward
        digitalWrite(in4, LOW);
        //send digital output signal to in4 to low to make right wheel move forward
  
        //Serial.print("obstacle in front: turn left for 2 sec until no more obstacles");
        delay(500);
        continue;
      
      
      default:  //error stop
  
        //stop left wheel
        digitalWrite(in1, LOW);
        //send digital output signal to in1 to high to stop left wheel
        digitalWrite(in2, LOW);
        //send digital output signal to in2 to low to stop left wheel
      
        //stop right wheel
        digitalWrite(in3, LOW);
        //send digital output signal to in3 to high to stop right wheel
        digitalWrite(in4, LOW);
        //send digital output signal to in4 to low to stop right wheel
        
        //Serial.print("error: stop both wheels");
        stp = 5;
        break;
     
    }
  }
}

The picture doesn't open. Guess it shows schematics.

No. It's this.

Based on your other thread
https://forum.arduino.cc/t/unable-to-use-reply-to-posted-question/1465169

You've got something broken in your environment.

The almost 9V is powering the UNO and the motors. The best solution is to use the battery pack for just the UNO and get a properly sized power pack for the motors

Without an annotated schematic showing exactly how you wired your project, I can only guess at the problem.

Photographs are of limited value unless someone has identical-looking components, and even then, components that look alike are not necessarily electrically identical.

Please post an annotated schematic showing all connections, including power and ground. Also, provide links to the hardware items you are using so we can identify the exact boards, modules, and power supply.

My best guess is that you have a power supply problem, based on your statement that the project operates correctly when powered by the PC.

I also suggest spending a few coins on an inexpensive digital multimeter. They are available from China for less than the cost of a six-pack and are an essential tool for troubleshooting electronics.

Once you have a multimeter, measure the supply voltage both with and without the project connected. That will help determine whether the power supply is maintaining the required voltage under load.

Your pic is all grey.
What could be broken? No system changes made. The last Win update was several days ago.

is this what you mean by annotated? :sweat_smile: im not very familiar with electronics sorry

wont the 9v straight to the arduino fry it? :sweat_smile: the battery pack is 12v connected to the l298n 12v pin, and the l298 5v pin is connected to the arduino 5v pin.

what i understand from you is that the arduino is not getting enough voltage that is why its not working properly?

You first drew a 9vdc battery pack. So, we used what we had. 9vdc would go in the Vin pin. Vin can take from 7.5vdc (some say 7vdc) to 12vdc (some say 20vdc)

Also... the "comments" do not follow the code, which means editing.

int t0 = 12;  //declare int var t0 at pin 8 to activate/trigger ultrasonic wave
int t1 = 10;
int t2 = 8;

int e0 = 13;  //declare int var e0 at pin 9 to receive the ultrasonic echo wave
int e1 = 11;
int e2 = 9;

Pin 2 is not PWM, but pin 3 is PWM... swap these...

If your battery pack positioned so your sensors can see it?

Not sure about the white wiring on the L298n Board.

Is Arduino 3v connected to 5v L298n?
Does the L298n provide or require 5v?

Never heard of this. Please provide a link.

In some form required for USB native boards like R4 and Leonardo but unlikely for R3.

The L298 module is able to feed the UNO. The regulator jumper needs to be in place. And then you need to use the 5V pin on the UNO, not the 3.3V pin (may damage your UNO).

Start by measuring the battery voltage while the motors are trying to run, because AA cells can sag badly under load even when they read fine with no load. Also confirm that the Uno ground and the L298N ground are connected together, since a missing common ground can make the motor signals unreliable. Finally, test one motor at a time with the sensors disconnected, so you can tell whether the problem is power capacity, wiring, or the sensor logic.

@7mju6tre
Do any LEDs on the Arduino Uno board light up when you connect it directly to a PC via USB? And the same question in case when you connect the entire circuit to an external power supply?

Did you installed a "5V-enable" jumper on the l298n module just above the power supply 3-pins screw terminal ?

6 x 1.5V is 9V at best. I have an UNO powered by a 9V battery sitting in front of me to do some small tests right now. It is a standard setup. HOWEVER if motors are involved you will need a SECOND battery to power the motors as many here have already told you.

Let's assume you get your power issue sorted, or, assume there is no power issue...

Your code will not start to move without an obstacle inside the danger zone (5cm).

A programming readability warning: Using variables such as e0, e1, e2 and t0, t1, t2 creates a programming difficulty. You have sixty variables and comments that have these six "variable names" in them, for example, "dest2"... From your 400+ lines of code-and-comments, I made this into 130 lines with some comments, more descriptive variable names, debug output, and used arrays and functions for redundant code.

sketch.ino

// https://forum.arduino.cc/t/arduino-uno-unable-to-work-with-external-power-supple/1465166/

bool debug = true; // for debug print statements

int trig[] = {12, 10, 8};
int echo[] = {13, 11, 9};
int duration[3];
int distance[3];
bool obstacle[3]; // bit packed array
int unsafeDistance = 5;
int obsTotal;
int stp = 0; // moved from setup() to global variables

int L298Npin[] = {2, 3, 4, 5, 6, 7}; // array to set pins as a batch

int enA = 3; // left motor // was 2 (a DIO pin) but needs a PWM pin (3)
int in1 = 2; // was 3 but only needs a DIO pin
int in2 = 4;

int enB = 5; // right motor // PWM pin
int in3 = 6;
int in4 = 7;

void setup() {
  if (debug) Serial.begin(115200); // need this for Serial printing
  for (byte i = 0; i < 3; i++) {
    pinMode(trig[i], OUTPUT);
    pinMode(echo[i], INPUT);
    pinMode(L298Npin[i], OUTPUT); // in1, ena, in2
    pinMode(L298Npin[i * 2], OUTPUT); // enB, in3, in4
    digitalWrite(L298Npin[i], LOW); // left motor (A) pins off
    digitalWrite(L298Npin[i * 2], LOW); // right motor (B) pins off
  }
  analogWrite(enA, 230); // moved these two, single-call lines from loop() to setup()
  analogWrite(enB, 250); // mismatched motors?
}

void loop() {
  while (stp == 0) {
    for (byte i = 0; i < 3; i++) { // three HC-SR04
      digitalWrite(trig[i], LOW);
      delayMicroseconds(2);
      digitalWrite(trig[i], HIGH);
      delayMicroseconds(10);
      digitalWrite(trig[i], LOW);
      duration[i] = pulseIn(echo[i], HIGH); // "time" changed to "duration" to avoid keyword conflict
      distance[i] = duration[i] * (0.034 / 2);    //speed of sound  = 0.034 cm/microsecond

      if (debug) debugoutput(distance[i], DEC, " Distance");

      if (distance[i] <= unsafeDistance)
        obstacle[i] = 1; // obstacle detected
      else
        obstacle[i] = 0; // obstacle not detected
    }

    obsTotal = obstacle[0] * 4 + obstacle[1] * 2 + obstacle[2];

    if (debug) debugoutput(obsTotal, BIN, "| obsTotal (BIN)");

    switch (obsTotal) {
      case B000: // stop
        drive (LOW, LOW, LOW, LOW);
        Serial.print(" end of line: stop");
        stp = 6;
        break;

      case B001: // left
        drive(LOW, LOW, HIGH, LOW);
        continue; // lets switch() test all case:s

      case B010:  // left for 0.5 sec
        drive(LOW, LOW, HIGH, LOW);
        delay(500);
        continue;

      case B011: // left
        drive(LOW, LOW, HIGH, LOW);
        continue;

      case B100: // right
        drive(HIGH, LOW, LOW, HIGH);
        continue;

      case B101:  // forward
        drive(HIGH, LOW, HIGH, LOW);
        continue;

      case B110: // right (again?)
        drive(HIGH, LOW, LOW, HIGH);
        continue;

      case B111:  //left for 0.5 sec
        drive (LOW, LOW, HIGH, LOW);
        delay(500);
        continue;

      default:  // error
        drive(LOW, LOW, LOW, LOW);
        stp = 5;
        break;
    }
    if (debug) Serial.println();
  }
}

void drive(bool i1, bool i2, bool i3, bool i4) { // four motor input signals
  digitalWrite(in1, i1);
  digitalWrite(in2, i2);
  digitalWrite(in3, i3);
  digitalWrite(in4, i4);
}

void debugoutput(int value, byte base, char text[]) {
  Serial.print(text);
  Serial.print(":");

  if (base == DEC) { // " " placeholders
    if (value < 100)
      Serial.print(" ");
    if (value < 10)
      Serial.print(" ");
  }
  if (base == BIN) { // "0" placeholders
    if  (value < 4)
      Serial.print("0");
    if (value < 2)
      Serial.print("0");
  }
  Serial.print(value, base);
  Serial.print(" ");
  if (base == BIN)
    Serial.println(); // end of line CRLF
}
click for "diagram.json" for wokwi nerds
{
  "version": 1,
  "author": "xfpd",
  "editor": "wokwi",
  "parts": [
    {
      "type": "wokwi-arduino-nano",
      "id": "nano",
      "top": 51,
      "left": -113.7,
      "rotate": 90,
      "attrs": {}
    },
    { "type": "wokwi-hc-sr04", "id": "ultrasonic1", "top": -209.7, "left": -71.3, "attrs": {} },
    { "type": "wokwi-hc-sr04", "id": "ultrasonic2", "top": -123.3, "left": 43.9, "attrs": {} },
    { "type": "wokwi-hc-sr04", "id": "ultrasonic3", "top": -209.7, "left": 149.5, "attrs": {} },
    { "type": "wokwi-vcc", "id": "vcc1", "top": -200.84, "left": -96, "attrs": {} },
    { "type": "wokwi-gnd", "id": "gnd1", "top": 134.4, "left": -106.2, "attrs": {} },
    {
      "type": "wokwi-led",
      "id": "led1",
      "top": 114,
      "left": 179.4,
      "rotate": 90,
      "attrs": { "color": "orange" }
    },
    {
      "type": "wokwi-led",
      "id": "led2",
      "top": 133.2,
      "left": 189,
      "rotate": 90,
      "attrs": { "color": "yellow" }
    },
    {
      "type": "wokwi-led",
      "id": "led3",
      "top": 152.4,
      "left": 179.4,
      "rotate": 90,
      "attrs": { "color": "white" }
    },
    {
      "type": "wokwi-led",
      "id": "led4",
      "top": 114,
      "left": 59,
      "rotate": 270,
      "attrs": { "color": "orange", "flip": "1" }
    },
    {
      "type": "wokwi-led",
      "id": "led5",
      "top": 133.2,
      "left": 49.4,
      "rotate": 270,
      "attrs": { "color": "yellow", "flip": "1" }
    },
    {
      "type": "wokwi-led",
      "id": "led6",
      "top": 152.4,
      "left": 59,
      "rotate": 270,
      "attrs": { "color": "white", "flip": "1" }
    },
    { "type": "wokwi-text", "id": "text1", "top": 144, "left": 230.4, "attrs": { "text": "ENB" } },
    {
      "type": "wokwi-text",
      "id": "text2",
      "top": 163.2,
      "left": 220.8,
      "attrs": { "text": "IN4" }
    },
    {
      "type": "wokwi-text",
      "id": "text3",
      "top": 124.8,
      "left": 220.8,
      "attrs": { "text": "IN3" }
    },
    { "type": "wokwi-text", "id": "text4", "top": 144, "left": 19.2, "attrs": { "text": "ENA" } },
    {
      "type": "wokwi-text",
      "id": "text5",
      "top": 163.2,
      "left": 28.8,
      "attrs": { "text": "IN2" }
    },
    {
      "type": "wokwi-text",
      "id": "text6",
      "top": 124.8,
      "left": 28.8,
      "attrs": { "text": "IN1" }
    }
  ],
  "connections": [
    [ "ultrasonic1:TRIG", "nano:12", "green", [ "v0" ] ],
    [ "ultrasonic1:ECHO", "nano:13", "green", [ "v115.2", "h-87.2", "v9.6" ] ],
    [ "ultrasonic2:TRIG", "nano:10", "green", [ "v0" ] ],
    [ "ultrasonic2:ECHO", "nano:11", "green", [ "v0" ] ],
    [ "ultrasonic3:TRIG", "nano:8", "green", [ "v0" ] ],
    [ "ultrasonic3:ECHO", "nano:9", "green", [ "v0" ] ],
    [ "vcc1:VCC", "ultrasonic1:VCC", "red", [ "v153.6", "h86.4" ] ],
    [ "gnd1:GND", "ultrasonic1:GND", "black", [ "v-144", "h126" ] ],
    [ "vcc1:VCC", "ultrasonic2:VCC", "red", [ "v153.6", "h201.6" ] ],
    [ "gnd1:GND", "ultrasonic2:GND", "black", [ "v-144", "h241.2" ] ],
    [ "ultrasonic3:VCC", "vcc1:VCC", "red", [ "v96", "h-297.6" ] ],
    [ "ultrasonic3:GND", "gnd1:GND", "black", [ "v105.6", "h-356.4" ] ],
    [ "nano:GND.2", "led4:C", "black", [ "h134.4", "v9.2" ] ],
    [ "nano:GND.2", "led1:C", "black", [ "h134.4", "v9.2" ] ],
    [ "nano:GND.2", "led5:C", "black", [ "h134.4", "v28.4" ] ],
    [ "nano:GND.2", "led2:C", "black", [ "h134.4", "v28.4" ] ],
    [ "nano:GND.2", "led6:C", "black", [ "h134.4", "v47.6" ] ],
    [ "nano:GND.2", "led3:C", "black", [ "h134.4", "v47.6" ] ],
    [ "nano:2", "led4:A", "orange", [ "h105.6", "v28.8" ] ],
    [ "nano:3", "led5:A", "yellow", [ "h115.2", "v57.6" ] ],
    [ "nano:4", "led6:A", "white", [ "h124.8", "v86.4" ] ],
    [ "nano:7", "led3:A", "gray", [ "h163.2", "v115.2" ] ],
    [ "gnd1:GND", "nano:GND.1", "black", [ "v-144", "h19.2", "v134.4" ] ],
    [ "led1:A", "nano:6", "blue", [ "h-28.8", "v-57.6" ] ],
    [ "nano:5", "led2:A", "cyan", [ "h144", "v76.8" ] ]
  ],
  "dependencies": {}
}

Are you connecting 6 x 1.5V AA = 9V to the Arduino's 5V pin?

Almost, that is an animated picture, not a schematic.

A schematic is a drawing that shows how electrical components are connected and how the circuit works. It uses standard symbols rather than pictures of the actual components. Picture on left schematic on right, much simpler and has all of the information.

The lines represent electrical connections, and the symbols represent components such as resistors, capacitors, transistors, and integrated circuits.

Unlike a wiring diagram, a schematic does not show the physical location of components or how the wires are routed.

For example, a simple circuit consisting of a 5V power supply, a 330-ohm resistor, and an LED can be represented by a schematic. The resistor limits the current through the LED. The schematic shows the electrical connections without requiring pictures of the individual parts.

Learning to read and draw schematics is an important part of working with electronics. It makes troubleshooting much easier and allows others to understand your circuit without having the actual hardware in front of them.

There are plenty of free resources available to help you learn:

  • All About Circuits has a free electronics textbook covering components, circuits, and schematic symbols.

  • SparkFun Tutorials provides a beginner-friendly introduction to reading schematics.

  • KiCad is a free, open-source program for drawing professional electronic schematics and designing printed circuit boards.

I recommend downloading KiCad and learning to use its schematic editor. You do not need to design a circuit board to use it.

Start by drawing the simple LED circuit described above. Connect the positive supply to the resistor, the resistor to the LED anode, and the LED cathode to ground.

It may seem complicated at first, but once you understand the basic symbols and connections, schematics become much easier to read and create.

Hi, @7mju6tre
Welcome to the forum.

Do you have a DMM? Digital MultiMeter?

Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

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