# Re: Min3 chirping sound

```

Hi!

I'll simply described what I have done. No fancy theory.

I got the idea from a Korean micromouser, whom I met in Japan in 1997.
Communication with the Korean wasn't exactly easy, but I think I managed to
understand him.

Hardware description:
A buzzer driven by a microcontroller timer output pin through a 2003
darlington driver. Different buzzer has different frequency response, so
some will sound better than others.

The buzzer is first and foremost a debugging device. It's not a fancy stuff
for entertainment.

My mouse chirps only when it's not moving, as the chirping is rather CPU
intensive.

Basically, the buzzer is driven by a square wave with either a rising or
falling frequency profile. The profile shape, whether it is straight,
exponential or other shape determine the kind of sound you can get. By
having more complicated frequency profile(pause and combination of
profile), you can get amazing kind of sound.

Here's the code for my mouse:
//////////////////////////////////////////////
int base = 400;
void Bird() {
int n, i, p;

beepCnt = -1;

BEEP_START_STOP=1;            //start timer
BEEP_CYCLE_FLAG=0;            // clear flag

for (n=256; n>24; n--) {
BEEP_PERIOD=(-n+base);        // equation for generating
sound profile
p = n/32+1;                   // determine number of
pulses
for (i=0; i<p; i++)
{
while(!BEEP_CYCLE_FLAG);      //BEEP_CYCLE_FLAG set
when timer pulse
BEEP_CYCLE_FLAG=0;
}
}

BEEP_START_STOP=0;            //stop TCNT
ITU.TOLR.BIT.TOA0=0;                //o/p cleared
}
// Experiment with your own equation.
/////////////////////////////////////////

How do I use the buzzer?

While, the mouse is running, I'll use the timer to generate a fixed
frequency beep as and when I need to know certain info. For example, during
a diagonal run, the mouse will generate a beep for every poles it detect.
Frequencies is different for left and right poles. When the mouse align
itself with the front wall with it's front sensor, it lets off another
different frequency beep. I found such debugging to be much more convenient
than led display. It has the side benefit of making the mouse more
entertaining.

When the mouse found the center of maze, it chirps (everything is OK). When
it could not find a path to home or destination due to a wrong maze update,
it chirps for a longer period (error).

I also have a simple user interface menu on my mouse and the buzzer is used
to feedback the user selection.

Regards
BengKiat

Peter Harrison
<peter_harrison@ntl         To:      micromouse@cs.rhul.ac.uk
world.com>                  cc:      (bcc: Beng Kiat Ng/me/staff/npnet)
Sent by:                    Subject: Re: Min3 chirping sound
owner-micromouse@cs
.rhul.ac.uk

22/07/04 05:52 AM
micromouse

Please tell us all - I am intrigued now.

Pete Harrison
http://micromouse.cannock.ac.uk/

Beng Kiat Ng wrote:

>
>
>
> Hi !
>
> I received an email last month requesting for info on my micromouse chirp
> sound. I've promised to reply when I have the time. Unfortunately, my
email
> inbox has been accidentally erased and I couldn't contact the email's
> sender. I believe he is on this mailing list.
>
> So, whoever you are, if you are on this mailing list, please reply.
>
> Sorry for the noise, everyone else.
>
> Regards
> BengKiat
>
>

```

• Follow-Ups: