Skip to content

Commit

Permalink
Passive Buzzer Documentation (#208)
Browse files Browse the repository at this point in the history
* Began process for documentation. Needs functionality information.

* Added further information about functionality and overview.

* Incorporated requested changes: javadoc and example controller

* Implemented requested changes. buzzer-SD.png was added in with activebuzzer issue. Once that is merged the img conflict should resolve here.

* left out index.adoc fix for passive adoc link. Implemented

* Touch switch was not incorporated into the file.Causing two links to be on the same line. Should resolve conflict

* Didn't resolve conflict. Removed link.

---------

Signed-off-by: adelgadoj3 <[email protected]>
  • Loading branch information
adelgadoj3 authored Mar 25, 2024
1 parent 6829291 commit ac620b3
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import jakarta.inject.Named;
import java.io.File;

//tag::ex[]
@Controller("/passive-buzzer")
public class PassiveBuzzerController {

Expand Down Expand Up @@ -94,4 +95,5 @@ public void playPiTone(){
passiveBuzzerHelper.piToneSequence();

}
}
}
//end::ex[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
: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. The anode is (+) while the cathode is (-).
* 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
Schematic Diagram

image::buzzer-SD.png[]

Circuit Diagram

image::passive_buzzer-CD.png[]

===== Functionality
Use: `curl http://localhost:8080/passive-buzzer` to test the component. 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).

===== YAML
[source, yaml]

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

===== Constructors and Methods
The constructor and the methods within the PassiveBuzzerHelper class can be seen in our javadoc link:https://oss-slu.github.io/Pi4Micronaut/javadoc/com/opensourcewithslu/outputdevices/PassiveBuzzerHelper.html[here].


===== 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]
----
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pi4micronaut-utils/src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ include::components/outputComponents/rgbLed.adoc[]

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


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

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

0 comments on commit ac620b3

Please sign in to comment.