
ultrablaze
Hello,
We are a team of engineering students working on a robotics project about to participate in a robotics competition. We have only a few days to finish up and we are currently having a problem with the DC motors for our second robot. We are trying to drive two DC motors to move the robot using PWM signals sent from an arduino card. Using an H bridge we are able to deliver PWM signals with a controllable duty cycle from the arduino card, which are -24V/+24V. Thus in theory at 50% the motors are at 0V, and close to +24V or -24V at 100% or 0% respectively by average voltage. When the cables we use to connect to the motors are checked with an oscilloscope, the signals are fine and as expected.
When we connect our motors to them, the signals are significantly degraded (can tell its supposed to be a PWM cycle but it's not as clean as before) and the over all average voltage is lower then what we had before. In this situation, with the robot lifted off the ground and the wheels not touching anything, the motors seem to turn fine, at a decent speed etc. However the torque seems quite low, not as much as we should be getting from our motors.
The real issue is as soon as we place the robot on the ground, the wheels can not move. In this situation the expected rough 21.5V average voltage we measured previously drops to around 3 to 3.2V. If observed at this point the PWM cycles are totally degraged, can barely make out a square signal, and the average voltage is around 3V.
We can not figure out what is causing this problem. When we connect our generator directly to the motors without going through our electronic card, as soon as we go above 5V on a motor the wheel is able to move the robot easily, and at a decent speed above 7 or 8V. What adds to our confusion is another team last year used these motors and drove them with a -24/+24 V PWM signal in the same way as far as we know.
We are totally stuck, and are available to answer any questions or provide any data that could help debug our issue.
Thanks for any help!
We are using the 2322G/GP022C motors from this datasheet, the last one (24V/1621) : http://store.mdpmotor.fr/media/documents/pdf/2322g_gp022c.pdf
For the generator, we easily moved the robot when connecting it directly to one of the motors and turned it up to just 6-7V, do you really think the batteries would fix this issue? We need to take apart a lot of stuff to switch battery power and were hoping to do it only when all our debugging was done and it worked ok ^^
We do have flyback diodes and a decent sized heatsink that doesn't seem to get to hot (easily touchable).
We use only the PWM signals on the input lines.
I'm gonna upload our oscilloscope pictures and our schematics somewhere and post the links here.
We got this response on another forum :
"major issue - the 22R current sesnsing resistors - thet bridge will never ever let you pass enough current with such a current sesing resistors. considering your motors (rated at 0.5 Amps @ 24V) you would loss 11 volds on those 22R sensisng resistors. change those for something more suitable. according to the datasheet you should use 0.5 Ohm for 2Amps limit."
This seems like this might be the issue, we are going to try and test this now but are open to all opinions on this verdict / other ideas!
Yep I would have to agree with that other forum, using 22ohm current sensing resistors is quite high. I usually use 0.1ohm myself.
Actually it's funny that @DJ (the founder of EZ-Robot) found you don't even need current sensing resistors when doing current sensing, just attach an analog input to the ground of the H-Bridge and you will get readings (albeit small) when the motors are under stress.
If you still have issues, I'd suggest looking at the motor impedance. When the robot is lifted off the ground, the mechanical load on the motor is low and so the total impedance of the electromechanical system is also low. When you put the robot on the ground the mechanical load increases the impedance of the electromechanical system. It's possible that under mechanical load, the voltage you are supplying is not sufficient to get the amount of current you need to get the motor moving. On the other side of the coin, you may not be able to supply sufficient current to get the motor moving due to a limit on the H-bridge. Either way, it's possible you are running into a physical limit due to the capability of the H-bridge and the change in impedance of the electromechanical system.
This can be a real easy fix.
Post your Arduino code please. Either ZIP it and use the Attach File option to the right of the edit box when replying to the post - or paste it in using the [ code ] and [/ code ] tags. Look to at the UBB Code commands to the right of the edit box when replying to the thread.
You are PWM the IN of the L298? I would not recommend that. I would recommend modulating the EN instead. This is for many reasons... One of the reasons is pulsing the IN requires both INA and INB of the first channel receive their HIGH and LOW pulses at the exact same time. That will never happen and that tiny little bit of overlap causes the L298 to do what it's asked at the time - meaning an overlap the current to the motor is reversed for a very small amount of time until the expected pulses are both HIGH or LOW as desired. And the PWM frequency is also going to increase the chance of the PWM never being on at the same time.
I don't know if I explained myself properly without drawings. In short, do not PWM the IN lines.
Use the IN lines as they are meant to be used. Use the EN as they were meant to be used.
Lastly, assuming your custom L298 motor driver circuit is designed correctly - then following my instructions to modulate the EN instead of INx will work
We will test this tommorow and get back to you with feedback regardless of how it turns out, but I'm fairly sure we don't have any resistors below 12 or 10 ohm....
Hmm very interesting comment DJ Sures. I think the way we designed our electronic cards it is to late to be able to apply the PWMs to the enable and put whatever is required on the IN ports. In theory the 2 PWM signals on inA and inB should be perfectly sync, since I'm generating 2 opposed phase PWM signals from the same timer for one pair, and another pair with another timer on the other. They are seperate from timer0 as well so there should be no interference causing any issues with these signals
This was a choice that was made early on and not by me since I wasn't really involved in the card design.
Part of the project was designing and making our own electronic cards so they are hooked up in such a way that now we can't switch to this other solution.
This is the code I used to generate the PWM signals, I took it from the rest because there is a lot of unrelated stuff, but I can post it if you want.
We used this system and slightly different code for a slower moving smaller first robot that has functioned without any issues
Note : this is for an Arduino Mega 2560
Here is an archive with some extra things that might help you get a better sense of our issue : <a href="http://speedy.sh/bMtUE/photos-robot.rar">Download at SpeedyShare</a>
Included are the 2 schematics of our 2 cards (one with 2 Arduino mega) and one which serves to distribute power throughout the robot.
Also I've added 3 oscilloscope pictures, in descending quality : -img3 : signals that arrive to the motors with them disconnected (after passing from the Arduino, through the optocoupler and leaving the H-bridge)
All things considered, our sensor resistors being at 22 seems like a likely issue, since it would lead directly to limiting current autoput and dropping voltage on the motor when we ask for to much current. Also, the datasheet does say no more then 0.5 ideally and we have 22.
Have you connected a two channel oscilloscope to the INA and INB of the first motor to verify the modulation peaks are correctly aligned?
Connect the oscilloscope to the output of the L298 to the motor and see if the PWM is correct and that there are no reverse polarity. If test #1 was success then there should be no reverse polarity anomalies
Do you have a circuit diagram for the motor controller?