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 holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top