I have a bipolar stepper motor with the following datasheet
And a L298N driver
wired like this:
I tried the 3 NPM packages available for the L298N driver
, but none of them work with my set up, the motor just make a noise but don't turn. I tried switching the IN pins and even tried some other python scripts but nothing works, the motor never rotate
Here is a sample code with the pigpio-l298n
package (note: i use 5,6,13,19 GPIO pins instead of the one on the L298N driver image above. Also i put GPIO 26 & 27 for en enable pins but i didn't connected them to the driver since there are already jumpers pins on it)
const readline = require('readline');
const L298N = require('pigpio-l298n');
//bcm code
let l298n = new L298N(26,5,6,27,13,19);
l298n.setSpeed(l298n.NO1,80);
l298n.forward(l298n.NO1);
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.on('line', function (input) {
if (input === 'quit()') {
rl.close();
} else if (input === 'f') {
l298n.forward(l298n.NO1);
} else if (input === 'b') {
l298n.backward(l298n.NO1)
} else if (input === 't') {
l298n.stop(l298n.NO1);
} else {
l298n.setSpeed(l298n.NO1,parseInt(input));
}
});
process.on("SIGINT", function(){
l298n.stop(l298n.NO1);
console.log('shutdown!');
process.exit(0);
});