Close

23.09.2019 - replacing driver motor l298n

A project log for TE-01

a Versatile robotic platform for various tasks.

nj1337nj1337 09/23/2019 at 20:090 Comments

Today i have replaced the l298n driver motor with a DRV8833.

My base is using 4 x DC 3-6V motor and the chip has only 4 pinout. I made some "Y" dupont cable for the "H" bridge, and after some tests, it's working. so the like the l298n, the DRV8833 can handle 4 motors. 

Here is my test code for the arduino in C++: 

#include <Arduino.h>

// Serial Debug
const unsigned long BAUD_RATE=115200;

#define pinINA1 6 // Moteur A, entrée 1 - Commande en PWM possible
#define pinINA2 7 // Moteur A, entrée 2 - Commande en PWM possible

#define pinINA3 8 // Moteur B, entrée 1 - Commande en PWM possible
#define pinINA4 9 // Moteur B, entrée 2 - Commande en PWM possible


void setup(){
  Serial.begin(115200);
  Serial.println("Test DRV8833");
  
  // Initialize les broches de commandes DRV8833
  // du moteur A
  pinMode( pinINA1, OUTPUT );
  pinMode( pinINA1, OUTPUT );
  digitalWrite( pinINA1, 1 );
  digitalWrite( pinINA2, 1 ); 

  // du moteur B
  pinMode( pinINA3, OUTPUT );
  pinMode( pinINA4, OUTPUT );
  digitalWrite( pinINA3, 1 );
  digitalWrite( pinINA4, 1 ); 

}

void loop(){
  // --- Moteur A: Controle pleine puissance -------------------
  // Marche avant
  Serial.println("Marche avant");
  digitalWrite( pinINA1, HIGH );
  digitalWrite( pinINA2, LOW  );
  digitalWrite( pinINA3, HIGH );
  digitalWrite( pinINA4, LOW  );
  
  delay( 3000 );
  
  // Arret par frein (voir documentation)
  Serial.println("Stop");
  digitalWrite( pinINA1, LOW );
  digitalWrite( pinINA2, LOW );
  digitalWrite( pinINA3, LOW );
  digitalWrite( pinINA4, LOW );
  
  delay( 2000 );
}

Before PWM on motor was not working (changing the speed of the motors). Now i can change the speed of the motors and they make less sounds noise. 

I'm using toys motors for testing the thing. i plan to replace them soon.

Here is some part of the project, unmounted : 

Thank you for reading me and have a good day.

Discussions