Hello everyone, I am currently working on making a device that I can use with amazon alexa to control the curtains in my room. I have successfully built and programmed it, but I can not figure out how to properly power it. It uses an node MCU ESP-8266, Ln298N motor driver, a NEMA 17 stepper motor and two buttons. When I connect it to my variable power supply and set it at 12 volts, it sucks about 3.4 amps. It works like this and the stepper motor turns like it is supposed to, but the L298 chip gets extremely hot, so much so that I can see smoke coming off of it. Before I bought the variable power supply, I estimated that it would take about 4 amps to power, giving the stepper motor 2 amps, the micro-controller 1 amp, and the L298N 1 amp, but the same thing happens when I plug the 12 volt 4 amp power supply into it, I get magic smoke. I will include all the pictures and schematics that I can, all the help I can get would b appreciated, I do not know how to power it without making the chip get so hot. Im sorry if the problem is obvious, I just graduated High School and I have no formal education concerning electronics other than what I have taught myself. Thank you!
This is the power it was taking while the stepper motor is running
Here is all of the wiring
This is the device, the idea is that when the curtain is either all the way open or closed, a stop attached to a string hits one of the buttons and the stepper stops turning.
and a picture with the cover on, the entire case and cover is 3D printed.