top of page

Stepper Motor Control using SmartWave

Adam Horvath

Updated: Jan 15, 2024

Effortless Control at Your Fingertips: Experience SmartWave's Instant Connection Capabilities with Our Stepper Motor Demo


Overview

To highlight the user-friendliness of SmartWave, consider the following use case. The heart of this demonstration lies in its plug-and-play convenience. SmartWave requires no elaborate hardware or software setup when connected to a PC. Using the WebGUI interface, engineers can effortlessly configure the SmartWave device, saving valuable time for what truly matters: testing and experimentation.


Setup

In this demonstration, we put the STM32 Nucleo F4464RE Microcontroller Evaluation Board, equipped with the EX-MotorShield8874, in the spotlight to control a stepper motor. The source code for this demo is available on our GitHub.

For this use case, we utilize SmartWave in I2C mode to send commands to the microcontroller and control the stepper motor.


Simplified block diagram

The I2C protocol, widely known for its simplicity and efficiency, employs a two-wire communication interface comprising a serial clock line (SCL) and a serial data line (SDA). It follows a controller-peripheral standard, with the controller initiating communication with one or more peripherals to exchange data and control information.


In this demonstration, after selecting the I2C driver in the WebGUI, the user can configure the SCL and SDA pins on the SmartWave device. Additionally, a unique Device ID has to be set as well, which is 8 for this demonstration.


Used I2C Protocol Details

The data to be transmitted is configured within the Controller Write section of the WebGUI. In this scenario, three bytes of data are transmitted. The first byte contains information about the desired position for the stepper motor, with 0xC8 (equivalent to 200 steps per revolution), representing the highest position achievable. The second byte encodes the motor's speed, with recommended values of 0x0A (slow), 0x64 (normal), and 0xFA (fast). The third byte specifies the direction of rotation, with 0x00 representing clockwise and 0x01 for counterclockwise. Users have the flexibility to express this data as an integer, hexadecimal, or binary value. This data is then communicated to the microcontroller, as illustrated in the figure below, enabling precise control over the stepper motor's movements.

I2C Communication Protocol

How to connect Nucleo to SmartWave


Once the SmartWave is configured in the WebGUI, the next step is establishing the physical connection between SmartWave and the microcontroller for data transmission. This involves connecting the selected pins (SCL and SDA) for data communication, as well as the GND and 3v3 lines for proper electrical connectivity. With these physical connections in place, the system is ready to execute commands sent via the WebGUI. The OLED display on the motor shield offers real-time feedback on the motor's position and current consumption.


SmartWave WebGUI with I2C configuration

To connect SmartWave to the Nucleo board, follow these instructions:

  • SDA to pin PC9 (pin 1 on header CN10)

  • SCL to pin PA8 (pin 23 on header CN10)

  • 3v3 to pin AVDD (pin 7 on header CN10)

  • GND to any GND pin (pin 9 on header CN10)


Nucleo-F446RE Evaluation Board I2C connection

For the initial setup, load the "smartwave.cpp" source file onto the target board. Afterwards, you won't need a USB connection to your PC. Power the Nucleo and MotorShield through the DC barrel jack connector by fitting the JP5 jumper on Pin 3-2 to use VIN as the power source.



ST-LINK VBUS setup

How to use SmartWave

SmartWave is a versatile tool built on an advanced FPGA platform designed to address a wide range of testing needs. It stands out for its flexibility in communicating with various devices, including ADCs, DACs, sensors, and more, using industry-standard interfaces such as SPI and I2C.


A standout feature of SmartWave is its WebGUI, a user-friendly interface providing flexibility in deployment. Users can choose to run the WebGUI on a server for faster access and enhanced security, or run it directly on local machines like PCs for convenience. What makes the WebGUI even more powerful is its ability to save configurations as JSON files. This feature simplifies the process of reproducing test conditions and facilitates seamless knowledge transfer within engineering teams.


Hardware setup

To see the Stepper Motor in action, check the following video Stepper Motor Control using SmartWave.


Conclusion

This demo underscores SmartWave's versatility and user-friendliness, making it an essential tool for a wide range of applications, from motor control to sensor interfacing. The easy configuration, real-time control, and configuration-saving feature enhance the efficiency of engineering tasks.


For those interested in exploring SmartWave's potential in their projects, the document encourages reaching out to semify for more information, product demonstrations, or to discuss specific requirements. Contact details and further information can be found on semify's website at www.semify-eda.com.




Recent Posts

See All

Comentários


bottom of page