georgroth
Posts: 8
Joined: Fri May 08, 2020 1:46 pm

Buzzer >> bluetooth

Wed May 13, 2020 6:26 am

Hi guys!

Maybe you could help me? Kind of lost....


I have installed a buzzer on my Pi3. All working fine but I would like to have that sound also via bluetooth headset. I tried to pair the headset, which worked fine but the sound of the buzzer is not (also) sent to the headset.

Can I change that?

Thanks a lot.
Georg

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Buzzer >> bluetooth

Wed May 13, 2020 8:14 am

So I assume you have connected a buzzer of some kind to a gpio pin, so that you can activate it when required.

as its the physical buzzer that makes the sound and not the pi there is no way to then transfer the buzzing sound to a Bluetooth headset.

You only option is to play a sound file of a buzzer through the headset at the same time as activating the buzzer.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
neilgl
Posts: 2111
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Buzzer >> bluetooth

Wed May 13, 2020 8:18 am

And (expensive) you could use a usb microphone on the pi to listen to the actual buzzer and then play back the recording via Bluetooth.

georgroth
Posts: 8
Joined: Fri May 08, 2020 1:46 pm

Re: Buzzer >> bluetooth

Wed May 13, 2020 8:45 am

I see!

Thanks for that.

What if I transfer the signal to a mobile-phone that is connected to the Pi?

So, I connect my mobile to the Pi via bluetooth and the mobile "makes" the sound? How difficult is this? Basically, I use my mobile as buzzer!

Can I do that?

Georg

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Buzzer >> bluetooth

Wed May 13, 2020 8:53 am

Does you mobile phone have a bluetooth option to actually make it buzz in some way or play sounds sent to it ?
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

scotty101
Posts: 3958
Joined: Fri Jun 08, 2012 6:03 pm

Re: Buzzer >> bluetooth

Wed May 13, 2020 9:03 am

Georg,

Can you explain how you have connected the buzzer to your Pi? This will help people to solve your problem.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

georgroth
Posts: 8
Joined: Fri May 08, 2020 1:46 pm

Re: Buzzer >> bluetooth

Wed May 13, 2020 9:06 am

Sorry guys for not being accurate.

I have connected the buzzer via GIPO pin 22 - that's it. The sound is triggered via a camera. If an object is crossing the cam, then the buzzer beeps.

Re mobile app: no, I dont have an app that makes a sound via bluetooth but I assume this should be available.... :?:

Cheers, Georg

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Buzzer >> bluetooth

Wed May 13, 2020 9:24 am

georgroth wrote:
Wed May 13, 2020 9:06 am

Re mobile app: no, I dont have an app that makes a sound via bluetooth but I assume this should be available.... :?:
I suggest you find the app first then figure out how to connect the pi to it.

and don't just assume because you want there to be an app that one will exist.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

PiGraham
Posts: 3929
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Buzzer >> bluetooth

Wed May 13, 2020 9:28 am

georgroth wrote:
Wed May 13, 2020 9:06 am
Sorry guys for not being accurate.

I have connected the buzzer via GIPO pin 22 - that's it. The sound is triggered via a camera. If an object is crossing the cam, then the buzzer beeps.

Re mobile app: no, I dont have an app that makes a sound via bluetooth but I assume this should be available.... :?:

Cheers, Georg
To send sound to a BT headset or speaker you need to play an audio file and route the audio to the BT audio device.

You could download a buzzer sound file and play it with aplay or mpg123 (command line) or maybe pygame.mixer.music.play() in your Python code.

If you want the headset sound to match the physical buzzer you could record the sound of the buzzer, maybe using a sound recorder app on your phone or tablet, or using a USB webcam or USB audio card with microphone. Maybe edit the sound in audacity. Save in .wav or .ogg or .mp3 or something. .wav "pcm" is a bit easier to use.

So when you actuvate the gpio to sound the physical buzzer also start the buzzer sound playing at the same time.

It seems there may be some more you have to do to get Pygame to output to a BT audio. If you want only the buzzer sound on BT, with other system audio to HDMI, that probably needs extra steps.

Some info here

georgroth
Posts: 8
Joined: Fri May 08, 2020 1:46 pm

Re: Buzzer >> bluetooth

Wed May 13, 2020 11:46 am

I see...wow....

Ok, is it difficult to write a script

"if signal is detected on GPIO XY, send file "buzzer.wav" to bluetooth device"

How do I do that?

Georg

PiGraham
Posts: 3929
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Buzzer >> bluetooth

Wed May 13, 2020 12:22 pm

georgroth wrote:
Wed May 13, 2020 11:46 am
I see...wow....

Ok, is it difficult to write a script

"if signal is detected on GPIO XY, send file "buzzer.wav" to bluetooth device"

How do I do that?

Georg
Do you need other audio to go to a different device (maybe HDMI)?

If not:

Get a buzzer sound file. e.g.
http://soundbible.com/1501-Buzzer.html

Download the wav:

Code: Select all

wget http://soundbible.com/grab.php?id=1501&type=wav
Play the sound on the default audio device:

Code: Select all

aplay Buzzer-SoundBible.com-188422102.wav
Pair your BT headphones, using the Bluetooth
Select them as the default audio device from the speaker audio setting icon top right of Raspbian desktop
Now repeat the aplay command. The buzzer sound should come out of the headphones.

Whatever script language you are using should have a way to play a wav file to default audio device.

You'll have to tell us what language you are using to get more specific help.

georgroth
Posts: 8
Joined: Fri May 08, 2020 1:46 pm

Re: Buzzer >> bluetooth

Wed May 13, 2020 12:35 pm

I'll try that!

I am getting exited! Thanks for your help!

Georg

georgroth
Posts: 8
Joined: Fri May 08, 2020 1:46 pm

Re: Buzzer >> bluetooth

Wed May 13, 2020 2:09 pm

I can play the sound, that's really cool!

Next step would be

if GPIO XY receives a signal
then aplay buzzerLONG.wav


The rest of the application was written python, if that helps?

at the moment the application does the following:

if GPIO XY receives a signal
then switch on buzzer
then switch on LED

additionally it would be great to send the sound as well, but I have no clue where the commands are that switch on the buzzer/LED hence I am looking for a script that is auto-started and checks always whether there is a signal on GPIO XY (=1).

What about

"import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)

GPIO.setup(XY, GPIO.IN)

while True:
if GPIO.input(XY) == 1
aplay buzzerLONG.wav"




Thanks guys! I'm learning a lot here.

Georg

Return to “Beginners”