A Simple Bluetooth-Connected Buzzer -That's Connected to Your Computer!

by anee_wheeheee in Circuits > Arduino

531 Views, 8 Favorites, 0 Comments

A Simple Bluetooth-Connected Buzzer -That's Connected to Your Computer!

WhatsApp Image 2024-08-06 at 11.54.02 PM.jpeg

Necessity is the mother of invention.

And I am the Mother of this.. Buzzer Project.

-------------

As a teacher, I would organize group game sessions every Friday. I'm talking about Jeopardy!, Tug of Words, Wheel of Fortune - basically team games. Each team would go online to a separate, third party website, and press the spacebar/ digital button when it was time to buzz in. There were a few problems with this:

  1. I would have to click out of the game website we were going on and go to the external website to see who had buzzed first - something that was quite cumbersome.
  2. The spacebar key on their computers were in dire need of some rescuing.
  3. It was difficult for others to access the computer if they were sat a little further away.

So, I decided to take matters into my own hands and modify a pre-existing buzzer toy so that whenever the button was pressed, I would be notified on it through a GUI on my computer. It would rank the teams in terms of which one came first, and also be able to reset these rankings. You can find the full code for this project on my github - https://github.com/AneeDreamy/Buzzer-Project.

Supplies

maker uno.jpg
hc051.jpg
buzzer.jpg
button.jpg

You'll Need:

  • An Arduino Board

For this project, I used a leftover Maker Uno but you can use any board that is compatible with Arduino, has a 3.3V and 5V pin for the bluetooth module, TX and RX pins, and a few I/O pins.

  • A HC-05 bluetooth module

The HC-06 module does NOT have the ability to function as a master slave module - only the HC 05 does. This might be useful in the future if you would like to modify the code so that it could stop other people from buzzing once one button has buzzed in.

  • A small 4 pin button
  • Plenty of single core wires
  • A 4-pack of AA batteries - for external power supply so that the whole buzzer is portable.
  • A soldering iron
  • The buzzer toy
  • Visual Studio Code (or any IDE that runs Python)
  • Arduino IDE
  • A breadboard to make the initial connections + testing

Powering the Board

Arduino Vin Connections.png

Since the whole idea is to make this as wireless as possible, the Arduino board needs to be powered separately. However, you can also used the included USB A cable to connect it to your computer/powerbank.

Usually, these boards run on a 5V power supply, or 4 AA Batteries. I used the tutorial from this instructable: https://www.instructables.com/3-Ways-to-Power-Up-Arduino-Uno/

Configuring the Bluetooth Module

hc051.jpg
Bluetooth Connections.png
Bluetooth Connections proper.png

Here, we'll rename the bluetooth module to Team A. To do this, we need to enter AT mode. Connect the bluetooth module to the Arduino board, following the step process and the connections from this link, or refer to the picture above.

Follow the instructions to change the name of the bluetooth module to: Team A (or whatever you would like to name your teams) and set a simple password.

Additional Notes:

  1. The EN pin is the same as the KEY pin
  2. If it does not go into AT mode, it helps to upload a blank sketch first, then go into AT mode.

If everything goes well, you should have sucessfully renamed your bluetooth module. Do this for all the bluetooth modules for each buzzer.

Disclaimer: I do not own the rights to any of these instructions. They were taken from here and here respectively.

Connect the Bluetooth Module

circuit diagram.png

It's time to connect the bluetooth module to the computer.

  1. Connect the bluetooth module as shown in the connections below, and the picture above.

Bluetooth Module -> Arduino

5V or VCC-> 3V3

GND -> GND

Tx -> Rx (Pin 2 of Arduino)

Rx -> Tx (Pin 4 of Arduino)


  1. You can initialise any two pins as the TX and RX pins, but make sure that the bluetooth's TX and RX are NOT connected to the actual TX and RX of the arduino.

Bluetooth TX --> Arduino RX

Bluetooth RX --> Arduino TX


  1. The LED on the bluetooth module should start blinking!

Discovering and Connecting the Bluetooth Module on the Computer

bluetooth settings.png

This step is to get the address for the bluetooth module being used in the button. This step is divided into two parts..


Part One: Discovering the Bluetooth Module on your Computer

Mac/IOS

Go to Settings>System Preferences>Bluetooth and it should appear as one of the listed devices.

Windows

Click on the Windows Logo on the Taskbar, and search for Bluetooth and Other Devices Settings. Scroll down until you see Bluetooth Devices Discovery and change it to Advanced. Then, click on Add Device> Bluetooth and it should appear. (Refer to the image above to help you)


Part Two: Getting the Address of the Bluetooth Module

  1. Go to this link on my github for the full instructions on how to install the Pybluez bluetooth library.
  2. Make sure the bluetooth module is connected to the Arduino. If it's connected succesfully, the LED should be flashing rapidly.
  3. Run the bluetooth_check.py code that's attached. You can also go to this link here and download the whole code for the project.
  4. The address will look something like this: Address: 00:24:01:01:04:7E, Name: TEAMG. (This is an example! Your address will be very different.)
  5. Take note of the address - copy it down in a comment.
  6. Copy down the address of the bluetooth modules for each team.

Downloads

Adding the Addresses of the Bluetooth Modules to the Code

Bluetooth addresses.png

In the GUI_final.py file, add in the addresses of the bluetooth modules that you will use in the dictionary. See the picture attached (its near the beginning of the file).

Follow the prexisting format that is in the code:

  1. "name" of your bluetooth module: Team A
  2. "bd_addr" is the address of your bluetooth module that you recorded in the previous step. 98:D3:61:F5:D7:C0 (this is an example!)
  3. "port" this is part of the bluetooth connection. Just leave it as 1.

Downloads

The GUI for the Pop Up Message

Which Buzz Page 1.png
Which Buzz Page 2.png
Which Buzz Page 3.png
Which Buzz Rankings.png

This step is relatively simple. Just run the GUI_final.py code in the previous step - it should have your addresses of all the teams bluetooth modules.The GUI works as follows.

A window should pop up, saying: Welcome to WhichBuzz! Here, you just need to add in the number of teams/buzzers that are going to be participating. You can always come back and change this number. Once you have typed in the number of teams, press enter, and you'll be taken to the second page.

The second page has 3 buttons:

  1. Connect Bluetooth: Press this button (ensuring that the bluetooth modules are connected to your computer first!( See Step 4). If they're connected, the team names for each buzzer should appear (see the 3rd image).
  2. Reset Rankings: This resets the rankings (the numbers infront of the team names) on the buzzers.
  3. Back: Once pressed, this takes you back to the first page, where you can change the number of teams that will be participating. It will then update the second page.

That's it! Now, we'll look at recieving the data, so that the bluetooth modules know which buzzers are pressed...

Connect and Program the Mini Button

Button connections.png

Before we recieve the data, there must be data.. to send!

The logic is as so: when the pushbutton (the buzzer) is pressed, it sends a string: "BUZZEDA*" via serial. Change the letter for each Arduino Board that you program, so that each respective buzzer/board sends a different string depending on what team it represents.

The reason for the asterisk is so that the computer knows the start and end of the string, and it can extract the message correctly.

  1. Connect your Arduino Board to the computer and make sure you have the Arduino IDE installed.
  2. Connect the button like the picture shown above. On one side, one of the legs should be connected to ground, and the other to any pin you want. In this case, it's Pin 5.
  3. Download the button_code_debounced.ino file attached and load it into the board. To test if it's working, you can add: Serial.println("Beep"), inside the if statement: if(buttonState == LOW) {}. You'll see instructions on how to do this in the code itself.
  4. Open the serial monitor to view that it does indeed print this string each time the pushbutton is pressed.

Soldering Everything Together

circuit diagram.png

This step is quite straightforward. Just solder all the connections as shown in the image.

If you would like, you can also use a breadboard to see how everything comes together, then solder everything afterwards.

Button-ception

WhatsApp Image 2024-08-06 at 10.47.12 PM.jpeg
Slide1.PNG
Slide2.PNG

Since the whole circuit is hooked up to the small 4 pin pushbutton, there must be a way for the buzzer to be pressed, light up, and send the signal to the computer.

When I opened up the buzzer (there are 4 screws you'll need to loosen at every corner), I found out that it was a very simple (but very sketchy) circuit, and that the buzzer itself was a button. Hence, for everything to happen at once, I found it was simpler to attach the button to the top of the buzzer button and have everything be pressed at the same time... button-ception!

  1. Just attach the button using a small piece of sticky tape - super glue should work as well. [See the bottom half of the buzzer picture for before and after the button is added ]
  2. Shave down the red plastic rod that presses the button (since with the added height, the whole thing won't close). Shave down to the point where you can comfortably press both buttons and close the whole buzzer while doing so. [See pictures for top half of the button for before and after lengths]

I modified an old soldering iron [see picture attached] to have a blade at the end, so that the heated blade can cut the plastic easily.


Protecting the Electronics

WhatsApp Image 2024-08-06 at 11.51.36 PM.jpeg

Now, all the electronics are sticking out of the buzzer. You can tape the electronics to the side of the buzzer box, so that it will be kept out of the way.

At the time of writing this, I have not yet created a 3D printed box to house all the electronics. This will be uploaded soon.

Enjoy Your Buzzer!

Hurrah!

You now have your very own buzzer! Enjoy!