3

I wanted to use a piezo sounder to sound an alarm in an application. Testing indicated that tone() was not very loud.

I could use some external circuitry to swing the pins ±5V but as I have plenty of spare pins, it seemed feasible to use 2 pins driven in anti-phase to increase the power by 4.

I looked at the source Tone.cpp but the code is somewhat intimidating. Before I start to modify it I was wondering if anyone else has already done something like this.

Milliways
  • 1,645
  • 2
  • 18
  • 29
  • Wouldn't you still end up with the total voltage difference across the two pins being at most 5V? – dlu Jan 05 '16 at 08:35
  • 4
    @dlu No The swing is 10V. Think about it - this is a standard technique. – Milliways Jan 05 '16 at 09:20
  • -1. No, the swing is 5V, unless you generate 10V with a boost converter or generate a -5V rail. Fundamental flaws in your plan aside, yes it's possible to add an anti-phase pin to the mix a few edits to the Tone library. – CharlieHanson Jan 05 '16 at 12:12
  • 4
    @CharlieHanson No, the swing is 10V. At any moment in time the instantaneous voltage between the two outputs is 5V, but into an inductive load (speaker, moving coil) the displacement is double since you are inverting the polarity all the time, and first *push*ing the coil with +5V and then *pull*ing the coil with -5V giving the equivalent drive displacement of 10V with a -5V offset. – Majenko Jan 05 '16 at 12:42

1 Answers1

3

Yes, Tim Eckel has already published a library "toneAC" on the Arduino website at http://playground.arduino.cc/Code/ToneAC

All of the syntax is there too.

Adrian
  • 108
  • 8