Did I destroy my UNO, or Motor Shield? ...and why?

Hi,
this is my first project, first post, first Arduino…(well… the second now… as the first is broken?)
I tried a simple program: read out joystick potentiometers and moving motors coresponding to the value.
I am using Arduino UNO rev 3 and AF motor shield version 1.
The problem: The motor 3 and 4 do not work as intended:

  • the first board and shield is now doing nothing on these pins
  • the second try: at least motor 3 works, motor 4 is behaving strange. Only 9 v…

I narrowed it down to hardware issues.
The reason might be: at some point, I connected switches to the pins 5 and 6. Did this hurt something? and if so: did it break the shield or the arduino UNO? Can I repair it?
Also what I did (maybe wrong): I connected 9V to the motor shield supply. In normal mode, I have the pwr jumper closed, to also get power for the UNO. I cannot guarantee, that I always opened it, when connecting the USB cable… Did THIs hurt something? What?
I already tried to exchange the ICs - but this did not imrove the behaviour
All the best
Chris

#include <AFMotor.h>

int pot1 = A2; 
int pot2 = A1; //hier legen wir unseren Pin zur Messung fest
int but1= 6;
int pot3 = A4; 
int pot4 = A3; //hier legen wir unseren Pin zur Messung fest
int but2= 5;

int but1State =0;
int pot1_wert = 0; //wir setzen den Wert vor der Messung auf 0
int pot2_wert = 0;

int but2State =0;
int pot3_wert = 0; //wir setzen den Wert vor der Messung auf 0
int pot4_wert = 0;

int motSpeed1 = 0;
int motSpeed2 = 0;
int motSpeed3 = 0;
int motSpeed4 = 0;

int pot1INIT=0;
int pot2INIT=0;
int pot3INIT=0;
int pot4INIT=0;

// DC motor on definition
AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
AF_DCMotor motor3(4);
AF_DCMotor motor4(3);

 void setup() {
   Serial.begin(9600); // Starte Serialmonitor
  delay(2000); //Spannungsaufbau, wenn nötig
   //middle values in zero position
  pot1INIT=analogRead(pot1);
  pot2INIT=analogRead(pot2);
  pot3INIT=analogRead(pot3);
  pot4INIT=analogRead(pot4);
   
   motor1.setSpeed(200);
   motor1.run(RELEASE);
   
   motor2.setSpeed(200);
   motor2.run(RELEASE);

   motor3.setSpeed(200);
   motor3.run(RELEASE);

   motor4.setSpeed(200);
   motor4.run(RELEASE);
   
   pinMode(but1, INPUT_PULLUP);
   pinMode(but2, INPUT_PULLUP);
 }



 void loop() {
  //Lese Werte ein
   pot1_wert = analogRead(pot1); // wir legen fest, dass die Variable pot1_wert für uns den Wert des Potis speichert
   pot2_wert = analogRead(pot2); 
   but1State = digitalRead(but1);
   pot3_wert = analogRead(pot3); // wir legen fest, dass die Variable pot1_wert für uns den Wert des Potis speichert
   pot4_wert = analogRead(pot4); 
   but2State = digitalRead(but2);
   
   Serial.print("P1 = "); // Der Serialmonitor soll vor dem Wert des ersten Potis "P1 =" anzeigen, fals wir mehrere Potisanschließen wollen
   Serial.print(pot1_wert); // Nun wird der Wert ausgegeben und die Zeile des Serialmonitors beendet.
   Serial.print("...P2 = ");
   Serial.print(pot2_wert);
   Serial.print("...But1 = ");
   Serial.print(but1State);
   Serial.print("  P3 = "); // Der Serialmonitor soll vor dem Wert des ersten Potis "P1 =" anzeigen, fals wir mehrere Potisanschließen wollen
   Serial.print(pot3_wert); // Nun wird der Wert ausgegeben und die Zeile des Serialmonitors beendet.
   Serial.print("...P4 = ");
   Serial.print(pot4_wert);
   Serial.print("...But2 = ");
   Serial.println(but2State);
   Serial.println();

   moveMotor(pot1_wert, pot1INIT, motor1);
   moveMotor(pot2_wert, pot2INIT, motor2);
   moveMotor(pot3_wert, pot3INIT, motor3);
   moveMotor(pot4_wert, pot4INIT, motor4);

   delay(50);
 }


void moveMotor(int pot, int potInit, AF_DCMotor mot){
  int motSpeed=abs(pot-potInit)/2;
  if (motSpeed>255) { motSpeed=255;}
  if (motSpeed<5) { motSpeed=0;}
  mot.setSpeed(motSpeed); 
   if (motSpeed==0)
  {
    mot.run(RELEASE);
  }
  else{
    if (pot-potInit<0)
    {
      mot.run(FORWARD);
    } 
    else 
    {
      mot.run(BACKWARD);
    }
  }
 }

There appears to be possibly two different faults.

First is that you have voltage going to the shield AND from the Arduino.
That should have been one or the other but NOT both.
hard to say what type of damage that may have caused.

The other sounds like possibly a CURRENT issue.
You have 9 volts at what amps ?

What are the motor specs ?
What is the total load on the 9V supply and does it exceed the required current (it should preferably have more than is needed)

I have 9 v on “zero” ampere…
But no matter what i tell the motor to supply, it stays on 9v :wink:
Also motor.run(release) puts out 9v.

Good to know the reason (power supply).
I had the feeling, i destroyed it by connecting the switches at the already used pins (6 and 7).
You dont assume problems here?
…and i got yoz right, that “anything” (uno or shield or both) might be broken?

To the power: it still IS allowed to ONLY connect the power on the shield and close the jumper to supply the board? (ONLY if usb is not connected?)

Thanks again!

Remove the shield / driver board or anything else from the equations.

Can you still see it and upload to it on its own ?
If so chances are your Arduino is still good at this point.

Can you link us to your EXACT PSU or supply all the label details please.
Same for the motors.

These are crucial details anyone who wants to help will need.

See the following links.

Could you take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

I'll try my best:

I still can connect the board and upload everything I want. Even with shield connected.

Shield: https://eckstein-shop.de/HIMALAYA-basic-L293D-Motor-Stepper-Servo-Schrittmotor-Arduino-Shield

Uno: QITA ATmega328 Board kompatible with Arduino UNO R3 CH340G USB CHIP -, 6,80 €

I also had another board and shield, but cannot find out anymore, where i got it from.
The mentioned one above is the one at which motor 3 still works.

The motors are hard to find details:
https://www.fischertechnik.de/de-de/produkte/einzelteile/aktoren/32293-mini-motor-6-9v-0-65-a-max-schwarz

So 0,65 A @9V...

My supply was a 9v block accumulator

chrisfx:
My supply was a 9v block accumulator

All good until we got to that...Do you mean battery ?
If so then the 9 volt rectangular batteries are almost useless in a motor scenario as they dont have enough capacity in terms of amps and will run down very very quickly.

All right...
Thanks for your help!
So next steps:
I will get:

  • a new power supply,
  • new uno
  • the motor shield v2..

I hope, this will clear all issues and prevent new issues...
Btw: I googled have a day without figuring out:
What is the difference in the shield version 2.0 and 2.3?
Except triple the price...

Adafruit Motor Stepper Servo Shield for Arduino v2 Kit - v2.3 - Eckst, 22,34 € (and similar)

Vs

(And similar)

...I will read carefully through the power options and hope that I will not again forget to remove jumper, before connecting with USB...