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

Motor Shield alimentation


  • Please log in to reply
11 replies to this topic

#1 pxl357

pxl357

    Member

  • Members
  • PipPip
  • 18 posts

Posted 03 September 2011 - 05:27 AM

Hey Guys !

I'm continuing to work on my project and i face a kind of weird little issue.
I can't have my motors running backwards. I'm using the Dfrobot 1A shield and a 9v battery plug directly on the netduino.

I put a basic test :

//FWD            
PWM Motor1Speed = new PWM(Pins.GPIO_PIN_D5);
PWM Motor2Speed = new PWM(Pins.GPIO_PIN_D6);
OutputPort Motor1Direction = new OutputPort(Pins.GPIO_PIN_D9, false);
OutputPort Motor2Direction = new OutputPort(Pins.GPIO_PIN_D10, false);


Motor1Direction.Write(false);
Motor1Speed.SetDutyCycle(100);
Motor2Direction.Write(false);
Motor2Speed.SetDutyCycle(100);


//BWD
PWM Motor1Speed = new PWM(Pins.GPIO_PIN_D5);
PWM Motor2Speed = new PWM(Pins.GPIO_PIN_D6);
OutputPort Motor1Direction = new OutputPort(Pins.GPIO_PIN_D9, false);
OutputPort Motor2Direction = new OutputPort(Pins.GPIO_PIN_D10, false);

Motor1Direction.Write(true);
Motor1Speed.SetDutyCycle(100);
Motor2Direction.Write(true);
Motor2Speed.SetDutyCycle(100);


Both test go forward.

I wonder if it's an alimentation issue or a code issue.

Any ideas or similar experience ?

PXL

Edited by Stefan, 03 September 2011 - 07:51 AM.
Added [code] tags


#2 Stefan

Stefan

    Moderator

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

Posted 03 September 2011 - 07:53 AM

I have the same shield and wrote some code for it, as you can see at the wiki: http://wiki.netduino...tor-Shield.ashx Perhaps that could help?
"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

#3 pxl357

pxl357

    Member

  • Members
  • PipPip
  • 18 posts

Posted 03 September 2011 - 06:21 PM

Hey Stephan ! I used the library and i have the same exact result the motor always go forward. That's why i start to think about an alimentation issue. How do you power the motors ? FOr now i have a 9v battery plug on the netduino

#4 Stefan

Stefan

    Moderator

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

Posted 03 September 2011 - 07:19 PM

Hey Stephan !
I used the library and i have the same exact result the motor always go forward.
That's why i start to think about an alimentation issue. How do you power the motors ? FOr now i have a 9v battery plug on the netduino

Did you place the jumpers correctly (PWM mode)? Also, if you measure the voltage on the output, does it switch from negative to positive? I powered them on a 12V power supply, but any direct current battery should work.
"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

#5 pxl357

pxl357

    Member

  • Members
  • PipPip
  • 18 posts

Posted 04 September 2011 - 05:53 AM

Sorry i suxx a bit at electronic , is the jumper are the blue connector ? It was basically already solder when i get it. So i assume it ok. I wire everything following the shield wiki as well. I will check the voltage tomorrow see what i have !

#6 Stefan

Stefan

    Moderator

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

Posted 04 September 2011 - 08:12 AM

As you can see at the shield's own wiki:
http://www.dfrobot.c...RI0009)#Diagram

Control Mode Selection Jumpers: The shield supports PWM and PLL(Phased Locked Loop) control Modes. The PWM mode uses E1 and E2 to generate PWM signal. The PLL mode uses M1 and M2 to generate phase control signal.

The 4 jumpers should be at the right to let it drive via PWM.
"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

#7 pxl357

pxl357

    Member

  • Members
  • PipPip
  • 18 posts

Posted 04 September 2011 - 07:42 PM

As you can see at the shield's own wiki:
http://www.dfrobot.c...RI0009)#Diagram

The 4 jumpers should be at the right to let it drive via PWM.



Oh ok i used the wrong shield !
I bought this one : http://www.dfrobot.c...d&product_id=59

SHould i buy the l298n ??

#8 Stefan

Stefan

    Moderator

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

Posted 05 September 2011 - 06:09 AM

Oh ok i used the wrong shield !
I bought this one : http://www.dfrobot.c...d&product_id=59

SHould i buy the l298n ??

Ah no, doesn't matter, that one should work the same, but only has PWM as option. I'm curious to your voltage measurement.
"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

#9 pxl357

pxl357

    Member

  • Members
  • PipPip
  • 18 posts

Posted 05 September 2011 - 08:09 PM

ok here the informations :


Battery Display 7,43 volt


Using :

Motor1Direction.Write(false);
Motor1Speed.SetDutyCycle(100);
Motor2Direction.Write(false);
Motor2Speed.SetDutyCycle(100);
m1 Output : -2,65 v
m2 Output : 2,59

Motor1Direction.Write(true);
Motor1Speed.SetDutyCycle(100);
Motor2Direction.Write(true);
Motor2Speed.SetDutyCycle(100);
m1 Output :-2,54 v
m2 Output : 2,51 v

I'm surprise the voltage is sow low. The battery is directly plug to the netduino and not the motor shield.
Any idea? If it's too hard to figure i will order the other motor shield and a better battery !

Thanks for your help

PXl

#10 Stefan

Stefan

    Moderator

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

Posted 05 September 2011 - 09:06 PM

I'm surprise the voltage is sow low. The battery is directly plug to the netduino and not the motor shield.

That is strange indeed. Could you try an AC Adapter? If a battery is getting low on power, well, your project gets low on power as well ;)

One thing I find rather curious. That shield of yours has two links, one in the DFRobot Shop and one on their wiki page. They both mention a different pin layout:

http://www.dfrobot.c...d&product_id=59

Pin 5,6,7,8 are used to drive two DC motor

http://www.dfrobot.c..._(SKU:_DRI0001)

Digital 4: Motor 2 Direction control
Digital 5: Motor 2 PWM control
Digital 6: Motor 1 PWM control
Digital 7: Motor 1 Direction control
*snap*
int IN2 = 4; //Latest version use pin 4 instead of pin 8


Perhaps you're driving the wrong pins...
"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

#11 pxl357

pxl357

    Member

  • Members
  • PipPip
  • 18 posts

Posted 06 September 2011 - 01:44 AM

That is strange indeed. Could you try an AC Adapter? If a battery is getting low on power, well, your project gets low on power as well ;)

One thing I find rather curious. That shield of yours has two links, one in the DFRobot Shop and one on their wiki page. They both mention a different pin layout:

http://www.dfrobot.c...d&product_id=59
http://www.dfrobot.c..._(SKU:_DRI0001)

Perhaps you're driving the wrong pins...



Yep that was the issue ! Now it's working !
Thanks a lot ! I will try to figure out a battery solution to have more volt and a separate alimentation probably !

Pxl

#12 Stefan

Stefan

    Moderator

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

Posted 06 September 2011 - 07:38 AM

Yep that was the issue ! Now it's working !
Thanks a lot ! I will try to figure out a battery solution to have more volt and a separate alimentation probably !

Glad to read it's solved. Appairently you bought from an older stock of the shield. Not that it matters but it's useful to know how to drive it I suppose :)

I am currently revising some of my classes, including the one for DFRobot shields. I'll add a comment about this so others won't experience the same troubles.
"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




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.