Shop OBEX P1 Docs P2 Docs Learn Events
Motor Controllers. An Anoying saga. — Parallax Forums

Motor Controllers. An Anoying saga.

John BoardJohn Board Posts: 371
edited 2012-04-19 23:01 in Propeller 1
G'day,

As most of you are familiar, I have been having some quite distressing troubles with motor drivers. I have bought a nice Li-po batt for the robot, and put some caps (100 uf and 0.015 (I think) uf). No avail. This problem is quite getting to me, I am quite anoyed with this... to the point of taking a hammer to the darned machine. So, I'll recap, if you could help me, I'd be obliged:

Power, no problem, I have a 3.6 AMP 7.4v power source, the power bus light not flickering indicating insufficient power supply. I also have the caps mentioned above in parallel with it.
Comms, no trouble.
Wiring, could be the fault, not sure yet
Motor: Well... how could a motor fail (Rehtorical)

So the actual trouble I have been having is this: The prop starts pulsing the PWM pin of the motor controller. The motor starts turning. Then for some reason the prop stops. The time between PWM'ing the pin and the chip stopping changes. So in other words, the motor starts, then stops, the time between starting and stopping varies.

Please help me before I destroy everything within reach...

-John

[EDIT] This is the web page for this driver: http://www.pololu.com/catalog/product/713
«13

Comments

  • average joeaverage joe Posts: 795
    edited 2012-03-25 01:25
    Code would help. Sounds like the program is stopping for some reason.
  • John BoardJohn Board Posts: 371
    edited 2012-03-25 01:34
    Its not the code. I'll tell you why: I visited a senior lecturer in electronics at my local university (2 hours away). For some reason, the motor drivers worked PEFRECTLY when I was at the uni... when I tried just now (with the same code), it didn't work. So it doesn't follow to reason that it is the code. I would post it up, but I don't currently have it on this computer, I'll see what I can do to put it on here.

    Thanks for your reply,

    John
  • John BoardJohn Board Posts: 371
    edited 2012-03-25 01:53
    Hey,

    Just burned out the my prop board. I had my batt attached, turned on the switch, it released the "blue smoke".

    This robot is... was going to be entered into the regional/state/nationals robot comps... now...

    I guess I could do something at least, I have 3 prop sticks just sitting here at home, but the whole second deck of the robot was custom built for this robot.

    It just came at the wrong moment. I think I must have shorted the wiring, not a good thing with a 7.4v 3.6 amp battery. I just don't know what I did...

    Thanks for your help, I'll try keep you posted.

    -John
  • average joeaverage joe Posts: 795
    edited 2012-03-25 03:09
    I've read a few of your posts but don't recall enough to help. A current schematic, photos, would all be helpful in diagnosing the problem.
  • max72max72 Posts: 1,155
    edited 2012-03-25 07:23
    Sorry for your loss. I'm a magic smoke expert, so I undestand your feelings.
    With motors voltage spikes around the circuit are the main issue.
    The simplest way to fix it is to have two battery packs, one for the motor and servo part and one for the "picky" electronics. This second battery can be very small, with common ground.
    You have two independent power supply circuits, and a shared ground. This way signals are consistent but the propeller is working with a steady voltage.
    100uF is too small in my opinion...
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2012-03-25 08:22
    Why was this posted in the Propeller Forum?
  • John BoardJohn Board Posts: 371
    edited 2012-03-25 14:02
    max72 wrote: »
    Sorry for your loss. I'm a magic smoke expert, so I undestand your feelings.
    With motors voltage spikes around the circuit are the main issue.
    The simplest way to fix it is to have two battery packs, one for the motor and servo part and one for the "picky" electronics. This second battery can be very small, with common ground.
    You have two independent power supply circuits, and a shared ground. This way signals are consistent but the propeller is working with a steady voltage.
    100uF is too small in my opinion...

    Sorry, it was 1000 uf, 'twas just a typo.

    @Allen: The problem is the propeller chip restarting for some reason. That is why the motors stop, is because for some unknown reason the prop restarts.

    Good news! Only the switch/terminal block of my Gadget Gangster burned out, I bi-passed it by plugging my power into the "VIN" and "GND" breadboard connections. In this case, I can continue using my Gadget Gangster! Ohh... :/ I pulled out all my circutry in the process of testing the board... That was a good 2 day's work.. Ohh well, atleast I have a chip to go on with ;)

    -John
  • John BoardJohn Board Posts: 371
    edited 2012-03-25 14:04
    I've read a few of your posts but don't recall enough to help. A current schematic, photos, would all be helpful in diagnosing the problem.

    Will see what I can do ASAP.
  • RaymanRayman Posts: 14,839
    edited 2012-03-25 16:15
    My Merlin plug-in board for Quickstart has a similar dual motor driver as you are using...

    For larger motors, I've found I had to add a big capacitor to the input to the Prop's 3.3V regulator to keep it from resetting...

    It's when the motor first starts moving that causes the trouble. It draws a lot of current then. I wouldn't be too sure it's not dropping the battery voltage.

    If you still have trouble, I'd recommend using a second battery pack to power the Prop and use that battery just for the motors.
  • John BoardJohn Board Posts: 371
    edited 2012-03-25 16:35
    Rayman wrote: »
    My Merlin plug-in board for Quickstart has a similar dual motor driver as you are using...

    For larger motors, I've found I had to add a big capacitor to the input to the Prop's 3.3V regulator to keep it from resetting...

    It's when the motor first starts moving that causes the trouble. It draws a lot of current then. I wouldn't be too sure it's not dropping the battery voltage.

    If you still have trouble, I'd recommend using a second battery pack to power the Prop and use that battery just for the motors.

    As I said, I have a 1000uf cap in parallel with the battery. I have also tried a second battery pack before, no avail, will try again though.

    -John
  • RaymanRayman Posts: 14,839
    edited 2012-03-25 16:41
    For Merlin, an extra capacitor across the battery doesn help enough. Neither does a capacitor on the 3.3 V supply.
    But, an extra capacitor on the input to the 3.3V regulator fixes it for me.
    Note that I have a Schottky diode between the battery and the 3.3 V regulator input to Quickstart.
    That way, even if the battery does get pulled down, power won't get sucked backwards...

    But, if you're having trouble, the way to be sure is to use a second power source for the Prop...
  • John BoardJohn Board Posts: 371
    edited 2012-03-25 16:46
    Rayman wrote: »
    For Merlin, an extra capacitor across the battery doesn help enough. Neither does a capacitor on the 3.3 V supply.
    But, an extra capacitor on the input to the 3.3V regulator fixes it for me.
    Note that I have a Schottky diode between the battery and the 3.3 V regulator input to Quickstart.
    That way, even if the battery does get pulled down, power won't get sucked backwards...

    But, if you're having trouble, the way to be sure is to use a second power source for the Prop...

    Not sure if I quite get it, I can't modify the input to the voltage regulator. I'm using the Gadget Gangster Prop platform board (usb).
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2012-03-25 16:55
    When I was developing my H-Bridge, last year or so, I used resistors and lamps for the load.
    I didn't bring a motor into the mix till I was satisfied with those results.

    http://incredulist.blogspot.com/p/h-bridge.html

    >>> Focus On Fundamentals <<<
  • RaymanRayman Posts: 14,839
    edited 2012-03-25 17:10
    John, Basically, connect your main battery pack only to your motor driver board.

    At this point, I'd recommend you use a second battery to power the Prop Platform.
    Later, maybe you might want to try using a diode to allow you to use the same battery for both...


    BTW: 3.6 A might sound like a lot. But, motors start out as basically short circuit loads.
    And, these motor drivers only have internal resistance of about 1 Ohm.
    So, if you drive 2 of them from a dead start, you can easy draw more than that current rating...
  • John BoardJohn Board Posts: 371
    edited 2012-03-25 17:47
    Okay, well, I have got the motor driver turning the wheel and the chip not restarting. Now for the next issue on the agenda. The motor driver is pumping out 8.x volts, I need it down to about 3, how do I change the voltage, i.e., what component, resistor? I'm really new to this stuff.

    -John
  • RaymanRayman Posts: 14,839
    edited 2012-03-25 18:18
    Ok, do you mean 8 Volts or 8 Amps... What voltage are your motors rated for? You probably want a battery voltage less than that...

    If they are drawing too much current, use PWM to control the current draw...
  • Mark_TMark_T Posts: 1,981
    edited 2012-03-25 18:29
    Power, no problem, I have a 3.6 AMP 7.4v power source

    3.6A or 3.6Ah ?
  • average joeaverage joe Posts: 795
    edited 2012-03-25 18:42
    John, to get voltage down to about 3 volts from 8 volts, we need a resistor. To figure for that resistor
    (Vin - MotorVoltage) / i

    So we need to know the current draw for the motor or i. Plug that into the equation and that will give you the resistor you need.
    EG. 8 volt supply, 3 volt motor, 200ma.

    (8 - 3) = 5 / 0.2 = 25 ohms ? *I think*
  • T ChapT Chap Posts: 4,223
    edited 2012-03-26 00:14
    John

    Not to try to give you a hard time, but as some friendly advice. This is about the 5th time you have stated that you have gotten the motor working, then you are posting that there are problems shortly afterwards. People have offered a good deal of good advice over several different threads regarding this particular issue, and still you have yet to provide a real schematic so that the forum can actually see what you are doing. It is a good thing to be enthusiastic about a project, but when you enlist the forum to help solve problems, then it is a good idea to provide the forum with the basic info. In an earlier thread regarding the motor issue, your code was not in fact PWM but was just a pin toggling on and off at different wait times, that is not PWM, and could very well be a problem for the driver. I mentioned that is was not PWM you were sending, and do not recall that you addressed it. In this thread, you were asked to post code, to which you have stated that code is not the issue. So the forum continues to guess at the problem blindly. PJ stated, fundamentals come first. The competition may be a good motivating factor to push you along, but controlling motors requires a lot of work to understand a number of electronic basics as well as software basics, and you are trying to tackle too much at once it looks like. Regarding the driver voltage output, does the datasheet for that driver state that the voltage is adjustable? Does the datasheet state that the motor driver can operate between a range of voltages that you provide via the battery or power supply? That info would be best handled by contacting the driver manufacturer or a forum related to that driver. Not the Propeller forum. Using waitcnt as you were at some point earlier, you are not providing PWM, but rather bursts of full on and full off. A full on from a dead stop is a serious load on a battery or power supply, almost a dead short as mentioned earlier. True PMW could be ramped from a dead stop to the max speed you want to run the motor at, so that the shock is not so radical, just ramp from 0 duty to MAXSPEED duty with a little loop.
       MAXSPEED := 50   '   set to whatever is your maximum speed desired which is between duty 0 - 100
       x := 0    'clear 
       repeat until x == MAXSPEED    'ramp the PWM from dead stop to maximum speed
          x := x + 1     <#   MAXSPEED
          pwm.duty := x
          waitcnt(100_000 +cnt)        '   use this line if desired to slow down the ramp, adjust wait time if desired, this value is just an example
    


    This code example will start out the motor at it's slowest possible speed and accelerate it to the highest speed you want. The ramp up reduces the initial power supply hit.
  • John BoardJohn Board Posts: 371
    edited 2012-03-26 00:41
    Okay, sorry T Chap, my bad :/

    I have just recently been working on a server in france... now I know what it means to "work blind".
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2012-03-26 05:51
    John Board wrote: »
    "...I live in the middle of outback Australia.
    "Thanks for your offer, but remember, I live in Australia. Also my parents don't like the idea and they've told me not to accept presents from "strangers" :/
    "I have just recently been working on a server in france..."

    Curious.
  • Wa_MoWa_Mo Posts: 17
    edited 2012-03-26 10:00
    Curious indeed. :blank:

    However, what puzzles me is that so many people have given advice to a situation where there is no concrete information given. In a case like that, what it comes down to, is essentially mindreading. I am sure, John wants this problem out of his hair, but without something tangible, like the code and the schematic, all of this is basically like throwing a dart at a barndoor.
  • John BoardJohn Board Posts: 371
    edited 2012-03-26 17:19
    PJ Allen wrote: »
    Curious.

    Heh, sorry, didn't explain enough, here is the "revised edition":

    Sorry, my bad, I now know what it means to "work blind", I have been working on a VPS server in france latley, I only had access to it using SSH and FTP.

    Hope that cleared it up, I am really new to this sorta stuff, and I don't really know how to make a schematic, like, do I take a picture of what I have done, or do I draw one, or what?

    Sorry for everything again,

    John
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2012-03-26 18:23
    Begin at the beginning, start over.
    T_Chap has given you a solid lead.
    That looks like a fair lot.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-03-26 18:52
    John, I'm here in Brisbane so where abouts are you located? You seem to NEED help quote "Please help me before I destroy everything within reach..." but frankly speaking you are just babbling and injecting redundant information (server in France for instance, IT support I gather). Take the time (which wouldn't take more than 15 minutes surely) to present the information that you have as if you were communicating over the Internet with the University. They can't see what hardware or software you have and neither can we. Use all of your genius if you have to to convey this information then acknowledge and interact with the responders who are biting at the bit to help.
    Hint: Post your code and any drawings you might have done in putting the project together and include a photo or two as this also speaks volumes.
  • John BoardJohn Board Posts: 371
    edited 2012-03-27 17:50
    Alright, sorry about everything. This is (hopefully) all the information you could want:

    Schematic:

    MotorDriver Schematic.jpg


    I hope that you can understand my schematic. Note, none of the wires that cross over are connected.

    Sorry, I can't currently take a picture of my board, will try and post one in a little while
    CON
    
    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
    
      OnTime = 50
      OffTime = 10
    
    
    OBJ
    
    
      Serial: "FullDuplexSerial"
    
    
    PUB Main
    
    
      Serial.start(31,30,0,9600)      'Initalizes serial comms with computer @ 9600 baud
      
      Serial.str(string("Program has started")) 'Self explanitory
    
    
      DIRA[16..19]~~                  'Sets PWMA to STBY to outputs
      OUTA[16..19] := 01          'PWMA: 0, AIN2: 1, AIN1: 0, STBY: 1
    
    
      repeat
        OUTA[16]~~                    'Turn motor on
        waitcnt(clkfreq/OnTime+cnt)   'Wait
        OUTA[16]~                     'Turn motor off
        waitcnt(clkfreq/OffTime+cnt)  'Wait
    

    Manufacturer's Page: http://www.pololu.com/catalog/product/713

    At the moment, everything seems to be operating as per normal. Note, I forgot to add in the schematic that the battery is 7.4v @ 3.6 AH. I am wanting to add in a 1M resistor inline with the motor as the driver is pumping out 8V when it should be only 3V. I have tested with a multimeter and a variable resistor, and a 1M resistor is the closest match to what I need (that I currently have).

    What I am wanting to achieve now is to get proper PWM, as someone (slips my mind who) noted that I wasn't using proper PWM, could anyone give me a few pointers on how to get proper PWM?

    Thanks again, and any suggestions would be appreciated,

    John

    P.S. I've learnt my lesson now, in future I'll post the schematic along with the code and a picture ;)
    1024 x 752 - 61K
  • John BoardJohn Board Posts: 371
    edited 2012-03-27 17:52
    The "code" section is being stupid, on the line that has this:

    OUTA[16..19] := %xx

    It is supposed to be:

    OUTA[16..19] := %0101
  • John BoardJohn Board Posts: 371
    edited 2012-03-27 17:59
    John, I'm here in Brisbane so where abouts are you located? You seem to NEED help quote "Please help me before I destroy everything within reach..." but frankly speaking you are just babbling and injecting redundant information (server in France for instance, IT support I gather). Take the time (which wouldn't take more than 15 minutes surely) to present the information that you have as if you were communicating over the Internet with the University. They can't see what hardware or software you have and neither can we. Use all of your genius if you have to to convey this information then acknowledge and interact with the responders who are biting at the bit to help.
    Hint: Post your code and any drawings you might have done in putting the project together and include a photo or two as this also speaks volumes.

    I am currently located at Baralaba, Central Queensland, about 6-8 hours from Brisbane, and 170km South West of Rockhampton (2 hours) , and about 2-3 hours from Emerald.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-03-27 18:13
    Hi John, well that's a little better now. There seems to be an error in the schematic as you have the capacitor in series with the battery supply but I know what you mean. Have you used one of the PWM objects in the OBEX? I don't know what you mean by a 1M resistor though because at 8V you will only have 8ua which isn't even enough to make an LED glow. Probably the 8V you are seeing is just your meter reacting to the pulsing and the inductance and back emf etc??? The motor controller will do what you ask so there is never a need to use a resistor, it's absolutely the wrong thing to do. PWM will pulse to the maximum voltage and back to zero so you are depending upon the duty cycle to provide the "average" voltage assuming you run this in the right frequency range to suit the load. Too low a frequency will result in vibration or too high will prove ineffective due to the motor's inductance etc. A really low frequency pulsing will do just that, run the motor hard for the on time, and cut the power for the off time, so you see the frequency is important too.

    Baralaba's a bit far but still what we would call "in the country" rather than "outback" :)

    BTW, just to answer your original problem - If your frequency is too low then the motor will draw a lot of current at the ON voltage which will be close to the battery voltage. It sounds like you were saying indirectly that the motor is a 3V motor so you will find that the battery will probably not be able to supply the current and so the battery voltage droops. Increasing the "PWM" frequency will alleviate this problem. You probably need to isolate the logic supply from the motor load by using a diode fed into a capacitor which will hold enough charge to supply the controller when the battery voltage droops (any diode plus a 470uf or more capacitor perhaps).
Sign In or Register to comment.