Step by Step Home Alarm Using ATMEGA128

by arick in Circuits > Microcontrollers

5422 Views, 20 Favorites, 0 Comments

Step by Step Home Alarm Using ATMEGA128

sirene_6.jpg
In this step by step, I wanna share my experiment using ATMEGA128 with LCD and PWM to drive a sirene,
I created at home as alarm, I'll put a sensor on it for activating, but I haven't done it yet,
I don't have the sensor yet so far :)

Let's get started, it's easy and simple

The Next Step Is Preparing the Part

sirene_1.jpg
sirene_3.jpg
sirene_4.jpg
sirene_5.jpg
sirene_6.jpg
USBISP.jpg
I need these parts for the experiment,
1. Small speaker, you can use any speaker or buzzer.
2. ATMEGA128 itself.
3. USBISP
4. LM386
5. LCD 16x2
6. Trimpot
7. Some female to female wires
8. AVR Studio

Connect Them All Together...

sirene_4.jpg
The most important think that I must see,
is the connection between LCD and speaker from ATMEGA128 port,

In this project
I used PORTA and PORTD for LCD and PORTB.5 as an output to the speaker

Prepare the Code...

Prepare the code.jpg
I used AvrStudio for coding this project,
In this tutorial I'll show the main code in C

int main(void)
{
  DDRA = 0xFF;
  DDRD = 0xFF;
   pwm_init();
   lcd_init();
   while(1)
   {
    lcd_cmd(0x80);//put the cursor into the first row
    _delay_ms (10);
    lcd_cmd(0x01);//Clear display
    _delay_ms (10);
    lcd_string("ALARM ON!");
    lcd_cmd(0xC0);//goto second row
    lcd_string("Voice...");
    _delay_ms(1000);
    //next screen
   }
}

Have It a Test and Enjoy Yourself Home Made Alarm...

sirene_6.jpg
That's it folks
Have it a test and enjoy yourself home made alarm...
The video of this project :


Thanks for reading