Main Site Documentation

Piezo,IO10 or PWM and drive circuit


Hello everyone

I create a new thread about this for a sake of clarity.

I’m creating a pcb to handle EMX. I want to play melody with a piezo. I 've seen that a piezo class is available on netmf.

[ulist]Does it works only for the IO10 of the EMX
can we use this class to play melody on IO10[/ulist]

I looked into the schematic for Cobra and the piezo is directly connected to IO10 through a 330Ohm resistor. I’m a litlle bit surprised by that if we consider the recommended circuit for this piezo:

Should I keep the cobra circuit if I use an other IO (i.e. IO15/PWM0), it seems to me that the IO will not drive enough current to supply properly the piezo but I may be wrong…

All of this is not clear to me


It is all optional, PWM will work and the internal piezo support will work. I recommend PWM.

For circuit, it depends on how large a piezo you have and how loud you want it to be. If you are happy with what you hear on cobra then just copy its circuit, if not then you can add transistor and even use a larger piezo.


Sorry GUS but I still do not understand. Probably that this is because I have never use the piezo class before.

Do you mean that piezo class can be used for other pin than IO10?
Do you mean also that melody can be played through piezo class and IO10? if yes IO10 is therefore capable of PWM and this is not documented so I am in doubt.

Concerning the circuit let’s consider that I use the one shown in the cobra schematic (i.e. F/TMB) with the same circuit.
The datasheet of the TMB shows that consumption at 5V is 22mA, this results into an internal resistor of 227Ohm. The circuit for the cobra shows a resistor of 330 Ohm. The voltage on the piezo is therefore Vio*(227/557). If Vio is 3.3V (I do not know exactly) then the voltage on the piezo is 1.34V (2.24 if Vio is 5V)

At this level of voltage I don’t know what is the SPL (prbably less than 70dB) but it will not match my needs (>82dB). Am I wrong?


The usual peizo pin is not PWM, use one of the PWM pins instead.

For the schematics, like I said it is up to your needs and your peizo.


Many thanks Gus, I just wanted to be sure and you confirm therefore that playing melody is not possible on IO10 even if we use the piezo class.

I’ve checked, Digital IO are 3.3V. This also confirms that the circuit has to be modify to obtain better performance


Not correct, it is possible but I recommended you use PWM instead as the piezo-class support maybe dropped in favor of PWM in future.