Weird output on Dual MC33926 Motor Driver Carrier

Hi,
I amtrying to set up this board with an arduino UNO, I wanted to use PWM on in1 and in2 directly. To test I connected up for just one motor. I am going to use jumpers on the D1 and D2 pins (shown with a blue box) where D1 will be brought low and D2 will be brought high so that I can use the PWM in1 in2 mode. I will then enable the EN pin with 5v and I will drive it by sending PWM to IN1 while keeping IN2 at ground

All seemed good until I started outputting different PWMs and the output got weird:
VIN is 12V
I have the multimeter connected to M1out1+ M1out2-
pin2 is set to PWM
pin3 is set to PWM

pin2 analogWrite(0)

pin3 analogWrite(0) 0.0V
pin3 analogWrite(100) 7.3V
pin3 analogWrite(200) 10.5V
pin3 analogWrite(255) -12.V ???

and then I switched the pins…:
pin3 analogWrite(0)
pin2 analogWrite(low) 0.0V
pin2 analogWrite(100) 0.0V
pin2 analogWrite(200) 12V
pin2 analogWrite(255) 12V

So it is responding to PWM input but not in the way I expected!

Have I wired something wrong in wiring it up? I checked the PWM output and it looks fine, I also put a resistor across M1out1 and M1out2 to simulate a motor load, still nothing.

any help would be greatly appreciated!

void setup() {
// initialize digital pin LED_BUILTIN as an output.
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
analogWrite(2, 0);
analogWrite(3, 0);
Serial.println(β€œlow”);
delay(2000); // wait for a second
analogWrite(3, 100);
Serial.println(β€œ100”);
delay(5000); // wait for a second
analogWrite(3, 200);
Serial.println(β€œ200”);
delay(5000); // wait for a second
analogWrite(3, 255);
Serial.println(β€œ255”);
delay(5000); // wait for a second

Hello.

Pin 2 on the Arduino Uno does not support analogWrite(), so you will need to use a different pin. This reference page has a table that lists the pins that can be used for PWM signals on different Arduinos:

https://www.arduino.cc/reference/en/language/functions/analog-io/analogwrite/

- Patrick

Thank you so much for your prompt reply and please forgive my electronic newbie-ness :slight_smile:

It was indeed I had it hooked up to a non-pwm pin.It is now looking much better but I am still not getting negative output which is still confusing me

the first part is fine:
pin3 = 0, pin5 = 0 β†’ 0V
pin3 = 0, pin5 = 100 β†’ 7V
pin3 = 0, pin5 = 200 β†’ 10V
pin3 = 0, pin5 = 255 β†’ 12V

but I thought when I reversed it I should get a negative voltage
pin3 = 0, pin5 = 0 β†’ 0V
pin3 = 100, pin5 = 0 β†’ 7V expected: -7v
pin3 = 200, pin5 = 0 β†’ 10V expected: -10v
pin3 = 255, pin5 = 0 β†’ -12V expected: -12v

What is particularly strange is I get two positive and one negative? Are my assumption on how it works wrong or again is it my dodgy wiring?

The behavior you are describing does not really make sense, so there might be some issues with your code or wiring (or possibly with the way you are measuring things). What happens if you connect a motor? Can you post your updated code?

- Patrick

Sorry I was trusting the multimeter but when I hooked it up to the motor it worked exactly as expected.
Thank you so much for your help. I am new to building stuff from scratch and I really appreciate the help debugging.

2 Likes