loading
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

Step 1: The Next Step Is Preparing the Part

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

Step 2: Connect Them All Together...

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

Step 3: Prepare the Code...

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
   }
}

Step 4: Have It a Test and Enjoy Yourself Home Made Alarm...

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


Thanks for reading

About This Instructable

4,171views

19favorites

License:

More by arick:2cm height 7 Segments 6 Digits AVR Clock  with 4 digits thermometer  Speaking clock with AVR DIY Online Bulb Controller 
Add instructable to: