Introduction: Noise Box

About: Hello world;

Hello and welcome back, everyone.

Now for something loud: the "Noise BOX" Project is a do-it-yourself synth built from scratch utilizing an Audio AMPLIFER Module and a Custom Synth Board joined by a 3D printed body.

As the name suggests, the mozzie library is used by this synth box to create and modify sound. Growls, sweeps, and chorusing noises may be produced by the Mozzie library that are far more intricate and captivating. Using common synthesis equipment like oscillators, delays, and filters, one may rapidly and simply create these sounds.

This article is about how this Synth project was made, so let's get started with the build.

Supplies

These were the materials used in this build:

  • Audio AMP Module (got from PCBWAY's Giftshop)
  • 4Ohms Speaker
  • Synth Board (Reused from previous project)
  • 3D-printed parts
  • M2 Screws
  • M3 Nuts and Bolts
  • 3.5mm Audio Cable

Step 1: The ZK-TB21 Audio Module

For the Audio AMP Module, I'm using the ZK-TB21, which is a 2.1-channel audio power amplifier based around the TPA3116D2 power AMP chip.

TPA3116D2 is a Class D stereo amplifier that can drive speakers up to 100 watts. To drive two 100-watt speakers, the ZK-TB21 utilizes two of these TPA3116D2 chips. one for the left and right speakers, and one for the subwoofer

Because it's a power amp, things get super hot, so there's a heatsink on the TPA chips for the dissipation of heat.

Also, there's a Bluetooth audio IC on this board, which lets us connect with this board for audio streaming.

Technical Specifications of Module

  • Product name: 2.1-channel Bluetooth audio power amplifier module
  • Product model: ZK-TB21
  • Bluetooth version: 5.0 (unobstructed, 10 meters)
  • Input sensitivity: 500 mV
  • Input method: AUX + Bluetooth
  • Number of channels: 2.1 channels
  • Power amplifier chip: TPA3116D2 (with AM interference suppression function)
  • Adaptable power supply: DC12~24V / 5A or more (over-voltage, output power setting)
  • Adapt to speakers: 20~100 W, 4~8.
  • Output power: 50W for left and right channels
  • Subwoofer 100W
  • Protection mechanisms: overvoltage, under voltage, overvoltage, DC detection, short circuit protection
  • Product size: 120mm * 100mm * 20mm
  • Product weight: about 256g (including packaging)


Step 2: PCBWAY Giftshop

As for sourcing the audio module, I used PCBWAY's Giftshop.

https://pcbway.com/s/K2862f

PCBWAY also has a dedicated component store in addition to PCB services.

PCBWAY GIFTSHOP is an online marketplace from which we can source all the major electronics stuff, like Arduino boards, Raspberry Pi boards, Modules, sensors, etc.

PCBWAY has this system that lets us purchase anything from their gift shop with beans. Beans are like redeemable currency or coupons that we get by placing an order on PCBWAY or by sharing your projects in the community to get beans.

Check PCBWAY out for getting great PCB service from here- https://www.pcbway.com/

Step 3: MIDI SYNTH Board

Here, I'm using the Midi Synth Board from an audio project I completed a while ago.

https://www.instructables.com/SYNTHESIZER-Made-From-Scratch/

In essence, it was an Atmega328PU-based sound modulation circuit. Five potentiometers are used by Minimal Setup to control tones that are generated using the Mozzie library.

It has an onboard power source that powers the speaker and a small Atemga328 setup using a lithium-ion battery.

Step 4: Modifications in the Synth Board

This project will use a 12V SMPS adaptor to supply power to the audio module; therefore, a buck converter will need to be added to step down the 12V from the adaptor to 5V in order for the synth board to function. The Synth Board contains an IP5303 IC that was added to provide power through a lithium-ion cell.

In addition, the IP5303 cannot operate at voltages higher than 12, and in this project, lithium cells are not being used.

To enable this board to be connected to an external 5V supply, we remove the onboard IP5303 IC and all of its necessary components.

Step 5: Modifications in Audio AMPLIFIER MODULE

The Audio AMP Module requires 12V to power the system; however, the Synth Board requires 5V.

Here is what we discovered about the Audio AMP Module: a small buck converter was added to the PCB because the Bluetooth IC of the audio AMP needs 5V to function.

We used a multimeter to determine the positive and negative terminals, and we added wires to the pads that will subsequently be linked to the VCC and GND on the Synth Board in order to power the board.

Step 6: SPEAKER

The amplifier we are using can support more high-power speakers that may be added in the future if necessary. For this design, a standard 4 ohm speaker is fine.

Step 7: 3D Design

In order to begin this project, we first prepare the 3D design, which is divided into three main sections: the speaker applied on the bottom side, the Audio AMP Module placed in the middle, and the Synth Board placed on top.

A designer's suggestion is to always model the components and raw materials before beginning the CAD process. For example, if we are using a circuit in our project, we must model it before building the housing or body for it.

First, we had to model the speaker, audio AMP module, and synth board—the three major parts.

After assembling the speaker holder, which supports the speaker upside down, we added two more parts to it, which will support the PCB for the audio amplifier module in the center.

In addition, we have two holders that are mounted with the mid-circuit holder portion on the left and right sides. The synth board will be held in place by these two holders from the upper side.

For aesthetic reasons, we eventually added a name plate to the rear.

The STL files for each component were exported after the model was finished, and white PLA was used to print all parts using an ENDER 3 with 0.2 mm layer height.

Step 8: Wiring

The wiring process is straightforward. To power the synth board, we first connect the GND and VCC of the Audio AMP Module to the GND and VCC of the synth board.

Next, we connect speaker to S+ and S- of the Audio Module

Finally, we utilise a 3.5mm cable and link the GND of the cable to the GND of the atmega328PU MCU. The L+ and R+ of the cable are connected to the D9 of the atmega328PU, which is designated as an audio pin in the code.

After soldering, we uploaded the sketch to the Atmega328PU and tested the arrangement.

Step 9: CODE and Test Video

The primary code used in this build is as follows. To use it, you must first install MOZZIE Library, which you can get by clicking the link below.

https://sensorium.github.io/Mozzi/

Here's the main code-

(Please note that LDR declared in the sketch are actually POTs.)

#include <MozziGuts.h>
#include <Oscil.h> // oscillator
#include <tables/cos2048_int8.h> // table for Oscils to play
#include <Smooth.h>
#include <AutoMap.h> // maps unpredictable inputs to a range

// int freqVal;

// desired carrier frequency max and min, for AutoMap
const int MIN_CARRIER_FREQ = 22;
const int MAX_CARRIER_FREQ = 440;

const int MIN = 1;
const int MAX = 10;

const int MIN_2 = 1;
const int MAX_2 = 15;

// desired intensity max and min, for AutoMap, note they're inverted for reverse dynamics
const int MIN_INTENSITY = 700;
const int MAX_INTENSITY = 10;

// desired mod speed max and min, for AutoMap, note they're inverted for reverse dynamics
const int MIN_MOD_SPEED = 10000;
const int MAX_MOD_SPEED = 1;

AutoMap kMapCarrierFreq(0,1023,MIN_CARRIER_FREQ,MAX_CARRIER_FREQ);
AutoMap kMapIntensity(0,1023,MIN_INTENSITY,MAX_INTENSITY);
AutoMap kMapModSpeed(0,1023,MIN_MOD_SPEED,MAX_MOD_SPEED);
AutoMap mapThis(0,1023,MIN,MAX);
AutoMap mapThisToo(0,1023,MIN_2,MAX_2);

const int KNOB_PIN = 0; // set the input for the knob to analog pin 0
const int LDR1_PIN=1; // set the analog input for fm_intensity to pin 1
const int LDR2_PIN=2; // set the analog input for mod rate to pin 2
const int LDR3_PIN=4;
const int LDR4_PIN=3;

Oscil<COS2048_NUM_CELLS, AUDIO_RATE> aCarrier(COS2048_DATA);
Oscil<COS2048_NUM_CELLS, AUDIO_RATE> aModulator(COS2048_DATA);
Oscil<COS2048_NUM_CELLS, CONTROL_RATE> kIntensityMod(COS2048_DATA);

int mod_ratio = 5; // brightness (harmonics)
long fm_intensity; // carries control info from updateControl to updateAudio

// smoothing for intensity to remove clicks on transitions
float smoothness = 0.95f;
Smooth <long> aSmoothIntensity(smoothness);


void setup(){
// Serial.begin(115200); // set up the Serial output so we can look at the light level
startMozzi(); // :))
}


void updateControl(){

// freqVal = map(LDR3_PIN, 0, 1023, 1, 100);

int freqVal = mozziAnalogRead(LDR3_PIN); // value is 0-1023
int FRQ = mapThis(freqVal);

int knob2 = mozziAnalogRead(LDR4_PIN); // value is 0-1023
int knob2Val = mapThis(knob2);

// read the knob
int knob_value = mozziAnalogRead(KNOB_PIN); // value is 0-1023

// map the knob to carrier frequency
int carrier_freq = kMapCarrierFreq(knob_value);

//calculate the modulation frequency to stay in ratio
int mod_freq = carrier_freq * mod_ratio * FRQ;

// set the FM oscillator frequencies
aCarrier.setFreq(carrier_freq);
aModulator.setFreq(mod_freq);

// read the light dependent resistor on the width Analog input pin
int LDR1_value= mozziAnalogRead(LDR1_PIN); // value is 0-1023
// print the value to the Serial monitor for debugging
//Serial.print("LDR1 = ");
// Serial.print(LDR1_value);
// Serial.print("\t"); // prints a tab

int LDR1_calibrated = kMapIntensity(LDR1_value);
// Serial.print("LDR1_calibrated = ");
// Serial.print(LDR1_calibrated);
// Serial.print("\t"); // prints a tab

// calculate the fm_intensity
fm_intensity = ((long)LDR1_calibrated * knob2Val * (kIntensityMod.next()+128))>>8; // shift back to range after 8 bit multiply
// Serial.print("fm_intensity = ");
// Serial.print(fm_intensity);
// Serial.print("\t"); // prints a tab

// read the light dependent resistor on the speed Analog input pin
int LDR2_value= mozziAnalogRead(LDR2_PIN); // value is 0-1023
// Serial.print("LDR2 = ");
// Serial.print(LDR2_value);
// Serial.print("\t"); // prints a tab

// use a float here for low frequencies
float mod_speed = (float)kMapModSpeed(LDR2_value)/1000;
//Serial.print(" mod_speed = ");
// Serial.print(mod_speed);
kIntensityMod.setFreq(mod_speed);

// Serial.println(); // finally, print a carraige return for the next line of debugging info
}


int updateAudio(){
long modulation = aSmoothIntensity.next(fm_intensity) * aModulator.next();
return aCarrier.phMod(modulation);
}


void loop(){
audioHook();
}


This code is an example of using the Mozzi library to generate audio modulation effects based on input from various sensors.

Here's a breakdown of the code:

1. The code includes several header files from the Mozzi library, which provide various functionalities for audio synthesis and control.

2. Constants are defined for minimum and maximum values of carrier frequency, intensity, and modulation speed. These values are used for mapping input values to the desired range.

3. AutoMap objects are created to map input values to the desired range of carrier frequency, intensity, and modulation speed.

4. Pin assignments are defined for the analog inputs, representing knobs and light-dependent resistors (LDRs) connected to the Arduino board.

5. Oscillator objects are created for the carrier, modulator, and intensity modulation signals. These oscillators generate audio waveforms based on pre-defined lookup tables.

6. Variables are defined for the modulation ratio, FM intensity, and smoothing factor for intensity transitions.

7. The `setup()` function initializes the serial communication and starts the Mozzi audio synthesis.

8. The `updateControl()` function is called repeatedly to read and process sensor inputs. It performs the following tasks:

  • Reads the values of LDR3 and LDR4, representing frequency and knob inputs, respectively.
  • Maps the frequency value to a desired range.
  • Maps the knob value to the carrier frequency.
  • Calculates the modulation frequency based on the carrier frequency, modulation ratio, and frequency value.
  • Sets the frequencies of the carrier and modulator oscillators.
  • Reads the value of LDR1, representing the intensity input.
  • Calibrates the intensity value using the mapped value.
  • Calculates the FM intensity based on the calibrated intensity, knob2 value, and the next value from the intensity modulation oscillator.
  • Reads the value of LDR2, representing the modulation speed input.
  • Maps the modulation speed value to a desired range and sets the frequency of the intensity modulation oscillator.

9. The `updateAudio()` function is called repeatedly to generate audio samples. It performs the following tasks:

  • Calculates the modulation value by multiplying the smoothed FM intensity by the output of the modulator oscillator.
  • Applies phase modulation to the carrier oscillator using the modulation value.
  • Returns the resulting audio sample.

10. The `loop()` function continuously calls the `audioHook()` function, which updates the audio output.

In summary, this code sets up audio modulation effects based on sensor inputs. It maps the sensor values to control parameters such as carrier frequency, intensity, and modulation speed and generates audio based on these parameters.

Step 10: Speaker Holder Assembly

We upload code into the Atmega328PU, test the entire setup, and then we start the major assembly process. Four M3 nuts and bolts are used to attach the speaker to the base mount.

Step 11: MID Section Assembly

  • Four M2 screws are used to attach the mid-circuit holder components to both sides of the speaker base assembly once it has been prepared.
  • The Audio AMP Board is then positioned and fastened there with four more M2 screws.
  • Now that the speaker and audio AMP module are back together, we attach the speaker's positive and negative terminals to the audio module's S+ and S- terminals.

Step 12: TOP Section Assembly

After connecting the audio AMP module and speaker, the synth board is the only thing left.

  • First, we use four M2 screws from both sides to attach two synth board holders to the holder of the audio AMP module.
  • The synth board is then positioned onto the holder and fastened securely in place with four additional M2 screws.
  • Finally, we use four M2 screws to fasten the noise box name to the rear of the box.

The noise box assembly has been completed.

Step 13: RESULT

The end result of this straightforward but loud build is this amazing noise box that produces sound, modifies it, and even alters pitch and frequency.

Check out the video for the proper result and sound check.

Special thanks to PCBWAY for providing the Audio AMP Module used in this project.

That's all I have to say for now, people. Please let me know if you need any assistance or more information on this project.

Peace.

Make Some Noise Contest

Participated in the
Make Some Noise Contest