Please update your browser. For the best Liquid Instruments experience, update to the latest version of Chrome, Edge, Firefox, or Safari. Update Microsoft Edge.
Liquid Instruments Logo
Products
Hardware Platforms
Moku:Delta
Moku:Delta
New
For advanced design and validation
Moku:Pro
Moku:ProFor versatile test and measurement
Moku:Lab
Moku:LabFor experimental research labs
Moku:Go
Moku:GoFor quick testing and debugging
Compare Hardware
Compare HardwareView a side-by-side of all Moku hardware
Technologies
GenInst Studio
New
Generate personalized instruments
Integrated InstrumentsProfessional-grade instruments at your fingertips
Neural NetworkFPGA-powered neural network integration
Multi-Instrument ModeCombine instruments to create a customized test system
Moku CompileCode, compile, and deploy to your Moku's FPGA
Software
MokuOSDownload the Moku app for Windows, macOS, iPadOS & visionOS
APIsPython, MATLAB, LabVIEW
UtilitiesCommand line and graphical tools for file conversion
Instruments
Analysis
Oscilloscope
Spectrum Analyzer
Frequency Response Analyzer
Lock-in Amplifier
Phasemeter
Logic Analyzer / Pattern Generator
Time & Frequency Analyzer
Data Logger
Generation
Waveform Generator
Arbitrary Waveform Generator
Control & Conditioning
PID Controller
Digital Filter Box
FIR Filter Builder
Laser Lock Box
Custom & Utility
GenInst Studio
New
Gigabit Streamer
Custom Instrument
Neural Network
Multi-Instrument Mode
Applications
Optics and Photonics
Microscopy and Spectroscopy
Photon Counting
Quantum Optics
Aerospace and defense
A&D Instrumentation
Component Test
Automated Testing
Semiconductor Test
Control Systems and Bode Analysis
MEMS Testing
AI and Machine Learning
Generative Instrumentation
New
Neural Networks
Education
Education and Research
Resources
App Notes
Blog
Case Studies
Coursework
Guides
Product Documentation
Publications
Webinars
White Papers
Support
Company
Contact Us
About Us
Leadership
Partners
News & Updates
Press
Events Calendar
Careers
Store
Moku:Delta
Moku:Pro
Moku:Go
Upgrade Moku:Pro
Upgrade Moku:Lab
Upgrade Moku:Go
0
Get a quote Buy Now
Build personalized instruments with GenInst Studio in minutes, not months. | Register for the webinar
Blog

Using ChatGPT and Moku Cloud Compile to perform custom transient fault detection

August 2, 2023

    When performing real-time fault detection, you typically run into a trade-off: you can either sample at a high rate but face long swaths of dead time, or you can sample at a very low rate with nearly continuous data. Obviously, neither method is ideal. However, there is a way to better optimize your test rig ­— program the transient fault detection yourself with VHDL and customizable test equipment. Doing this allows you to detect faults in real time, in an FPGA, and even do it inside the test and validation equipment you’re already using. We know that writing FPGA code has a deserved reputation for being more challenging than more traditional procedural programming. However, the new generation of large language models, like ChatGPT, make it easy to be productive in a language without knowing it in detail.

    The traditional way

    Test rigs aren’t very good at transient fault detection. There are typically two approaches to monitoring and detection:

    1. High rate but intermittent
    2. Low rate but continuous

    Option 1 uses an Oscilloscope. An Oscilloscope typically has a dead time between 20% and >99.9%, so relying on “seeing” a transient fault on the screen is very unlikely. One way around this is to set up a trigger to enable the Oscilloscope to do the fault detection for you and just show you the results. This method has a few drawbacks: firstly, the fault must be something that’s able to be triggered on, and secondly, it can only reliably tell you whether the fault occurred once. It can’t determine things like fault count, fault rate, total time in the fault condition, and so on.

    Option 2 uses a data logger or data acquisition device. In this case, a computer monitors all the relevant signals in real time and can compute intermediate values. The system detects faults and associated parameters. However, this method also has its own set of drawbacks. This method requires a computer with an appropriate programming environment, but more importantly it can only monitor signals up to some maximum rate, limited by the power of the computer, the complexity of any calculations, and the throughput of the connection between the data acquisition device and the computer.

    It would be desirable to combine the best of both approaches: to detect complex transient fault conditions and measure their parameters in real time without being limited to low sampling rates. Conveniently, Moku devices utilize an Instrument-on-Chip architecture and user-programmable FPGA. Along with up to 15 other instruments on a Moku device (Figure 1), Moku Cloud Compile (MCC) provides a programming environment for custom instrumentation. MCC provides all the infrastructure you need to write your own FPGA code and deploy it to your Moku.

    Moku:Pro, Moku:Lab, Moku:Go, Moku:Ipad iOS

    Figure 1: Moku product lineup with iPad and desktop interfaces

    Example: Transient power event detection

    Let’s say your tester needs to monitor a power system for transient power events. The system is rated up to a total power, however in reality it can survive transient over-power so long as the event rate, event time, and total time in the fault condition are below a threshold. To put it another way, we want to design a test rig that’s capable of:

    1. Monitoring the power through a point in the system, i.e., monitor the voltage and current then compute the power.
    2. Count the number of times that power exceeds a threshold, if at all.
    3. Record the total amount of time that the power has exceeded the threshold.

    We could also record the maximum duration of any one fault, the total energy in the fault conditions, and more, but we’ll limit ourselves to those three steps.

    This is not a good fit for intermittent monitoring like one would perform with an Oscilloscope. It would require that the Oscilloscope trigger on power levels when the inputs to the Oscilloscope are voltage and current. Very few systems can use real time computation as input to a trigger circuit.

    Depending on the system parameters, it’s also a poor fit for data acquisition approaches. Modern power systems can be damaged by high-speed transients, requiring a high acquisition rate; but a power system like this is typically designed for long-time, continuous use, so the amount of time the system needs monitoring to give confidence in its behavior may also be very long. Together, this leads to very high data volumes, increasing cost and complexity.

    A custom Instrument-on-Chip deployment is a perfect fit, let’s see how we can use ChatGPT to help us build one.

    ChatGPT for custom fault detection

    First, ChatGPT performs best when it’s given very specific instructions. Break down large problem statements into more manageable iterations. In this way, it’s quite human!

    Next, we ask for a VHDL entity that counts the number of fault events in Figure 2.

    Figure 2: Prompting ChatGPT for a VHDL-based fault counter.

    Figure 2: Prompting ChatGPT for a VHDL-based fault counter.

    Next, we add the counter for the total amount of time in the fault state (Figure 3).

    Figure 3: Prompting ChatGPT to add a counter to our program.

    Figure 3: Prompting ChatGPT to add a counter to our program.

    Finally, we make the fault condition threshold configurable at run-time, by adding it as a port to the VHDL entity (Figure 4). In the final MCC implementation, this threshold will be connected to a control register so it can be set without requiring the whole instrument to be rebuilt.

    Figure 4: Prompting ChatGPT to modify our entity.

    Figure 4: Prompting ChatGPT to modify our entity.

    Find the full listing of the final VHDL at the end of this post.

    Note that we have not yet tackled computing the power of the input. We can accomplish this by simply multiplying the voltage and current inputs before they go in to the VHDL entity. Figure 5 shows an example of how you might instantiate this entity in MCC, taking power as an input.

    Figure 5: Computing the power of the input signal in VHDL

    Figure 5: Computing the power of the input signal in VHDL

    Note that this does increase the width of the input port from 16 to 32 bits. Either the instantiation here can throw away the low 16-bits (if the loss of precision is acceptable), or the entity updated to take a 32-bit input directly. Either way, all you need to do is ask! See the prompts at the end of this post.

    Recap: Using ChatGPT and Moku Cloud Compile to perform custom transient fault detection

    We had a problem requiring real-time, high-rate, deadtime-free fault detection of a computed quantity (as opposed to one that could be directly measured). After only three prompts, ChatGPT gave us all the code we needed to implement this in VHDL, a language specifically designed for high-speed data processing on FPGAs. A simple cut-and-paste operation and a little bit of glue code, and Moku Cloud Compile from Liquid Instruments turned this into a custom instrument, capable of being deployed to Moku Instrument-on-Chip. Not bad for 10 minutes’ work!

    For more examples of using ChatGPT with MCC, watch our webinar here: https://liquidinstruments.com/webinar-registration-moku-cloud-compile-and-chatgpt-essential-strategies-for-testing-smarter-with-ai/

    Have questions about a custom instrument you want to develop with MCC? Contact us at support@liquidinstruments.com and we’ll connect you with an engineer.

    Appendix 1: Code listing

    Appendix 1: Code listing

    VHDL Code Snippet:

    library ieee;
    use ieee.std_logic_1164.all;
    use ieee.numeric_std.all;
    
    entity RisingAboveZero is
        Port (
            clk: in std_logic;
            reset: in std_logic;
            in_value: in signed(15 downto 0);
            threshold: in unsigned(15 downto 0);
            out_value: out signed(15 downto 0);
            out_cycle_count: out signed(15 downto 0)
        );
    end RisingAboveZero;
    
    architecture Behavioral of RisingAboveZero is
        signal counter: signed(15 downto 0);
        signal cycle_count: signed(21 downto 0);  -- Updated to 22 bits
        signal previous_value: signed(15 downto 0);
    begin
        process(clk, reset)
        begin
            if reset = '1' then
                counter <= to_signed(0, 16);
                cycle_count <= to_signed(0, 22);  -- Updated to 22 bits
                previous_value <= to_signed(0, 16); elsif rising_edge(clk) then if in_value > signed(threshold) and previous_value <= signed(threshold) then
                    counter <= counter + 1; end if; if in_value > signed(threshold) then
                    cycle_count <= cycle_count + 1;
                end if;
    
                previous_value <= in_value;
            end if;
        end process;
    
        out_value <= counter;
        out_cycle_count <= cycle_count(21 downto 6);  -- Output the 16 most significant bits
    end Behavioral;

     

    Appendix 2: Port connection prompt

    Appendix 2: Port connection prompt

     

    Try Moku in demo mode Download the Moku app → Get answers to FAQs Visit Knowledge Base → Connect with Moku users Join the user forum →

    Other Recommended Blog Posts

    Blog
    What is Generative Instrumentation?

    The AI-enabled technology for creating customized test solutions, including specialized measurements, real-time signal processing, and control capabilities

    Date: July 14, 2026

    Blog
    5 Advantages of FPGA-Based Customization for Test & Measurement

    How instruments with user-programmable FPGAs are replacing racks of test equipment, and what that means for your lab.

    Featuring: Moku Cloud Compile

    Date: May 22, 2026

    Blog
    Faster, more powerful real-time customization with MokuOS 4.2

    MokuOS 4.2 unlocks higher bandwidth, faster real-time processing, and more instruments on Moku:Delta, all with a simple software update.

    Date: March 19, 2026

    Back to all Blog

    Nav

    • Products
    • Instruments
    • Resources
    • Support
    • Company
    • Contact Us
    • Privacy Policy
    • Terms of Use

    Offices

    United States
    (619) 332-6230
    12526 High Bluff Dr.
    Suite 150
    San Diego, CA 92130

    Australia
    +61 2 6171 9730
    243 Northbourne Avenue
    Suite 1, Level 1
    Lyneham, ACT 2602

    Australia
    +61 3 7073 3594
    Suite 5C, Level 5,
    700 Swanston Street,
    Carlton, VIC – 3058

     

     

    Follow us

    LinkedIn YouTube X Facebook Instagram

    官方微信

    © 2026 Liquid Instruments. All rights reserved.