I am very new to the world of raspberrypi and I am probably making some beginner mistakes. I am trying to move a NEMA17 motor (stepper motor) using a Raspberry Pi 3B+ and a4988 driver.
First I set the driver voltage to 12v (since Imax = Vref/(8Rs); Vref=1.5A8*0.1 Ohm ; vref=12v).
So, after this adjustment and measuring it with the multimeter I connected the motor to the driver (Red wire to 2A, Blue wire to 2B, Green wire to 1A, Black to 1B).
I also connected the voltage of 5V (pins 4 y 6) and 12 v after transform it.
Additionally I connected MS1, MS2 and MS3 of the driver with pins 8, 10 and 12 of the Raspberry Pi . Finally I connected pins 38 and 40 of the Raspberry Pi to the step and dir pins respectively.
Something like this:
The code I used is from this page (https://www.iotdesignpro.com/projects/raspberry-pi-stepper-motor-control-through-a-webpage-using-flask) I paste the link to the page as I don’t want to overwhelm the reader writting here all the code.
After switching on the transformer the driver gets very hot and the motor makes noises but does not run. I followed all the instructions on the page copied above. What am I doing wrong?
Any contribution will be welcome. Thank you in advance.
I paste photos of the connection:
- 1There are too many possibilities. I suggest you do one thing at a time. Perhaps just a simple program to pulse the stepper? You need to localise the fault(s). – joan 7 hours ago
- 1And unless you properly anchor the power cable and cover the power connections you may not live to try other methods. – Milliways 5 hours ago
- @Adrián P.L., Welcome and nice to meet you. I very much appreciate your very considerate, very concise and yet very detailed question, which is, in short: “How can Rpi3B+ use the A4988 driver to drive a NEMA17 stepper motor? I am thinking to writing up an answer this gloomy, locking down Saturday afternoon. It would be nice if you can let me know the web links to the following: (a) The NEMA stepper motor, (b) The A4988 driver module, (c) the PSU (not too important though). And can I assume that you are using the most update Rpi buster OS? Have a great project. Cheers. – tlfong01 1 hour ago
- Before answering a question, I usually search the forum for related questions, to avoid reinventing the wheels. The search results is disappointing: either superficial answers, or generic answers not related to the specific ddriver A4988. This is the search summary: (1) Related Questions on Rpi SE (given by Rpi SE built in search system) (a) 4 rPi2 model B v1.1 smoke comes out near power port, (b) 1 Updated info/software/advice on using Raspberry Pi to control stepper motor drivers, (c) 0 Can this DC Motor Driver feed my RPi?, / to continue, … – tlfong01 36 mins ago
- / cont’d, … (d) 1 Rpi GPIO Interface L298N DC Motor Driver Troubleshooting Problem, (e) 1 Robot Buggy Not Moving Once Set On Surface, (f) 0 brushless dc motor connection, (2) Search “A4988” found 5 results (a) Which driver for controlling bipolar stepper motor with a raspberry pi? Asked 4 years ago, Viewed 587 times raspberrypi.stackexchange.com/questions/55632/…, / to continue, … – tlfong01 35 mins ago
- / cont’d, …(b) How to control unipolar/bipolar stepper/stepping motors such as 28BYJ48 using motor drivers such as L293D – Asked 2 years ago, Viewed 884 times raspberrypi.stackexchange.com/questions/97975/…. This last answer is on the generic stuff of stepping motor and drivers, but not at all on A4988. / to continue, … – tlfong01 34 mins ago
- / cont’d, … So it would be useful for the OP to get a rough idea on stepper motors and drivers, using popular drivers such as ULN2003 and L293D, which are general drivers for both DC motor and stepping motors, again not specific for stepper motors. – tlfong01 29 mins ago
- I skimmed the tutorial the OP followed and found it a bit too complicated: Raspberry Pi Stepper Motor Control through a Webpage using Flask (Rpi, NEMA 17, A4988, Flask, RpiMotorLib) – IoTDesignPro, 2019dec06 iotdesignpro.com/projects/…. The project is based on the web page based Flash server and the RpiMotorLib tested on Rpi3B and might not be compatible to Rpi4B. / to continue, … – tlfong01 15 mins ago
- / cont’d, … My plan is to start the testing as simple as possible, starting with the simplest schematic, and using manual jumper wires to input motor driver signals by hand, ie, offline without using Rpi. It is only after successful off line by hand testing of the A4988, then I would try to use a simple, cheapy, sig gen, such as NE555 or XY-PWM sign gen to do, stall offline, PWM speed adjustment of stepper motor. If offline sig gen test OK, then I will try Rpi3B/+/4B using python to control the A4988. The OP, can carry on my test with Flask and RpiMotorLib. – tlfong01 9 mins ago
- PS. I found the OP’s question only tagged with “DC Motor” but no “Stepper Motor“. I tried to add tags “Stepper Motor“, “Stepping Motor“, “A4988” etc but no luck. Perhaps I would suggest Rpi SE to at least add the tag “Stepper Motor”, after I have completed my stepper motor answer here. – tlfong01 just now Edit