with an Arduino project. I'm designing an Arduino clone and I'd assumed I'd just put it on the PCB itself.
Then I got to thinking - the buzzer is essentially generating a strong enough magnetic field to get a little bit of metal to vibrate significantly enough that I can hear it. Will that kind of magnetic field cause a problem if it's only an inch away from things like the AVR chip itself or an RTC?
Forgive me if this is a silly question - just trying to determine if it's reasonable to put the buzzer on the board or if I should mount it remotely. I've never used any sort of sound-producing device with an Arduino before. . .
Not likely. But you may want to reconsider the choice of that buzzer (unless it is an emergency indicator - or you can control the voltage to it) - 83db is pretty loud!
What would be more useful is a variable frequency piezo speaker device; they come in a similar package (many computer motherboards have them on-board as the PC speaker output) - something that you can interface to a pin and control its volume level and pitch (via the tone library or something).
Unless, once again - a LOUD warning buzzer is what you are going for, of course...
But as far as magnetic fields being generated by it - I wouldn't worry about it.
FWIW this is indeed an OH GOD SOMETHING'S WRONG!!!!!! alarm, so loud is good. ;D
In my PCB design I have it driven directly from a digital I/O pin, non-PWM, because I want to preserve PWM pins. I should note that there's also an amplifier circuit for a pH probe, and an Ethernet interface onboard. But if you guys are confident there won't be interference problems I'll give it a go. Worst case, I can just pull it off the board and mount it remotely, though I MAY just do that anyways - as my question was mainly driven by board space concerns (that thing is big and I'd like the space back).
In my PCB design I have it driven directly from a digital I/O pin, non-PWM, because I want to preserve PWM pins.
You do know that any pin can be a PWM pin (you have to write your own code for it, though)...?
Worst case, I can just pull it off the board and mount it remotely, though I MAY just do that anyways - as my question was mainly driven by board space concerns (that thing is big and I'd like the space back).
You could always make a larger board. I was thinking about this when you posted ("Hmm - where is he finding the space?")...
Your application seems to be specialized (not so much an Arduino clone, as an embedded project using an Arduino); in such a case, don't worry about board size (unless you are using Eagle or something else that limits you).
Even so, you may want to think about how you could instead use a speaker (like bbm3 posted) instead of a buzzer - to provide audible communications and status messages to the user. If it is to be a more general purpose board, you could always add a jumper to disable the speaker from the rest of the system, if the pin is needed for something else. Another option might be to include a digital i/o expander of some sort, and hang such peripherals off it.
As cr0sh said you can use any output pin to drive a speaker like the one I linked to. Just turn it on and off creating a square wave at the resonant frequency of the buzzer / speaker.
As a side note I drive these with a high speed FET to take the load off the output pin.
If you don't mind my asking are you designing a pH controller for fish or hydroponics?
Designing this PCB to act as a monitor/controller for fish tanks.
The problem with "software" approaches to getting a speaker working on a non-PWM pin are that you're tying up the processor for as long as the speaker is on. That's my understanding at least, correct me if I'm wrong. I want to be able to activate the alarm, but have the controller continue to operate as normal in the meantime.
I've been asking lots of stupid little questions on this forum over the last month or two related to the project, I think I'm getting close to the point of ordering some prototype PCBs and posting the design here. It's getting exciting.
At any rate, I chose to just remove the buzzer. This way, I don't have to worry about interference (it can be remote-mounted) and the users can choose which pin they wanted it wired to vs. me hard-wiring it to a specific pin on the PCB.
Like I said before (based on my understanding); any pin can be a PWM pin; the ones that are currently "defined" as PWM are just arbitrarily used like that - you could take over the timer yourself, set up an interrrupt handler, and put PWM on any other pin you want. Since it is an interrupt, it shouldn't be taking up all of the processors time.
If that little bit of overhead is too much, and since you want this to be an alarm, you could set up some kind of circuit (using some kind of latching buffer or something) that you can trigger "high" and keep high, and this could activate a custom alarm circuit or oscillator...
I've been asking lots of stupid little questions on this forum over the last month or two related to the project, I think I'm getting close to the point of ordering some prototype PCBs and posting the design here. It's getting exciting. Cheesy
At any rate, I chose to just remove the buzzer. This way, I don't have to worry about interference (it can be remote-mounted) and the users can choose which pin they wanted it wired to vs. me hard-wiring it to a specific pin on the PCB.
I know the feeling of excitement. I have been making single sided prototype boards at home for about a year and just recently ordered my first "real" double sided boards form a real Fab shop.
Wow seeing my first boards all green and shinny was so cool and even cooler when I built the first one and it worked!
Have a thread or website about your project? It strikes me that we might be trying to solve many of the same problems so it would be interesting to compare notes.
any pin can be a PWM pin; the ones that are currently "defined" as PWM are just arbitrarily used like that
Not really arbitrary - the pins labeled as PWM have hardware support for PWM driven by the timers. Timer 0 has an interrupt set up but that is for the millis functionality, not PWM. There is no software overhead involved in driving a PWM pin beyond the analogWrite call. There are also a number of variations on PWM supported by the timers. These can be very useful for particular applications if you don't mind digging into the nuts & bolts of the datasheet.
Have a thread or website about your project? It strikes me that we might be trying to solve many of the same problems so it would be interesting to compare notes.
Not yet.
Spending too much time on hardware / software development.