LPC-P2148 Buzzer question

Hello.

I have the LPC-P2148 dev board from Olimex.

But the source code for the buzzer on their site is incorrect ( wondering if they really bothered to upload anything real on their website ).

I cant drive the buzzer - its different from the provided source code since the code assumes is from MT-2138 board with 1 pin for the buzzer. The P2148 has the two buzzer’s pins connected directly to the LPC2148 and i cant get what should i do to get it working.

When i received the board it was OK,but of course i reflashed it with my own code and i want to use the buzzer for testing.

What i am supposed to do ? keep one of the end low and the other going low-high-low or ?

Just cant get how that thing works.

If anyone can help will be much appreciated.

Hey Lamerx,

I’m having the exact same problem. Did you ever work it out? Or does anyone else have the answer?

When I set both pins as output, hold one high and the other low, nothing happens. The buzzer simply ‘clicks’ once quietly when it is supposed to turn on. I checked the voltage drop across the buzzer pins and it is about 3.3V I tried reversing the polarity with no success

Any ideas?

Shaneo.

Try driving both pins in antiphase (opposite polarity). Using two outputs like that increases the sound output, as it puts twice the supply voltage across the piezo. I’ve used the technique occasionally with other MCUs.

Leon

insane:
… hold one high and the other low, nothing happens …

I believe you have to oscillate one of the pins (or as leon says, both, in opposite phases) in order for it to work. It’s more like a speaker than a buzzer, you can’t just give it juice and it makes noise (at least the one’s I’ve used).

The buzzer can be piloted in 2 different ways:

1 - Using software delays, the 2 bits toggle their state, 01 → 10 → 01 → 10 and so on.

2 - Doing the same thing using the timer 1 with no CPU usage, you can generate sounds while doing other things.

You can reduce the intensity by toggling a single bit and keeping the other to a fixed value.

Look at the LPC-P2148 demo in the link in my signature, there is a device driver that allows to generate any frequency using the timer. The driver is specific for the ChibiOS/RT but you can easily modify it to work standalone.

The code is in ./demos/ARM7-LPC214x-GCC/buzzer.c

Hahaha… That’s awesome.

The buzzer simply ‘clicks’ once quietly when it is supposed to turn on.

Yeah, that’s what it’s supposed to do, now make it click really fast!

Cheers for the fast response guys. Tested it out with a software loop delay and it works fine. Will use a timer when the need arises. Thanks again.

Shaneo.

P.S. Shame I can’t set the thread to [SOLVED].

:lol: cheers, cliking noise ain’t bad at all … keep toggling. Thank you for the solution.