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 Shield rev3 driver / library


  • Please log in to reply
12 replies to this topic

#1 tomassch

tomassch

    New Member

  • Members
  • Pip
  • 6 posts

Posted 20 August 2012 - 06:07 PM

Hi Guys, First off, I'm a complete newbie to Netduino :D. Working with the .NET framework for several years now, so I bought a Netduino Go! including a Arduino Motor Shield rev3 in order to do a little experimenting with home automation. Unboxed it yesterday and got to work on driving my stepper motor. I was surprised to find the pins of the Arduino shield fit on the Go's shieldbase, so I decided that was probably what the shield base was for and plugged them together! ;) I got the thing working (including >somewhat< controlled rotation of the stepper motor, jeej) but both the Motor Shield and the steppermotor get very hot. Now, I'm not really into electric engineering, but seeing the external power supply supplies 2Amp to the Motor Shield, I'm guessing it's rather normal for it to get hot. I'm a little worried though about my stepper motor getting hot, will this damage it? Actually, I'm wondering if there is a sample driver, library or a tutorial for the Arduino Motor Shield Rev3 in combination with the Netduino (GO). I find it hard to find any sample code for the Netduino at all. I love it how easy it is to prototype something with the Netduino! Expected it to be rather easy, but I was really surprised how fast I got stuff up and running, almost instantly being able to play :D. Cheers

#2 Arron Chapman

Arron Chapman

    Advanced Member

  • Members
  • PipPipPip
  • 289 posts
  • LocationOregon, USA

Posted 20 August 2012 - 10:17 PM

Hi Guys,

First off, I'm a complete newbie to Netduino :D. Working with the .NET framework for several years now, so I bought a Netduino Go! including a Arduino Motor Shield rev3 in order to do a little experimenting with home automation.

Unboxed it yesterday and got to work on driving my stepper motor. I was surprised to find the pins of the Arduino shield fit on the Go's shieldbase, so I decided that was probably what the shield base was for and plugged them together! ;)

I got the thing working (including >somewhat< controlled rotation of the stepper motor, jeej) but both the Motor Shield and the steppermotor get very hot. Now, I'm not really into electric engineering, but seeing the external power supply supplies 2Amp to the Motor Shield, I'm guessing it's rather normal for it to get hot. I'm a little worried though about my stepper motor getting hot, will this damage it?

Actually, I'm wondering if there is a sample driver, library or a tutorial for the Arduino Motor Shield Rev3 in combination with the Netduino (GO). I find it hard to find any sample code for the Netduino at all.

I love it how easy it is to prototype something with the Netduino! Expected it to be rather easy, but I was really surprised how fast I got stuff up and running, almost instantly being able to play :D.

Cheers


Welcome to the Netduino community.

From my experience with the Motor Shield, it's not uncommon for it to get rather warm. The Motor driver does have a thermal shutoff, if I recall correctly, so I wouldn't worry about it too much. The more current your motors draw the warmer things will get though. If your concerned about the heat, you can always add a heatsink.

When you talk EE use small words, I'm just a Software Developer :)
My Blog/Site and Everything Else

If my post helped you please consider pressing the "Like This" button in the bottom right-hand corner.

 

Oh my. So many things, so little money!!

 


#3 tomassch

tomassch

    New Member

  • Members
  • Pip
  • 6 posts

Posted 21 August 2012 - 11:54 AM

Thanks for the reply Arron. Anyone has an answer on the library / driver question? (A) "Actually, I'm wondering if there is a sample driver, library or a tutorial for the Arduino Motor Shield Rev3 in combination with the Netduino (GO). I find it hard to find any sample code for the Netduino at all."

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 21 August 2012 - 12:47 PM

Hi tomassch, To drive a motor, you'll basically just open up an OutputPort for each motor (to control the direction) and a PWM for each motor (to control the speed). By altering the DutyCycle of the motor, you'll change its speed. By using OutputPort.Write(true) or .Write(false), you'll change the motor between forward and backwards rotation direction. Stefan--do you have any samples for using the PWM classes (old or new classes) in your toolbox? Chris

#5 Stefan

Stefan

    Moderator

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

Posted 21 August 2012 - 12:53 PM

Stefan--do you have any samples for using the PWM classes (old or new classes) in your toolbox?

Yes, I have, but nothing for stepper motors. I only have experience with servo motors and regular 'hobby' motors (DC motors)

I've written code for the Adafruit Motorshield, available here:
http://netmftoolbox....ruitMotorshield

It may help understanding the principles of PWM itself.
"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

#6 tomassch

tomassch

    New Member

  • Members
  • Pip
  • 6 posts

Posted 21 August 2012 - 05:57 PM

Yes, I have, but nothing for stepper motors. I only have experience with servo motors and regular 'hobby' motors (DC motors)

I've written code for the Adafruit Motorshield, available here:
http://netmftoolbox....ruitMotorshield

It may help understanding the principles of PWM itself.


Hi,

Thanks for the replies. I am familiar with the concept of PWM (done a little programming / experimenting on some PIC microcontrollers and have a degree in computer science).. Although development for the PIC was a pain [both in terms of software and soldering the hardware], I managed to learn some electrical engineering and more hardware level concepts.

Again, I love the speed at which one can just start prototyping!

#7 Igor Kondrasovas

Igor Kondrasovas

    Advanced Member

  • Members
  • PipPipPip
  • 105 posts
  • LocationPorto, Portugal

Posted 28 August 2012 - 11:12 PM

Yes, I have, but nothing for stepper motors. I only have experience with servo motors and regular 'hobby' motors (DC motors)

I've written code for the Adafruit Motorshield, available here:
http://netmftoolbox....ruitMotorshield

It may help understanding the principles of PWM itself.



Hello Stefan,

Do you think that Netduino 3.3V logic level can cause any problems on driving generic Arduino (5V) motor shields based on the L298 bridge? I am not aware of this bridge details, so I am not sure if it takes actually the PWM pulses or the average voltage. In case of second option, we could never be able to run the DC motors at maximum speed, right?

I was having a look at the datasheet, and although I did not find the information there, I believe this bridge uses the LOGIC SUPPLY VOLTAGE VSS input voltage to compare with the average voltage generated by the PWM. However, the minimum value accepted is 4.5V..

What do you think?

Igor.

Igor Kondrasovas

www.inovativatec.com


#8 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 29 August 2012 - 03:15 AM

Hi Igor,

Do you think that Netduino 3.3V logic level can cause any problems on driving generic Arduino (5V) motor shields based on the L298 bridge?

If you're using the Arduino "REV3" motor shield, you should be good. It has an IOREF pin which reads the 3V3 voltage from the mainboard...and should adjust accordingly as needed.

Chris

#9 Igor Kondrasovas

Igor Kondrasovas

    Advanced Member

  • Members
  • PipPipPip
  • 105 posts
  • LocationPorto, Portugal

Posted 29 August 2012 - 04:24 PM

Hi Chris,

Hi Igor,


If you're using the Arduino "REV3" motor shield, you should be good. It has an IOREF pin which reads the 3V3 voltage from the mainboard...and should adjust accordingly as needed.

Chris


I think you mean Adafruit's motor shield, right? Do you have a quick tip on how to make sure it is REV3? I am looking at Adafruit website and not revision is specified nor if there is any IOREF pin.


Thanks,

Igor.

Igor Kondrasovas

www.inovativatec.com


#10 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 29 August 2012 - 04:45 PM

Hi Igor,

I think you mean Adafruit's motor shield, right? Do you have a quick tip on how to make sure it is REV3? I am looking at Adafruit website and not revision is specified nor if there is any IOREF pin.

Here you go:
http://arduino.cc/en...noMotorShieldR3

Chris

#11 Igor Kondrasovas

Igor Kondrasovas

    Advanced Member

  • Members
  • PipPipPip
  • 105 posts
  • LocationPorto, Portugal

Posted 29 August 2012 - 05:38 PM

Hi Igor,


Here you go:
http://arduino.cc/en...noMotorShieldR3

Chris


Hi Chris,

Thank you for the reply. On the page you mentioned, PWMA (motor a) and PWMB (motor B) pins are D3 and D11 respectively. These pins are not PWM outputs on Netduino. Is that OK if my application (on Netduino):

1 - Set pin3 and pin11 as digital inputs;

2 - Use pin5 and pin10 as PWM outputs;

3 - connect pin5 to pin3 and pin10 to pin11;

I think someone else should have a better option...

I know .NET Micro Framework Toolbox has support for Adafruit, DFRobot motor shields, but I guess they assume you have are using a 5V TTL logic board, right?


Thanks,

Igor

Igor Kondrasovas

www.inovativatec.com


#12 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 29 August 2012 - 06:14 PM

Hi Igor,

Thank you for the reply. On the page you mentioned, PWMA (motor a) and PWMB (motor B) pins are D3 and D11 respectively. These pins are not PWM outputs on Netduino.

So sorry, this thread is in the Netduino Go forum so I assumed that you were using a Shield Base.

These pins are not PWM outputs on Netduino. Is that OK if my application (on Netduino):

1 - Set pin3 and pin11 as digital inputs;

2 - Use pin5 and pin10 as PWM outputs;

3 - connect pin5 to pin3 and pin10 to pin11;

Yes, that should work. You can also bend the pins (on the bottom of the shield) for pin3/pin11 instead of using them as digital inputs; you'll need to connect the pwm pins as mentioned...

I know .NET Micro Framework Toolbox has support for Adafruit, DFRobot motor shields, but I guess they assume you have are using a 5V TTL logic board, right?

We have used the DFRobot and Adafruit shields without any noticeable issues.

Chris

#13 Igor Kondrasovas

Igor Kondrasovas

    Advanced Member

  • Members
  • PipPipPip
  • 105 posts
  • LocationPorto, Portugal

Posted 29 August 2012 - 06:26 PM

Hi Igor,


So sorry, this thread is in the Netduino Go forum so I assumed that you were using a Shield Base.


Yes, that should work. You can also bend the pins (on the bottom of the shield) for pin3/pin11 instead of using them as digital inputs; you'll need to connect the pwm pins as mentioned...


We have used the DFRobot and Adafruit shields without any noticeable issues.

Chris


Hi Chris,

My bad posting on the wrong forum.

I think now I got the trick: PWM control to these boards (including the Motor Shield Rev3 and potentially the other ones) are performed on the "enable" pins of L298 chip, so the chip is enabled/disabled accordingly to the PWM duty cycle. Datasheet says 2.5V is OK for high level detection.

The other shield configuration is usually performed using onboard jumpers.

I bought some shields and I will test them when they arrive. Then I will post something in Portuguese for Brazilian community.

Thanks,

Igor.

Igor Kondrasovas

www.inovativatec.com





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.