Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Nano Controlled PAM8403 Audio Amplifier with Voice Synthesis

View and Edit Project In Cirkit DesignerImage of Arduino Nano Controlled PAM8403 Audio Amplifier with Voice Synthesis

Circuit Documentation

Summary

The circuit in question is designed to drive a loudspeaker using an audio signal generated by an Arduino Nano and amplified by a PAM8403 amplifier module. The Arduino Nano is programmed to read an analog voltage, convert it to a digital value, and output a corresponding audio signal. The PAM8403 module amplifies this audio signal to drive the loudspeaker. A resistor is included in the circuit, likely for voltage measurement or signal conditioning purposes.

Component List

PAM8403 Amplifier Module

Loudspeaker

Arduino Nano

Resistor (200 Ohms)

Wiring Details

PAM8403 Amplifier Module

Loudspeaker

Arduino Nano

Resistor (200 Ohms)

Documented Code

The code provided is for the Arduino Nano and is written in C++ using the Arduino IDE. The code utilizes the Talkie library to generate voice from the Arduino Nano. It reads an analog voltage from pin A0, converts it to a digital value, and outputs a corresponding audio signal through pin D3.

#include <Arduino.h>
#include <Talkie.h>
#include <TalkieUtils.h>
#include <Vocab_Special.h>

// ... (initial setup and library includes)

Talkie Voice;

void setup() {
    Serial.begin(115200);
    // ... (additional setup code)
    Serial.println(F("START " __FILE__ " from " __DATE__));
    Serial.print(F("Voice queue size is: "));
    Serial.println(Voice.sayQ(spPAUSE1));
    // ... (more setup code)
}

void loop() {
    // Read voltage at pin A0
    int tVoltage = analogRead(A0) * 3.3 / 1.023;
    Serial.print(tVoltage);
    Serial.println(" mV input");
    // ... (additional loop code)
    float tVoltageFloat = tVoltage / 1000.0;
    sayQVoltageVolts(&Voice, tVoltageFloat);
    Voice.sayQ(spPAUSE1);
    while (Voice.isTalking()) {
        // wait for end of speech
    }
    delay(200);
}

The code initializes the Talkie library, sets up serial communication, and in the main loop, reads the analog voltage, prints it to the serial monitor, and uses the Talkie library to convert the voltage value to speech. The sayQVoltageVolts function is used to queue the voltage value for speech output. The loop waits for the speech to finish before continuing with a short delay.