Stufin
Home Quick Cart Profile

TPA3118 PBTL Mono Digital Amplifier

Buy Now on Stufin

Pin Configuration

  • TPA3118 PBTL Mono Digital Amplifier Pin Description
  • The TPA3118 is a high-performance, mono, digital-input, audio power amplifier with high efficiency and low noise. It is ideal for battery-powered portable audio devices. Here is a detailed description of each pin and how to connect them:
  • Pin 1: VCC (Power Supply)
  • Function: Positive power supply input
  • Connection: Connect to a stable DC power supply (e.g., battery or regulated voltage source)
  • Recommended voltage range: 4.5V to 14.4V
  • Note: Ensure the power supply voltage is within the recommended range to ensure stable operation and prevent damage to the device.
  • Pin 2: GND (Ground)
  • Function: Ground reference point
  • Connection: Connect to the system ground
  • Note: Ensure a low-impedance ground connection to minimize noise and electromagnetic interference (EMI).
  • Pin 3: SD (Shutdown)
  • Function: Shutdown control input
  • Connection:
  • + Logic high (VCC or 3.3V): Normal operation
  • + Logic low (GND): Shutdown mode (low power consumption)
  • Note: This pin can be connected to a microcontroller or a switch to control the amplifier's power state.
  • Pin 4: DIN (Digital Input)
  • Function: Digital audio input
  • Connection: Connect to a digital audio source (e.g., PCM or I2S interface)
  • Note: Ensure the digital input signal is compliant with the TPA3118's digital input format (e.g., 16-bit, 32 kHz sample rate).
  • Pin 5: CLK (Clock Input)
  • Function: Clock input for the digital audio interface
  • Connection: Connect to a clock signal source (e.g., crystal oscillator or clock generator)
  • Note: Ensure the clock frequency is compatible with the digital input format (e.g., 32 kHz or 44.1 kHz).
  • Pin 6: LOUT+ (Left Channel Output Positive)
  • Function: Audio output (positive phase)
  • Connection: Connect to a speaker or an audio load
  • Note: This pin outputs the amplified audio signal. Ensure proper impedance matching and wiring to prevent signal degradation.
  • Pin 7: LOUT- (Left Channel Output Negative)
  • Function: Audio output (negative phase)
  • Connection: Connect to a speaker or an audio load
  • Note: This pin outputs the amplified audio signal. Ensure proper impedance matching and wiring to prevent signal degradation.
  • Pin 8: VREF (Voltage Reference)
  • Function: Internal voltage reference output
  • Connection: Connect to a capacitor (e.g., 10uF) for filtering and stabilization
  • Note: This pin provides an internal voltage reference for the amplifier. A capacitor is required to filter the output and prevent noise.
  • Pin 9: FBM (Feedback Pin)
  • Function: Feedback pin for output stage
  • Connection: Connect to a resistor (e.g., 1k) and a capacitor (e.g., 10nF) to the output stage
  • Note: This pin provides feedback to the output stage. Ensure proper component selection and wiring to maintain stability and performance.
  • Pin 10: Bypass (Not Connected Internally)
  • Function: Not connected internally
  • Connection: Leave unconnected or connect to a capacitor (e.g., 10uF) for power supply filtering
  • Note: This pin is not connected internally and can be used for power supply filtering or left unconnected.
  • When connecting the pins, ensure:
  • Use appropriate wire gauges and lengths to minimize signal loss and EMI.
  • Implement proper decoupling and filtering for the power supply and audio signals.
  • Follow the recommended layout and PCB design guidelines for optimal performance and thermal dissipation.
  • By following this pin description and connection guide, you can effectively integrate the TPA3118 PBTL Mono Digital Amplifier into your IoT audio application.

Code Examples

TPA3118 PBTL Mono Digital Amplifier
Overview
The TPA3118 is a high-performance, mono, digital audio power amplifier with aStereo Serial Interface (SSI) for improved sound quality and reduced noise. It is designed for use in portable audio devices, wireless speakers, and other applications where high-quality audio reproduction is required.
Pinout and Package
The TPA3118 comes in a 20-pin QFN package. The pinout is as follows:
| Pin | Function | Description |
| --- | --- | --- |
| 1-4 | GND | Ground pins |
| 5 | VCC | Power supply pin ( typically 5V or 3.3V) |
| 6 | SCK | Serial clock input |
| 7 | SDI | Serial data input |
| 8 | LOUT- | Left channel output negative terminal |
| 9 | LOUT+ | Left channel output positive terminal |
| 10 | ROUT- | Right channel output negative terminal |
| 11 | ROUT+ | Right channel output positive terminal |
| 12-15 |Reserved | No connection |
| 16 | SHUTDOWN | Shutdown input (active low) |
| 17 | FLT | Fault output (active low) |
| 18 | VREF | Voltage reference output |
| 19 | AGND | Analog ground pin |
| 20 | DGND | Digital ground pin |
Code Examples
The following examples demonstrate how to use the TPA3118 PBTL Mono Digital Amplifier in various contexts.
Example 1: Basic Audio Playback with Arduino
This example demonstrates how to use the TPA3118 with an Arduino board to play a basic audio tone.
```c
#include <TPA3118.h>
#define SCK 13 // Serial clock pin
#define SDI 11 // Serial data input pin
#define SHUTDOWN 10 // Shutdown pin
TPA3118 amplifier(SCK, SDI, SHUTDOWN);
void setup() {
  amplifier.begin();
}
void loop() {
  amplifier.setVolume(50); // Set volume to 50%
  amplifier.playTone(440, 1000); // Play a 440Hz tone for 1 second
  delay(1000);
}
```
Example 2: Audio Playback with Raspberry Pi (Python)
This example demonstrates how to use the TPA3118 with a Raspberry Pi to play an audio file.
```python
import RPi.GPIO as GPIO
import pygame
GPIO.setmode(GPIO.BCM)
# Define TPA3118 pins
SCK = 17
SDI = 23
SHUTDOWN = 24
# Initialize TPA3118
GPIO.setup(SCK, GPIO.OUT)
GPIO.setup(SDI, GPIO.OUT)
GPIO.setup(SHUTDOWN, GPIO.OUT)
# Initialize Pygame
pygame.init()
pygame.mixer.init()
# Play an audio file
pygame.mixer.music.load("audio_file.wav")
pygame.mixer.music.play()
# Set volume to 50%
GPIO.output(SCK, 1)
GPIO.output(SDI, 0x10)
GPIO.output(SHUTDOWN, 1)
# Wait for the audio file to finish playing
while pygame.mixer.music.get_busy():
    pass
# Clean up
pygame.quit()
GPIO.cleanup()
```
Example 3: Audio Streaming with ESP32 (C++)
This example demonstrates how to use the TPA3118 with an ESP32 board to stream audio data from a server.
```c
#include <WiFi.h>
#include <TPA3118.h>
#define SCK 18 // Serial clock pin
#define SDI 19 // Serial data input pin
#define SHUTDOWN 23 // Shutdown pin
TPA3118 amplifier(SCK, SDI, SHUTDOWN);
WiFiClient client;
const char ssid = "your_wifi_ssid";
const char password = "your_wifi_password";
const char serverUrl = "http://example.com/audio_stream.mp3";
void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
  }
amplifier.begin();
}
void loop() {
  client.setServer(serverUrl, 80);
  client.connect();
// Stream audio data from the server
  while (client.connected()) {
    int bytesRead = client.read((char)buffer, 1024);
    if (bytesRead > 0) {
      amplifier.playAudio(buffer, bytesRead);
    }
  }
client.stop();
  delay(1000);
}
```
These examples demonstrate the basic usage of the TPA3118 PBTL Mono Digital Amplifier with various microcontrollers and platforms. The TPA3118 can be used in a wide range of applications, including audio players, speakers, and soundbars.