The "Radar" application is a captivating Python-based project that combines hardware components, 3D printing, and programming to simulate a radar system. This project utilizes an SMD Motor Driver, a DC Motor, and an HC-SR04 Ultrasonic Distance Module mounted on the motor with 3D printed parts. As the motor turns, the distance sensor collects data and displays it in real-time on the user's screen, creating a radar-like visualization.

Project Media:

Project Key Components:

  1. SMD Motor Driver:

    • The SMD Motor Driver serves as the interface between the Python script and the DC Motor. It interprets commands from the script and translates them into actions that control the rotation of the motor.

  2. DC Motor:

    • The DC Motor is connected to the SMD Motor Driver and is responsible for turning the HC-SR04 Ultrasonic Distance Module, creating a scanning effect.

  3. HC-SR04 Ultrasonic Distance Module:

    • The HC-SR04 Ultrasonic Distance Module is mounted on the DC Motor using 3D printed parts. It measures the distance to objects in its path and sends this information to the Python script.

  4. 3D Printed Parts:

    • Custom 3D printed parts are used to securely mount the HC-SR04 Ultrasonic Distance Module onto the DC Motor. These parts facilitate the rotating movement of the distance sensor.

  5. Python Script:

    • The Python script is the core of the application. It communicates with the SMD Motor Driver, reads distance data from the HC-SR04 Ultrasonic Module, and displays real-time radar-like visuals on the user's screen.

Project Key Features:

  1. Rotating Radar Scan:

    • The DC Motor turns the HC-SR04 Ultrasonic Distance Module in a circular motion, simulating a radar scan. The distance sensor continuously collects data as it rotates.

  2. Real-time Distance Visualization:

    • The Python script receives distance data from the HC-SR04 Ultrasonic Module in real-time and dynamically visualizes it on the user's screen. Objects closer to the sensor are represented differently from those farther away, creating an interactive radar display.

  3. User-Friendly Interface:

    • The application includes a user-friendly interface that displays the radar scan and distance information. It provides a visual representation of the surroundings as detected by the distance sensor.

Project Wiring Diagram:

Getting Started:

  1. Hardware Setup:

    • Connect the DC Motor to the SMD Motor Driver according to the provided documentation.

    • Mount the HC-SR04 Ultrasonic Distance Module on the DC Motor using custom 3D printed parts, ensuring secure placement.

  2. Run the Application:

    • Execute the Python script, initiating the "Radar" application.

    • Observe the rotating radar scan on the user's screen and real-time distance information as detected by the HC-SR04 Ultrasonic Module.

  3. Experiment and Customize:

    • Experiment with different scanning speeds, distances, and visual representations.

    • Explore the possibilities of enhancing the user interface, such as adding sound effects or incorporating additional sensors for a more comprehensive radar system.

Project Codes:

from smd.red import*
import time
port = "COM13"
m = Master(port)

# print(m.scan_modules(0))

m.set_shaft_rpm(0,10000)  #rpm and cpr values are depend on the motor you use.
m.set_control_parameters_velocity(0,10,1,0) #SMD 0, Kp, Ki, Kd
setpoint = -20000

m.set_operation_mode(0, 2)    #sets the operating mode to 2 represents Velocity control mode.
m.set_velocity(0, 2000)       #sets the setpoint to 2000 RPM.   
m.enable_torque(0, True)      #enables the motor torque to start rotating

while True:

    distance = m.get_distance(0, Index.Distance_1)
    # print(distance)
    m.set_velocity(0, 2000)

    if m.get_position == 9205:
        m.set_velocity(0, -2000)

Hardware Designs:

Last updated