PDA

View Full Version : Motor Controllers. An Anoying saga.



John Board
03-25-2012, 09:16 AM
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

average joe
03-25-2012, 09:25 AM
Code would help. Sounds like the program is stopping for some reason.

John Board
03-25-2012, 09:34 AM
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 Board
03-25-2012, 09:53 AM
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 joe
03-25-2012, 11:09 AM
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.

max72
03-25-2012, 03:23 PM
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...

PJ Allen
03-25-2012, 04:22 PM
Why was this posted in the Propeller Forum?

John Board
03-25-2012, 10:02 PM
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 Board
03-25-2012, 10:04 PM
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.

John Board
03-26-2012, 12:02 AM
Here is some more info:

My last thread for this: http://forums.parallax.com/showthread.php?138545-Prop-Unexpectedly-Restarting&highlight=Unexpectedly+restarting
(http://forums.parallax.com/showthread.php?138545-Prop-Unexpectedly-Restarting&highlight=Unexpectedly+restarting)The "Guide" I used to wire this: http://www.meanpc.com/2012/01/how-to-use-tb6612fng-motor-driver-with.html
(http://www.meanpc.com/2012/01/how-to-use-tb6612fng-motor-driver-with.html)
-John

Rayman
03-26-2012, 12:15 AM
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 Board
03-26-2012, 12:35 AM
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

Rayman
03-26-2012, 12:41 AM
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 Board
03-26-2012, 12:46 AM
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).

PJ Allen
03-26-2012, 12:55 AM
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 <<<

Rayman
03-26-2012, 01:10 AM
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 Board
03-26-2012, 01:47 AM
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

Rayman
03-26-2012, 02:18 AM
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_T
03-26-2012, 02:29 AM
Power, no problem, I have a 3.6 AMP 7.4v power source

3.6A or 3.6Ah ?

average joe
03-26-2012, 02:42 AM
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 Chap
03-26-2012, 08:14 AM
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 Board
03-26-2012, 08:41 AM
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".

PJ Allen
03-26-2012, 01:51 PM
"...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_Mo
03-26-2012, 06:00 PM
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 Board
03-27-2012, 01:19 AM
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

PJ Allen
03-27-2012, 02:23 AM
Begin at the beginning, start over.
T_Chap has given you a solid lead.
That looks like a fair lot.

Peter Jakacki
03-27-2012, 02:52 AM
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 Board
03-28-2012, 01:50 AM
Alright, sorry about everything. This is (hopefully) all the information you could want:

Schematic:

91073

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 ;)

John Board
03-28-2012, 01:52 AM
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 Board
03-28-2012, 01:59 AM
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 Jakacki
03-28-2012, 02:13 AM
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).

John Board
03-28-2012, 03:02 AM
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).

'Tis a bit far, and as you said, maybe not quite the "outback", but it is certainly small, it's population is about 200 people.. a far strech from Brisbane's 2,043,186... On the QAS's "remoteness scale" it rates a 6 out of 7.

Sorry about that cap schematic flaw, it was meant to be paralleled across the battery terminals. And yes, the 1M resistor was another mistake... Need to refine it, will get back to you on that.

Thanks for your help anyhow, I will try to fix everything. Mind you... if I need any parts, the local Jaycar is 2 hours away...

Thanks anyway,

-John

P.S. Interesting fact, "Baralaba" is spelt like "Banana" in the way that every second letter is an "a". Funnily enough there is a town nearby (about 20 minutes) by the name of Banana... But it wasn't actually named after the fruit, it was named after a bull.

Peter Jakacki
03-28-2012, 04:25 AM
Paralax with a single L also qualifies :)

No need to refine the resistor value as it is not needed or desired as explained.

Here's a quick schematic of that supply filter which may in conjunction with the proper PWM signals alleviate voltage droops from resetting the Prop. All it does is hold a charge on the capacitor but the diode prevents it from feeding back to the motor supply which comes direct from the battery. You may find that the 1,000uf cap you already have would be better off being used in this manner.
91083

John Board
03-28-2012, 04:39 AM
Righto, will see if I can put that in some time.

I just found a PWM obj that I like, it seems to be working. Having said that, since my previous motors suffered "abuse" from high voltages, I think they have given up on me, not to worry though, I have 2 spares. Assembling them now to put them on.

Thanks,

-John

John Board
03-28-2012, 04:39 AM
Paralax with a single L also qualifies :)


...?

Peter Jakacki
03-28-2012, 04:42 AM
...? "Baralaba" is spelt like "Banana" in the way that every second letter is an "a". If you remove one L from Parallax then every second letter is an A too, just a play on words, or in this case, letters.

PJ Allen
03-28-2012, 04:43 AM
"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)."

You cannot pad down the h-bridge/controller output with resistance, that would limit the heck out of current.
If you cannot use a lower voltage for that then you have to use diodes.
91084
It's inefficient as all get out, but if you're stuck on this 7V battery pack then that's how it is. Each diode results an approx 0.8V drop, 5 would be 4V, 7.4V - 4V = 3.4V (close enough, or add another diode each way).
If you've been zapping that 3V motor with 7V, the result will not be pretty, long term.

Peter Jakacki
03-28-2012, 05:11 AM
It is advantageous when PWM'ing motors to run them off a higher supply than what the supply is rated at. DC motors are pretty forgiving anyway and you also never want to introduce voltage drops intentionally. If the PWM frequency is high enough then the inductance of the winding prevents the current from going too high. The higher voltage allows higher PWM frequencies to be used. Think of a switch-mode regulator which might run from 24V and supplies 5V out and all it's basically doing is PWM'ing 24V through the inductor in conjunction with the schottky diode and filtered on the output with a capacitor. So you would never insert extra voltage dropping diodes in this circuit either.

John Board
03-28-2012, 05:25 AM
It is advantageous when PWM'ing motors to run them off a higher supply than what the supply is rated at. DC motors are pretty forgiving anyway and you also never want to introduce voltage drops intentionally. If the PWM frequency is high enough then the inductance of the winding prevents the current from going too high. The higher voltage allows higher PWM frequencies to be used. Think of a switch-mode regulator which might run from 24V and supplies 5V out and all it's basically doing is PWM'ing 24V through the inductor in conjunction with the schottky diode and filtered on the output with a capacitor. So you would never insert extra voltage dropping diodes in this circuit either.

Thanks,

I was just able to vary the voltage of the motor drivers via the duty of the PWM any how, I find about a 50% duty gets me right about the right voltage for the motors.

I believe that the problem is solved now :) Thanks for all the help ;)

-John

Peter Jakacki
03-28-2012, 05:58 AM
If the problem's solved then what was the problem? You know you owe the group that much. I reckon that you were running your test PWM at too low a frequency and also too high a duty cycle 5:1 and so suffered voltage droop when the battery couldn't supply the current.

John Board
03-28-2012, 08:09 AM
If the problem's solved then what was the problem? You know you owe the group that much. I reckon that you were running your test PWM at too low a frequency and also too high a duty cycle 5:1 and so suffered voltage droop when the battery couldn't supply the current.

I reckon that you would know more than me what fixed the problem... But anyway, I have said a number of times that the problem has been fixed... then it appeared again...

I have just dissasembled my robot due to the gear boxes needed replacing. Once I get the robot back together, with the new gearboxes, a new battery strap, and a PS/2 port, I will do some more extensive experiments.

I assume that it was the drop in voltage that caused the prop to reset, as its appears only logical answer to the problem.

Apart from the wiring that I had in place, I changed the code to a library that I found on the OBEX. I don't really know what the library was called.. but it does a great job with PWM ;)

-John

P.S. I probbably wouldn't dismiss this problem that quickly as it has happened to me so many times that it isn't funny. I started about 1 month ago with dual serial motor drivers... I had problems with them... Then I moved to H-Bridge drivers.. then I had problems with them... I wish I knew more about this stuff so I could fix it more readily :} Well anyway, you learn from your mistakes, so although I'm havin' this problem now, I probbably won't have this problem again :)

PJ Allen
03-28-2012, 02:13 PM
It is advantageous when PWM'ing motors to run them off a higher supply than what the supply is rated at. DC motors are pretty forgiving anyway and you also never want to introduce voltage drops intentionally. If the PWM frequency is high enough then the inductance of the winding prevents the current from going too high. The higher voltage allows higher PWM frequencies to be used. Think of a switch-mode regulator which might run from 24V and supplies 5V out and all it's basically doing is PWM'ing 24V through the inductor in conjunction with the schottky diode and filtered on the output with a capacitor. So you would never insert extra voltage dropping diodes in this circuit either.

That's all relative to many factors, freq, pw, motor XL -- all of which which are, in this context, Unknown, as many other specifics.
DC motors aren't forgiving, quite the opposite, and more so the little crappy sort.
7V to a 3V motor is excessive, especially when somebody has no idea what he's doing.
The diodes are like training wheels.

I guess there'll be more "it's fixed"/"no, it's not fixed" stuff down the road.

Blindly doing this and that, incorporating unknowns from the obex, hoping something might happen, and wondering why nothing ever works just isn't making it.
Have fun, boys!

Peter Jakacki
03-28-2012, 02:28 PM
John's pulling his hair out so I guess he is having fun :)

Anyway I doubt very much that the voltage was as high as John measured it as he is relying on a cheap meter and trying to measure a pulsing motor without understanding what he is seeing. It's a bit like someone measuring 4V on the output of a 5V regulator and assuming the regulator is faulty when the input is measuring 8V. What they are missing is that the DC meter is reading the average of a lot of ripple due to a dried out electrolytic. Switch the meter to AC and it comes alive. The fact is that the board would cut out very quickly and the motor will not be destroyed that quickly will it?. You really need to overheat it which will only come about with too much current for too long.

average joe
03-29-2012, 10:08 AM
I knew the resistor wouldn't work as I walking out my door. My own noob-ishness showing through. Just had a chance to jump on and promote the diode voltage dropper. This will save a huge amount of time, and cost of motors. Good luck and keep having fun! Even after you're bald.

John Board
03-29-2012, 10:44 AM
John measured it as he is relying on a cheap meter

Good thing I was using my father's meter... or you'd be quite right. How can you assume that the meter I was using was wrong? At any rate, you are probbably right.

Heh, I reckon I'd better "lay low" for a while, seems like I've made a few "enemies".

-John

Peter Jakacki
03-29-2012, 02:36 PM
Don't worry, there's always some friction, only way to totally avoid it is to avoid the forum, but that would be silly. It's not about "one-upmanship" or getting the last word in as this is a forum and we can bounce ideas off each other as well as assist where we can. If for instance somebody thinks my suggestions are "dumb" or whatever then it is always far better to state why and also why another solution is better. That way it encourages ideas and gets the brain working, rather than the emotions putting people off-side.
So try not to see any bad or anything personal in what someone else says or how they react, it'll all blow over. Just keep waving and smiling and all friendly like, you know what I mean.

Anyway I said cheap meter, not bad meter as either will give you the same reading to a point, but really it comes back to knowing what the limitations of your test gear are and how to use them properly in different situations. That's why I gave a short example of measuring a faulty power supply with a meter. The results would be the same if you used an expensive meter but understanding a bit more about the device under test and the device observing the test certainly helps a lot. In your case bear in mind that DC motors are inductive and also generate back-EMF in which case an oscilloscope would be more beneficial to see what is going on. If I step in to correct a misconception, I will go to some lengths to explain why as you have seen but we are all busy and only have so much time so posting is a luxury and rather low priority normally I'm afraid.

John Board
03-31-2012, 06:43 AM
Thanks for all your help,

One last thing, someone mentioned putting a diode in to run both prop and motors off the 1 batt, how can I do that?

Thanks,

John

Peter Jakacki
03-31-2012, 07:03 AM
Thanks for all your help,

One last thing, someone mentioned putting a diode in to run both prop and motors off the 1 batt, how can I do that?

Thanks,

John

Did you scan back through the posts at all???? The schematic shows the connections so it's only a matter of having a diode in series with the battery supply that runs to your VIN of the Prop board and then adding a large enough capacitor to the the VIN side. You might even be better off taking the large 1,000uf cap you have now and putting it on the VIN side. Diode anode is connected to Vbatt, diode cathode to VIN.

John Board
03-31-2012, 07:05 AM
Sorry... I did scan through... Must have missed it...

Peter Jakacki
03-31-2012, 07:34 AM
That's okay, I just didn't know whether it's just that you don't understand it or that unbelievably but maybe you haven't read back through your own thread :smile: It's even possible to insert a resistor in series with the diode to help filter any nasties but the value depends upon the maximum load etc so don't worry about that for now. If you had a value of 22R or so you could try that though.

John Board
03-31-2012, 07:44 AM
As funny as it may sound... I don't have a diode...

In any case, I just tried a 6V torch battery as the processor's power supply, and the RC car batt as the motor's supply... still the same issue. They are both sharing the same ground. The power LED is flickering on the board, so some how the motor driver is drawing power from the chip.. I have no idea how.

Well, I'll keep working on it.

John Board
03-31-2012, 07:58 AM
Just ran tests with my Arduino.. Performs pefectly. I don't know, I'll keep working on the prop.

John Board
03-31-2012, 08:06 AM
Just ran another test, Propeller Demo Board controlling PWM, and the arduino supplying power. Also worked fine

John Board
03-31-2012, 08:19 AM
Heh.. Just ran tests fully off Demo board... Worked fine..

Peter Jakacki
03-31-2012, 08:19 AM
As funny as it may sound... I don't have a diode...

In any case, I just tried a 6V torch battery as the processor's power supply, and the RC car batt as the motor's supply... still the same issue. They are both sharing the same ground. The power LED is flickering on the board, so some how the motor driver is drawing power from the chip.. I have no idea how.

Well, I'll keep working on it.

I hope you mean that they are both sharing the same ground AT the battery negative and not at the negative terminal of the logic board. The fact that your power LED is flickering seems to indicate that your battery supply is drooping and the difference between this board and the others could very simply be a matter of PWM duty cycle. If the Prop board is leaving the motor pulsed on for too long it can cause a problem. You want to make sure that output is correct and since you have basic test instruments *your Dad's meter" then I suggest disconnecting the motor and put a small 6V torch bulb in there for the moment. Measure the voltage across your bulb to ensure that the duty cycle is correct then substitute the lamp for the motor.

John Board
03-31-2012, 08:35 AM
I hope you mean that they are both sharing the same ground AT the battery negative and not at the negative terminal of the logic board.

Well... a bit of a long story. I burned out (Somehow) the screw terminal block of the GG prop board. I now connect the power to the prop from the VIN and the GND sockets of the board. As of yet this hasn't had any ill effects. So in a sense, I am connecting both GND's at the logic board, but at the same token, it is kinda at the batt terminals.

Also, with the prop demo board, I can't connect both GND's at the battery terminals because it is using the mains socket. In this case I am connecting the GND to the logic board's GND.


You want to make sure that output is correct and since you have basic test instruments *your Dad's meter" then I suggest disconnecting the motor and put a small 6V torch bulb in there for the moment. I'll see what I can cook up - but hopefully not cook...

John Board
04-15-2012, 03:23 AM
Okey dokey! Time for a news flash! I one of my motor controlers on a demo board and mounted that to my robot, then I used a serial line to communicate between the two chips. This worked fantasticly - except it couldn't update fast enough. The serial communication was a bit to slow for my purposes, and although it worked, it has to update lightningly fast which this arrangement couldn't achieve. So, I went on to parallel style of communication which I got semi working before I burned out my last motor controller... t'was a sad moment. But anyway, a fresh batch of promising parts are arriving from Parallax! I found the HB-25 motor controllers a perfect match for what I want to do on the robot... and much more, so I ordered some and they should come within the next week or two! So these drivers should get my robot up and running in no time! By the way, if there is anything you reckon I should know about the HB's, please tell me - I really don't want to do something wrong with these ones...

Although this has been a long road (about 2 months), I believe it is comming to an end, and then I can start the *cough* glorious *cough* task of doing everything else... Having said that, I wasn't ever much good at electronics and mechanics, I'm more the programmer type, I guess I've been programming much longer than wiring ;)

-John

Peter Jakacki
04-15-2012, 04:18 AM
Hi John, thanks for the update. We are always curious as to how it all turns out but rarely are we fortunate enough in that department to be enlightened. The feedback does help us though when we are dealing with future problems.

I'm surprised that your serial communications was not fast enough but then I looked through the thread and found your code which was using a baud rate of 9600. Now that's fine for a little console debugging maybe but why go so slow? That object is fine up to 115.2K baud and I have plenty of objects which run at megabits/sec although you would not use archaic RS232 drivers for these speeds.

Don't think you've taken the trophy for long roads though as we have all experienced longer roads then this I think :) Take each trial and setback as a lesson learned and an opportunity to gain experience.

John Board
04-15-2012, 11:46 PM
Don't think you've taken the trophy for long roads though as we have all experienced longer roads then this I think :) Take each trial and setback as a lesson learned and an opportunity to gain experience.

Will do ;) As I said before, I'm not much of a wire-ist but I can do some nice stuff with computers. I've been programming in 8+ languages for over half my life - and I've only been wiring for a few years...

Okey dokey, you mentioned a different serial driver for the RS323 serial comms, where could I aquire this? Note: I did speed up the baud later on up to 115200, still didn't appear fast enough, maybe I'm doing something wrong, but it just didn't update fast enough for my liking. Well anyway, I think the switch to the HB-25 drivers will be a change for the better, I can't imagine how I would have any trouble with them... after all, I'm running at about a 300ma, and they are rated at 25A... They also have a very easy interface to use. Well, anyway, I hope this turns out well. Here's a bit more information about the base:

It is getting built for RCJA State Championships at Brisbane in August, for those not familiar with RCJA it basically comprises of the robot having to follow a line, making decisions at T-Junctions and going around obstructions. The most commonly used base at such comps are the Lego Mindstorms - that's why I need to win, to show them that it is possible to custom build such robots ;) Well anyway, I don't think I need to explain the motor driver system! I am using 2 ColorPAL's for the line and color sensing, 2 Ping's for the obstruction sensing, it has an arm for picking up objects consisting of a 30kg torque, titanium geared, servo motor. 1-2 props for the brains, and 1x 7.4v 3.6AH Li-Po battery for the power source, 2 tamiya gear boxes for the drive motors, 3 omni-directional castors for the back stability, 2 bumper switches for detecting arm movement, a 2GB SD card for large storage, 1 serial LCD display for giving feedback, and more!

I think if I can get the base assembled well, and the programming working great I can throttle those mindstorms kids at the comp ;) There is no way that the Mindstorm's 40MHz brain could keep up with a the staggering 1.28 GHz of the 2 props ;)

Well anyway, time to get back to whatever I'm supposed to be doing, and I'll keep y'all updated.

-John

Peter Jakacki
04-16-2012, 02:43 AM
Hi John,
Can you post your code because I would like to see where this communications bottleneck is as it may not have anything to do with the speed. Just as a note for now fast serial drivers also require fast access from Spin code for full throughput and many of these OUT and IN routines are bogged down with handling the FIFO buffers. To streamline that it is easier to read/write a variable which will have the latest character and status. It would be good if Spin had a single fast read and clear operation.

John Board
04-16-2012, 11:05 PM
This might not be the most up-to-date version of the code, but it would be pretty close.

Server code (Demo board with motor driver on it)


{
Name: Jaws Serial Motor Driver Firmware
Author: John Board
(c) 2012 John Board
}
CON

_CLKMODE = xtal1 + pll16x
_xinfreq = 5_000_000

RxPin = 31 'Currently set to computer comms, can be set to other pins
TxPin = 30
Baud = 9600 'Was also tried set at 115200

OBJ

PWM : "PWM_32_v4.spin"
Serial: "Serial"

PUB Start | Duty, alarmCount

waitcnt(clkfreq/2+cnt)

DIRA[0..6]~~ 'Motor driver stuff
OUTA[3]~~

DIRA[16..23]~~ 'Motor driver stuff

DIRA[RxPin]~

PWM.Start

DIRA[23]~~ 'Demo board status LED


repeat until ina[RxPin]==1 'Wait for other chip to connect...

OUTA[23]~~ 'Demo board status LED

Serial.start(RxPin,TxPin,0,Baud)

SerialLoop 'Enter Main Loop

PUB SerialLoop | params1, params2, params3

repeat
params1 := Serial.rxdec
if params1 == 1 'Forward
Serial.dec(1)
params2 := Serial.rxDec
ForwardLeft(params2)
elseif params1 == 2 'Backward
Serial.dec(4)
params2 := Serial.rxDec
BackwardLeft(params2)
elseif params1 == 3 'Reboot
reboot
elseif params1 == 4 'Halt all systems
Halt
Serial.tx(3)
if params1 == 5 'Forward
params2 := Serial.rxDec
ForwardRight(params2)
if params1 == 6 'Forward
params2 := Serial.rxDec
BackwardRight(params2)
else
Serial.dec(100)
Flash
params1 := false
params2 := false
params3 := false

'Motor driver code from now on

PUB ForwardLeft(Duty)

OUTA[0..3] := %0011
PWM.Duty(0,Duty,5000)

PUB BackwardLeft(Duty)

OUTA[0..3] := %0101
PWM.Duty(0,Duty,5000)

PUB ForwardRight(Duty)

OUTA[3..6] := %1100
PWM.Duty(6,Duty,5000)

PUB BackwardRight(Duty)

OUTA[3..6] := %1010
PWM.Duty(6,Duty,5000)

PUB Halt

PWM.Duty(0,0,5000)
PWM.Duty(6,0,5000)

PUB Flash

OUTA[22]~~ 'DEmo board status LED
waitcnt(clkfreq/10+cnt)
OUTA[22]~


"Client" board. This is not quite the code that I was using on the robot, but it shows how I communicate with the other code



CON

_CLKMODE = xtal1 + pll16x
_XINFREQ = 5_000_000

RxPin = 6
TxPin = 7

Calibration = 20

OBJ

Serial: "Serial"
Ping: "Ping"

PUB Main | data, cm

Serial.start(RxPin, TxPin, 0, 9600) 'Baud configurable

waitcnt(clkfreq*2+cnt)

repeat
cm := Ping.Centimeters(15)

if cm < Calibration
CMD(1)
CMD(Calibration-cm)
elseif cm > Calibration and cm < Calibration*2
CMD(2)
CMD(cm-Calibration)

PUB cmd(command) 'Send dec commands to host board

Serial.dec(command)
Serial.tx(13)
waitcnt(clkfreq/10+cnt)


I think this is all correct, the actual code I was using is on another laptop that I don't currently have access to, but this is essentially the same code.

-John

Peter Jakacki
04-17-2012, 12:05 AM
Hi John, I'm not familiar with the "Serial" object you are using. Could you simply backup your code into an archive and post that so I can see. Looking at you serial transmit loop it looks like you are sending a command 10 times a second. Is this update rate correct for your requirements?

John Board
04-17-2012, 04:08 AM
Okey, so, the "Serial" object is actually FullDuplexSerial. In that code it says it was update every 100ms, In the other code it was updating every 1-10ms

John Board
04-17-2012, 04:09 AM
Just remember, it could have been just how I was interpreting it, it might not have been a speed issue. I can't test this however because both my motor drivers are "broken".

John Board
04-20-2012, 06:28 AM
Wow. Just wow. I just had the HB's arrive in the post, and wow. They are nice little drivers, some of the best I've ever seen...

One question though, I know that this is the same across the board, but why do drivers/parts not come with their own bolts? (Not to worry though, I've got some computer case bolts to fit)

Thanks,

John

Peter Jakacki
04-20-2012, 06:47 AM
A bit excited there John? Better bolt off then....
Yeah, why don't they throw in a few lousy screws and mounting posts. There you go Parallax, that's truly the "hardware" side of the business, the nuts n bolts :)

John Board
04-20-2012, 07:01 AM
Am I excited? Yes sir! These motor drivers have the best chance of working out of all my drivers. I prefer things that don't require any fancy wiring - the HB's have the stock standard 3-wire headers that I can plug straight into anything, and they only require a servo-style pulse to drive them, most MCU's can generate those pulses ;) Also I'm quite a bit excited because I've layed off my fancy TAOS color sensors for something a bit less resource consuming, the ColorPAL's. I found the TAOS's were quite a bit too sensitive, and the red channel always spiked a bit... But anyway, the ColorPAL's should do the job well. Although, they can't update nearly as fast as the other ones could - but anyway, I guess there always is a tradeoff.


Better bolt off then... :P

Well, I'll let you know how it comes along, and I agree with you. Parallax! Throw in a few screws with your parts!

-John

[Edit] Loving it - it's stickin' right within the KISS principles ;)