Make yourself a speaking ATMEGA128

Guys,
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
2.ATMEGA128
3.USBISP
4.AVRStudio
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 */
TCCR0|=(1<<CS00);
TCNT0=0;
TIMSK|=(1<<TOIE0);
sample_count = 4;
sei(); //Enable interrupts
}
 
For more detail: Make yourself a speaking ATMEGA128


About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation and engineering. My writing style is clear and simple, and I am skilled in using infographics and diagrams. I am a great researcher and am able to present information in a well-organized and logical manner.

Follow Us:
LinkedinTwitter
Scroll to Top