A doorbell for Arduino Uno or Nano interfacing EEPROM with I2C. The EEPROM 24C512 is 512Kbits and it can store up to 3 seconds wave file of 22.050KHz, 8 bits, mono.
The Arduino reads the ROM bytes in a sequential read mode and stream each byte to the PWM generator at a rate of 22 KHz. The I2C bus works at 200 KHz for the purpose of managing to process 22 Kbits per second. Changing the bus frequency changes the speed of the sound.
The transistors are a class D amplifier for driving the speaker, any replacement can be used.
The I2C 'wire' lib doesn't have a function for sequential read, so I added a routine in C. Seting the PWM to 64KHz is also in C.
To load sound file to the eeprom do this:
The Arduino reads the ROM bytes in a sequential read mode and stream each byte to the PWM generator at a rate of 22 KHz. The I2C bus works at 200 KHz for the purpose of managing to process 22 Kbits per second. Changing the bus frequency changes the speed of the sound.
The transistors are a class D amplifier for driving the speaker, any replacement can be used.
The I2C 'wire' lib doesn't have a function for sequential read, so I added a routine in C. Seting the PWM to 64KHz is also in C.
To load sound file to the eeprom do this:
- Convert sound file to .wav PCM 22.050KHz, 8 bits, mono
- Change the file name extension from wav to bin.
- Load the bin file to the EEPROM Programmer, I used PICKIT2.