0

I want to connect my adafruit motor shield v2.3 to a touch board from bare conductive so that the motor turns when one of the electrodes is touched.

I've tested the touch part and that isn't a problem so i tested the motor shield on my arduino uno. I am using the DCMotorTest example and when uploading it doesn't give any errors. The shield is getting powered, but the motor isn't turning.

The motor does turn when connected to a 9v battery. The motor doesn't turn when connected to motor shield without external power and VIN jumper connected.enter image description here The motor doesn't turn when connected to motor shield with external power with and without VIN jumper connected.

/* 
This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2
It won't work with v1.x motor shields! Only for the v2's with built in PWM
control

For use with the Adafruit Motor Shield v2 
---->   http://www.adafruit.com/products/1438
*/

#include <Wire.h>
#include <Adafruit_MotorShield.h>

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield(); 
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61); 

// Select which 'port' M1, M2, M3 or M4. In this case, M1
Adafruit_DCMotor *myMotor = AFMS.getMotor(1);
// You can also make another motor on port M2
//Adafruit_DCMotor *myOtherMotor = AFMS.getMotor(2);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Adafruit Motorshield v2 - DC Motor test!");

  AFMS.begin();  // create with the default frequency 1.6KHz
  //AFMS.begin(1000);  // OR with a different frequency, say 1KHz

  // Set the speed to start, from 0 (off) to 255 (max speed)
  myMotor->setSpeed(150);
  myMotor->run(FORWARD);
  // turn on motor
  myMotor->run(RELEASE);
}

void loop() {
  uint8_t i;

  Serial.print("tick");

  myMotor->run(FORWARD);
  for (i=0; i<255; i++) {
    myMotor->setSpeed(i);  
    delay(10);
  }
  for (i=255; i!=0; i--) {
    myMotor->setSpeed(i);  
    delay(10);
  }

  Serial.print("tock");

  myMotor->run(BACKWARD);
  for (i=0; i<255; i++) {
    myMotor->setSpeed(i);  
    delay(10);
  }
  for (i=255; i!=0; i--) {
    myMotor->setSpeed(i);  
    delay(10);
  }

  Serial.print("tech");
  myMotor->run(RELEASE);
  delay(1000);
}

https://i.stack.imgur.com/uzsEb.jpg

3
  • If you are using a 9V block battery: don't use it. These batteries are made for low power applications and can only provide a low current. Not fitting to drive motors
    – chrisl
    Dec 15, 2019 at 18:46
  • What should i use instead?
    – Nick
    Dec 15, 2019 at 18:47
  • Many possibilities. For example a fitting number of AA batteries in series. Or a LiPo battery
    – chrisl
    Dec 15, 2019 at 18:49

2 Answers 2

1

You have two possibilities of powering the shield according to the adafruit documentation.

A: power the Arduino over the power plug (not the USB plug) of the Arduino and set the VIN jumper.

B: Leave the VIN jumper off and power over the power connector of the shield.

Don't try other possibilities. They may kill the shield or the Arduino.

The reason your motor doesn't turn is because you switched it off myMotor->run(RELEASE); immediately after you switched it on myMotor->run(FORWARD);.

5
  • Setting the VIN jumper is connecting the pins or leaving them not-connected?
    – Nick
    Dec 15, 2019 at 16:24
  • I'm unsure, if I understood your question correctly. If I do, the answer is: Setting the VIN jumper means taking a jumper or other conducting materials and putting it on/between the two VIN pins. These are the two pins close to the power connector on the shield. If they are connected together, the power of the Arduino (but only from the *ext Power plug*, *not* from the USB connector) is connected to the power management of the shield and you don't need extra power on the shield. Dec 15, 2019 at 17:42
  • Yhea that's what i meant sorry for formulating the question so werid. When i leave the VIN jumper and connect the shield to o 9v battery the shields led lights up, but the arduino doesn't
    – Nick
    Dec 15, 2019 at 17:50
  • When connecting a couple of AA batteries the same thing happens, i also changed the M1 to M4 but this also didn't do anything
    – Nick
    Dec 15, 2019 at 20:22
  • If I understood the documentation correctly, the Arduino must be powered separately even if you power the shield externally. But you can power the shield from the arduino if the VIn Jumper is set on the pins. Then you don't need to power the shield externally. Dec 15, 2019 at 22:03
2

I just used a different motor-shield and it works now, thank you all for your replies and research in this!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.