HELP with H Bridge (DC Motors)

Drive a 4-wire bipolar stepper motor or a pair of DC motors from your Arduino. [Product page]
Post Reply
peteb
Posts: 3
Joined: Tue May 06, 2014 5:32 am
Location: Orange NSW Australia

HELP with H Bridge (DC Motors)

Post by peteb » Tue May 06, 2014 10:25 am

Hi everyone,
I have an issue with my H Board, I cannot get my motors to turn.
First I will describe how everything is connected, then I will discuss my troubleshooting thus far. If I could get some help on this issue I would be grateful.

My Project

I have a prototype of a autonomous car I am building. I have the following items connected.
- Freetronics 'Eleven'
- Freetronics H-Bridge Shield
- 2x 3.3V DC motors (With wheels)
- 4xAA Battery supply (Motor Power into H-Bridge board)
- 9V battery connected to Freetronics 'Eleven'

Troubleshooting thus far

- 9V Battery measures 8.71V OC
- 4xAA Battery measures 6.22V OC
- Bridge VIN to Motor is not connected
- 5V LED on HBridge is lit
- 6x Bridge connecters for Enable and Inputs connected
- 4.99V output on D4, 7, 3 and 2 they also successfully switch to LOW
- Polarity on both batteries correct
- Motor OC resistance reading is 1.1Ohms
- Motor connected 4xAA supply turns and runs successfully in both directions
- Voltage reading on output A (1 and 2) is 0V and output B (3 and 4) is 0V

I do need to mention that this is the second HBridge board I have bought from Jaycar for this issue. I have come to the conclusion that it is unlikely to be a second board and all inputs seem to work fine, the Freetronics Eleven board is functional aswell. My connections I cannot see any problem with and not been 100% of C programming I have used the example on the Freetronics website for DC Motors with HBridge. I will copy this code across from my program. Please help if you can Im very desperate and out of answers.

I thankyou in advance
Regards,
Pete

Code: Select all

const int channel_a_enable  = 6;
const int channel_a_input_1 = 4;
const int channel_a_input_2 = 7;
const int channel_b_enable  = 5;
const int channel_b_input_3 = 3;
const int channel_b_input_4 = 2;

void setup()
{
  pinMode( channel_a_enable, OUTPUT );  // Channel A enable
  pinMode( channel_a_input_1, OUTPUT ); // Channel A input 1
  pinMode( channel_a_input_2, OUTPUT ); // Channel A input 2
  
  pinMode( channel_b_enable, OUTPUT );  // Channel B enable
  pinMode( channel_b_input_3, OUTPUT ); // Channel B input 3
  pinMode( channel_b_input_4, OUTPUT ); // Channel B input 4
  
  Serial.begin( 38400 );
  Serial.println("Starting up");
}

void loop()
{
      Serial.println("Channel A forward");
      analogWrite( channel_a_enable, 255);
      digitalWrite( channel_a_input_1, HIGH);
      digitalWrite( channel_a_input_2, LOW);
      delay(5000);
      allInputsOff();
    
      Serial.println("Channel A reverse");
      analogWrite( channel_a_enable, 255);
      digitalWrite( channel_a_input_1, LOW);
      digitalWrite( channel_a_input_2, HIGH);
      delay(5000);
      allInputsOff();
      
      Serial.println("Channel A forward half speed");
      analogWrite( channel_a_enable, 127);
      digitalWrite( channel_a_input_1, HIGH);
      digitalWrite( channel_a_input_2, LOW);
      delay(5000);
      allInputsOff();
}

void allInputsOff()
{
  digitalWrite( 4, LOW );
  digitalWrite( 7, LOW );
  digitalWrite( 6, LOW );
  digitalWrite( 3, LOW );
  digitalWrite( 2, LOW );
  digitalWrite( 5, LOW );
}

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: HELP with H Bridge (DC Motors)

Post by andrew » Tue May 06, 2014 11:13 pm

Hello
You need to use motors that are between 8 and 40V DC.
http://www.freetronics.com/pages/hbridg ... tart-guide
John

cef
Freetronics Staff
Freetronics Staff
Posts: 106
Joined: Wed Nov 09, 2011 12:53 am

Re: HELP with H Bridge (DC Motors)

Post by cef » Tue May 06, 2014 11:48 pm

johnb wrote:Hello
You need to use motors that are between 8 and 40V DC.
http://www.freetronics.com/pages/hbridg ... tart-guide
John
To clarify that:

You can use lower rated motors than 8V, however you need to modulate the enable line.

What you also need is to give the H-Bridge board more than 8V of supply to work with.

For a test, I would wire both motors in series to one output (so that 6.6V is required to drive them, as they're in series), then connect a 9V supply to the H-Bridge board. For just testing a standard 9V battery would be fine, but you wouldn't want to run it that way for any extended time as it will drain the battery fairly quickly.

Assuming this works, you could then move on to setting up PWM on the motor enable pins so that they don't drive the motor outputs too hard, and going back to your original wiring.

Note: You would probably be better off with 6V motors, as you'd need to do less PWM (if any). The chip will drop some voltage, but it might still run it a bit higher than you'd want unless you do some PWM of the motor enable pins.

peteb
Posts: 3
Joined: Tue May 06, 2014 5:32 am
Location: Orange NSW Australia

Re: HELP with H Bridge (DC Motors)

Post by peteb » Wed May 07, 2014 1:39 pm

Hi,

Thankyou so much! I have connected 2x9v batteries in series taking into consideration what you have told me, thinking that the 8v may not have been enough to drive the output. It now works so thankyou very much.

Pete

Post Reply