Basic Motor Speed Control Application

This program demonstrates a basic motor control application that adjusts the motor's speed based on user input. It communicates with the motor controller via USB and sets the motor speed (velocity) according to the user's specified value. This allows for simple motor speed control, where the user can input a desired speed, and the motor will rotate accordingly.

About Tools and Materials:

SMD Redarrow-up-right (Purchase Herearrow-up-right)

SMD USB Gatewayarrow-up-right (Purchase Herearrow-up-right)

Arduino Gateway Modulearrow-up-right (Purchase Herearrow-up-right)

BDC Motorarrow-up-right (Purchase Herearrow-up-right)

Step 1: Hardware & Software Overview

Project Key Components

  1. SMDarrow-up-right The SMD acts as a bridge between the script and the modules. It is responsible for interpreting the commands sent by the script and translating them into actions that read input from the Button Modulearrow-up-right and actuate the BDC motor, the RGB LED Modulearrow-up-right and the Buzzer Modulearrow-up-right.

  2. BDC Motorarrow-up-right The motor is controlled using velocity commands, allowing for smooth acceleration and deceleration.

Project Key Features:

  1. USB Port Detection:

    1. The program starts by detecting the available USB serial port for communication with the motor. It uses the serial module to find connected serial devices.

    2. The program supports multiple platforms (Windows, Linux, and macOS) and automatically identifies the correct port based on the operating system.

  2. Motor Control with SMD Red:

    1. The motor is controlled through the smd.red library, which allows sending commands to the motor via the Red controller.

    2. A Master object is used to establish communication with the motor, and the motor is attached using the Red(ID) method.

  3. Motor Speed Configuration:

    1. The program allows the user to input a speed value (in RPM or another suitable unit). The motor's velocity is set to this value using the m.set_velocity() method.

    2. The motor's other parameters, such as the revolutions per minute (RPM) and control settings, are preconfigured for optimal operation.

  4. User Input:

    1. The program prompts the user to input the desired motor speed, and then it sets the motor’s velocity accordingly. The speed is used to control how fast the motor will rotate.

  5. Feedback to User:

    1. After setting the motor speed, the program confirms the set speed with a printed message: "The engine rotates at speed {speed}."

Step 2: Assemble

Getting Started

  1. Hardware Setup

Project Wiring Diagram

Step 3: Run & Test

Run the Script

1. Upload the Arduino code to the SMD Master Controller using the Arduino IDE.

2. Open the Serial Monitor (set baud rate to 115200).

3. Enter a speed value (0 to 5000) to adjust the motor speed.

Experience Speed Control

• Observe how the motor starts at 50 RPM (default) and adjusts based on the entered speed.

• Enter a higher speed value to increase the motor velocity.

• Enter zero (0) to stop the motor.

Codes

Last updated