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

SeeedStudio Motorshield


  • Please log in to reply
10 replies to this topic

#1 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 15 September 2012 - 09:24 PM

Has anyone played with the SeeedStudio Motorshield on a Netduino. If so, are there any libraries for it out there? I had no luck finding one via google.

#2 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 18 September 2012 - 12:38 PM

I guess that would be a no?

#3 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 18 September 2012 - 12:50 PM

I don't think it would be a problem interfacing it, it just contains an H-bridge chip like on other motor shields. Pins 9 and 10 are for speed, which are also PWM pins for netduino. I would recommend a generic H-bridge driver.
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#4 RandTheDragon

RandTheDragon

    Member

  • Members
  • PipPip
  • 10 posts
  • LocationCorpus Christi, TX

Posted 18 September 2012 - 02:09 PM

It wasn't too bad setting it up on the go: http://forums.netdui...a-simple-rover/ . There is a beta version of code attached in that post. I've written a class that allows you to create motor objects for each motor port. I can grab that when I get home. If you need help adapting for the regular netduino, let me know.

#5 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 18 September 2012 - 02:59 PM

My local RadioShack has them in stock on the shelf, so I thought I'd pick one up. It's the same price as SeeedStudio website but no shipping. I'll grab the code and run out and get one later to play with. Working on some Halloween props and thought it would be good for animating some props.

#6 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 18 September 2012 - 03:03 PM

It wasn't too bad setting it up on the go: http://forums.netdui...a-simple-rover/ . There is a beta version of code attached in that post. I've written a class that allows you to create motor objects for each motor port. I can grab that when I get home. If you need help adapting for the regular netduino, let me know.


I'm not seeing the code attached. Maybe I am missing something?

#7 RandTheDragon

RandTheDragon

    Member

  • Members
  • PipPip
  • 10 posts
  • LocationCorpus Christi, TX

Posted 18 September 2012 - 08:42 PM

I'm not seeing the code attached. Maybe I am missing something?


No, you're completely right...I know everybody says this...but I really thought I attached it. That's fine, I'll put the new version of the code here and there when I get home(as my home computer decided to go into hibernate and prevent teamviewer). It'll probably be pretty late :(

#8 RandTheDragon

RandTheDragon

    Member

  • Members
  • PipPip
  • 10 posts
  • LocationCorpus Christi, TX

Posted 19 September 2012 - 03:09 AM

Ok, attached is a zip with the motor class, and the program I'm using with it. Hope this helps!

Attached Files



#9 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 19 September 2012 - 03:18 AM

Very Cool! I'll check it out! If I build any good Halloween Props using it I'll be sure to post it.

#10 RMJ

RMJ

    New Member

  • Members
  • Pip
  • 1 posts

Posted 01 November 2013 - 05:44 PM

Ok, attached is a zip with the motor class, and the program I'm using with it. Hope this helps!

 

Thanks RandTheDragon. I got chance to run the DC motors using your code. Its working with no issues. But not able to run the stepper motor. Do you have any code update to run the stepper motor using SEEED motor shield?



#11 MacGuffin

MacGuffin

    New Member

  • Members
  • Pip
  • 1 posts

Posted 29 December 2013 - 07:08 AM

I have a Netduino (series 1), and am trying to convert the above code to run my motor shield. I have made some progress, considering that I know little programming. I think I have it set up to power the motor back and forth when it starts, but it is not powering it very much (barely powers the small motor I got to check if it was working, let alone the large motor I want it to power)

 

Here is what I have:

SeeedMotorShield.cs

using System;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.Netduino;using System.Collections;namespace Seeed.MotorShield{    class Motor    {	    public enum motors { M1, M2, Stepper };	    private static int[] activeMotors=new int[2];   	 public static int[] ActiveMotors   	 {       	 get { return activeMotors;}   	 }	    public /*readonly*/ Microsoft.SPOT.Hardware.PWM SpeedPin /*= new PWM(PWMChannels.PWM_PIN_D9, 20000, 1500, false)*/;	    //Pins.GPIO_PIN_D9, 20000, 1500, Microsoft.SPOT.Hardware.PWM.ScaleFactor.Microseconds, false	   		 public /*readonly*/ OutputPort pinPos; //= new OutputPort(Pins.GPIO_PIN_D8, false);	    public /*readonly*/ OutputPort pinNeg; //= new OutputPort(Pins.GPIO_PIN_D11, false);	   	    		 //public readonly OutputPort pin_step1;	    //public readonly OutputPort pin_step2;	    //public readonly OutputPort pin_step3;	    //public readonly OutputPort pin_step4;	    //public readonly Microsoft.SPOT.Hardware.PWM		  public void spinPositive()	    {		    SpeedPin.Start();		    pinNeg.Write(false);		    pinPos.Write(true);	    }	    public void spinNegative()	    {		    SpeedPin.Start();		    pinPos.Write(false);		    pinNeg.Write(true);	    }	    public void stop()	    {		    SpeedPin.Stop();		    pinPos.Write(false);		    pinNeg.Write(false);	    }    }}

And Program.cs

using System;using System.Threading;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.Netduino;using Seeed.MotorShield;namespace HelloMotor{    public class Program    {	    private static Motor motorA;	    private static bool moveForward = true;	    private static bool motorOn = false;	    public static void Main()	    {		    motorA = new Motor();		    /*InputPort button =				    new InputPort(Pins.ONBOARD_SW1, false, Port.ResistorMode.Disabled);*/		    /*OutputPort */motorA.pinPos = new OutputPort(Pins.GPIO_PIN_D8, false);		    /*OutputPort */motorA.pinNeg = new OutputPort(Pins.GPIO_PIN_D11, false);		    /*public readonly Microsoft.SPOT.Hardware.PWM*/		    motorA.SpeedPin = new PWM(PWMChannels.PWM_PIN_D9, 20000, 5000, Microsoft.SPOT.Hardware.PWM.ScaleFactor.Microseconds, false);		    motorA.SpeedPin.SetDutyCycle(65)		    motorA.spinPositive();		    System.Threading.Thread.Sleep(800);		    motorA.spinNegative();		    System.Threading.Thread.Sleep(200);		    motorA.spinPositive();		    System.Threading.Thread.Sleep(200);		    motorA.spinNegative();		    System.Threading.Thread.Sleep(800);		    motorA.spinPositive();		    System.Threading.Thread.Sleep(200);		    motorA.spinNegative();		    System.Threading.Thread.Sleep(800);		    motorA.stop();		    /*while (true)		    {			   			    				 motorOn = True;			   				 if (motorOn)			    {				    if (moveForward)					    forward();				    else					    backward();			    }			    else			    {				    motorA.stop();			    }			    //ledPort.Write(!ledPort.Read());			    //System.Threading.Thread.Sleep((int)(pot.GetValue()*1000));		    }*/	    }	    private static void forward()	    {		    motorA.spinPositive();		    System.Threading.Thread.Sleep(200);	    }	    private static void backward()	    {		    motorA.spinNegative();		    System.Threading.Thread.Sleep(200);	    }	    private static void onboardButton_OnInterrupt(uint data1, uint data2, DateTime time)	    {		    motorOn = !motorOn;	    }	    private static void button_ButtonReleased(object sender, bool buttonState)	    {		    moveForward = !moveForward;	    }    }}

I am very new to this, and would appreciate any feedback!

.

 

 

Edit: update! I have worked on the code, and I now get a series of blinking lights but the motor is way under powered, can anyone tell why by the code?






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.