Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Arduino Motor Driver Shield


  • Please log in to reply
8 replies to this topic

#1 Frode

Frode

    Advanced Member

  • Members
  • PipPipPip
  • 202 posts
  • LocationNorway

Posted 13 September 2013 - 07:09 PM

Hi, I'm trying to connect an Arduino Motor Driver Shield to my Netduino Plus 2, but need some help to get started.

 

My Netduino died and had to be erased the first time I connected the shield and ran my code, so now I think I need to make sure the code is OK first, and also see if anyone else has got this combo working.

 

Has anyone tried this shield?



#2 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 15 September 2013 - 12:15 PM

Hi Frode,

 

There are quite a few motor shields out there - the one I chose had all the PWM pins in the wrong place!

 

Would be helpful if you gave some more details about the shield - part/model number or link to data sheet.

 

Have Fun - Paul



#3 Frode

Frode

    Advanced Member

  • Members
  • PipPipPip
  • 202 posts
  • LocationNorway

Posted 15 September 2013 - 01:06 PM

Hi, I'm sorry - I thought I had added the link.

 

It's this one: https://www.sparkfun.com/products/9815



#4 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 15 September 2013 - 03:03 PM

Hi again,

 

Yes that's the one I bought!

I wrote a wiki page to describe it from a Netduino point of view.

 

Yes I do have it working, but it was necesary to remap the pins on the Netduino to those on the Ardumoto shield.

This was because I had a v1 Netduino Plus where the 4 PWM outputs did not map to the correct pins for the shield.

 

I have not checked if the Netduino v2s have the PWM outputs necesary - I think they might now that the v2 has six PWMs.

 

Assuming the PWMs are in the correct place, to do a quick test, I would do the following:

1/ Disconnect any motors from the shield

2/ Connect shield to Netduino

3/ Apply power to the Vin on the Netduino - this will reach the shield. (Or you could connect it to the shield pins) I would suggest the minimum of 7V. (You can go lower, 5V will work)

4/ Write a simple program that just sets the PWM pins and direction pins as normal GPIO outputs, and sets them "high" -"ON" - "1".

  The LEDs on the shield should light up.

5/ Change the code to set the direction pins (only) to "LOW" - "OFF" - "0"

The LEDs should change colour.

 

If that works, you have control of the shield.

Next try setting the GPIOs as PWM instead (not the direction ones) and try varying the pulse length to see if you can dim the LEDs.

 

That should get you started.

 

In the long term, think carefully about power supplies. I had lots of problems when I used the same Vin to supply the Netduinoand the shield - when the motors turned the Netduino rebooted.

I initially used my own fixit shield, in the end I have mounted the shield separately in the base of my buggy, and have a number of wires to link the shield and Netduino.

 

Also I suffered from the motors running whilethe Netduino booted - this is due to the GPIOs pulling high at power on / reboot. I fixed this using opto-isolators that needed more current to energise them.

 

Hope this all makes sense - Paul



#5 TLtechguy

TLtechguy

    New Member

  • Members
  • Pip
  • 3 posts

Posted 17 September 2013 - 03:16 PM

Hello, I would also recomend Sparkfun's Monster Motor Shield for mid to high current applications. This shield is a sterling example of WWWND. I will try and post my code in the near future and feel free to PM in the meantime if you would like to learn more. -Pat



#6 Frode

Frode

    Advanced Member

  • Members
  • PipPipPip
  • 202 posts
  • LocationNorway

Posted 17 September 2013 - 04:10 PM

Hi, thanks for the help! Got it working now.

 

The main issue was power. When I supply 9V to the Netduino board it works, but I get the same problem as you did when I drive both motors. The board just reboots.

 

I separated the boards, and just put jumperwires between D3, D11, D12, D13 and GND, powered the Netduino through USB, and powered the Arduino motorshield with 9V, and that made it stable.

 

The Arduino shield does seem to be pin compatible with the Netduino Plus 2, but I haven't managed to get PWM working yet. That is probably my fault, not the board's. The board freezes up when I deploy code with PWM, and my computer bluescreens when I disconnects the USB plug.

 

I tried updating the Wiki, but I get logged out when I go to the Wiki. I probably don't have permission to update it.



#7 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 19 September 2013 - 05:19 PM

To separate the Vin from the Netduino's Vin, you could snip off the pin on the underside of the Ardumoto shield.

That will save you some jumper wires.

 

I could still edit the Wiki page - so I did :P

It may be that you can't edit the Wiki yet - Is that true Chris/Stefan??

 

Paul



#8 wofene

wofene

    New Member

  • Members
  • Pip
  • 1 posts

Posted 24 September 2013 - 06:48 AM

@Frode 

 

I use the shield with a Fez Cerbuino Bee. I had to change PWM Channels to other pins of the Cerbuino.

 

I use the 

 

http://netmftoolbox....ardware.HBridge

 

Library. It works.

 

Sometimes i had a strange behaviour, when the voltage drops below 6V. I seperate the VIN from Cerbuino and the Ardumoto shield. Now it is better.

 

I use a very old version of Ardumoto Shield. The version has the PWM channel on Pin 10 and 11 and direction on Pin 12 and 13.



#9 Frode

Frode

    Advanced Member

  • Members
  • PipPipPip
  • 202 posts
  • LocationNorway

Posted 01 October 2013 - 05:13 PM

I clipped off both the 3.3v and 5v pins from the Ardumoto shield, seems to do the trick. When I write the program to the Netduino I only power the Netduino with USB. Afterwards I disconnect the USB, and then power the Ardumoto with 9V. That gives enough juice to drive the two DC motors, and also powers up the Netduino. (I thought that clipping the 3.3v and 5v would require me to supply separate power to the Netduino, but for some reason it just works..)

 

Here is an example class for the Ardumoto shield. I wrote it for a tank I put the Netduino+Ardumoto on, so that's why it uses Forward, TurnLeft, etc.

 

I'm just putting it up here for future reference for anyone else interrested.

public class ArduMotoDriverShield    {        PWM motorA = new PWM(Pins.GPIO_PIN_D3);        PWM motorB = new PWM(Pins.GPIO_PIN_D11);        OutputPort directionA = new OutputPort(Pins.GPIO_PIN_D12, false);        OutputPort directionB = new OutputPort(Pins.GPIO_PIN_D13, false);        /// <summary>        /// Period defines how many milliseconds in each PWM cycle.        /// </summary>        public uint Period { get; set; }        /// <summary>        /// Duration defines how long in each Period the signal is High.        /// Should be less than, or equal to Period. In milliseconds.        /// </summary>        public uint Duration { get; set; }        public ArduMotoDriverShield()        {            //Default values            this.Period = 40;            this.Duration = 30;        }        public void Forward()        {            directionA.Write(true);            directionB.Write(true);            motorA.SetPulse(Period * 1000, Duration * 1000);            motorB.SetPulse(Period * 1000, Duration * 1000);        }        public void TurnLeft()        {            directionA.Write(true);            directionB.Write(false);            motorA.SetPulse(Period * 1000, Duration * 1000);            motorB.SetPulse(Period * 1000, Duration * 1000);        }        public void Stop()        {            motorA.SetPulse(0, 0);            motorB.SetPulse(0, 0);        }    }





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.