4

I have this Arduino motor shield which is hooked up with two DC motors. The board is the same as this one from Sparkfun.

A PWM output controls the speed of the motor, and a digital out controls the direction. The problem is that it only works in one direction, namely if the direction pin is high.

With the direction pin HIGH and 255 is written to the PWM pin, Vout on the terminals is similar to Vin. If I reverse the direction by setting the direction pin LOW I would expect Vout to be -Vin, ie. the polarity reversed. But not so. I get a little more than zero volt across the terminals.

It's the same for both channels.

Edit: The setup is powered from a 9V power adaptor through the barrel jack on Arduino.

Photo of the DC motor connected to the driver board

Is the board defective, or am I misunderstanding something?

SOLUTION: Thanks to the edited post (especially #3) in the accepted answer, I not only looked at the schematic (again), I actually understood it. I had already noticed the jumper called V-LOGIC which on the picture from Sparkfun was set to 5V where it on my shield was not set. I really didn't know what it was used for, but I set it to 5V so it was the same. But by looking at the schematic and the inverters, I realized that the inverter was fed from V-LOGIC which was connected to 5V. And bingo: I had not connected the 5V pin on the shield, only vIN which I assumed would be sufficient. The thing is, I am awaiting a set of stackable headers instead of the ones supplied, so I only connected the minimum numbers of pins because I will need to desolder them when I get the new headers.

  • How have you hooked up the motor? – Ignacio Vazquez-Abrams Dec 29 '14 at 13:03
  • Sounds like something is hooked up wrong. Please add a photo or a diagram of your wiring. Also, what happens with the LEDs on the shield? – Jasmine Dec 29 '14 at 17:43
  • The motor is connected between 1 & 2 on the terminal. Or 3 & 4 for motor B. The LEDs light up for the direction that works (with the DIR pin high). For the other direction there is no light in the LEDs. Will add some photos tomorrow as it's late now. But thanks so far. – marlar Dec 29 '14 at 21:12
  • Added an image of the setup. Here the motor is connected to terminal A, but it's the same with B. Only works in one direction; the same applies to the LED. – marlar Dec 30 '14 at 16:57
  • 1
    Also, there is only light in the LEDs for one direction. – marlar Dec 30 '14 at 19:18
2

I think you may be having an issue with how you are powering the shield. Are you trying to do it with just your USB connection?

In your photo, I do not see a connection to your Arduino's barrel jack or to the Vin connector of the shield itself. According to the SparkFun site:

The Ardumoto Shield should be powered through one of two power supply inputs. Pick one or the other:

  1. The barrel jack input on the Arduino.
  2. The Vin input on the shield

If you don’t want to use the Arduino’s barrel jack input, you can use the Vin input on the shield instead. This voltage input will supply both the shield and the Arduino. Like the motor outputs, this connection is broken out to both a 3.5mm screw terminal and a 0.1"-pitch header.

Do not supply power to both the Arduino barrel jack input and Vin on the shield!

I hope this helps!

EDIT BASED ON COMMENTS
Since you are properly powering the shield, I would recommend the following (see the shield's schematic for specifics):

  1. Maintaining the connection shown above (with the addition of the 9V power supply connected to the barrel jack) ensure that you are able to properly set the DIRA input. You can check this with a multimeter on pin 7 of the LN298 whenever you are trying to switch directions.
  2. If you are getting the expected results on pin 7 (pin goes HI when your code wants the motor to go one direction and pin goes LOW for the other) - check pin 9... the value here should always be the opposite of what you are setting for DIRA on pin 7. If that is all good, then you probably have an issue with the LN298.
  3. If you are not getting the expected results at pin 9, but pin 7 looks good, then you are having a problem with the 74HC1G04 IC (although I would doubt this since you are having problems with both the A and B motor outputs).
  4. If you are not getting the expected results at pin 7, then double check the code to make sure you have set and cleared the correct output pin. I would also check the solder joints of the connectors on the shield - you can set a multimeter to do a resistance check from the shield's connector (pin 12) to the direction input on the LN298 (pin 7). If the continuity is measuring close to 0 ohms then there is probably an issue with your code.
  5. If your code looks good, I have also had issues with bad outputs on the Arduino - you can check to see if you are properly toggling the direction pin (pin 12) on the Arduino without the shield connected. Then, if the pin is not toggling, there is probably an issue with your Arduino - try toggling a different (unused) pin and jumpering it.
  • I power the setup from a 9V power source via the barrel jack. Should have mentioned that, sorry. However, the shield works just the same powered from USB, only the motors spins somewhat slower. – marlar Dec 30 '14 at 20:07
  • "However, the shield works just the same powered from USB, only the motors spins somewhat slower" - and apparently in only one direction. The effect of lower voltage can be "doesn't work at all" it's not always just "weak" – Jasmine Dec 30 '14 at 20:11
  • Yes, but I do power it from a 9V external power source! I only say that it works the same powered from USB, because I tried that also :-) – marlar Dec 30 '14 at 20:22
  • @embedded_guy: Thanks for your thorough advice. Pin 7 goes HI and LO as expected, with the motor and LED on when hi. However, pin 9 stays LO all the time. And it's the same for driver B: Pin 13 goes HI and LO, but 15 stays LO. So two dead 74HC1G04 ICs? – marlar Jan 1 '15 at 23:44
  • Hooray! Problem solved. See my updated question. – marlar Jan 2 '15 at 0:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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