1 Reply Latest reply on Sep 25, 2017 3:04 AM by jobi

    PSoC4 and stepper motor

    karla.drazen_2665571

      Hi!

       

      I'm trying to run a 12 V, 0.6 A unipolar stepper motor from PSoC4 using 4 MOSFETs. The problem is that the motor doesn't rotate, it seems that nothing happens.

       

      It is 6 wires stepper motor and I determined the middle wires for the each coil and connected them to 12 V. Other 4 wires are connected to 4 N-channel MOSFETs. I use four 100 ohm gate resistors and four 2.2 k resistors as pull down resistors, as shown on the schematic. I wasn't sure how to calculate values for the gate and pull down resistors, maybe I use too big resistors? Is there any formula how to calculate these values?

       

      I use IRF630 MOSFETs and I'm not sure can I drive them from PSoC4?

       

      Code is quite simple:

       

      #include "project.h"

       

      int main(void)

      {

          CyGlobalIntEnable; /* Enable global interrupts. */

       

          /* Place your initialization/startup code here (e.g. MyInst_Start()) */

         

          int currentState = 0;

       

          for(;;)

          {

              /* Place your application code here. */

             

              switch (currentState){

                 

                  case 0:

            

                      Pin_1_Write (1);

                      Pin_2_Write (0);

                      Pin_3_Write (0);

                      Pin_4_Write (0);

                      break;

                  

                  case 1:

                     

                      Pin_1_Write (0);

                      Pin_2_Write (1);

                      Pin_3_Write (0);

                      Pin_4_Write (0);

                      break;

                 

                  case 2:

                     

                      Pin_1_Write (0);

                      Pin_2_Write (0);

                      Pin_3_Write (1);

                      Pin_4_Write (0);

                      break;          

                 

                  case 3:

                      Pin_1_Write (0);

                      Pin_2_Write (0);

                      Pin_3_Write (0);

                      Pin_4_Write (1);

                      break;

              }

         

              if (currentState < 4)

              {

                  currentState++;

              }

              else

              {

                  currentState = 0;

              }

             

              CyDelay (100);

          }

      }

       

      /* [] END OF FILE */