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

Help - Overheating and voltage drop on motor shield


  • Please log in to reply
15 replies to this topic

#1 ATmega-Man

ATmega-Man

    Member

  • Members
  • PipPip
  • 15 posts

Posted 09 February 2012 - 10:31 PM

Hi Guys, this is driving me nuts!!
I have bought an adafruit style motor shield and for some reason it seems to be suffering from a voltage drop and the L293D thats in use overheats.
Im using it with a tamiya tracked chassis and the dual motor gearbox.
The demo code I am using sends both motors through the same L293D (M3 & M4) although there are two available across 4 channels, now I think this is due to the netduinos lack of PWMs.
the code runs but the motors rapidly grind to a halt getting slower and slower, and the temp of the L293D goes through the roof.
Now i recon shifting one of the motors to the other L293D will fix the problem but I'm not sure the Netduino will let that happen due to the PWMs but as my knowledge of it is really slim im hoping im wrong.
Can anyone help me workout why this is happening and if there is an easy solution.

Im using a 6c 11.1v 5200MaH battery

Motor Shield details
Motor Shield schem
Motors (x2)

Heres the code
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace MotorApp
{
    public class Program
    {
        public sealed class MotorShield
        {
            public const Cpu.Pin PWM_0A = Pins.GPIO_PIN_D6; // M4
            public const Cpu.Pin PWM_0B = Pins.GPIO_PIN_D5; // M3

            private static MotorShield _instance = new MotorShield();
            public static MotorShield Instance { get { return _instance; } }

            private OutputPort _motorLatch;
            private OutputPort _motorClock;
            private OutputPort _motorEnable;
            private OutputPort _motorData;

            internal byte LatchState = 0x00;

            private MotorShield()
            {
                _motorLatch = new OutputPort(Pins.GPIO_PIN_D12, false);
                _motorClock = new OutputPort(Pins.GPIO_PIN_D4, false);
                _motorEnable = new OutputPort(Pins.GPIO_PIN_D7, false);
                _motorData = new OutputPort(Pins.GPIO_PIN_D8, false);
            }

            internal void LatchTx()
            {
                //LATCH_PORT &= ~_BV(LATCH);
                _motorLatch.Write(false);

                //SER_PORT &= ~_BV(SER);
                _motorData.Write(false);

                for (int i = 0; i < 8; i++)
                {
                    //CLK_PORT &= ~_BV(CLK);
                    _motorClock.Write(false);

                    int mask = (1 << (7 - i));
                    if ((LatchState & mask) != 0)
                    {
                        //SER_PORT |= _BV(SER);
                        _motorData.Write(true);
                    }
                    else
                    {
                        //SER_PORT &= ~_BV(SER);
                        _motorData.Write(false);
                    }
                    //CLK_PORT |= _BV(CLK);
                    _motorClock.Write(true);
                }
                //LATCH_PORT |= _BV(LATCH);
                _motorLatch.Write(true);
            }
        }

        public sealed class DcMotor
        {
            private PWM _pwm;
            private byte _motorBitA, _motorBitB;

            public DcMotor(MotorHeaders header)
            {
                switch (header)
                {
                    case MotorHeaders.M3:
                        _motorBitA = (int)MotorBits.Motor3_A;
                        _motorBitB = (int)MotorBits.Motor3_B;
                        _pwm = new PWM(MotorShield.PWM_0B);
                        break;
                    case MotorHeaders.M4:
                        _motorBitA = (int)MotorBits.Motor4_A;
                        _motorBitB = (int)MotorBits.Motor4_B;
                        _pwm = new PWM(MotorShield.PWM_0A);
                        break;
                    default:
                        throw new InvalidOperationException("Invalid motor header specified.");
                }

                MotorShield.Instance.LatchState &= (byte)(~(1 << _motorBitA) & ~(1 << _motorBitB));
                MotorShield.Instance.LatchTx();

                _pwm.SetPulse(100, 0);
            }

            public void Run(MotorDirection dir)
            {
                switch (dir)
                {
                    case MotorDirection.Release:
                        MotorShield.Instance.LatchState &= (byte)(~(1 << _motorBitA));
                        MotorShield.Instance.LatchState &= (byte)(~(1 << _motorBitB));
                        break;
                    case MotorDirection.Forward:
                        MotorShield.Instance.LatchState |= (byte)(1 << _motorBitA);
                        MotorShield.Instance.LatchState &= (byte)(~(1 << _motorBitB));
                        break;
                    case MotorDirection.Reverse:
                        MotorShield.Instance.LatchState &= (byte)(~(1 << _motorBitA));
                        MotorShield.Instance.LatchState |= (byte)(1 << _motorBitB);
                        break;
                    default:
                        throw new InvalidOperationException("Invalid motor direction specified");
                }

                MotorShield.Instance.LatchTx();
            }

            public void SetSpeed(uint speed)
            {
                if (speed > 100)
                {
                    speed = 100;
                }

                _pwm.SetDutyCycle(speed);
            }
        }

        public enum MotorBits
        {
            Motor4_A = 0,
            Motor4_B = 6,
            Motor3_A = 5,
            Motor3_B = 7
        }

        public enum MotorDirection
        {
            Release, Forward, Reverse
        }

        public enum MotorHeaders
        {
            M3, M4
        }
        public static void Main()
        {
            DcMotor leftWheel = new DcMotor(MotorHeaders.M4);
            DcMotor rightWheel = new DcMotor(MotorHeaders.M3);

            leftWheel.SetSpeed(0);
            rightWheel.SetSpeed(0);

            leftWheel.Run(MotorDirection.Forward);
            rightWheel.Run(MotorDirection.Forward);

            leftWheel.SetSpeed(90);
            rightWheel.SetSpeed(90);

            while (true)
            {
                leftWheel.Run(MotorDirection.Reverse);
                rightWheel.Run(MotorDirection.Forward);

                Thread.Sleep(1000);

                leftWheel.Run(MotorDirection.Forward);
                rightWheel.Run(MotorDirection.Reverse);

                Thread.Sleep(1000);
            }
        }
    }
}

eternally greatful!!

#2 Stefan

Stefan

    Moderator

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

Posted 10 February 2012 - 08:58 AM

Hi ATmega-Man, From the specs of your shield: "0.6A per bridge (1.2A peak)" From the specs of your motor: "Stall current at 3 V: about 2.10 A" You could be pulling too much current. Also: You're using a 11.1v 5200MaH battery? The motor specs mention: "Operating voltage: 1.5-3 V" So you're giving it way too much power!
"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 ATmega-Man

ATmega-Man

    Member

  • Members
  • PipPip
  • 15 posts

Posted 10 February 2012 - 09:33 AM

Hi Stefan, how are you? What sort of power supply would you suggest? I can run it off the USB with the Netduino but I get the same result its just slower

#4 Stefan

Stefan

    Moderator

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

Posted 10 February 2012 - 09:35 AM

The demo code I am using sends both motors through the same L293D (M3 & M4) although there are two available across 4 channels, now I think this is due to the netduinos lack of PWMs.

It's true the Netduino has only 4 PWM-ports, where Arduino has 6.

From the schematics of the shield:

GPIO D3 = PWM2B (not a PWM-pin on Netduino!)
GPIO D5 = PWM0B (works with Netduino)
GPIO D6 = PWM0A (works with Netduino)
GPIO D9 = PWM1A (works with Netduino)
GPIO D10 = PWM1B (works with Netduino)
GPIO D11 = PWM2A (not a PWM-pin on Netduino!)

[/color]

IC1 (L293D): PWM2A, PWM2B (doesn't work with Netduino!)
IC2 (L293D): PWM0A, PWM0B (works with Netduino)
SER1: PWM1B (works with Netduino)
SERVO2: PWM1A (works with Netduino)


With the Go-Between Shield you could re-route those PWMs if you like.
"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 Stefan

Stefan

    Moderator

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

Posted 10 February 2012 - 09:38 AM

Hi Stefan, how are you?
What sort of power supply would you suggest? I can run it off the USB with the Netduino but I get the same result its just slower

How did you connect the motors at this moment?

I would suggest different motors. I myself used these on a 12V battery: http://www.pololu.co...og/product/2208
Because those motors don't live long on >9V, I decided not to set dutycycle higher as 75, so I wouldn't exceed 9V.


Ps. I've ordered the same shield recently, hopefully I'll get it soon. Perhaps I could help you out better if I have one as well ;)
"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 ATmega-Man

ATmega-Man

    Member

  • Members
  • PipPip
  • 15 posts

Posted 10 February 2012 - 10:34 AM

It's true the Netduino has only 4 PWM-ports, where Arduino has 6.

From the schematics of the shield:


With the Go-Between Shield you could re-route those PWMs if you like.


mmm, would it be worth breadboarding it to test?

#7 ATmega-Man

ATmega-Man

    Member

  • Members
  • PipPip
  • 15 posts

Posted 10 February 2012 - 10:36 AM

How did you connect the motors at this moment?

I would suggest different motors. I myself used these on a 12V battery: http://www.pololu.co...og/product/2208
Because those motors don't live long on >9V, I decided not to set dutycycle higher as 75, so I wouldn't exceed 9V.


Ps. I've ordered the same shield recently, hopefully I'll get it soon. Perhaps I could help you out better if I have one as well ;)


It has a jumper to allow either Neduino powered or external powered, so I just take the external off and set the jumper

#8 Stefan

Stefan

    Moderator

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

Posted 10 February 2012 - 10:48 AM

It has a jumper to allow either Neduino powered or external powered, so I just take the external off and set the jumper

With the jumper on 'Netduino Powered', will it take power from the Vin pin or 3V3/5V pin? I wouldn't use the last ones, they can only take up to a limited amount of mA's.
"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 ATmega-Man

ATmega-Man

    Member

  • Members
  • PipPip
  • 15 posts

Posted 10 February 2012 - 10:59 AM

I can dismantle the battery im using down to lower V's and A's as its just a laptop battery I pulled out of its casing and taped up. what sort of levels would you suggest? its a 6 cell

#10 Stefan

Stefan

    Moderator

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

Posted 10 February 2012 - 11:59 AM

I can dismantle the battery im using down to lower V's and A's as its just a laptop battery I pulled out of its casing and taped up. what sort of levels would you suggest? its a 6 cell

I wouldn't do that. You could also use voltage deviders without breaking stuff.

I'm concerned about the motors, since they seem to pull too much current anyway (2.10A is a lot!)
The L293D just can't handle that.
"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 ATmega-Man

ATmega-Man

    Member

  • Members
  • PipPip
  • 15 posts

Posted 10 February 2012 - 12:53 PM

ripping the battery appart isnt a massive issue as its just a string of NiMh cells bundled up and taped, as for the current drain I really dont know what to do. if I run the same code but disconnect one of the motors it runs fine. would it be worth lowering the speed in the code to see if it runs at half pace?

#12 Stefan

Stefan

    Moderator

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

Posted 10 February 2012 - 01:08 PM

would it be worth lowering the speed in the code to see if it runs at half pace?

Sounds like a plan, as I mentioned before, I did that too.

You could also get motors that match more the rest of the equipment in specifications (the H-bridge chip and the battery)
"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

#13 ATmega-Man

ATmega-Man

    Member

  • Members
  • PipPip
  • 15 posts

Posted 10 February 2012 - 01:22 PM

Sounds like a plan, as I mentioned before, I did that too.

You could also get motors that match more the rest of the equipment in specifications (the H-bridge chip and the battery)

the only issue with that is getting one that fits the tamiya dual gearbox as thats whats driving the chassis.

I'm also gonna bite the bullet and set this up on the Arduino and see if the issue persists. that way i'll know if its power/shield related and it will be easier to check if running one motor per H Bridge is any better

#14 Arron Chapman

Arron Chapman

    Advanced Member

  • Members
  • PipPipPip
  • 289 posts
  • LocationOregon, USA

Posted 10 February 2012 - 10:15 PM

I've used the Motor Shield from Adafruit quite a bit and I havn't had this problem yet (even when providing quite a bit more current than I should), you might want to make sure that you havn't got any shorts. I also ported a driver for it to the Netduino.

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!!

 


#15 ATmega-Man

ATmega-Man

    Member

  • Members
  • PipPip
  • 15 posts

Posted 11 February 2012 - 10:40 AM

Hi Stefan, Just a quick update on my diag process. I ran the code at half speed - same problem Built and ran the code on my arduino mega - same problem Arduino mega at half speed - same problem Arduino configured to use seperate H Bridges - same problem Alternate motors - same problem Now i dont know the draw on other motors as they are inside a broken toy car of my sons but it ran on 4x 1.5v AA batteries in usual situe. So it cant be that much ampage, im guessing theyre 1.5v considering the other functions required from the 6v. I'm going to dismantle the battery today and see if running it on 3c 6v instead of 6c 12v is the solution. And i may try 2c if it improves slightly. If that doesnt work then i can only asume i have a dud board. Unless you can think of any other ideas?

#16 ATmega-Man

ATmega-Man

    Member

  • Members
  • PipPip
  • 15 posts

Posted 13 February 2012 - 08:18 PM

I had a minor fail with the battery and I've managed to blow the motor controller, I'll get another one and try again. In the mean time I have some ultrasonic distance sensors to play with.




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.