piątek, 13 listopada 2015

IBT-3 H-bridge module with arduino


Back after some time with good news :)


For my personal project I was looking for H-bridge module. There is always option DIY or BIY....

Anyway, there is very nice article about older module IBT-2 but probably there is no article about IBT-3 ...

This is picture of IBT-3 module which come to me from ebay (id: good4deal999).


It has few connectors. IN1, IN2, GND, PWR -/+ and MOTOR (power output).

From description:
- 50A current limit,
- 5V up to 15V (tested by me on 5S life accu, works, no issues with 120Watt/12V rc tire truer engine),
- max 99% PWM.

Caution: please remember that this module can't accept 100% PWM pulse width. Can't use 255 value in analogWrite() function. DC engine will cogg!!!

In my case, when I drive on arduino like UNO shield, 99% gives value 252.45 from 255 (analogWrite(PIN, value)), but I tested 254, module probably works on limit now.

In prototype device which is not published ;) max value of PWM is 252, will test it on 254 to see which element get hot ;)

 Some wires mess:









Movie:

 

Arduino sample code:

// IBT-3 H-bridge module test
// m.abramowicz@abram.pl
// 2015-11-13

/*
 * simple test code which will rotate CCW and CW small DC engine using PWM
 * from ebay page there is info that this module needs max 99% for PWM, can't use 100% :(
 * if 255 is max value for analogWrite, then 99% is about 252.45 -> 252 max!
 * if value 255 is set, then DC engine cogs ...
 * max tested is 254 without cogging
 */

// define pins
// arduino 5 -> IN1
#define PIN_CW 5
// arduino 6 -> IN2
#define PIN_CCW 6

// max tested was 254
#define MAX 252

void setup() {
  pinMode(PIN_CW, OUTPUT);
  pinMode(PIN_CCW, OUTPUT);
  // set h-bridge pins to 0
  digitalWrite(PIN_CW, LOW);
  digitalWrite(PIN_CCW, LOW);
  delay(300);
}

void loop() {
  // put your main code here, to run repeatedly:

  // PIN_CCW set to LOW;
  digitalWrite(PIN_CCW, LOW);
  //start CW
  for (int fadeValue = 0 ; fadeValue <= MAX; fadeValue += 2) {
    analogWrite(PIN_CW,fadeValue);
    delay(10);
  }
  delay(1500);
  // stop
  for (int fadeValue = MAX ; fadeValue >= 0; fadeValue -= 2) {
    analogWrite(PIN_CW,fadeValue);
    delay(10);
  }
  digitalWrite(PIN_CW, LOW);

  //start CCW
  for (int fadeValue = 0 ; fadeValue <= MAX; fadeValue += 2) {
    analogWrite(PIN_CCW,fadeValue);
    delay(10);
  }
  delay(1500);
  // stop
  for (int fadeValue = MAX ; fadeValue >= 0; fadeValue -= 2) {
    analogWrite(PIN_CCW,fadeValue);
    delay(10);
  }
 
}

I can say, for that money what I paid, there is almost no option to do it better at home with my skills ;) Prepare project, count some values ... I said no, not for 10$ ... I'm not electronic kung fu panda!


2 komentarze:

  1. Hello sir, is the fade really necessary?

    Can I just do like this?
    digitalWrite(PIN_CCW, LOW);
    analogWrite(PIN_CW, value);

    OdpowiedzUsuń
  2. Hi.

    Why not to use fade?

    You can do whatever want to do ;)

    But starting engine like analogWrite(PIN, 240) without starting from 0 to some value by steps ...

    OdpowiedzUsuń