This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

eZ430-Chronos: Alarm when z-axis acceleration data change

Hello,

Im interested t make alarm that would make sound and flash backlight when x-axis acceleration data change over specific value and that it last till i press backlight button. So far i have manage to make that alarm buzz, and to write ALARM is second line of display. but alarm is litle to sensitive.

I have wrote in main.c

// Global Variable section

u8 zvalue;
u8 thresh = 254;

I have put in main function this code:

        if (sAccel.mode == ACCEL_MODE_ON)
        {
            zvalue=sAccel.xyz[2];
            if (zvalue > thresh){
                    display_chars(LCD_SEG_L2_4_0, (u8 *)"ALARM", SEG_ON);
                    request.flag.buzzer = 1;
            }
        }

Any suggestion?

  • Hi Petar,

    you should never rely on single unfiltered samples.

    If you dont want to put too much work into it then you could just add several sensor samples and calculate the mean value of them.

    If you want a better result then you need to implement a filter. What you need is a filter that works like a high-pass filter in order to filter little spikes.

  • The two advices you give are contradicting, creating the mean out of several sensor samples is a low pass filter, yet you suggest a high pass filter.

    But I guess you simply mistyped and meant a low pass filter to smooth out the spikes you get in raw samples. 

  • Yes sorry, I confused a low-pass filter with a high-pass filter. A high pass filter would remove everything but the spikes, this is not what he wants, hehe.

  • I need this for my school project, the profesor ask me to make alarm on this clock that would turn on when person wearing clock fell. I was thinking using acceleration data of  z-axis. Can you give me some code for low-pass filter and how to implement it in my code. As i sad im not wery familiar with CCS. Thanx in advance.

**Attention** This is a public forum