ADC Buzzer Alarm - Tang Nano 9k


Creating your Project

In this tutorial, you will learn how to configure a project that reads analog data from an ADC via the I2C protocol and, upon exceeding a predefined threshold, activates a buzzer. All development will be carried out in the ChipInventor platform, using preconfigured blocks for quick and efficient implementation.

Initial steps to create the project:

1. Open ChipInventor.

2. Click on New Project.

3. Fill in the following fields:

4. Click Create to finalize the project creation.

 

Understanding the Project and the Blocks Used

The basic diagram of this project consists of reading data from an ADC (Analog-to-Digital Converter) via I2C. Then, based on the value read, we compare it to a threshold. If it exceeds that threshold, a buzzer sound is generated at a predefined frequency, with a periodic on/off pulse.

Below is an overview of the main blocks:

 

Connecting the Blocks

The diagram below illustrates how the blocks can be connected (this example follows the organization shown in the provided Verilog code).

Finally, the buzzer pin (FPGA output) receives this final enable signal, causing an intermittent sound when the ADC value exceeds the defined threshold. At the end, it should be something like this:

 

Project Simulation

a) Steps to Simulate:
b) What to Observe During Simulation:

✅ I2C Communication

✅ Data Exchange

✅ Channel Output (Ch0)

✅ Comparator Behavior

✅ Buzzer Control

c) What to Do in Case of Errors:

If any issues arise:

Synthesis and FPGA Programming

After verifying the simulation:

  1. Click on the Synthesize tab.

  2. Select Start Synthesis to generate the bitstream.

  3. Wait until all items turn green, indicating a successful synthesis.

  4. Connect your FPGA board to the computer via USB.

  5. Select the correct serial port (often labeled “Enhanced” or similar).

Hardware Validation

After programming the FPGA, it’s time to test the system in practice.

Wrapping Up

Congratulations! You have created a complete system for reading analog values via an ADC (I2C) in ChipInventor, including a comparator and buzzer activation. You explored:

From here, you can:

Continue exploring ChipInventor to build increasingly advanced digital electronics projects, combining sensor inputs, signal processing, and various outputs!