Maker.io main logo

ATtiny13 Audio Player

33

2016-08-11 | By Vinod Subramanian

License: None

Beneath old electronic gadgets are usable chips that can be recycled into new gadgets. One example of recycling can be seen with this project.  Using an 8-pin IC with an SO8 package recycled from an old camera pen, we created an audio player using ATtiny13 microcontroller that combines with an SPI flash memory. The project turned out to be very good for a lossless and uncompressed 8 kHz mono wav files that plays for about one minute.

The ATtiny13 gives high-performance, low-power microcontroller with a 1KB ISP flash memory, 64B SRAM and 64B EEPROM. It is an 8-pin MCU with 5 GPIO pins. It can be programmed using an ISP.

MICROCONTROLLER PIN CONNECTIONS

The following are the pin assignments to cover all of the required pins of the ATtiny13 MCU:

  • One PWM pin for audio out. [1 pin];
  • SPI pins for interfacing with flash memory. (SO, SI, CS, SCK) [4 pins];
  • UART communication for song update. [2 pins];
  • Switch to select song loading mode [1 pin].

With the 5 GPIO pins of the ATtiny13 MCU, PB0 is used as the PWM for the audio output. To update the song in the memory chip, the PWM pin is also used as UART RX because of the pin change interrupt feature. The SCK pin was set for sending ACK and also for proper handshaking.

A MOSFET was used to help prevent the CK pin from toggling. The gate of an n-channel MOSFET is connected to the chip select pin and the SOURCE, as well as the SCK pin. The drain of the MOSFET is pulled up using a resistor.  This served as a bitbanged TX.

A push-button is connected on the RX pin, which is also the PB0 pin (or PWM pin). Pressing the button makes the pin go into flash loading mode. The baud rate of the bitbanged UART is 115200. With the 64B SRAM, some restrictions were applied in the program codes.

ATtiny13

More instructions, code and demonstration video.

 

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.