Queries about Arduino+Stepper Motor+L298N

Greetings!

I am fairly new to the world of electronics, so please bear with me if my questions seem a little mundane.

I am working on a project to develop an Arduino based, 2-axis, laser cutting machine, to cut profiles from balsa wood (and similar materials) of thickness <3mm. The idea is to achieve the cutting action using a laser diode(currently experimenting using a 500mW diode, will welcome any guidance in this matter), and the controlled movement of the laser diode using 2 stepper motors (one for each axis).

I am using an Arduino Uno Atmega328f, L298N Motor Driver, 17HS1538-P4170(which I got off Banggood) stepper motor(s).

Due to my inexperience with this, I decided to start by learning to control one stepper motor using the Arduino. The objective was to implement the stepper_oneRevolution sketch, for one revolution cw and one ccw.

I’ve identified the coils of the stepper motor by shorting two coils at a time and identifying which combinations increase the resistance of the motor shaft. With the shaft protruding upwards, from left to right, I’m assuming the “terminals” are A+, A-, B+, B- respectively. A+, A-, B+, B- are connected to OUT1, OUT2, OUT3 and OUT4 on the L298N. IN1, IN2, IN3 and IN4 are connected to pins 8,9,10,11 on the Arduino respectively.

  1. I’m powering the motor using 12V, 1.5A DC from a wall adapter. I’ve removed the 5V_EN jumper on the L298N. I connected the +ve wire of the adapter to the +12V of the L298N, the -ve wire of the adapter to the GND of the L298N as well as the Arduino. Since the 5V_EN jumper is not in place, I connected the 5V output of the Arduino to the 5V input of the L298N. I powered the Arduino using USB from my laptop, uploaded the sketch, connected the 12V wall adapter to the socket and switched it on.
    The motor spins erratically, both cw and ccw. I can feel slight charges/ shock as I run my fingers across the laptop body.
    Is this normal? What am I doing wrong with regard to the motor?

  2. Can I upload the sketch to the Arduino, power the Arduino using it’s barreljack(and a DC adapter), and power the L298N using a separate DC adapter? I will connect the GND of the L298N and the GND of the Arduino by wire. Is this safe?

  3. Can I use a single DC adapter, connect the positive wire to the +12V of the L298N AND the Vin of the Arduino in parallel, as well as the GND of both the L298N and the Arduino in parallel?

Which is the best method?

After gaining a little knowledge by successfully turning the motor one revolution in either direction, I would like to do the same using an A4988, and then achieve synchronous motion of 2 stepper motors using the A4988.

Any guidance will be greatly appreciated!

Thanks

Forget the L298. Those ancient drivers are inefficient and just crap compared to modern drivers like the A4988 and DRV8825. The rated coil current for the motor is 1.68A so a bit outside the current that an A4988 can supply. The DRV8825 would be a better choice. Either way, be sure to set the current limit as described on the Pololu page for the driver. And a power supply that can supply a minimum of 2A at 12V. A 24V supply will give better speed and torque if required.

See stepper basics by robin2 for more information on steppers, drivers, and power supplies.