4796

We will literally make no programming in this project to control the speed and direction of stepper motor using A4988

Tools that you will need
Probably you will need some electronics designing and assembly skills in this project if you are willing to build your customized Stepper Controller similar to mine, but you still can use the ready made A4988 shield along-side with some other on breadboard and it will perfectly work. So in case you will make your own Stepper Controller then you will need some Supplies for the Software and the Hardware, here I list them both:
  • Software
Altium designer
Solidworks
  • Hardware:
Hot-Plate for PCB assemblySolder iron
Solder Paste CHIPQUIK SMDLTLFP10T5
Flux removal solvent
Tape
Spatula
In addition to the Printed Circuit Board and its electronics components which are listed in Step 3.

Details About A4988 
Maybe you saw it somewhere but probably you didn't spotted these details, actually the name of the "A4988 Stepper Shield" firstly invented by inventors of Polulu Robotics & Electronics when first DIY CNC Machines appear since these Stepper drivers helps to easily driver the Steppers of CNC machines but the name itself comes from the Integrated Circuit of the Shield which is the A4988 designed and manufactured by British company Allegro Microsystems mainly oriented to Automotive industry sector.The Shield is now a popular part among makers and even engineers since it is highly used in prototyping due to its high performance mainly coming from the A4988 IC.This chip helps to drive a Bipolar Stepper Motor in full-, half-, quarter-, eighth-, and even sixteenth-step modes which gives high motion precision, it is also able to drive up to 2Amps per stepper coil at up to 35V DC which is very satisfying to drive several Stepper Motors Models.You can find the full Part Datasheet by clicking this link.In our project we will not consider Microstepping mode of this IC since the stepper will run in continous mode with adjustable speed and controlled direction.

It's Good to Make a Prototype  
I will not immediately get to the Circuit board design but first it is always recommended to try your circuit on a breadboard as long as you have some ready made modules and then once it works without problems then you can transform the whole circuit from the breadboard into one Printed Circuit Board design so here we are.
 I used the A4988 Module provided by Polulu and if you don't know how to properly interface with it then maybe you want to ready my posted video about it by clicking this link.
The circuit is mainly based on the signals coming from the NE555, I manage to generate a square wave form signal from this IC configured in Astable mode, the square pulses frequency will define the stepper rotation speed since this signal will go from the NE555 Output pin straight to the STEP pin of A4988 module, remember that the higher the signal frequency the faster the motor speed, I controlled the frequency of the output signal through a potentiometer acting as voltage divider on the THRES pin of NE555. The main power input is 9V DC converted to 5V through a 7805 voltage regulator to get the appropriate logic voltage for the A4988, I place a slide switch on the DIR pin of A4988 module in order to control the motor direction, in such setup the pull-up high of the DIR pin will switch the Motor rotation direction.

From Breadboard to Circuit Board  
Here is the advantage of this guide, I'm intending mainly to show you how you could produce your own customized circuit board design and put all the parts and components that you use from your prototyping breadboard in one circuit board design that you could take it to the market for selling (always good to make incomes pushing you forward in your invention journey). I moved to Altium designer ECAD tool that helps me to put all the prototype blocks in one schematic and then transform the schematic into a PCB design to establish the nets connection of my blocks and this way I get the whole design in one circuit board then send it to the manufacturers the easy way.I kept the same arrangement as my breadboard by dividing the schematic into four main blocks:
  • Power supply Input
  • Voltage regulation
  • NE555 Astable Mode Configuration
  • A4988 Setup

Power Supply Input
I used the DC Jack connector to get the 9V input power through it, this power entery will be provided for both the voltage regulator and the Motor coils through the A4988 stepper driver, I also inserted a slide switch for On/Off power control.I didn't used any protection (Like SMD fuse) because this is just a prototyping model and I'm not intending to make it looks so commercial but you still can drop some budget on your design and you add a Fuse at the power entery. 

 Voltage regulation
This is a very simple stage, I placed a voltage regulator component that get a 9V DC of the power Input and provide a 5V DC at its Output we will use this dropped down voltage to power on the A4988 Module and the NE555 integrated circuits. 

 NE555 Astable Mode Configuration
It is amazing how we could use such integrated circuit for several purposes! I configured this component in Astable mode to generate a square wave signal that helps to control the stepper rotation steps speed, the square wave frequency could be adjusted through a potentiometer so I used an SMD one to keep a compact size of my design. 

 A4988 Setup
The heart of our circuit board since eveything is turning around it, I refered to the setup provided by Polulu Robotics & Electronics where they posted the tested circuit setup for their designed shield and here I followed the same setup (same parts values) in order to get the same functionalities, I just adjusted the input net of STEP pin that I connected to the output pin of NE555 and I place a slide switch to the DIR pin, also the slide switch is an SMD one to save space on the Printed Circuit Board. The outputs of A4988 circuit will are connected to a "quick-mount" terminal block where we will wire the Stepper coils wires. 
 Schematic PDF is available for download through the files section

Convert to Printed Circuit Board (PCB)
After getting the Schematic ready I then converted it to a PCB design, I check the Nema17 drawing for the exact stepper size measures to draw the board outline of my circuit board since I manage to place the module at the back-side of the stepper motor and make it looks like a true shield. I then brought the components to the board area and arranged them in the appropriate layout, I considered to keep the parts of each same block closer together because this will help me later while routing the circuit board.I also drawed a 45 angle degrees copper pour area around the top layer to act as a heat dissipation for A4988 chip.A track width of 0.254mm is suitable for the connection nets, I used a 0.5mm track width for the 5V, 9V and the motor outputs since these tracks will carry a higher current.After finishing the PCB routing I generated the GERBER design files and send it for manufacturing.

Shield Assembly
In order to produce this Shield I moved to JLCPCB where I uploaded the design files (GERBER) to their website for PCB and Stencil order (the Stencil will help me deposit the solder paste equally on the board, this is just an option so you still can produce your shield without the use of Stencil). I selected the Black color for the Board and the Golden Nickel surface finish, no purpose for my selection so you could go for the most appropriate settings of your choice based on your budget.At this level you will use the supplies that we posted on the "Supplies" section, first you need to stick the PCB on a flat surface and then stick the Stencil above it to keep the pads exposed, you then drop the solder paste on the Stencil and use the Spatula to deposit the solder paste, once you remove the Stencil covering the PCB you will get the solder paste covering the exposed pads and no extra solder paste around these pads. 
Now you place the electronics components each one to its place on the board and use the Hot-Plate to heat the solder paste and get the electronics components soldered.  This technique is for the SMD parts, about the Terminal block you will use a solder iron for the assembly of this part. 
Once you get the Shield assembled you will notice the purple LED lighting up as soon as you plug-in the power supply connector to the board's main power. 
Now we unscrew the Nema17 housing and we place the Shield to its back-side then screw it again, the last step is connecting the Stepper coils ends to the terminal Block following the label that I draw on the Shield as a coils connection guide. 

 Testing the Shield
After getting the Board very well assembled, I plug-in the power supply cable coming from a 9V DC power source and the stepper starts spinning, the Speed is controlled through the rotary potentiometer and the direction is controlled through the direction slide switch. 
 This way we completed the making of this Shield and I hope that I explained the details that you need to make your own one, feel free to write your thoughts around it in the comments section.