Monday, 20 February 2017

Attiny85 Eeprom Player

After doing a SD player, I continue to do a EEPROM player. First, I use what I learn in  my earlier post to build a SD to EEPROM WRITER using an Attiny85. Then, I turn on PWM to play the music from the EEPROM. So it is possible to use I2C and SPI together in Attiny85. I2C is used to talk to the external microchip memory 24LC256 DIP while SPI is used to talk to the SD card. The trick is to use beginTiny before each write (see source code below). The work is motivated by my 3 years old daughter who want a good Barney song in her Barney stuff toy. Next I will move to Winbond Flash with Attiny85 which I could hold the whole song.

Credit to :
1. http://www.jechavarria.com/2013/06/28/components-i-usually-use-ii-24lc256-i2c-eeprom-memory/   that i learn there need a delay of 5ms for each write. Once i got it, the rest is easy.
2. https://www.reddit.com/r/arduino/comments/19typ5/attiny85_with_external_i2c_eeprom/ that i learn to start with the circuit

Here is the photo:




The video:

https://youtu.be/MUv98w__nwI

The circuit:
I am using 2 x 1k ohm resistor to pull up insteads of the 4.7k ohm resister as recommended in the link above. 


The source:
Writer - https://drive.google.com/open?id=0B1Ozs0W50qCpekFoMm14eDl1bVU
Player - https://drive.google.com/open?id=0B1Ozs0W50qCpWnVwSk5ZZ2tyRWc

Note:
I am using TinyWireM.h and make the following changes. As I am writing and reading 64 bytes at one time, I change the buffer to 67 in USI_TWI_Master.h below. And I find I do not need to change the clock speed from 1000.0 kHz to 8Mhz which my Attiny85 is running. It still runs!

#define USI_BUF_SIZE    67  // bytes in message buffer

#define SYS_CLK   1000.0  // [kHz] Default for ATtiny2313








No comments:

Post a Comment