Connect with us

Rise and Shine Bell

Discussion in 'General Electronics Discussion' started by eleeng, May 24, 2013.

Scroll to continue with content
  1. eleeng

    eleeng

    7
    0
    May 24, 2013
    This is a project we designed for a residential school. They wanted a really loud alarm bell to wake the kids up for morning exercises. We added more features by providing additional alarm functions. A separate code programmed in the same hardware converts the alarm bell into a school bell. The next illustration shows the block diagram of the alarm bell. It has a mains power supply input as well as a battery backup. The audio amplifier provides a loud output to wake the kids up from sleep.
    [​IMG]
    Design Specifications
    The objective of the project was to design a loud mains-powered alarm bell with battery backup for the timekeeping functions. The bell offers three alarm settings.

    Design Description
    Figure 4-21 shows the main schematic of the project, and Figure 4-22 shows the schematic diagram of the add-on switches. The alarm bell has two power supply inputs: a source from mains power and another from a battery. The mains-powered source is used to power the microcontroller circuit as well as the audio amplifier, while the battery source only powers the microcontroller. The microcontroller, a Tiny861, uses a 32.768-KHz crystal as the system clock source to execute the program as well as to maintain time. Providing operating voltage to the microcontroller is, therefore, extremely important
    and critical for the operation of the alarm bell. The user can set up to three alarms, and when any of the alarm times matches the current time, the microcontroller generates a tone on the PB3 pin
    that drives a 20W audio amplifier. The microcontroller power supply is from a LP2950-3.3 regulator since the system interfaces
    to a Nokia display. The display is used to interact with the user.
    On powering up the circuit, the current time set appears on the top-right corner of the LCD along with the menu, which has six items—TIME, MODE, DISP, ALARM1, ALARM2, and ALARM3.
    ■ TIME Configures the present time of the system.
    ■ MODE Switches individual alarms on and off.
    ■ DISP Switches off the display.
    ■ ALARMx Sets the time of the individual alarm.
    [​IMG]
    The triangle-shaped pointer shows the current menu item selected, and it can be moved down by pressing S2 and up by pressing S3. Pressing S1 displays the submenu of the selected menu item. At this level, S4 has no function but to asynchronously stop the running alarm. The submenus are as follows:
    ■ TIME S1 updates the current time shown and exits the menu. S2 changes the pointer of the digit to be changed. S3 and S4 increment and decrement, respectively, the digit currently pointed to.
    ■ MODE S1, S2, and S3 toggle the positions of Alarm1, Alarm2, and Alarm3, respectively, while S4 exits the menu. The status of the alarm is shown on the top-left corner of the main screen.
    ■ DISP This has no submenu, but simply clears the display. The display can be switched on by pressing any switch. After being switched on, the display returns to the same state that it was in before being switched off.
    ■ Alarmx Same as TIME, but the respective alarm is updated and not the system time.
    [​IMG]


    For the rest of this project, see the source link: url removed
     
    Last edited by a moderator: May 26, 2013
  2. eleeng

    eleeng

    7
    0
    May 24, 2013
    [​IMG]
    [​IMG]

    Fabrication
    The board is routed in the component (top) layer with a few jumpers in the solder (bottom) layer. The component side and solder side of the board are shown in Figures 4-23 and 4-24, respectively. A photograph of the complete system, along with the switchboard and speaker, is shown in Figure 4-25.

    Design Code
    The code runs at a clock frequency of 32768 Hz, provided using an external crystal. The controller is programmed using STK500 in ISP programming mode.

    Important sections of the code are explained later. The whole program is menu driven; therefore, several functions have infinite while loops that allow the user to change the settings and then jump out of that loop by selecting the appropriate menu option. The setmode function allows the user to switch on or off any of the three alarms, and setalarm allows the user to set the time of the individual alarm. The critical sections of the code are those that display the present time, continue the previously playing
    alarm, and switch on the alarm with the time setting equal to the present time. Hence, these three sections have been repeated in all the while loops inside main or some other function. The function showTime_d displays the current time, and the function showTime displays the time that is passed to it using the array Time[3]. The code runs at a low frequency and, hence, refreshing the LCD takes time, but using a low frequency decreases the overall power consumption of the system.
    Code:
    void showTime(unsigned char
    Time[3],unsigned char x,unsigned
    char y)
    {
    cursorxy(x%84,y%6);
    timetext[0]=(Time[hour]/10+'0');
    timetext[1]=(Time[hour]%10+'0');
    timetext[2]=(':');
    timetext[3]=(Time[min]/10+'0'');
    timetext[4]=(Time[min]%10+'0');
    timetext[5]= '\0';
    putstr(timetext);
    }
    void showTime_d(unsigned char
    x,unsigned char y)
    {
    cursorxy(x%84,y%6);
    putcharacter(Alarm[0][hour]/10+'0');
    putcharacter(Alarm[0][hour]%10+'0');
    putcharacter(':');
    putcharacter(Alarm[0][min]/10+'0');
    putcharacter(Alarm[0][min]%10+'0');
    if(((Alarm[0][sec])%2))
    {
    cursorxy((x%84)+2*6,y%6);
    putcharacter(' ');
    }
    if(al_on==0)
    {
    cursorxy(0,1);
    if(alarm1==1)
    {
    putstr("1 ");
    }
    else putstr(" ");
    if(alarm2==1)
    {
    putstr("2 ");
    }
    else putstr(" ");
    if(alarm3==1)
    {
    putstr("3 ");
    }
    else putstr(" ");
    }
    }
    The time has been maintained using the external crystal, which is more accurate than the internal RC oscillator of the microcontroller. The other important parts of the code start the PLL, initialize and stop the alarms, and set various other global parameters in the beginning of the code.
     
    Last edited by a moderator: Jun 1, 2013
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-