Howto run a 12V bipolar stepper motor with arduino micro and L298N at 150rpm

Today I experimented with a 12V bipolar stepper motor and the 5V arduino micro.

To get things working I’ve put the 9V from my six 1.5V Batteries into an UBEC which accelerates them to 12V at a loss of below 10% (at 350mAh) connected them to the VCC of the L298N and wired the 4 signal cables of the motors to it. Because thats a lot of numbers to keep track of – I’ve made a small video of the setup:

Youtube Video

Doing the math according to a wheel with 5,8cm heigth and 150rpm I’ve reached, my robot will be able to run about 1,6 km/h – this might be increased with a better motor driver like they used on the arduino motor shield. I’ve read they reached about 250 rpm on the same motor which would be 2,73km/h.

The code of the arduino is pretty simple:

#include <Stepper.h>

const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution
// for your motor


// init the stepper lib on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8,9,10,11);            

void setup() {
  // nothing to do inside the setup
}

void loop() {
    myStepper.setSpeed(150);
    myStepper.step(stepsPerRevolution/100); 
}

 

Leave a Reply