Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passive Buzzer Documentation #208

Merged
merged 9 commits into from
Mar 25, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
:imagesdir: img/

ifndef::rootpath[]
:rootpath: ../../
endif::rootpath[]

ifdef::rootpath[]
:imagesdir: {rootpath}{imagesdir}
endif::rootpath[]



==== Passive Buzzer

[.text-right]
https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/passivebuzzer.adoc[Improve this doc]



===== Overview
This section provides details of the Passive Buzzer, including the components and assembly instructions. The Passive Buzzer emits various frequencies, as described by the code, to play music or many other frequencies.

===== Components
* 1 x RaspberryPi
* 1 x Breadboard
* 1 x T-extension Board
* 1 x Passive Buzzer
* 6 x Jumper wires
* 1 x Resistor (1KΩ)
* 1 x S8550 PNP Transistor
* Power source (appropriate voltage, typically 3.3V)

===== Assembly Instructions

* Place the Passive Buzzer onto the Breadboard.
* Place the 1KΩ resistor onto the Breadboard, must be inline with base pin of S8550 PNP Transistor.
* Place the S8550 PNP Transistor onto the BreadBoard.
* The Passive Buzzer will have two pins of the same length.
* Connect a jumper wire from GND to (-) negative side
* Connect a jumper wire from 3.3V to (+) positive side.
* Connect a jumper wire from GPIO 17 to the 1KΩ resistor
* Connect jumper wire from positive side to positive end of Passive Buzzer.
* Connect jumper wire from negative end of Passive Buzzer to emitter pin of S8550 PNP Transistor.
* Connect jumper wire from negative side to collector pin of S8550 PNP Transistor.


===== Circuit Diagram

image::passive_buzzer-CD.png[]

===== Functionality
Use: `curl http://localhost:8080/passive-buzzer` to test the component. The constructor and the methods these commands call within the PassiveBuzzerHelper class can be seen in our javadoc link:https://oss-slu.github.io/Pi4Micronaut/javadoc/com/opensourcewithslu/outputdevices/PassiveBuzzerHelper.html[here]. These following commands will test the component:

* `/enable` - Turns the Passive Buzzer on.
* `/disable` - Turns the Passive Buzzer off.
* `/showFreq` - Displays the current frequency of the Passive Buzzer.
* `/setFreq/{frequenciesFile}` - Plays a series of frequencies from a file specified by the user.
* `/passBuzz` - Plays a 1 - second buzz.
* `/freqIter` - Cycles through different frequencies.
* `/playPiSeq` - Plays an array containing the first ten digits of pi.



===== Troubleshooting
- Passive Buzzer not creating sound:
* Double check power source
* Verify that 1K resistor is used
* Verify all wires are in appropriate slots.
* When using a file, verify that the file itself is scp'd to the raspberrypi (see PassiveBuzzerController for full information).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add constructors and methods senction with passiveBuzzer javadoc link.
https://oss-slu.github.io/Pi4Micronaut/javadoc/com/opensourcewithslu/outputdevices/PassiveBuzzerHelper.html

===== YAML
[source, yaml]

----
passive-buzzer:
name: passive-buzzer
address: 17
pwmType: SOFTWARE
provider: pigpio-pwm
initial: 0
shutdown: 0
----

===== Example Controller

====== This controller uses the Passive Buzzer to emit sound once prompted by the commands

[source, java]
----
include::../../../../../../components/src/main/java/com/opensourcewithslu/components/controllers/PassiveBuzzerController.java[tag=ex]
adelgadoj3 marked this conversation as resolved.
Show resolved Hide resolved

----
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions pi4micronaut-utils/src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,6 @@ include::components/outputComponents/rgbLed.adoc[]

include::components/outputComponents/lcd1602.adoc[]

include :: components/outputComponents/passivebuzzer.adoc[]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space here - include::components....



Loading