In this instructable, you will go through all the different steps to realize a device that adds sound effects (a delay and an echo). This device mostly consists of a microphone, a DE0 Nano SoC board, a loudspeaker, a screen and an infrared sensor. Depending on the distance you stand from the infrared sensor, an effect will be realized. The screen is here to print the FFT.
We used a De0 Nano SoC board, and two PCB are connected to it. These are analog circuit on which we welded each component we need.
Step 1: Architecture
Here is the architecture we first thought about before starting the project. We first got the microphone that realizes the signal acquisition, which is then amplified with the Voltage Amplifier. It is then connected to the ADC pin of the DE0 Nano Soc board, that calculates the FFT and prints it on a screen. The outputs of the board are then connected to a DAC, before being amplified and connected to the loudspeaker.
At this point of the projet we did not think about the use of an infrared sensor, which we assimilated within the project later.
Step 2: Materials
To realize this project, we used the following components :
- DE0 Nano Soc board
- Analog-to-Digital Converter (integrated to the DE0 Nano Soc board)
- Digital-to-Analog Converter (MCP4821)
- Audio Power Amplifier (LM386N-1)
- Voltage Amplifier with automatic gain control
- Voltage regulator that generates -5V (MAX764)
- Infrared sensor (GP2Y0E02A)
- Solar power that generates 5V (power supply)
- Screen (that prints the FFT)
Step 3: First PCB - Before De0 Nano SoC
This first analog circuit contains the microphone (MC1), the Voltage Amplifier with automatic gain control (the part of the circuit connected to the operational amplifier) and the Voltage regulator that generates -5V (MAX764).
First the microphone catches the sound, then the sound is amplified with the Voltage Amplifier ; the voltage goes from 16mV to 1.2V approximately. The Voltage regulator is only here to supply the operational amplifier.
The output of the whole circuit is related to the ADC pin of the DE0 Nano Soc board.
Step 4: Second PCB - After the De0 Nano SoC Board
This second analog circuit's inputs are connected to different pins of the DE0 Nano Soc board, which are the CS, SCK and SDI pins. These inputs are then connected to the DAC (MCP4821), which is then connected to the Audio Power Amplifier (LM386N-1). We finally have the loudspeaker.
This whole circuit is supplied with 5V coming from the DE0 Nano Soc board, and its ground is connected to the DE0 Nano Soc's and to the first PCB's ground.
Step 5: Communication Between PCB and De0 Nano SoC
The signal that comes from the microphone is connected to the ADC of the card. The ADC is connected to the HPS and we have a NIOS II that is used to control de screen. To communicate, the HPS and the NIOS II are using a shared memory. We have a C code runing in the HPS that receives values from the ADC and does some effects on the sound. The result is then sent to the next PCB via a SPI wire that is connected on a GPIO of the card. We also have a C code runing in the NIOS II at the same time. This program is there to control the screen and to show an FFT spectrum.
Step 6: How Make Sound Effects With Infrared Sensor ?
In this project, we only use one sound effect, which is sound delay. To activate this effect, we decided to use the infrared sensor. The sensor that is connected to the integrated ADC of the card has value between 60 and 3300. We have a value near 3300 when we are near the sensor and we have a value near 60 when we are far from it. We chose to activate the delay only if the value is over 1800, otherwise the sound is directly sent to the SPI.