You Are Here: Home » AVR ATmega Projects » Sound - Audio Projects » Make yourself a speaking ATMEGA128

Make yourself a speaking ATMEGA128

In previous weekend, I made myself a speaking ATMEGA128.
I used ATMEGA128 and LM386 as an amplifier,
Let’s get started

Make yourself a speaking ATMEGA128

Step 1: The part I need for this project

These parts are needed for this project :
1. LM386
5. Small speaker
6. LCD 16×2

Step 2: Assemble the project

Here’s the connection I used for this project :
I connected PB5 as an input for LM386
and for LCD :
#define lcd_data_pin PORTA
#define en PORT_D.b2
#define rs PORT_D.b3
#define rw PORT_D.b4

Step 3: The code

Make yourself a speaking ATMEGA12828, s

I used PWM and timer for this project
void pwm_init(void)
/* use OC1A pin as output */
DDRB = _BV(PB5);

* clear OC1A on compare match
* set OC1A at BOTTOM, non-inverting mode
* Fast PWM, 8bit
TCCR1A = _BV(COM1A1) | _BV(WGM10);

* Fast PWM, 8bit
* Prescaler: clk/1 = 8MHz
* PWM frequency = 8MHz / (255 + 1) = 31.25kHz
TCCR1B = _BV(WGM12) | _BV(CS10);

/* set initial duty cycle to zero */
OCR1A = 0;

/* Setup Timer0 */

sample_count = 4;
sei(); //Enable interrupts


For more detail: Make yourself a speaking ATMEGA128

Leave a Comment

You must be logged in to post a comment.

Read previous post:
Team maps gas emissions from comet 67P/Churyumov-Gerasimenko

The European Space Agency's Rosetta spacecraft began orbiting comet 67P/Churyumov-Gerasimenko in August 2014, providing the closest and most detailed look...

Scroll to top