- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
I have a custom CYBLE-022001 board with a piezo beeper (see attached portion of the schematic)
What do I need to do in PSoC creator to turn it on and off?
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would suggest to use a TCPWM configured as PWM and connect the two lines to the beeper. Select a frequency as desired and a duty cycle of 50%.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Set the PiezoClock to 100kHz and the period of the PWM to 100. This will result in a 1kHz signal. Setting the compare value to Period / 2 will result in a 50% duty cycle.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No luck ..
Maybe I'm not initializing the components in the code correctly?
What align clock divider should be used for PiezoClock1_StartEx?
I use:
TCPWM_1_Start();
PiezoClock1_StartEx(1);
PiezoPin_1_Write(0);
PiezoPin_1_Write(1);
PiezoPin_2_Write(0);
PiezoPin_2_Write(1);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It works!!
Thank you so much for help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are always welcome.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Revisiting this subject..
The beeper works just fine but the sound it emits is very high pitched and not very loud
What are my options in adjusting that (lower pitch, louder)?
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use lower frequency for the PWM. Currently its output is 1kHz. A very nice tune will be 440Hz (a).
If still not loud enough, change beeper or use an external amplifier.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My clock was set to 100 Khz and the PWM period is set to 100 and compare is set to 50.
I set the PWM period to 227 ( 100000 Hz clock /440Hz desired= 227) and the compare to 113 ( 227/2)
The pitch got lower
Could you please confirm that this is the way to do it or I just got lucky 🙂
The volume did not - as expected, so I may have to look for another beeper
Thank you very much for help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The volume of the piezo is based on the AC voltage, which in your case is between 0% and 50% duty cycle. 50% is the maximum volume, and anything higher or lower will result in a lower volume. (The piezo creates noise based on how much it oscillates, with a 50% duty cycle being the maximum oscillation at a given frequency).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, that was quite right. When you want to play music, remember there are 12 tones in an octave (not eight) and the difference between 2 tones is the factor 12th root of 2 which is about 1.0595
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the feedback, much appreciated
I got the spec for the piezo (attached) ,adjusted the clock speed to 400Khz (with the PWM set as before, to 100/50) and now the beep is much lower in pitch and louder.
Per spec the part should output 65 dB. I don't think I'm getting that.
Someone suggested to "drive the pins with a complimentary signal to effectively double the drive voltage"
Is there a way to do this in the PSoC IDE?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, I'll check it out
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're welcome!
You can always do some external wiring to increase the voltage difference, but that might be tricky/dangerous 🙂
At the very least, you should be able to double the volume with the opposite voltages.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unfortunately it did not work
I tried to set it up the same way as the sample project
There are several differences
1, The pins that the sample project uses for start and stop buttons are used by other parts on my board. I tried to use unused pins ( in my case pins 15 and 20) but it did not work
2. The speaker output pins are separate in my case and together in the sample project. I could group mine together - was getting errors on the Pins page.
Attached is the project that works on my board. I'd really appreciate some help increasing the volume
Thank you
Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tried to modify the PWM example to use the pins in my hardware design. Still not getting any sound.
Don't know how to set up the input pins. On my board the pins used in the sample are taken. The attached project is set up to use unused pins for input - but it does not work
Please help!
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Writing to a hi-z digital input pin will not give a result at the signal side. PWM will not be started/stopped, Scope your beeper input to see if there is a signal.
You may increase the drive level of the beeper by connecting more pins to the PWM output signal and connect them in parallel to the beeper.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The beeper works in general.See project attached to post #18
Could you please provide more specifics for your suggestion "You may increase the drive level of the beeper by connecting more pins to the PWM output signal and connect them in parallel to the beeper."
I' not sure how to do that. Also, how many more pins should be connected? 2 ? 4?
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Either wire the PWM output pins to multiple pins internally or externally:
E.G. Wire P0(1),P0(2),P0(3),P0(4) all together and connected to PWM + output, and wire P1(1),P1(2),P(3),P(4) all together and connected to PWM - output. That way, if you toggle them all to the same output at the same time, you will get 25 mA for each pin (iirc), which would mean 200 mA current driving the piezo-beeper rather than a measly 25mA for a single pin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry for newbie questions..
Are you referring to physical wiring of parts on the board or to the logical wiring of components in the design and pin windows ?
If it's the latter could you provide a sample how it's done? There is a bit of a disconnect in my understanding here
Thank you
Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The physical wiring. I believe the PSoC creator won't let you wire them together internally.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK
Talked to the hardware guys , here is what they are saying (quotes below)
How do I the PWM and pins to implement what they suggest?
Thanks
Quote 1
"I really doubt doubling-up the port pins will make a difference. Piezo devices like this have a fairly high impedance, so a 25mA capable output should be fine (this can be easily verified with a scope). Also, as I mentioned in the past, make sure you are providing a "push-pull" drive to the beeper. In other words one pin is 3V the other is 0V, and then they are flipped, 0V and 3V. I notice in the datasheet, there is a response peak at 2.5KHz, so maybe you should try to hit that, and of course, make sure your PWM is running at 50% duty cycle."
Quote 2
"We have two pins driving the piezo. When activating the buzzer they should swtich between these two states with 50% duty cycle for each state:
STATE 1:
PIN 1 = High
PIN 2 = Low
STATE 2:
PIN 1 = Low
PIN2 = High
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The doubled up pins won't provide "DC current", but it will help with parasitic impedances to decrease the slew times for the piezo (not sure how much, but still some effect I would think).
The response peak at 2.5 kHz is definitely the frequency you want to hit for maximum volume, but it also means you won't be able to change pitch without volume changes.
The PWM setup with the + and - outputs wired to the high and low pins of the piezo speaker will provide the "3.0v and 0.0v" for the pin 1,2 flipping. The PWM will be at 50% duty cycle if you set the compare value to half of the period.
Afaik, we already helped you with implementing this setup earlier? Just for a 1kHz frequency instead of the 2.5kHz. Changing the overall frequency should be pretty trivial I think though:
A period of 20 and compare value of 10 at the clock frequency input of 100kHz will give either a 5kHz or 2.5kHz,
and a period of 10 and compare value of 5 at the same clock frequency input of 100kHz will give either 2.5kHz or 1.25kHz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, the setup is working fine, I was concerned that I'm not getting the 65 dB mentioned in the piezo spec.
Tried your suggestions - the volume went down actually. The loudest I can make it is at clock=400 hZ, period = 100, compare=50
but it's definitely not 65dB
So any suggestions how to make it louder are much appreciated.
Thanks
Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Besides varying your frequencies (which would change the tone, and you've already determined that 400 Hz is the loudest), I don't see much you can do to affect the volume without modifying the hardware in some way. Since 50% duty cycle is max volume, and the Piezo is going to be limited by voltage level not current level, then you are pretty much stuck 😞
That said, if you can change the hardware: Getting higher voltages on the piezo wires would be the most direct/effective method of increasing the volume of the beeper. (9v instead of 3.3v would be 3x volume) Using a higher voltage rail connected through some transistors to the beeper pin would be the "ideal" method 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much. I can go wrestle with the hardware guys now 🙂