element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Cypress Kits
  • Products
  • Dev Tools
  • Cypress Kits
  • More
  • Cancel
Cypress Kits
Forum PSoC 4 Pioneer Kit Community Project#045 – Stepper Motor Example
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Cypress Kits to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 22 replies
  • Subscribers 34 subscribers
  • Views 8031 views
  • Users 0 members are here
  • 100projects
Related

PSoC 4 Pioneer Kit Community Project#045 – Stepper Motor Example

cy.wbz
cy.wbz over 13 years ago

Hello!

 

In today’s example we will be showcasing a very simple stepper motor example project. In this example we show you how to spin a stepper motor using the PSoC 4 Pioneer kit and the Arduino Motor Shield.

 

image

 

Forum Post Attachments:

 

At the bottom of this post we are including the following items:

  • Example Project Zip File
  • Zip File of Images
    • Project Schematic
    • Component Configurations

 

Components Used:

 

The user can download the example project at the bottom of this post. The project uses the following list of Creator Components:

  • PWM
  • Control Register
  • CyClock
  • CyPin

 

The components are configured by right clicking on the component in your Top Design schematic view and selecting Configure. Please enable the following selections in the Configuration windows for the listed components above.

 

Firmware Description:

 

The main.c firmware is included in the example project. Please review the commented sections for more details.

 

In this example we are giving users an example on how to control a Stepper Motor. In this example we have included a number of motor control source files that will provide you simple APIs to control the motor. These files are:

  • genSine.c/h
  • inputScan.c/h
  • Move.c/h
  • PhaseControl.c/h
  • systemInit.c/h

 

The firmware is designed to drive the stepper motor is various directions and different speeds and different lengths of time. There are a number of if/else statements that progress through the demonstration. Please take a few moments to review the included source files to get a feel for the firmware controls for the motor.

 

Hardware Connections:

 

Connect the Arduino Motor Shield to the PSoC 4 Pioneer Board. Then connect wires from the stepper motor to the Arduino Motor Shield and power the motor.

 

image

 

Test Your Project:

 

Program your project and power up the Motor Shield using an external power supply.

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

I hope this example can help you in your design.

 

Best,

Matt

Attachments:
6175.Project Images.zip
StepMotor_PSoC4200_demo.cyprj.Archive01.zip
  • Sign in to reply
  • Cancel

Top Replies

  • e14 Contributor
    e14 Contributor over 10 years ago in reply to balearicdynamics +1
    Enrico, I'm referring to the one linked in the project above: A000079 - ARDUINO - ADD-ON CARD, MOTOR SHIELD R3, L298P | Newark element14 I'd be happy to use another one that is compatible, if you know…
  • balearicdynamics
    balearicdynamics over 10 years ago in reply to e14 Contributor +1
    Hello Shaka, I am providing this At the actual date I have already developed a couple of prototypes: The first project is in the state of waiting for the PCB ready and the principle and schematics has…
  • lindulajj
    lindulajj over 8 years ago +1
    Hello, the link to the Adriuno Motor shield shows that it is No Longer Manufactured. Can anyone recommend a motor shield that is compatible with the PSoc4? How about this one from Pololu: https://www.pololu…
  • e14 Contributor
    e14 Contributor over 10 years ago in reply to balearicdynamics

    Enrico,

     

    I'm referring to the one linked in the project above: A000079 - ARDUINO - ADD-ON CARD, MOTOR SHIELD R3, L298P | Newark element14

     

    I'd be happy to use another one that is compatible, if you know of any

     

    -Matt

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • balearicdynamics
    balearicdynamics over 10 years ago in reply to e14 Contributor

    Hello Shaka,

    I am providing this image At the actual date I have already developed a couple of prototypes:

     

    The first project is in the state of waiting for the PCB ready and the principle and schematics has been presented in this article: Dual stepper intelligent motor controller - part #1 Hardware As you can see, the provided microcontroller board is a PSoC 4 but exactly the same circuit and schematics (and obviously the same PCB) can be used on Arduino. This circuit IMHO has the interesting feature that instead of using four PWM signals to control the motor, it is sufficient just two signals. The fact that with the stepper motors the opposite direction of the PWM signals on the phases invert the step direction, this is automatically enabled by a PN2222 transistor so are sufficient two PWM pins to control the stepper motor.

    The PCB design will be ready in few days but as you can see in the article it has been designed to host a PSoC4 microcontroller. The circuit without the PSoC soldered on board can be anyway used with Arduino or a reasonable number of other microcotrollers. As I have these first set of PCB ready and assembled I will make another one based on the Arduino Shield form-factor, just to simplify the installation of the controller over the Arduino uno boards, but to be honest this is not my highest priority.

     

    As mentioned above there is also another project that will be available very soon where a single L293D half bridge can be used (in the same configuration of the board above) to control two DC motors instead of a single stepper.  So the board will be used to control two stepper motors or four DC motors just modifying the software.

     

    Enrico

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • e14 Contributor
    e14 Contributor over 10 years ago

    I was able to order one of the current motor shield boards from present stock. 

    Enrico, thank you for the additional options.  I'll check them out as well.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • kowsar
    kowsar over 9 years ago

    this is more usefull project thanks really it helps me alot . i have one quesition could you please tell me the psoc 4 code of solar panel i am designing psoc solar tracker by using stepper motor .

    thanks

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • lindulajj
    lindulajj over 8 years ago

    Hello, the link to the Adriuno Motor shield shows that it is No Longer Manufactured. Can anyone recommend a motor shield that is compatible with the PSoc4? How about this one from Pololu:

     

    https://www.pololu.com/product/2503

     

    Thanks,

    Joe

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • balearicdynamics
    balearicdynamics over 8 years ago in reply to lindulajj

    Hello,

     

    if you need to control a stepper motor there are many options you can decide and I think that this you mention is ok. As a matter of fact you can connect the PSoC 4 with right pins to any motor control board. No matter what, just check that the signals are compatible. I wrote something about this in past. Here are the posts:

     

    Dual stepper intelligent motor controller - part #1 Hardware  I have some PCB already prepared at home. I had not yet had time to put them on the market.

    PiIoT - The perfect reading place #15 [tech]: Stepper motors and controller testing (5$ Gearbest Stepper controller)

    Infineon DC Motor Shield w/ TLE94112EL for Arduino - Review This is another good motor controller (better for dc motors) that will work for sure with the PSoC4 via the SPI protocol

     

    Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • lindulajj
    lindulajj over 8 years ago in reply to balearicdynamics

    Enrico,

     

    Hello, how about this one:

     

    SainSmart L293D Motor Drive Shield

     

    Thanks,

    Joe

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • balearicdynamics
    balearicdynamics over 8 years ago in reply to lindulajj

    Hello Joe, please can you post the link? In theory it works. But better to see what it is exactly

    Anyway my circuit if I am not wrong is just based on this.

     

    Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • lindulajj
    lindulajj over 8 years ago in reply to lindulajj

    However, maybe this one

    Adafruit Motor/Stepper/Servo Shield for Arduino v2.3 Kit

     

    is better.

     

    Thanks,

    Joe

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • lindulajj
    lindulajj over 8 years ago in reply to balearicdynamics

    Here is the link to the page that says the Arduino Shield is no longer available:

     

    Arduino Motor Shield

    A000079 - ARDUINO - ADD-ON CARD, MOTOR SHIELD R3, | Newark element14

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
<>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube