External piezo drive circuit, switched by PICAXE

rs2845

Senior Member
Hi everyone,

In my project I currently use a looped pwmout command to drive a piezo.


The main Picaxe 40X2 has lots of blocking commands to drive displays and other Picaxe chips. So to solely produce the sound I used a spare 14M2, which waited for specific serial commands from the main Picaxe in order to determine whether to loop a continuous 2800Hz or 1400Hz output. However, this is a waste of a chip that I want to use elsewhere.


I'd like to know if there's a way I can drive this piezo at 2800 Hz and 1400Hz to create a continuous sound without using a Picaxe?


Ideally I want to start/stop one of these two sounds by making pins high/low on my main Picaxe.


I'll eventually be amplifying the sound with a MAX232 as I read elsewhere these can boost the signals but if you know a method that will do this too then great.
 
Last edited:

sghioto

Senior Member
Normally I would say use a 555 chip, but why bother. An 08M2 is easier, less parts and can be easily re-programmed as needed.

Steve G
 

techElder

Well-known member
You only have two choices; internal, external. Choose one.

Always keep extra "08"s around just for this kind of use.
 

hippy

Ex-Staff (retired)
The 14M2 as you have it would seem to be the ideal solution. You can use HPWM to create a push-pull amplifier, similar to what you are intending to do with a MAX232, which can boost volume and that may deliver enough volume by itself.

Rather than buy another component to free-up the 14M2 it is just as easy to buy another 14M2. It is probably no more expensive, especially when you take into account the cost of time and effort in moving to something else.
 

rs2845

Senior Member
Thanks for the replies all!

Normally I would say use a 555 chip, but why bother. An 08M2 is easier, less parts and can be easily re-programmed as needed.
Steve G
I was hoping to find a new solution with different components. I have 555 timers and tried different circuits but all I get is clicking or very low frequencies. I may just keep the 14M2 in place if the new proposed items cost more than a new 14M2

Note also there are piezos with built in oscillator - just key the voltage... no FSK :-(
I know there's piezos out there that just require 5v but I want the two frequencies I mentioned. I want an external solution.


The 14M2 as you have it would seem to be the ideal solution. You can use HPWM to create a push-pull amplifier...
Hippy I may just end up keeping the 14M2 there if I can have it amplify the sound too. I saw your thread about creating louder piezo sounds and gave it a try but I didn't really get any louder sound, a standard pwmout gave louder sounds. Can you explain more about how the circuit is wired, am I literally connecting the piezo pins to HPWM A and B or are capacitors/resistors required?
 

hippy

Ex-Staff (retired)
The code in that thread should work with a piezo across any of the HPWM output pairs; AB, AD, BC or CD, so should have worked across AB. I did not use any R's or C's.

I cannot recall which PICAXE I used to test the code but will try and dig out a 14M2 and try it later.
 

AllyCat

Senior Member
Hi,

I currently use a looped pwmout command to drive a piezo. ...... to loop a continuous 2800Hz or 1400Hz output.
Why do you need to "loop" the command for a "continuous" output? A PWM output will normally function continuously as a "background" task.

There are various types of "piezo sounder", some of which need to be attached firmly to a "sounding board", or to a baffle or resonant enclosure, to produce an adequate sound output.

A MAX 232 can perform two tasks: It will probably have two outputs that can drive the piezo terminals in antiphase like an H-Bridge (as can the PICaxe). But it also contains "charge pump" circuits to produce boosted voltage rails of perhaps +10v and - 10v. Some versions require external capacitors, more recent devices can have them built-in. Combined with driving both termiinals, the sounder could have effectively a 40v (peak-peak) square wave applied.

Or perhaps a 555 (or 556) timer would offer the most economical solution, because they often have a much higher voltage rating than a PICaxe.

Cheers, Alan.
 

hippy

Ex-Staff (retired)
Update: tried on a 40X2 and still just as quiet sadly!
Not sure what's going wrong there because it works for me on a 14M2 and 40X2, and it is loud enough to have justified my warning about that loudness on the other thread.

It could be that you just have a faulty or inefficient piezo or perhaps there is some wiring error or other hardware issue.
 
Top