Somthing is wrong with my baby O!

I use the tamiya double gear motor, and I noticed that motor B on my baby O is outputing lees voltage them motor A (motor B output 2V, motor A output 2.40V) this makes my robot to go in circles and it is not what I want! in my code, I activate both motors in the same time, using PWM. any ideas?
Arbel

That shouldn’t be. Can you post your code please?

Also, were you measuring the voltage with or without the motors connected? And was it very stable (not jumping around)?

-Adam

the code is very simple:

main (void)
{
//initialise pwm
pwm_init();

//endless loop
for(;;)
{
//set speed to motor A from -255 to 255
pwm_a(130);
//set speed to motor B from -255 to 255
pwm_b(130);
}
}

I measured the voltage with and without the motors, and when I measured it with the motors, motor A WAS 2v and motor B was 1.6V.

the voltage was stable

I even tried to use NiCD battery instead of the AAA battery, steal, no good :frowning:

now it’s even worst! when the motors are connected, motor A is 3.3V and motor B is 1.6V.
I should say that I am using a ni-cd AA 6V 900mAh battery.
is my board lost? :cry:

Hello,

I’m not sure how you’re measuring voltage, but it wouldn’t be that surprising to me if a fluctuating output (the PWM) gave inconsistent results on a tool that is trying to measure DC. Can you try setting the various outputs high (100% duty cycle) and measuring those relative to ground?

- Jan

I don’t anderstend what you mean by that, how should I measure?

Do you have any idea why is this happening? is there some thing wrong with my board?
Arbel

First off, there’s probably nothing wrong with your board. Most multimeters aren’t designed to read PWM voltage properly. Also, without feedback, your robot will tend to turn one direction or the other, but it shouldn’t be making small circles!

In your code, what library are you using for your PWM functions?

To test your hardware, you can just turn both of your H-bridges on full forward (no PWM) with this simple code:

#include <avr/io.h>

int main(){
	DDRB|=(1<<PB1)|(1<<PB2);//Set PB1 and PB2 as outputs
	PORTB|=(1<<PB1)|(1<<PB2);//Set PB1 and PB2 high
	while(1);//loop forever
	return 0;
}

With this code running, you should be able to read the same voltage from both motor ports with a normal multimeter (with no motors connected). If the voltages read out close to the same, then your hardware is fine. If this is the case, plug your motors back in, and see how straight (and fast!) your robot goes. You can straighten it out further by sending the two motors different speed commands, or with some sort of feedback sensor.

Also, part of your problem may be that you’re repeatedly calling the PWM function. Try moving your PWM command lines in your code before your endless loop and see how your robot moves.

Any luck?

-Adam

P.S. The “Duty Cycle” is the percent of the time that a PWM signal is on. So in your code, you’re setting a PWM duty cycle of 130/255, or about a 51% duty cycle.

thanks, I’ll give it a shoot and let you know what happened.

one thing puzzles me thou, if I am to put my pwm function out side the loop, how will I use conditioning? the call to the pwm function must be in the loop, or maybe there is another way…
do you get my meaning?
Arbel

Ultimately, your calls to the PWM function will be in some loop; otherwise, you would never change speed from your first setting. However, that loop would also presumably do things like read sensors and do some calculations, leaving more time between the calls to the PWM function. You might have a PWM frequency of a few kHz and update your duty cycles at around a hundred times per second; with your current loop, you might be calling the PWM function much more frequently than the PWM frequency.

- Jan

very good, I will try every thing and will let you know! I had no time during the week end because I was in the most grooviest cave in Israel!!! :smiley:

I just tried every thing you have said and here are the results:

  1. when I took the pwm function out of the loop, motor B was a lot slower then A.
  2. when I used the relay function the voltage in motor B was 0.40 lower then the one in motor A.
    what the @#$% is going on??? give it to me strait doc, how bad is it? :cry:

The Tamiya motors can draw up to about 4 amps at 6 V, which is well past what the motor driver on the Baby Orangutan can supply. Therefore, trying to do tests with them is not the best test of your controller. You also report only the difference of 0.4 V, which is not that significant. Can you try setting each of the 4 outputs high (without PWM) and measure each of the voltages relative to ground, with and without a load?

- Jan

but they are small motors! how can they draw 4 amps? is it the gearbox? I used the exact same motors in a small car toy, and I got the same problem there as well… maybe we are not talking about the same motors… this is what I use

I am sorry, but I am not sure how to do that, can you please explain?
Arbel :blush:

Using the short code I posted earlier, try measuring the voltages between M01 and ground, and M03 and ground.

Use this slightly modified code to test the voltages between M02 and ground, and M04 and ground:

#include <avr/io.h>

int main(){
   DDRD|=(1<<PD5)|(1<<PD6);//Set PD5 and PD6 as outputs
   PORTD|=(1<<PD5)|(1<<PD6);//Set PD5 and PD6 high
   while(1);//loop forever
   return 0;
}

Also, small motors which can generally only run at lower voltages, draw more current to output the same amount of power (P=I*V). Small toy motors also tend to operate less efficiently, so more power is wasted as heat for the same effective work output. It sounds odd, but a larger motor, which would most likely be more efficient, and could be safely operated at a higher voltages, would actually need less current to do the same rate of work. It’s a little counterintuitive to think of components hitting a current limit rather than a power limit, but as my tenth grade Physics teacher Mr. Robinson used to say, “You see, it’s the amps that make things hot!”

The motor driver on the Baby-O is designed to accept input voltages up to 9V, but it is only meant to output up to one amp per channel.

-Adam

lets just say that I checked the voltage and that they are different. what dose that say about my baby O and if they are the same, why dose 1 motor goes slower then the other and how can I fix that?
Arbel

Depending on how big the difference is, it might not say anything about your baby O. Motors, gearboxes, and motor drivers won’t all be the exact same, so some variation is expected. The best way to make up for that is to use feedback to measure the motor speeds and balance them in software. If that’s not feasible, you can also calibrate your setup for the difference in motor speeds and always slow down the faster motor by the same factor.

You can also try to balance things as much as possible by looking for the combination of motor output, motor, and gearbox that will give you the closest output speeds.

However, the details of what you are doing with the software can also make a big difference, so it’s possible that the hardware differences are not as big as you think. Changing the PWM frequency can have a big impact on performance. The hardware PWMs on the baby orangutan are different (8-bit and 16-bit), so it’s possible to have them configured in different ways, which could explain some of the differences you are seeing.

- Jan

right now I am using the gearbox with a 204:1 ratio, if I will use the other ratio option will the current decries?
Arbel

No. In general, reducing the gear ratio might reduce the no-load current (since the gears are the only load), but doing so makes it easier to stall the motor and generally requires more of the motor. In the case of the twin-motor gearbox, however, the lower gear ratio actually uses more gears, making it less efficient.

- Jan

so I should use the 58:1 ratio, is that the more efficient one?

by the way, I think I’v balanced the motors using the code ane using the 58:1 ratio on the gearbox… but I don’t know for sure yet…
Arbel