Using the Bammer Motor driver with Ardunio

Making robots move is not always easy. Driving motors can be a difficult task and the Bammer motor driver can make moving DC motors a lot easier. This motor driver is designed to be easy to use and bullet proof. With this motor driver you can have a motor moving in minutes with an Arduino and there are no external libraries needed.

Materials Required

  1. A DC motor or two
  2. A power supply, preferably something rated for your motor (you can check the motor product page)
  3. An Arduino and some jumper wires

Wiring the Arduino to the Bammer Board

Connect the wires according to the pinout diagram. You can connect the wires differently but then you will have to change your Arduino code for the motor to spin correctly. Remember not to apply power until you are finished wiring.

Once you are finished wiring you should have something similar to the image below. If you are using a battery, it is recommend to test with something small if you are not sure if the battery and the motor will work together.

Programming the Arduino

The way this driver is designed to work with Arduino is very simple. It uses 3 pins to control the basic functionality of the motor driver. With these pins you can disable/enable the driver, change direction and change speed.

  • Sleep: This pin will put the motor driver to sleep. This will disengage any power going to the motor. A high signal will activate the motor driver and a low signal will disable it
  • Direction: A high signal on this pin will cause the motor to spin forward and a low signal will spin the motor the other way.
  • Enable/PWM: Giving this pin a high signal will cause the motor to spin in whatever direction is selected by the direction pin. If the pin is low the motor will not spin. Pulsing this pin on and off very fast can be done to change the speed of the motor. This is done with functions like the Arduino analogWrite() function.

To understand how we can program this motor, take a look at the comments in the code below. If you want to use this motor in your own code all you need to do is use the motor1Speed() function.

 

The Motor is Spinning

If you followed the hookup guide and the coding, you should have a spinning motor once you turn the power on. The motor should spin slowly to full speed, quickly stop, and then change directions.

You may need to control two motors, the Bammer drive is perfect for this. All you need to do is add a few more jumper wires and add another function and pin definitions for the second motor. If you are using a board with many pins you can hook up many Bammer board. Just remember not to push your power supply past its limits.