HomeElectronicsTest and MeasurementUsing the Analog Discovery 2 to Debug Different Motor Controllers

    Using the Analog Discovery 2 to Debug Different Motor Controllers

    This project presents how to create and run an automated test written in C to debug an H-Bridge DC motor controller and a stepper motor controller with Digilent Analog Discovery 2 Logic Analyzer, Static I/O, Voltmeter, and Pattern Generator.

    Digilent Analog Discovery 2 (134-6480) is a USB oscilloscope, logic analyzer, and multi-function instrument that allows users to measure, visualize, generate, record, and control mixed-signal circuits of all kinds. Driven by the free WaveForms software, Analog Discovery 2 can be configured to work as any one of several traditional test and measurement instruments including an Oscilloscope, Waveform Generator, Power Supply, Voltmeter, Data Logger, Logic Analyzer, Pattern Generator, Static I/O, Spectrum Analyzer, Network Analyzer, Impedance Analyzer, and Protocol Analyzer.

    Featured products

     

    Digilent Analog Discovery 2 PC Based Oscilloscope, 30MHz, 2 Channels

    Digilent Analog Discovery 2 PC Based Oscilloscope, 30MHz, 2 Channels

    Arduino, Uno Rev 3

    Arduino, Uno Rev 3

    WaveForms is the free software application for Analog Discovery 2 and enables any of Analog Discovery 2 instruments including oscilloscope, logic analyzer, and function generator. WaveForms SDK (Software Development Kit) provides libraries and examples to write custom applications in C, Python, and more.

    We want to debug an H-Bridge DC motor driver and a stepper driver are controlled by an Arduino UNO with Analog Discovery 2. Two potentiometers are used to set the speed of the DC motor and the position of the stepper. A Hall-effect sensor sends an interrupt signal to the MCU after every half-turn of the DC motor, and the direction of rotation is changed. We read volage across potentiometers. Both motors should be tested by sending digital control signals to the drivers, while the MCU is disabled, Then, we take the measurement after enabling the MCU.

    Create an automated test application

    Create an automated test application

    Firstly, we create the header file (AD2_motor_debugger.h) to declare and define the following functions. We also include DWF Library (dwf.h) and other standard C libraries in the header file.

    1. Initialize Analog Discovery 2
    2. Reset Analog Discovery 2 instruments
    3. Write a value in Digital I/O pins (For Static I/O)
    4. Read voltage from an analogue input (For Voltmeter)
    5. Drive two motors (For Pattern Generator)
    6. Record digital signals (For Logic Analyzer)
    7. Save the data into .csv

    The main source file (main.c), which is a wrapper, defines the structure of the project and two scripts, one in Python and one in MATLAB, for displaying the recorded data

    We define connections and connect the Analog Discovery 2 at the start of the main source file. To test the motor drivers, the Arduino Uno must be turned off by setting its RESET pin to low. After that, the voltages on the potentiometers can be read, and the digital_write() and PWM generation functions can be used to test both motors with varying speeds, in both directions.

    To record the signals coming from the Arduino, it must be turned on, by setting its RESET pin to logic high. We allocate memory for the number of samples (data_size) and buffer size (digital_data). After the acquisition, data loss/corruption should be checked.

    The results of the test are displayed in the console window along with messages about the current operation.

    Visualize the data in MATLAB or Python

    Data can be exported in a file and visualized by running the plotting.m MATLAB script or the plotting.py Python program.

    ELE Times Bureau
    ELE Times Bureauhttps://www.eletimes.ai/
    ELE Times provides a comprehensive global coverage of Electronics, Technology and the Market. In addition to providing in depth articles, ELE Times attracts the industry’s largest, qualified and highly engaged audiences, who appreciate our timely, relevant content and popular formats. ELE Times helps you build awareness, drive traffic, communicate your offerings to right audience, generate leads and sell your products better.

    Related News

    Must Read

    Renesas Expands Sensing Portfolio with 3 Magnet-Free IPS ICs & Web-Based Design Tool

    New Simulation & Optimization Platform Enables Custom Coil Designs...

    IEEE IEDM, 2025 Showcases Latest Technologies in Microelectronics, Themed “100 Years of FETs”

    The IEEE International Electron Devices Meeting (IEDM) is considered...

    OMNIVISION Introduces Next-Generation 8-MP Image Sensor For Exterior Automotive Cameras

    OMNIVISION announced its latest-generation automotive image sensor: the OX08D20, 8-megapixel (MP) CMOS...

    Vishay Intertechnology Expands Inductor Portfolio with 2000+ New SKUs and Increased Capacity

    Vishay Intertechnology, Inc. announced that it has successfully delivered...

    Keysight to Demonstrate AI-enabled 6G and Wireless Technologies at India Mobile Congress 2025

    Keysight Technologies will demonstrate 20 advanced AI-enabled 6G and...

    Ashwini Vaishnaw Approves NaMo Semiconductor Lab at IIT Bhubaneswar

    As part of a big push towards the development...

    Electric Mobility Drives India’s Power Electronics Expansion

    India is on the verge of an electric revolution....

    India Targets 40% Local Value Addition in Electronics with New Component Scheme

    India's electronics manufacturing landscape is set for a major...