Problem with M2 on BabyO 328

I am having trouble using PWM on M2 on a particular BabyO board I have. Regardless of what value I set for M2 the motor still turns even when set to zero. I tried my code on another board and got no movement as expected so I know the program works and M1 functions fine so it appears to be something with the particular board/h-bridge. Is there something I can check to see why M2 is always turning?

Thanks,
Mike

Hello.

Is this a recent problem with your board, or has it always been this way? Does the motor driver get hot when you supply a PWM to it and have no motor connected (be careful not to burn yourself)? What voltage have you been supplying to the Baby O? What is the stall current of your motors?

- Ben

Well that is a great question. This is a board that I had soldered header pins on and decided I wanted them on the other side so I ordered another board and put it aside. It has been a while since I used it so I can’t say for sure if it ever worked. properly. The motor driver does not get hot at all. I am using a 5V supply and according to the motor spec sheet: Stall Current at (3V) is 210 mA and Stall Current (6V) is 350 mA.

When I run the code into my other board both M1 and M2 respond accordingly - that is they either run or not. M1 works fine and responds to any of the values I use for the speed, but M2 runs no matter what value is set for it to include 0. I am guessing part of the chip is damaged, but wanted to see if there was someway of salvaging it at all.

Mike

Mike,

If the chip isn’t getting hot, it seems unlikely that it is damaged. If you look at the Baby Orangutan schematic, you can see that one of the ISP programming pins (PB3) is also a control input for motor driver channel 2 (the motor driver enable line is connected to reset so that the simple act of programming the board doesn’t drive connected motors!), and PB3 is right next to VCC and GND on the programming header. Can you look at your soldering job (and preferrably check with a multimeter) to see if you have any shorts between PB3 and VCC or ground. Do you have anything connected to your ISP header while you’re performing these motor tests?

- Ben

Ben,

I checked with a meter and there are no shorts and I do not have the cable connected when I am testing the motor. Regardless of what set M2 to it still spins. I need to take a close look at the motor driver pins to make sure there are no accidental shorts, but otherwise not sure what happened. I will have to look at the schematic to see which pins are being affected. I know the code I am testing works as when I use it on another BabyO328 board it behaves the way it should. However, on this one regardless if I set it to M2_forward or reverse it still turns in the same direction.

Mike

Can you use your multimeter to probe the voltages on the motor driver pins when commanding the motor to run forward and in reverse?

- Ben

I measured the voltage going in at it was ~6.3V. At M1 it was fluctuating on and off as it should but when I measured M2 with it set to forward and then reverse and either at 0 or 255 I got ~6.3V. It is like the those two pins are being fed directly and that the chip is being bypassed for M2…it is a mystery.

Mike

Can you measure the voltages on the control inputs to the motor driver pins and compare those voltage to (a) what you expect them to be from your code and (b) what the motor driver truth table says are the corresponding outputs from those inputs.

- Ben

OK - I will try that after work. It looks like that should be pins 21 and 22 based on the schematic.

Mike

The important ones are the PWM pin and the two direction inputs for the motor driver channel that’s misbehaving. The PWM isn’t connected to an AVR I/O pin, but it would still be good to check the voltage on it just to cover everything. I recommend you conduct your tests without PWMing the motor driver inputs. Rather, just use the two pins connected to the M2 direction inputs as digital outputs held high or low and conduct the same test for all four permutations of pin values. Make note of what the input values should be, what the input values are measured to be, and what the resulting output is for each case.

Before you conduct these tests, please use your multimeter to verify that there are no shorts between the two AVR I/O pins connected to the M2 driver inputs and both VCC and ground. I know you said you checked for this, but please check again just to be safe. Don’t conduct the test if you find a short.

- Ben

Thanks, that was really helpful. I will try and test this out over the holiday break, and this information will be extremely useful.

Mike