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.

marlar
  • 467
  • 1
  • 6
  • 10
  • 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
  • Have you verified that the motor rotates in both directions independent of the board? – Ignacio Vazquez-Abrams Dec 30 '14 at 16:58
  • I think the problem is with your motor. What is the blue wire that's not connected to anything? I think this is not a 'simple' DC motor. It's not a brushless though, or it wouldn't run at all. I would try a different motor in this situation. – Jasmine Dec 30 '14 at 16:59
  • @Jasmine: If you look at the motor itself it only has 2 leads. The blue wire is likely an unused conductor in a 3-conductor cable. – Ignacio Vazquez-Abrams Dec 30 '14 at 17:13
  • I considered that, but then I also considered we only see one side of it in the photo. And, that it really should work, it's wired up fine, so something must be wrong with the motor, or the shield is broken and that's less likely. – Jasmine Dec 30 '14 at 17:14
  • The blue wire it not used. There are three wires in the cable and I just used the two of them. The motor spins fine in both direction if I reverse the wires, so it's definetely not the motor. Besides, I have 4 motors and it's the same for all of them! Also, as noted, I have measured the voltage across the terminal and I only get a reading for one direction (DIR pin is high). For the other, there is 0 V across the terminal. My best guess is that the shield is broken, it's just very unlike that BOTH channels would be broken, but of course not impossible. – marlar Dec 30 '14 at 19:16
  • 1
    Also, there is only light in the LEDs for one direction. – marlar Dec 30 '14 at 19:18
  • OK that sounds all good. Where is the power source for the motors? I don't see the 12V source for the motors in the picture? I can see that you're powering it from the USB, which is only 5V, and might not be enough voltage. – Jasmine Dec 30 '14 at 19:50
  • That the LED's won't light for reverse on either channel suggests you are doing something wrong - for example, you could be swapping direction and enable. You might try looking up the L298 pinout and probing the input signals there - be careful though as it is easily shorted so you might want to do that using a current limited 5v supply rather than a high current 9v one. – Chris Stratton Jan 01 '15 at 15:13

1 Answers1

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.
embedded_guy
  • 206
  • 3
  • 6
  • 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 01 '15 at 23:44
  • Hooray! Problem solved. See my updated question. – marlar Jan 02 '15 at 00:02
  • @marlar Outstanding troubleshooting, I am glad that it is working for you now! – embedded_guy Jan 05 '15 at 17:21