Let there be sound

From Electriki
Jump to: navigation, search

"DING DONG, the failure you have ordered has just arrived." /#ele

The concept

The idea

I want an AVR to talk to me. No need for it to speak words... i just want a DING DONG sound, or two. Or three. I want it to alert me in case one of few events occurs, and I want to be able to determine which event occured by just hearing it. A lot? Let's see...

The base

Searching for tone generation app notes leads to some decent solutions, yes. A 8MHz crystal, varying PWM fill ratio, a lot of math, etc. Gimme a break, it's sunday damnit. I just want to hear it working.

The problem

Why can't one make it simpler?

Let there be sound!

The base setup

I'll be using tiny2313 by atmel for this one. And a vera-board which is SOOOOOO nice (not). Some pics follow:

Concept #1: PWM + speaker

Setup

The most basic setup of all. A 8Ohm 0.25W speaker with a current limiting resistor in series (360Ohm) driven by a PWM output.

Code

Pics

Conclusion

One can hear it, yes. From very close range, in a quiet room. Some frequency/fill_ratio settings seem like a good base to work from. But I need something louder - this could only alert me around 3a.m. if it's supersilent in the whole block and I am awake already. Scope pics not worth downloading, too. Neeeeext!

Concept #2: PWM + piezo w/ builtin generator

Setup

Here's a PWM output driving a piezo element integrated with a generator. Will it blend?

Code

Pics

Conclusion

This is at least loud! It wont shatter windows, but it could surely do as a doorbell. Or some other simple alert of a similar kind. This sounds like my old atari 65 while the tape player was being adjusted. Not sure I liked it *that* much...

Concept #3: R/2R DAC

Setup

Code

Pics

Conclusion

Yours truly,

pit, 2013-06-16