CONTENTS

Home
Updates
Software
Electronics
Music
Resume
Contact


YouTube
Twitter
GitHub
LinkedIn


Playing Sound From An SD/MMC Card

Posted: October 30, 2009

Introduction

This is an Atmel ATmega168 circuit demonstrating how to grab data off an SD/MMC card, send that data out through an SPI DAC connected to an amplifier, and how to use the A/D converter with an infrared proximity detector. The way I have it programmed here, when the proximity detector detects something geting close it plays 1 sound. When the proximity detector no longer detects the object it plays a second sound. Since it's halloween tomorrow I figured I'd make it a halloween theme. There is a video of it working here:

Related Projects @mikekohn.net

Halloween: SD Sound, LED Pumpkin Candle, Motion Eyes

Video



Here is a video showing the circuit in action. When I step close it instructs me to take a piece of candy. When the circuit notices I walked away it gives me a cheery halloween message. https://youtu.be/uhiz7umTcXw

Problems

Not SD/MMC related, I'm experiencing horrible noise out of the LM386 amplifier when the infrared proximity sensor is connected to the circuit. If I disconnect the 5v power supply from the circuit the noise heard in the circuit above goes away. I probed the circuit with my oscilloscope between the DAC and the amplifier and the signal is perfectly clean so I guess it's somewhere in the amplifier. I tried some capacitors too but had no luck with that.

My second problem seems to be that the SD card doesn't honor the /CS pin. In that I mean, when I send data out of the SPI with the DAC selected, the SD card seems to shift the next byte in/out. So I wrote all my samples to the SD card twice and assume only 128 two byte samples per flash block.

Pictures

SD card circuit

Above is the small test circuit from the schematic below.

SD card circuit

Above is the small test circuit from the schematic below.

Schematic
SD card schematic

Source code
sd_sound.asm

Copyright 1997-2024 - Michael Kohn