diff --git a/.gitignore b/.gitignore index 969b3915..b2010b72 100644 --- a/.gitignore +++ b/.gitignore @@ -15,5 +15,5 @@ out/ .classpath .factorypath *@* -Workflow.png +Workflow_Diagram.png Pi4Micronaut_logo.png diff --git a/README.md b/README.md index 8bb161a0..a014307f 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ The existence of Pi4Micronaut is justified by the need for a robust, scalable, a - [API Reference](https://oss-slu.github.io/Pi4Micronaut/javadoc/index.html) ### Architecture Diagram -![Pi4Micronaut.png](Workflow.png) +![Pi4Micronaut.png](Workflow_Diagram.png) ## Micronaut 3.7.3 - [Micronaut 3.7.3 User Guide](https://micronaut-projects.github.io/micronaut-docs-mn3/3.7.3/guide/index.html) diff --git a/Workflow.png b/Workflow.png deleted file mode 100644 index 92e056a2..00000000 Binary files a/Workflow.png and /dev/null differ diff --git a/Workflow_Diagram.png b/Workflow_Diagram.png new file mode 100644 index 00000000..0ab4f90a Binary files /dev/null and b/Workflow_Diagram.png differ diff --git a/components/src/main/java/com/opensourcewithslu/components/controllers/ActiveBuzzerController.java b/components/src/main/java/com/opensourcewithslu/components/controllers/ActiveBuzzerController.java index d25c60de..8fbaaeba 100644 --- a/components/src/main/java/com/opensourcewithslu/components/controllers/ActiveBuzzerController.java +++ b/components/src/main/java/com/opensourcewithslu/components/controllers/ActiveBuzzerController.java @@ -6,6 +6,7 @@ import io.micronaut.http.annotation.Get; import jakarta.inject.Named; +//tag::ex[] @Controller("/active-buzzer") public class ActiveBuzzerController { @@ -37,7 +38,7 @@ public void disableActiveBuzzer(){ } /** - * Emits an beep sound from the active buzzer. + * Emits a beep sound from the active buzzer. */ @Get("/beepTone") public void playBeepTone(){ @@ -65,4 +66,5 @@ public void morseCodeTest(){ activeBuzzerHelper.morseCodeTone(); } -} \ No newline at end of file +} +//end::ex[] \ No newline at end of file diff --git a/components/src/main/java/com/opensourcewithslu/components/controllers/LEDController.java b/components/src/main/java/com/opensourcewithslu/components/controllers/LEDController.java index eda4a6bd..5c037b5c 100644 --- a/components/src/main/java/com/opensourcewithslu/components/controllers/LEDController.java +++ b/components/src/main/java/com/opensourcewithslu/components/controllers/LEDController.java @@ -6,6 +6,7 @@ import io.micronaut.http.annotation.Get; import jakarta.inject.Named; +//tag::ex[] @Controller("/led") public class LEDController { private final LEDHelper ledHelper; @@ -28,4 +29,10 @@ public void ledOff(){ public void switchState(){ ledHelper.switchState(); } + + @Get("/blink/{duration}/") + public void blink(int duration){ + ledHelper.blink(duration); + } } +//end::ex[] \ No newline at end of file diff --git a/components/src/main/java/com/opensourcewithslu/components/controllers/PIRSensorController.java b/components/src/main/java/com/opensourcewithslu/components/controllers/PIRSensorController.java index defb9557..4e0ded9a 100644 --- a/components/src/main/java/com/opensourcewithslu/components/controllers/PIRSensorController.java +++ b/components/src/main/java/com/opensourcewithslu/components/controllers/PIRSensorController.java @@ -2,7 +2,7 @@ import com.opensourcewithslu.inputdevices.PIRSensorHelper; import com.opensourcewithslu.outputdevices.RGBLEDHelper; -import com.opensourcewithslu.utilities.MultipinConfiguration; +import com.opensourcewithslu.utilities.MultiPinConfiguration; import com.pi4j.io.gpio.digital.DigitalInput; import io.micronaut.http.annotation.Controller; import io.micronaut.http.annotation.Get; @@ -11,33 +11,28 @@ /** * The PIRSensorController class is used with the PIRSensorHelper class and RGBHelper class to implement a PIR motion sensor with an RGB LED light. */ + +//tag::ex[] @Controller("/pirSensor") public class PIRSensorController { - private final PIRSensorHelper pirSensorHelper; - private final RGBLEDHelper rgbledHelper; - /** * The PirSensorController constructor. * @param pirSensor A Pi4J DigitalInput object. * @param rgbLed A MultiPinConfiguration object. */ - public PIRSensorController(@Named("pir-sensor")DigitalInput pirSensor, - @Named("rgb-led-2")MultipinConfiguration rgbLed) { + public PIRSensorController(@Named("pir-sensor") DigitalInput pirSensor, @Named("rgb-led-2") MultiPinConfiguration rgbLed) { this.pirSensorHelper = new PIRSensorHelper(pirSensor); this.rgbledHelper = new RGBLEDHelper(rgbLed); } - /** * Enables the PIR sensor by adding an event listener which sets the RGB LED to red when movement is detected and green otherwise. */ @Get("/enable") public void enablePIRSensor() { - int[] red = {255,0,0}; int[] green = {0,255,0}; - pirSensorHelper.addEventListener(e -> { if (pirSensorHelper.isMoving) { rgbledHelper.setColor(red); @@ -47,7 +42,6 @@ public void enablePIRSensor() { } }); } - /** * Disables the controller by removing the event listener and turning off the RGB LED. */ @@ -56,5 +50,5 @@ public void disablePIRSensor() { pirSensorHelper.removeEventListener(); rgbledHelper.ledOff(); } - -} \ No newline at end of file +} +//end::ex[] diff --git a/components/src/main/java/com/opensourcewithslu/components/controllers/PassiveBuzzerController.java b/components/src/main/java/com/opensourcewithslu/components/controllers/PassiveBuzzerController.java index 66ffb612..eb695fdc 100644 --- a/components/src/main/java/com/opensourcewithslu/components/controllers/PassiveBuzzerController.java +++ b/components/src/main/java/com/opensourcewithslu/components/controllers/PassiveBuzzerController.java @@ -6,6 +6,7 @@ import jakarta.inject.Named; import java.io.File; +//tag::ex[] @Controller("/passive-buzzer") public class PassiveBuzzerController { @@ -94,4 +95,5 @@ public void playPiTone(){ passiveBuzzerHelper.piToneSequence(); } -} \ No newline at end of file +} +//end::ex[] \ No newline at end of file diff --git a/components/src/main/java/com/opensourcewithslu/components/controllers/RotaryEncoderController.java b/components/src/main/java/com/opensourcewithslu/components/controllers/RotaryEncoderController.java index e083d769..b9d857e9 100644 --- a/components/src/main/java/com/opensourcewithslu/components/controllers/RotaryEncoderController.java +++ b/components/src/main/java/com/opensourcewithslu/components/controllers/RotaryEncoderController.java @@ -1,7 +1,7 @@ package com.opensourcewithslu.components.controllers; import com.opensourcewithslu.inputdevices.RotaryEncoderHelper; -import com.opensourcewithslu.utilities.MultipinConfiguration; +import com.opensourcewithslu.utilities.MultiPinConfiguration; import io.micronaut.http.annotation.Controller; import io.micronaut.http.annotation.Get; import jakarta.inject.Named; @@ -11,7 +11,7 @@ public class RotaryEncoderController { private final RotaryEncoderHelper encoderHelper; - public RotaryEncoderController(@Named("rotary-encoder")MultipinConfiguration rotaryEncoder){ + public RotaryEncoderController(@Named("rotary-encoder") MultiPinConfiguration rotaryEncoder){ this.encoderHelper = new RotaryEncoderHelper(rotaryEncoder); } diff --git a/components/src/main/java/com/opensourcewithslu/components/controllers/TouchSwitchController.java b/components/src/main/java/com/opensourcewithslu/components/controllers/TouchSwitchController.java index fe8b12ee..fa1b8d29 100644 --- a/components/src/main/java/com/opensourcewithslu/components/controllers/TouchSwitchController.java +++ b/components/src/main/java/com/opensourcewithslu/components/controllers/TouchSwitchController.java @@ -8,6 +8,7 @@ import io.micronaut.http.annotation.Get; import jakarta.inject.Named; +//tag::ex[] @Controller("/touchSwitch") public class TouchSwitchController { @@ -37,4 +38,5 @@ public void enableTouchSwitch() { public void disableTouchSwitch() { touchSwitchHelper.removeEventListener(); } -} \ No newline at end of file +} +//end::ex[] \ No newline at end of file diff --git a/components/src/main/java/com/opensourcewithslu/components/controllers/UltraSonicSensorController.java b/components/src/main/java/com/opensourcewithslu/components/controllers/UltraSonicSensorController.java index f0023096..664eed53 100644 --- a/components/src/main/java/com/opensourcewithslu/components/controllers/UltraSonicSensorController.java +++ b/components/src/main/java/com/opensourcewithslu/components/controllers/UltraSonicSensorController.java @@ -9,6 +9,7 @@ import jakarta.inject.Named; +//tag::ex[] @Controller("/ultraSound") public class UltraSonicSensorController { @@ -55,3 +56,4 @@ public String disableUltrasoundSensor() { return "Ultra Sonic Sensor Disabled"; } } +//end::ex[] \ No newline at end of file diff --git a/components/src/main/java/com/opensourcewithslu/components/controllers/lcdController.java b/components/src/main/java/com/opensourcewithslu/components/controllers/lcdController.java index 343f884f..4f27e147 100644 --- a/components/src/main/java/com/opensourcewithslu/components/controllers/lcdController.java +++ b/components/src/main/java/com/opensourcewithslu/components/controllers/lcdController.java @@ -11,6 +11,7 @@ /** * Controller for managing LCD1602 display operations via HTTP requests. */ +//tag::ex[] @Controller("/lcd") public class lcdController { private final LCD1602Helper lcdHelper; @@ -37,10 +38,10 @@ public String writeDataAtPos(@PathVariable String text, @PathVariable int line, return "Text written at line " + line + ", position " + pos + ": " + text + "\n"; } - @Get("/write/character/{charvalue}") - public String writeCharacter(@PathVariable char charvalue) { - lcdHelper.writeCharacter(charvalue); - return "Character '" + charvalue + "' written to LCD\n"; + @Get("/write/character/{charValue}") + public String writeCharacter(@PathVariable char charValue) { + lcdHelper.writeCharacter(charValue); + return "Character '" + charValue + "' written to LCD\n"; } @Get("/backlight/{state}") @@ -68,3 +69,4 @@ public String turnOff() { return "Display turned off\n"; } } +//end::ex[] \ No newline at end of file diff --git a/components/src/main/java/com/opensourcewithslu/components/controllers/rgbController.java b/components/src/main/java/com/opensourcewithslu/components/controllers/rgbController.java index 0e9e5e68..b8a912b3 100644 --- a/components/src/main/java/com/opensourcewithslu/components/controllers/rgbController.java +++ b/components/src/main/java/com/opensourcewithslu/components/controllers/rgbController.java @@ -1,7 +1,7 @@ package com.opensourcewithslu.components.controllers; import com.opensourcewithslu.outputdevices.RGBLEDHelper; -import com.opensourcewithslu.utilities.MultipinConfiguration; +import com.opensourcewithslu.utilities.MultiPinConfiguration; import io.micronaut.http.annotation.Controller; import io.micronaut.http.annotation.Get; import jakarta.inject.Named; @@ -11,7 +11,7 @@ public class rgbController { private final RGBLEDHelper rgbledHelper; - public rgbController(@Named("rgb-led") MultipinConfiguration rgbLed){ + public rgbController(@Named("rgb-led") MultiPinConfiguration rgbLed){ this.rgbledHelper = new RGBLEDHelper(rgbLed); } diff --git a/components/src/main/resources/application.yml b/components/src/main/resources/application.yml index 59b97e31..86abad60 100644 --- a/components/src/main/resources/application.yml +++ b/components/src/main/resources/application.yml @@ -14,34 +14,13 @@ pi4j: # tag::pwm[] pwm: - red-pwm: # <1> - name: red # <2> - address: 17 # <3> - pwmType: SOFTWARE # <4> - provider: pigpio-pwm # <5> - initial: 0 # <6> - shutdown: 0 # <7> - blue-pwm: - name: blue - address: 18 - pwmType: SOFTWARE - provider: pigpio-pwm - initial: 0 - shutdown: 0 - green-pwm: - name: green - address: 27 - pwmType: SOFTWARE - provider: pigpio-pwm - initial: 0 - shutdown: 0 - active-buzzer: - name: active-buzzer - address: 17 - pwmType: SOFTWARE - provider: pigpio-pwm - initial: 0 - shutdown: 0 + active-buzzer: # <1> + name: active-buzzer # <2> + address: 17 # <3> + pwmType: SOFTWARE # <4> + provider: pigpio-pwm # <5> + initial: 0 # <6> + shutdown: 0 # <7> passive-buzzer: name: passive-buzzer address: 17 @@ -165,7 +144,7 @@ pi4j: provider: pigpio-digital-input # end::multiInput[] - # tag::multipwm[] + # tag::multiPWM[] multi-pwm: rgb-led: # <.> name: RGB LED # <.> @@ -181,22 +160,5 @@ pi4j: provider: pigpio-pwm initials: 0, 0, 0 shutdowns: 0, 0, 0 - # end::multipwm[] - + # end::multiPWM[] -# clk: -# name: CLK Output -# address: 23 -# debounce: 500 -# pull: PULL_UP -# shutdown: LOW -# initial: HIGH -# provider: pigpio-digital-input -# dt: -# name: DT Output -# address: 24 -# debounce: 500 -# pull: PULL_UP -# shutdown: LOW -# initial: HIGH -# provider: pigpio-digital-input \ No newline at end of file diff --git a/joss/architecture_pi4micronaut.png b/joss/architecture_pi4micronaut.png new file mode 100644 index 00000000..4cc861c4 Binary files /dev/null and b/joss/architecture_pi4micronaut.png differ diff --git a/joss/paper.bib b/joss/paper.bib new file mode 100644 index 00000000..afc1c1d6 --- /dev/null +++ b/joss/paper.bib @@ -0,0 +1,31 @@ +@article{Jolles, + author = {Jolles, Jolle W.}, + journal = {Methods in Ecology and Evolution}, + title = {Broad‐scale applications of the Raspberry Pi: A Review and guide for Biologists.}, + year = {2021}, + pages = {1562-1579}, + volume = {12}, + doi = {10.1111/2041-210X.13652} + +} + +@article{Longley, + author = {Longley, Matthew, et al.}, + journal = {PeerJ}, + title = {An open source device for operant licking in rats.}, + year = {2017}, + volume = {5}, + doi = {10.7717/peerj.2981.} +} + + +@article{Shah, + author ={ Shah, Neel P., and Priyang Bhatt}, + journal ={International Journal of Advanced Research in Computer Science}, + title = {Greenhouse Automation and Monitoring System Design and Implementation}, + year = {2017}, + pages = {468-471}, + volume = {8}, + doi = {10.26483/ijarcs.v8i9.4981} + +} diff --git a/joss/paper.md b/joss/paper.md new file mode 100644 index 00000000..7d46d071 --- /dev/null +++ b/joss/paper.md @@ -0,0 +1,89 @@ +--- +title: 'Pi4Micronaut' +tags: + - Java + - Micronaut + - RaspberryPi + - Pi4j + - GPIO +authors: +- name: Adrian Swindle + equal-contrib: true + affiliation: 1 +- name: Ruthvik Mannem + equal-contrib: true + affiliation: 1 +affiliations: + - name: Open Source with SLU + index: 1 + + +date: 3 April 2024 +bibliography: paper.bib +--- + +# Summary + +Pi4Micronaut is a Java library designed specifically to support researchers in integrating various sensors and electronic +components into their research instruments and experiments. This library empowers researchers to create Internet of Things +(IoT) applications that leverage the versatility and affordability of the Raspberry Pi, enabling them to build sophisticated +research instruments tailored to their specific needs. By running directly on the Raspberry Pi platform, Pi4Micronaut serves +as a bridge between the high-level Micronaut framework and the low-level hardware control provided by Pi4J. + + + +The Micronaut framework, widely used for building web applications and microservices, handles HTTP requests. +These requests are then passed to Micronaut's application controller, which is custom code written for each specific web +application. The application controller can make calls to the Pi4Micronaut library to interact with the hardware components. +Pi4Micronaut library uses Pi4J for low-level hardware interaction. Thus, Pi4Micronaut provides an abstraction layer between +Pi4J utilities and Micronaut framework, allowing the developer to focus on the application logic. + +![Pi4Micronaut](architecture_pi4micronaut.png) + + +# Statement of Need + +Data gather is a major element of research. Many research instruments can be simply connected to a personal computer and +used as is. However, there are many circumstances when customized instruments need to be developed. The single board computer Raspberry Pi with its ability to interface with almost anything provides an answer. The small +size and versatility at a low price, makes the Raspberry Pi an ideal solution for researchers. Applications for the +Raspberry Pi include rat licking behavior @Longley, greenhouse gas effect monitoring system @Shah, +and many other applications @Jolles. Pi4Micronaut also allows for multiple users to read input from sensors. This +eliminates the elbowing that may occur when multiple researchers are trying to read input from a sensors. The utilization +of a Raspberry Pi, eliminates the hassle and cost of needing a full computer for one small sensor. + + + +# Availability and Usage + +* [Pi4Micronaut library package](https://central.sonatype.com/artifact/io.github.oss-slu/pi4micronaut-utils). +* [Repository](https://github.com/oss-slu/Pi4Micronaut) +* [Documentation](https://oss-slu.github.io/Pi4Micronaut/). + +A [check-in system](https://github.com/oss-slu/SLU_OSS_CheckIn) and a simple [security system](https://github.com/oss-slu/Pi4Micronaut/tree/Home_Automation) were created as examples for how to use this library. + +# Library + +The following is the list of the currently supported hardware components: +* Push Button +* Slide Switch +* Rotary Encoder +* RFID Scanner +* LED +* RGB LED +* LCD Screen +* Photosensor +* Touch Switch Sensor +* Active Buzzer +* Passive Buzzer +* PIR Motion Sensor +* Ultrasonic Sensor + + +# Acknowledgments + +Thank you to Alex Delgado, Joe Folen, and John Yanev for helping create the first full release of Pi4Micronaut. To the +previous team who set the groundwork for us and set us up for the successful release of 1.0. A big thank you to +Jeff Brown from the Unity Foundation for overseeing and supporting this project. A final thank you to Open Source with SLU for funding and supporting the project. + + +# References diff --git a/pi4micronaut-utils/build.gradle b/pi4micronaut-utils/build.gradle index b2949049..47b6b259 100644 --- a/pi4micronaut-utils/build.gradle +++ b/pi4micronaut-utils/build.gradle @@ -7,7 +7,7 @@ plugins { } group = 'io.github.oss-slu' -version = 'v1.0' +version = 'v1.1' apply plugin: 'maven-publish' apply plugin: 'signing' @@ -35,7 +35,6 @@ java { targetCompatibility = JavaVersion.toVersion("17") } - tasks.named('build').configure { dependsOn 'javadoc' copy { @@ -94,7 +93,7 @@ publishing { mavenJava(MavenPublication) { groupId = 'io.github.oss-slu' artifactId = 'pi4micronaut-utils' - version = 'v1.0' + version = 'v1.1' from components.java artifact sourcesJar diff --git a/pi4micronaut-utils/src/docs/asciidoc/Introduction/buildAndRun.adoc b/pi4micronaut-utils/src/docs/asciidoc/Introduction/buildAndRun.adoc index 6ec99014..7f456381 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/Introduction/buildAndRun.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/Introduction/buildAndRun.adoc @@ -74,6 +74,25 @@ Finally, install pigpio sudo apt-get install pigpio ---- +==== Enabling Different Communication Protocols +. In the Pi4Micronaut library, we have used different communication protocols, such as I2C, SPI, etc. +. To enable any of these protocols when needed, enter the following command: ++ +[source, bash] +---- +sudo raspi-config +---- ++ +. Navigate to "*Interfacing Options*" ++ +image::commProtocol1.png[] ++ +. Choose your desired protocol. ++ +image::commProtocol2.png[] ++ +. Reboot when prompted. + ==== Build and Copy Over Jar File . Open your terminal of choice . Navigate to the project root directory @@ -104,7 +123,7 @@ scp Demo_Pi4Micronaut-0.1-all.jar test@raspberrypi-test:~ + image:Copying_Jar_File_To_Pi.png[] -==== Almost Done! +==== Run Jar file on Pi and Test the Application . To test if you've set up everything correctly on your raspberry pi, we have some sample commands for you to run. . Open a new terminal and ssh into your raspberry pi. . Enter the following command to run the jar file: @@ -133,21 +152,3 @@ curl http://localhost:8080/led/ledOn . If this command works and the LED has lit up, congratulations! You have successfully built and ran one of our components! -==== Enabling Different Communication Protocols -. In the Pi4Micronaut library, we have used different communication protocols, such as I2C, SPI, etc. -. To enable any of these protocols when needed, enter the following command: -+ -[source, bash] ----- -sudo raspi-config ----- -+ -. Navigate to "*Interfacing Options*" -+ -image::commProtocol1.png[] -+ -. Choose your desired protocol -+ -image::commProtocol2.png[] -+ -. Reboot when prompted to diff --git a/pi4micronaut-utils/src/docs/asciidoc/Introduction/exampleApplications.adoc b/pi4micronaut-utils/src/docs/asciidoc/Introduction/exampleApplications.adoc index 5e8dcefa..779e0cd4 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/Introduction/exampleApplications.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/Introduction/exampleApplications.adoc @@ -1,9 +1,12 @@ === Example Applications [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/Introduction/exampleApplications.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/Introduction/exampleApplications.adoc[Improve this doc] If you're curious about what Pi4Micronaut is capable of, check out some of the working applications created using our library. -==== Remote Mointoring Check-In System +==== Remote Monitoring Check-In System https://github.com/oss-slu/SLU_OSS_CheckIn + +==== Home Automation +https://github.com/oss-slu/Pi4Micronaut/tree/Home_Automation diff --git a/pi4micronaut-utils/src/docs/asciidoc/Introduction/supportedHardware.adoc b/pi4micronaut-utils/src/docs/asciidoc/Introduction/supportedHardware.adoc index e2f51f88..b5291fed 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/Introduction/supportedHardware.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/Introduction/supportedHardware.adoc @@ -1,6 +1,6 @@ == Currently Supported Hardware [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/Introduction/supportedHardware.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/Introduction/supportedHardware.adoc[Improve this doc] If you plan on creating an application using any of the hardware components listed below, then our library is perfect for you! @@ -13,7 +13,7 @@ We plan on offering support for many more hardware components in the future. If * LED * RGB LED * LCD Screen -* Photosensor +* Photo Sensor * Touch Switch Sensor * Active Buzzer * Passive Buzzer diff --git a/pi4micronaut-utils/src/docs/asciidoc/adding_creating_App.adoc b/pi4micronaut-utils/src/docs/asciidoc/adding_creating_App.adoc deleted file mode 100644 index 75f3e049..00000000 --- a/pi4micronaut-utils/src/docs/asciidoc/adding_creating_App.adoc +++ /dev/null @@ -1,7 +0,0 @@ - -== Adding to/Creating an Application -[.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/adding_creating_App.adoc[Improve this doc] - -TODO: outline how to create a basic applicaton like we did for the start of the check-in system + -TODO: outline how someone should add our jar to their exsisting application \ No newline at end of file diff --git a/pi4micronaut-utils/src/docs/asciidoc/components.adoc b/pi4micronaut-utils/src/docs/asciidoc/components.adoc deleted file mode 100644 index d0eb206f..00000000 --- a/pi4micronaut-utils/src/docs/asciidoc/components.adoc +++ /dev/null @@ -1,4 +0,0 @@ -== Components -[.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components.adoc[Improve this doc] - diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware.adoc index a59223e6..1983b2aa 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware.adoc @@ -1,6 +1,34 @@ +:imagesdir: img/ + +ifndef::rootpath[] +:rootpath: ../ +endif::rootpath[] + +ifdef::rootpath[] +:imagesdir: {rootpath}{imagesdir} +endif::rootpath[] + === Communicating with a Hardware Component [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/commun_WithHardware.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware.adoc[Improve this doc] + +Interacting with a hardware component is done through its communication type which determines +its circuit setup and configuration. + +For example, the LCD1602 component uses an I2C communication type +which determines how the circuit is created by utilizing the I2C pins of the GPIO. + +Based on the pins and communication type, you have to define the configuration in the yml file accordingly. +If a user wants to implement multiple hardware components then the configuration should be defined in the snake yml structure. + +==== YAML Configuration Workflow: + +- The specifications in the yml file are given to the component in the controller through the use of the @Named() annotation. +- The controller passes on the configuration to the helper through the object. +- The communication types are initialized in the Pi4JFactory and Pi4JMultiPinFactory as beans with specifications as listed in the yml file. +- The communication type configuration classes are in our utilities folder which define the methods and attributes which are used in the factory classes + to apply the specifics listed in the yml file. +- The factory classes create a context with all the beans which can be used by the different hardware components. +- When the JAR file is ran on the RaspberryPi, the beans interact with the pigpio library to communicate with the GPIO pins. -TODO: outline the use and access of application.yaml for an app + -TODO: Consolidate the format and include examples of how each comm type is used \ No newline at end of file +image:Config_Workflow.png[] \ No newline at end of file diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/digitalInput.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/digitalInput.adoc index 9d405ca8..1f46b6f6 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/digitalInput.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/digitalInput.adoc @@ -1,17 +1,21 @@ ==== Digital Input [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/commun_WithHardware/digitalInput.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/digitalInput.adoc[Improve this doc] + +"Digital Input" refers to a type of electronic signal or data that can be read by the Raspberry Pi's GPIO pins. These signals are binary, meaning they can only be in one of two states: HIGH (1) or LOW (0). + +To define in application.yaml add digital-input as a field under Pi4J, then add each component under digital-input. -To define in application.yaml add digital-input as a field under pi4j, then add each component under digital-input Each component will need * name: Name of the component * address: GPIO pin associated with component -* debounce: +* debounce: value that determines the threshold for noise from the component * pull: Either PULL_UP or PULL_DOWN depending on component * provider: pigpio-digital-input +.Example Digital Input declaration [source,yaml] ---- include::../../../../../../components/src/main/resources/application.yml[tags=digitalInput] diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/digitalOutput.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/digitalOutput.adoc index fb9bc074..baa15cb2 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/digitalOutput.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/digitalOutput.adoc @@ -1,8 +1,13 @@ ==== Digital Output [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/commun_WithHardware/digitalOutput.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/digitalOutput.adoc[Improve this doc] + +"Digital Output" refers to a signal sent from the Raspberry Pi's GPIO pins to another device or circuit. Unlike digital input, which the Raspberry Pi reads, digital output is a signal that the Raspberry Pi sends out. + +Digital outputs are also binary, meaning they can only have two states: HIGH (1) or LOW (0). These states correspond to different voltage levels, typically 3.3V for high and 0V (ground) for low on a Raspberry Pi. + +To define in application.yaml, add digital-output as a field under Pi4J, then add each component under digital-output. -To define in application.yaml add digital-output as a field under pi4j, then add each component under digital-input Each component will need * name: Name of the component @@ -11,6 +16,7 @@ Each component will need * shutdown: State to take when program successfully shuts down properly, either LOW or HIGH * provider: pigpio-digital-output +.Example Digital Output declaration [source,yaml] ---- include::../../../../../../components/src/main/resources/application.yml[tags=digitalOutput] diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/i2c.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/i2c.adoc index 04e89968..0cee2b51 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/i2c.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/i2c.adoc @@ -1,7 +1,26 @@ ==== I2C [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/commun_WithHardware/i2c.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/i2c.adoc[Improve this doc] +I2C stands for **Inter-Integrated Circuit**. It is a bus interface connection protocol incorporated into devices for serial communication. (https://geeksforgeeks.org/i2c-communication-protocol/[Source: geeksforgeeks.com]) +The I2C protocol uses two wires: SDA (serial data) and SCL (serial clock). This protocol allows for communication between +multiple devices using only two wires and unique addresses. + +The I2C LCD1602 consists of a normal LCD1602 and an I2C module that is attached to the back of the LCD. +The I2C module is a chip that can expand the I/O ports of the LCD1602 using the I2C protocol. +It converts the signals from the Raspberry Pi into commands for the LCD. + +(https://docs.sunfounder.com/projects/umsk/en/latest/01_components_basic/26-component_i2c_lcd1602.html[Source: docs.sunfounder.com]) + +To define in application.yaml add i2c as a field under pi4j, then add each component under i2c. + +Each component will need: + +* name: Name of the component +* bus: Bus address of device +* device: Address of device + +.Example I2C declaration [source,yaml] ---- include::../../../../../../components/src/main/resources/application.yml[tags=i2c] @@ -11,4 +30,3 @@ include::../../../../../../components/src/main/resources/application.yml[tags=i2 <3> Device bus (0 or 1) <4> Device address -TODO: add I2C information \ No newline at end of file diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/multipinConfig.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/multipinConfig.adoc index d85367eb..ef7cd1b9 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/multipinConfig.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/multipinConfig.adoc @@ -1,32 +1,32 @@ -==== Multipin Configurations +==== MultiPin Configurations [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/commun_WithHardware/multipinConfig.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/multipinConfig.adoc[Improve this doc] -Multipin components are unique in that they require several of the same type of pin in order to function properly. -Each class of multipin component (Digital Input, PWM), is declared slightly differently in the application.yaml file +MultiPin components are unique in that they require several of the same type of pin in order to function properly. +Each class of multi-pin component (Digital Input, PWM), is declared slightly differently in the application.yaml file -.Example Multipin Digital Input declaration +.Example MultiPin Digital Input declaration [source, yaml] ---- include::../../../../../../components/src/main/resources/application.yml[tags=multiInput] ---- -<.> Top level field for multipin digital inputs (equivlent of digital-output declaration) +<.> Top level field for multi-pin digital inputs (equivalent of digital-output declaration) <.> Component Identifier (Used in @Named annotations) <.> Component Name <.> Addresses for each pin (Each component has a specific order outlined in the component description) <.> Debounce values for each pin (same order as above) <.> Pull values for each pin (same order as above) <.> Shutdown value (All pins have the same shut down) -<.> Startup value (All pins have the same start up) +<.> Startup value (All pins have the same start-up) <.> Provider (All pins have the same provider) -.Example Multipin PWM declaration +.Example MultiPin PWM declaration [source, yaml] ---- -include::../../../../../../components/src/main/resources/application.yml[tags=multipwm] +include::../../../../../../components/src/main/resources/application.yml[tags=multiPWM] ---- -<.> Top level field for multipin PWMs (equivlent of digital-output declaration) +<.> Top level field for multi-pin PWMs <.> Component Identifier (Used in @Named annotations) <.> Component Name <.> Addresses for each pin (Each component has a specific order outlined in the component description) diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/pwm.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/pwm.adoc index a2652930..910c00a3 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/pwm.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/pwm.adoc @@ -1,15 +1,24 @@ ==== PWM [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/commun_WithHardware/pwm.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/pwm.adoc[Improve this doc] -To define in application.yaml add digital-input as a field under pi4j, then add each component under digital-input -Each component will need +Pulse width modulation, or PWM, is a technique for getting analog results with digital means. Digital control is used to create a square wave, a signal switched between on and off. +This on-off pattern can simulate voltages in between full on (5 Volts) and off (0 Volts) by changing the portion of the time the signal spends on versus the time that the signal spends off. +The duration of “on time” is called the pulse width. To get varying analog values, you change, or modulate, that pulse width (https://learn.sunfounder.com/lesson-2-controlling-led-by-pwm-3/[Source: sunfounder.com]). +In our library, our Active Buzzer component uses PWM. Once fully activated at 5 Volts, the buzzer will go off, creating a tone. + +To define in application.yaml add pwm as a field under pi4j, then add each component under pwm. + +Each component will need: * name: Name of the component * address: GPIO pin associated with component * pwmType: Either SOFTWARE or HARDWARE based upon which type of PWM you wish to use * provider: pigpio-pwm +* initial: Initial value on startup +* shutdown: Final value at shut down +.Example PWM declaration [source,yaml] ---- include::../../../../../../components/src/main/resources/application.yml[tags=pwm] diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/spi.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/spi.adoc index 41fb4d14..25cebf75 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/spi.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/spi.adoc @@ -1,9 +1,43 @@ ==== SPI - [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/commun_WithHardware/spi.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/spi.adoc[Improve this doc] + +The Serial Peripheral Interface (SPI) is a communication protocol used to transfer data between the Raspberry Pi and peripheral devices. These peripheral devices may be either sensors or actuators. + +(https://raspberrypi-aa.github.io/session3/spi.html[Source: raspberrypi-aa.github.io]) + +Many different devices use the SPI protocol, such as SD card reader modules, RFID card reader modules, and 2.4 GHz wireless transmitter/receivers all use SPI to communicate with the Raspberry Pi. + +(https://www.circuitbasics.com/basics-of-the-spi-communication-protocol/[Source: circuitbasics.com]) + + +SPI uses 4 separate connections to communicate with the target device: + +- COPI (Controller Output/Peripheral Input) – Line for the Controller to send data to the Peripherals. + +- CIPO (Controller Input/Peripheral Output) – Line for the Peripherals to send data to the Controller. + +- SCLK (Clock) – Line for the clock signal. + +- PS/CS (Peripheral Select/Chip Select) – Line for the Controller to select which Peripheral to send data to. + + +==== +*Note:* Controller/Peripheral is formerly referred to as Master/Slave. In order to move away from the use of such terminology, we have opted to use the term Controller in place of Master, and Peripheral in place of Slave. +==== + + +To define in application.yaml add spi as a field under pi4j, then add each component under spi. + +Each component will need: + +* name: Name of the component +* address: Address for Controller/Peripheral +* baud: Baud rate/data rate +* reset-pin: Address of GPIO reset pin +.Example SPI declaration [source,yaml] ---- include::../../../../../../components/src/main/resources/application.yml[tags=spi] @@ -14,4 +48,3 @@ include::../../../../../../components/src/main/resources/application.yml[tags=sp <4> Baud rate <5> Address of GPIO Reset pin -TODO: add SPI information \ No newline at end of file diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents.adoc index 4d54242b..016b6a9c 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents.adoc @@ -1,3 +1,5 @@ === Input Components [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/inputComponents.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents.adoc[Improve this doc] + +The Components that provide input signal or data to the application from Raspberry Pi GPIO pins. \ No newline at end of file diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/photosensor.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/photosensor.adoc index 6772abe5..3ee51ea5 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/photosensor.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/photosensor.adoc @@ -1,5 +1,5 @@ ==== Photosensor [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/inputComponents/photosensor.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/photosensor.adoc[Improve this doc] TODO: add in photosensor support docs \ No newline at end of file diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/pirSensor.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/pirSensor.adoc new file mode 100644 index 00000000..0973e162 --- /dev/null +++ b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/pirSensor.adoc @@ -0,0 +1,87 @@ +:imagesdir: img/ + +ifndef::rootpath[] +:rootpath: ../../ +endif::rootpath[] + +ifdef::rootpath[] +:imagesdir: {rootpath}{imagesdir} +endif::rootpath[] + +==== PIR Sensor +[.text-right] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/pirSensor.adoc[Improve this doc] + + +===== Overview + +This section provides details of the PIR Sensor, including the components and assembly instructions. A Passive Infrared Sensor measures infrared light radiating from objects to detect motion. + +===== Components + +* PIR Sensor +* Breadboard +* T-Extension Board +* Jumper wires x 3 +* Power source (5V) +* 3 x 220Ω resistors +* RGB LED + +===== Assembly Instructions +When looking at the bottom of PIR, the pins from left to right are: + +. Power: connect the left pin on the PIR to 5V0 on the breadboard +. I/O: connect the middle pin on the PIR to GPIO 13 on the breadboard +. Ground: connect right pin on the PIR to GND on the breadboard +. Set up the RGB LED + +===== Circuit Diagram + +image::PIR_Sensor_Circuit.png[] + + +===== Functionality + +A PIR - Passive Infrared sensor detects motion by sensing changes in the infrared light emitted by objects in its environment. It works passively, meaning it does not emit any infrared light itself, but rather detects the infrared radiation coming from warm objects, such as humans or animals. The sensor has two sensitive slots that detect infrared radiation. + +As a warm object moves across its field of view, the amount of infrared radiation reaching each slot changes, creating a detectable change in the radiation pattern. This change triggers the sensor to send an electrical signal, which can then be used to activate alarms, lights, or other devices, making PIR sensors widely used in security systems and automated lighting controls due to their efficiency and effectiveness in detecting motion. + +===== Testing +Use the below command to enable the sensor. +[source, bash] +---- +$ curl http://localhost:8080/pirSensor/enable +---- +Once the sensor is enabled, anytime the sensor detects motion, the RGB LED will turn red. If no motion is detected, the RGB LED will be green. + +Use the below command to disable the sensor. +[source, bash] +---- +$ curl http://localhost:8080/pirSensor/disable +---- + +===== Troubleshooting +- Sensor not detecting something: + * Make sure the object is moving. The sensor only detects movement. Once an object stops moving, it is no longer detected. + + +===== YAML Configuration +[source, yaml] +---- +digital-input: + pir-sensor: + name: PIR Sensor + address: 13 + pull: PULL_DOWN + debounce: 30000 + provider: pigpio-digital-input +---- + +===== Constructor and Methods +The constructor and the methods within the PIRSensorHelper class can be seen in our javadoc link:https://oss-slu.github.io/Pi4Micronaut/javadoc/com/opensourcewithslu/inputdevices/PIRSensorHelper.html[here]. + +===== Example Controller + +====== This controller uses the PIR Sensor to turn an RGB LED red if motion is detected, green otherwise +[source, java] +include::../../../../../../components/src/main/java/com/opensourcewithslu/components/controllers/PIRSensorController.java[tag=ex] \ No newline at end of file diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/pushButton.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/pushButton.adoc index 9b3fde2f..5c0ad5c4 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/pushButton.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/pushButton.adoc @@ -1,6 +1,6 @@ ==== Push Button [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/inputComponents/pushButton.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/pushButton.adoc[Improve this doc] ===== Overview This document provides details of the Push Button circuit, @@ -16,20 +16,26 @@ including its components, assembly instructions, and functionality. . Power source ===== Circuit Diagram -Model: - -* Note the 220Ω resistor is for the LED and the 10Ω for the button. image::https://docs.sunfounder.com/projects/raphael-kit/en/latest/_images/image152.png[] +.*Note:* The 220Ω resistor is for the LED and the 10Ω for the button. - -Circuit Diagram: +*Schematic Diagram:* image::https://docs.sunfounder.com/projects/raphael-kit/en/latest/_images/image303.png[] ===== Functionality -A push of the button turns the LED light on and another push turns it off. +On click of a button can either open or close the circuit based on its current state. + +===== Testing +Use below command to test the component. + +[source, bash] +---- +$ curl http://localhost:8080/pushButton/init +---- +* `/init` - Initializes the Push Button for use. ===== Troubleshooting . LED not lighting up: Check all connections, ensure the LED is placed correctly, @@ -37,14 +43,18 @@ and check the power source. . LED is too dim: The resistor value might be too high. Ensure you're using the correct resistors or adjust according to your power source and LED specifications -===== YAML Pin Order +===== YAML Configuration The order for declaring the pin for the LED is as follows: [source, yaml] ---- digital-output: led: + name: LED Output address: 17 + shutdown: LOW + initial: LOW + provider: pigpio-digital-output ---- So the LED would be connected to GPIO 17. @@ -53,24 +63,20 @@ The order for declaring the pin for the push button is as follows: [source, yaml] ---- digital-input: - button-input-3: - address: 18 + button-input-3: + name: Push Button Input + address: 18 + pull: PULL_DOWN + debounce: 30 + provider: pigpio-digital-input ---- So the push button would be connected to GPIO 18. -===== Constructors - -[source, java] ----- -include::../../../../../../pi4micronaut-utils/src/main/java/com/opensourcewithslu/inputDevices/PushButtonHelper.java[tag=const] ----- +===== Constructor and Methods -===== Methods +To see the constructor and methods of our PushButtonHelper class see our javadoc link:https://oss-slu.github.io/Pi4Micronaut/javadoc/com/opensourcewithslu/inputdevices/PushButtonHelper.html[here] +for more details. -[source, java] ----- -include::../../../../../../pi4micronaut-utils/src/main/java/com/opensourcewithslu/inputDevices/PushButtonHelper.java[tags=method] ----- ===== An Example Controller @@ -79,4 +85,4 @@ include::../../../../../../pi4micronaut-utils/src/main/java/com/opensourcewithsl [source, java] ---- include::../../../../../../components/src/main/java/com/opensourcewithslu/components/controllers/PushButtonController.java[tag=ex] ----- \ No newline at end of file +---- diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/rfidScanner.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/rfidScanner.adoc index 41788a47..3bda659c 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/rfidScanner.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/rfidScanner.adoc @@ -10,12 +10,11 @@ endif::rootpath[] ==== RFID Scanner [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/inputComponents/rfidScanner.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/rfidScanner.adoc[Improve this doc] ===== Overview This section provides information regarding the RFID scanner component and its circuit, including assembly instructions. - ===== Components * RFID-RC522 @@ -24,9 +23,6 @@ This section provides information regarding the RFID scanner component and its c * Breadboard * Power source (3.3V) - - - ===== Assembly Instructions * Put RFID scanner on breadboard as shown in the diagram below. @@ -35,31 +31,25 @@ This section provides information regarding the RFID scanner component and its c ===== Circuit Diagram -Model: image::rfid_circuit.png[] ===== Functionality -The two main functions of the RFID scanner are to read RFIDs and to write to them. What is written to the RFID will vary depending on the intended use for the scanner. - -===== Troubleshooting +RFID Scanner requires RFID tags to work with. We can read/write the data on to the tags using the scanner. -Make sure everything is connected to the correct pins. +* `/write/{value}` - Writes {value} to the RFID key fob +* `/read` - Scanner will be ready to read the key fob ===== Testing the Circuit: -To write to the RFID fob: `curl -X POST http://localhost:8080/rfid/write/{message}` - -Example: +To write to the RFID fob: [source] ---- $ curl -X POST http://localhost:8080/rfid/write/HelloThere ---- Scan the key fob to write the message to the fob. -To read from the RFID fob: `curl http://localhost:8080/rfid/read` - -Example: +To read from the RFID fob: [source] ---- $ curl http://localhost:8080/rfid/read @@ -70,25 +60,25 @@ Scan the key fob and the message on the fob will be printed. HelloThere ---- -===== YAML -The RFID scanner as it appears in the application.yml: - -include::../../../../../../components/src/main/resources/application.yml[tag=spi] - - -===== Constructors +===== Troubleshooting -[source, java] ----- -include::../../../../../../pi4micronaut-utils/src/main/java/com/opensourcewithslu/inputDevices/RFidHelper.java[tag=const] ----- +Make sure everything is connected to the correct pins. -===== Methods +===== YAML Configuration +The RFID scanner configuration as it appears in the application.yml: -[source, java] +[source] ---- -include::../../../../../../pi4micronaut-utils/src/main/java/com/opensourcewithslu/inputDevices/RFidHelper.java[tag=method] +spi: + rfid: + name: MFRC522 + address: 8 + baud: 500000 + reset-pin: 25 ---- +===== Constructors and Methods +To see the constructor and methods of our RFidHelper class see our javadoc link:https://oss-slu.github.io/Pi4Micronaut/javadoc/com/opensourcewithslu/inputdevices/RFidHelper.html[here] +for more details. ===== An Example Controller @@ -96,5 +86,5 @@ include::../../../../../../pi4micronaut-utils/src/main/java/com/opensourcewithsl [source, java] ---- -include::../../../../../../components/src/main/java/com/opensourcewithslu/components/controllers/RFidController.java[tag=ex] ----- \ No newline at end of file +include::../../../../../../components/src/main/java/com/opensourcewithslu/components/controllers/RfidController.java[tag=ex] +---- diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/rotaryEncoder.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/rotaryEncoder.adoc index f1a7a446..3b441b1d 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/rotaryEncoder.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/rotaryEncoder.adoc @@ -10,7 +10,7 @@ endif::rootpath[] ==== Rotary Encoder [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/inputComponents/rotaryEncoder.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/rotaryEncoder.adoc[Improve this doc] ===== Overview This section provides details of the Rotary Encoder circuit, @@ -38,15 +38,12 @@ stated below and in the diagram. ===== Circuit Diagram -- Note the resistor location at GPIO 27 - image::rotary_encoder_circuit.png[] +*Note:* The resistor location at GPIO 27. + ===== Functionality -- The initial value returned is 0. -- Turning the shaft one unit clockwise will increase the value returned by 1, whereas, turning the - knob counterclockwise by one unit will decrease the value returned by 1. -- The value returned is an integer with a max value of 2147483647 and min of -2147483647. +The rotary encoder returns the value as you rotate the knob. ===== Testing the Circuit To return the value of the rotary encoder: @@ -56,12 +53,14 @@ To return the value of the rotary encoder: $ curl http://localhost:8080/rotaryEncoder/value ---- +* `/value` - returns the current value of the rotary encoder + ===== Troubleshooting - Value not being returned: Make sure all pins on the encoder match up to the correct GPIO pins according to the YAML pin order below. - Make sure that a 10k resistor is being used -===== YAML Pin Order +===== YAML Configuration The order for declaring pins for a Rotary Encoder component in the application.yaml file is as follows *SW-PIN-INFO, CLK-PIN-INFO, DT-PIN-INFO* @@ -71,31 +70,27 @@ So in the case of [source, yaml] ---- multi-digital-input: - rot-encoder: - addresses: 17, 18, 27 + rotary-encoder: + name: Rotary Encoder + addresses: 27,18,17 + debounces: 6000,500,500 + pulls: PULL_DOWN,PULL_UP,PULL_UP + shutdown: LOW + initial: HIGH + provider: pigpio-digital-input ---- the sw pin would be the one connected to GPIO 27, the clk pin would be connected to GPIO 18, and the dt pin would connect to GPIO 17. All lists of values for Rotary Encoder components will follow the same order. -===== Constructors - -[source, java] ----- -include::../../../../../../pi4micronaut-utils/src/main/java/com/opensourcewithslu/inputDevices/RotaryEncoderHelper.java[tag=const] ----- - -===== Methods - -[source, java] ----- -include::../../../../../../pi4micronaut-utils/src/main/java/com/opensourcewithslu/inputDevices/RotaryEncoderHelper.java[tags=method] ----- +===== Constructors and Methods +To see the constructor and methods of our RotaryEncoderHelper class see our javadoc link:https://oss-slu.github.io/Pi4Micronaut/javadoc/com/opensourcewithslu/inputdevices/RotaryEncoderHelper.html[here] +for more details. ===== An Example Controller -====== This controller sets up two rotary encoders +====== This controller uses a rotary encoder [source, java] ---- include::../../../../../../components/src/main/java/com/opensourcewithslu/components/controllers/RotaryEncoderController.java[tag=ex] ----- +---- \ No newline at end of file diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/slideSwitch.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/slideSwitch.adoc index f8455900..c936b648 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/slideSwitch.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/slideSwitch.adoc @@ -13,7 +13,7 @@ endif::rootpath[] ==== Slide Switch [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/inputComponents/slideSwitch.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/slideSwitch.adoc[Improve this doc] ===== Overview @@ -36,7 +36,6 @@ This section provides the details of the Slide Switch circuit, including its com 6. Connect the GPIO18 pin of the Pi to the middle pin of the slide switch so that the resistor and the connection to the capacitor are between. ===== Circuit Diagram -Model: image::slideSwitch_circuit.jpg[] @@ -45,17 +44,23 @@ Making a request to the switch will return whether the switch is on or off, flip ===== Testing the Circuit: -Use: `curl http://localhost:8080/slideSwitch/switch1` to test the switch. This will either return true,if the switch is on, and false if the switch is off. Flip the switch and run the command again to see the opposite result of the first call. +Use the below command to test the switch. +[source, bash] +---- +$ curl http://localhost:8080/slideSwitch/switch1 +---- +This will either return true,if the switch is on, and false if the switch is off. Flip the switch and run the command again to see the opposite result of the first call. ===== Troubleshooting Verify that all connections are correct and that the order of components in a row are correct. -===== YAML +===== YAML Configuration The slide switch as it appears in the application.yml: [source, yaml] ---- +digital-input: slide-switch-input: name: Slide Switch Input address: 18 @@ -71,21 +76,12 @@ The slide switch as it appears in the application.yml: provider: pigpio-digital-input ---- -Note that there are two slide switches, one that uses GPIO 18 and the other uses GPIO 22. - -===== Constructors - -[source, java] ----- -include::../../../../main/java/com/opensourcewithslu/inputDevices/SlideSwitchHelper.java[tag=const] ----- +*Note:* There are two slide switches, one that uses GPIO 18 and the other uses GPIO 22. -===== Methods +===== Constructors and Methods +To see the constructor and methods of our SlideSwitchHelper class see our javadoc link:https://oss-slu.github.io/Pi4Micronaut/javadoc/com/opensourcewithslu/inputdevices/SlideSwitchHelper.html[here] +for more details. -[source, java] ----- -include::../../../../main/java/com/opensourcewithslu/inputDevices/SlideSwitchHelper.java[tags=method] ----- ===== An Example Controller diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/touchSwitch.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/touchSwitch.adoc new file mode 100644 index 00000000..c24f19a1 --- /dev/null +++ b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/touchSwitch.adoc @@ -0,0 +1,122 @@ +:imagesdir: img/ + +ifndef::rootpath[] +:rootpath: ../../ +endif::rootpath[] + +ifdef::rootpath[] +:imagesdir: {rootpath}{imagesdir} +endif::rootpath[] + +==== Touch Switch + +[.text-right] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/touchSwitch.adoc[Improve this doc] + +===== Overview + +This section provides details of a touch switch sensor implementation, +including its circuit diagram, required hardware components, +assembly instructions, and functionality. + +===== Components + +. Touch switch module +. LED light +. 1 x 220Ω resistor +. Breadboard +. Jumper wires +. Power source + +===== Assembly Instructions + +Connect the 3 pins on the touch switch to the breadboard as well as the LED and resistor +making sure the LED has power. + +. Ground: connect the ground on the touch switch to the ground on the breadboard +. Power: Connect the VCC on the touch switch to the 3.3V on the breadboard +.. You will want to have a wire connecting 3.3V and ground to the bottom of the board +so that power can be supplied to the LED and touch switch as shown in the diagram below +. IO: Connect the IO on the touch switch to GPIO 17 on the breadboard which is the digital input +. Resistor: Place the resistor vertically so that it can connect the LED light to power +. Connect a wire from GPIO26 to the LED which is its digital output + +===== Circuit Diagram + + +image:touchSwitchDiagram.png[] + +*Schematic Diagram:* + +image:touchSwitch.png[] + +===== Functionality + +We can either open or close a circuit using touch switch when you touch it. + +===== Testing the Circuit + +Use the below commands to test the touch switch. + +* `/enable` - turns on touch switch +[source, bash] +---- +$ curl http://localhost:8080/touchSwitch/enable +---- + +* `/disable` - turns off touch switch +[source, bash] +---- +$ curl http://localhost:8080/touchSwitch/disable +---- + +===== Troubleshooting + +- LED not lighting up once it has been enabled and is being touched: +Make sure that all the pins on the touch switch are in the right spot and that everything is receiving power. +Also make sure that everything is properly secured to the breadboard. +- Ensure a 220Ω resistor is being used + +===== YAML Configuration + +The YAML configuration for the LED is as follows: + +[source, yaml] +---- +digital-output: + led2: + name: LED Output + address: 26 + shutdown: HIGH + initial: HIGH + provider: pigpio-digital-output +---- +So, the output of the LED is connected to GPIO 26. + +The YAML configuration for the touch switch is as follows: + +[source, yaml] +---- +digital-input: + touch-switch-input: + name: Touch Switch Input + address: 17 + pull: PULL_DOWN + debounce: 200000 + provider: pigpio-digital-input +---- +So, the input of the touch switch is connected to GPIO 17. + +===== Constructor and Methods + +To see the constructor and methods of our TouchSwitchHelper class see our javadoc link:https://oss-slu.github.io/Pi4Micronaut/javadoc/com/opensourcewithslu/inputdevices/TouchSwitchHelper.html[here] +for more details. + +===== An Example Controller + +====== This controller uses the touch switch to light up a LED light once touched + +[source, java] +---- +include::../../../../../../components/src/main/java/com/opensourcewithslu/components/controllers/TouchSwitchController.java[tag=ex] +---- \ No newline at end of file diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/ultraSonicSensor.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/ultraSonicSensor.adoc new file mode 100644 index 00000000..7f483a68 --- /dev/null +++ b/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/ultraSonicSensor.adoc @@ -0,0 +1,96 @@ +:imagesdir: img/ + +ifndef::rootpath[] +:rootpath: ../../ +endif::rootpath[] + +ifdef::rootpath[] +:imagesdir: {rootpath}{imagesdir} +endif::rootpath[] + + +==== Ultrasonic Sensor +[.text-right] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/ultraSonicSensor.adoc[Improve this doc] + +===== Overview +This document provides details of the Ultrasonic Sensor circuit, +including its components, assembly instructions, and functionality. + +===== Components +. HC SR04 +. T-Extension Board +. Breadboard +. Jumper wires +. Power source + +===== Circuit Diagram + +image::ultrasonic_sensor_model.png[] + +*Schematic Diagram:* + +image::ultrasonic_sensor_circuit.png[] + +===== Functionality +The Ultrasonic Sensor uses sound waves to calculate the distance from itself to the surface it is pointed at. +The resulting measurement is accurate within a range of 3mm of the true measurement. +The Ultrasonic Sensor's signal is stable within 5m of the sensor, gradually weakening until the signal fully disappears at 7m. + +===== Testing + +Use the below commands to test the component. + +[source, bash] +---- +$curl http://localhost:8080/ultraSound/enable +---- + +* `/enable` - turns on ultrasonic sensor, starts measuring distance +* `/distance/cm` - returns distance to nearest object in centimeters +* `/distance/m` - returns distance to nearest object in meters +* `/disable` - turns off ultrasonic sensor + + + +===== Troubleshooting +. Distance measurements not showing: Check all connections, ensure the sensor is placed correctly, +and check the power source. + +===== YAML Configuration +The order for declaring the Trigger and Echo Pins of the Ultrasonic Sensor is as follows: + +So the Trigger Pin would be connected to GPIO 23 and the Echo Pin would be connected to GPIO 24. + +[source, yaml] +---- +digital-input: + ultra-sonic-echo: + name: UltraSonic Sensor Input + address: 24 + pull: PULL_DOWN + debounce: 3000 + provider: pigpio-digital-input + +digital-output: + ultra-sonic-trig: + name: UltraSonic Sensor Output + address: 23 + shutdown: LOW + initial: LOW + provider: pigpio-digital-output +---- + +===== Constructor and Methods + +To see the constructor and methods of our UltraSonicSensor class see our javadoc link:https://oss-slu.github.io/Pi4Micronaut/javadoc/com/opensourcewithslu/inputdevices/UltraSonicSensorHelper.html[here] +for more details. + +===== An Example Controller + +====== This controller uses the Ultrasonic Sensor to calculate distance from the sensor to a surface + +[source, java] +---- +include::../../../../../../components/src/main/java/com/opensourcewithslu/components/controllers/UltraSonicSensorController.java[tag=ex] +---- \ No newline at end of file diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents.adoc index 1f7233be..2aa6278c 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents.adoc @@ -1,4 +1,6 @@ === Output Components [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/outputComponents.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents.adoc[Improve this doc] + +The Components that provide output signal either by emitting, displaying, lighting, etc. through Raspberry Pi GPIO pins. \ No newline at end of file diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/activebuzzer.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/activebuzzer.adoc new file mode 100644 index 00000000..a6993fae --- /dev/null +++ b/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/activebuzzer.adoc @@ -0,0 +1,119 @@ +:imagesdir: img/ + +ifndef::rootpath[] +:rootpath: ../../ +endif::rootpath[] + +ifdef::rootpath[] +:imagesdir: {rootpath}{imagesdir} +endif::rootpath[] + + +==== Active Buzzer + +[.text-right] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/activebuzzer.adoc[Improve this doc] + +===== Overview +This section provides details of the Active Buzzer, including the components and assembly instructions. The Active Buzzer only emits one frequency, as described in the code, to play various sounds. + +===== Components +* 1 x RaspberryPi +* 1 x Breadboard +* 1 x T-extension Board +* 1 x Active 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 Active 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 Active Buzzer will have two pins. The longer pin is the anode (+) while the shorter is the cathode(-). +* 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 Active Buzzer. +* Connect jumper wire from negative end of Active Buzzer to emitter pin of S8550 PNP Transistor. +* Connect jumper wire from negative side to collector pin of S8550 PNP Transistor. + +===== Circuit Diagram + +image::active_buzzer-CD.png[] + +*Schematic Diagram* + +image::buzzer-SD.png[] + +===== Functionality +Active Buzzer is PWM type and emits a beep tone, intermittent tone and a morseCode tone based on the frequency and the time interval. + +*Note:* If you use transistor in the circuit, it swaps the functionalities of the buzzer i.e., if you enable the buzzer, it actually disables it and vice versa. + +===== Testing the circuit +Use the below command to test the component. + +[source, bash] +---- +$curl http://localhost:8080/active-buzzer/enable +---- + +* `/enable` - Turns the Active Buzzer on. + +[source, bash] +---- +$curl http://localhost:8080/active-buzzer/disable +---- +* `/disable` - Turns the Active Buzzer off. + +[source, bash] +---- +$curl http://localhost:8080/active-buzzer/beepTone +---- +* `/beepTone` - Emits a beep sound from the Active Buzzer. + +[source, bash] +---- +$curl http://localhost:8080/active-buzzer/intermittentTone +---- +* `/intermittentTone` - Emits an intermittent tone from the Active Buzzer. The total duration is twenty seconds: ten seconds of sound and ten seconds of silence. + +[source, bash] +---- +$curl http://localhost:8080/active-buzzer/morseCode +---- +* `/morseCode` - Emits the word "pi" in morse code. + + +===== Troubleshooting +- Active Buzzer not creating sound: + * Double check power source + * Verify that 1K resistor is used + * Verify all wires are in appropriate slots. + +===== YAML Configuration +[source, yaml] +---- +pwm: + active-buzzer: + name: active-buzzer + address: 17 + pwmType: SOFTWARE + provider: pigpio-pwm + initial: 0 + shutdown: 0 +---- + +===== Constructor and Methods +The constructor and the methods within the ActiveBuzzerHelper class can be seen in our javadoc link:https://oss-slu.github.io/Pi4Micronaut/javadoc/com/opensourcewithslu/outputdevices/ActiveBuzzerHelper.html[here]. + +===== Example Controller + +====== This controller uses the Active Buzzer to emit sound once prompted by the commands + +[source, java] +---- +include::../../../../../../components/src/main/java/com/opensourcewithslu/components/controllers/ActiveBuzzerController.java[tag=ex] +---- \ No newline at end of file diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/lcd1602.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/lcd1602.adoc index 693ba2dc..f8417628 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/lcd1602.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/lcd1602.adoc @@ -11,10 +11,13 @@ endif::rootpath[] ==== LCD1602 [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/outputComponents/lcdScreen.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/lcdScreen.adoc[Improve this doc] ===== Overview -This section provides details of the LCD1602 (Liquid Crystal Display) circuit, including its components, assembly instructions, and functionality. The LCD1602 is a kind of dot matrix module that can show letters, numbers, and other characters. The number 1602 describes the display: 2 rows with 16 characters per row. NOTE: The LCD display only works on the 32 bit version of Raspberry Pi OS. +This section provides details of the LCD1602 (Liquid Crystal Display) circuit, +including its components, assembly instructions, and functionality. + +.Note: The LCD1602 only works on the 32-bit version of Raspberry Pi OS. ===== Components . LCD1602 @@ -36,7 +39,22 @@ Connect the 4 pins on the LCD1602 screen to the breadboard as described below an image::lcd1602-circuit.png[] ===== Functionality -The LCD1602 screen will light up once connected to a power source. + +The LCD1602 is a kind of dot matrix module that can show letters, numbers, and other characters. +The number 1602 describes the display: 2 rows with 16 characters per row. + +Use: `curl http://localhost:8080/lcd` to test the component. These following commands will test the component: + +* `/write/{text}` - writes *{text}* to lcd screen +* `/write/{text}/{line}` - writes *{text}* to lcd screen on line number *{line}* +* `/write/{text}/{line}/{pos}` - writes *{text}* to lcd screen on line number *{line}* at pos *{pos}* +* `/write/character/{charValue}` - writes character *{charValue}* to lcd screen +* `/backlight/{state}` - sets backlight to *{state}* (state must be set to *"on"* or *"off"*) +* `/clear/all` - clears lcd screen +* `/clear/{line}` - clears line number {line} of lcd screen +* `/turnOff` - turns off lcd screen + + ===== Testing the Circuit Write Hello to the LCD1602 screen @@ -105,7 +123,7 @@ $ sudo reboot $ uname -m ................. -===== YAML +===== YAML Configuration LCD1602 uses I2C communication for this circuit and configuration in the application.yml file is as follows [source, yaml] ---- @@ -116,19 +134,10 @@ i2c: device: 0x27 ---- -===== Constructors - -[source, java] ----- -include::../../../../../../pi4micronaut-utils/src/main/java/com/opensourcewithslu/outputDevices/LCD1602Helper.java[tag=const] ----- - -===== Methods +===== Constructor and Methods -[source, java] ----- -include::../../../../../../pi4micronaut-utils/src/main/java/com/opensourcewithslu/outputDevices/LCD1602Helper.java[tags=method] ----- +To see the constructor and methods of our LCD1602Helper class, see our javadoc link:https://oss-slu.github.io/Pi4Micronaut/javadoc/com/opensourcewithslu/outputdevices/LCD1602Helper.html[here] +for more details. ===== An Example Controller diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/led.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/led.adoc index 6eac757b..bd4060a3 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/led.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/led.adoc @@ -11,7 +11,7 @@ endif::rootpath[] ==== LED [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/outputComponents/led.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/led.adoc[Improve this doc] ===== Overview This section provides details of the LED, including its components and assembly instructions. @@ -25,7 +25,7 @@ This section provides details of the LED, including its components and assembly * 1 x Resistor (220Ω) * Power source (appropriate voltage, typically 3.3V) -===== Assembly +===== Assembly Instructions * Place a single LED onto the Breadboard. * The LED will have two pins, a cathode and an anode. @@ -41,50 +41,53 @@ This section provides details of the LED, including its components and assembly image::LED_circuit.png[] +===== Functionality +LED can be turned on or off, switch state and set to blink for the provided duration in milliseconds. + ===== Testing -Use: `curl http://localhost:8080/LED/LEDOn` to test the component. This will cause the LED to light. +Use the below commands to test the component. This will cause the LED to light. +[source, bash] +---- +$ curl http://localhost:8080/led/ledOn +---- +* `/ledOn` - Turns the led on. +* `/ledOff` - Turns the led off. +* `/switchState` - Switches the state of the led. +* `/blink/{duration}/` - Causes the led to blink for the desired duration(milliseconds). ===== Troubleshooting - LED not lighting: Check the connections, and ensure the LED is placed correctly. Double-check the power source. - LED is too dim: Resistor value may be too high. Verify you're using 220Ω or adjust according to the power source your using as well as the LED specifications. -===== YAML +===== YAML Configuration [source, yaml] ---- -led: # <1> - name: LED Output # <2> - address: 17 # <3> - shutdown: HIGH # <4> - initial: HIGH # <5> - provider: pigpio-digital-output # <6> - -led2: - name: LED Output - address: 26 - shutdown: HIGH - initial: HIGH - provider: pigpio-digital-output +digital-output: + led: + name: LED Output + address: 17 + shutdown: LOW + initial: LOW + provider: pigpio-digital-output + led2: + name: LED Output + address: 26 + shutdown: HIGH + initial: HIGH + provider: pigpio-digital-output ---- -===== Constructors - -[source, java] ----- -include::../../../../../../pi4micronaut-utils/src/main/java/com/opensourcewithslu/outputDevices/LEDHelper.java[tag=const] ----- -===== Methods +===== Constructor and Methods -[source, java] ----- -include::../../../../../../pi4micronaut-utils/src/main/java/com/opensourcewithslu/outputDevices/LEDHelper.java[tags=method] ----- +To see the constructor and methods of our LEDHelper class see our javadoc link:https://oss-slu.github.io/Pi4Micronaut/javadoc/com/opensourcewithslu/outputdevices/LEDHelper.html[here] +for more details. ===== An Example Controller [source, java] ---- -include:: ../../../../../../components/src/main/java/com/opensourcewithslu/components/controllers/LEDController.java[tags=method] +include::../../../../../../components/src/main/java/com/opensourcewithslu/components/controllers/LEDController.java[tag=ex] ---- diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/passivebuzzer.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/passivebuzzer.adoc new file mode 100644 index 00000000..735d7ef5 --- /dev/null +++ b/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/passivebuzzer.adoc @@ -0,0 +1,113 @@ +: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 + +image::passive_buzzer-CD.png[] + +*Schematic Diagram* + +image::buzzer-SD.png[] + +===== Functionality + +A passive buzzer is an electronic component that produces sound by using an external oscillation source. +To produce sound, a passive buzzer needs an external PWM signal supplied by Raspberry Pi. This signal controls the frequency of the sound produced, allowing for different tones or beeps. You can program specific melodies or sequences of beeps by changing the frequency of the PWM signal over time. + +*Note:* If you use transistor in the circuit, it swaps the functionalities of the buzzer i.e., if you enable the buzzer, it actually disables it and vice versa. + +===== Testing +Use the below commands to test the component. + +[source, bash] +---- +$ curl http://localhost:8080/passive-buzzer/enable +---- + +* `/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 Configuration +[source, yaml] + +---- +pwm: + 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] + +---- \ No newline at end of file diff --git a/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/rgbLed.adoc b/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/rgbLed.adoc index 0f52215b..e7fc9aa7 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/rgbLed.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/rgbLed.adoc @@ -1,6 +1,6 @@ ==== RGB LED [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/outputComponents/rgbLed.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/rgbLed.adoc[Improve this doc] ===== Overview This document provides details of the RGB (Red-Green-Blue) LED circuit, @@ -14,7 +14,7 @@ including its components, assembly instructions, and functionality. . Power source (appropriate voltage, typically 3.3V or 5V) ===== Assembly Instructions -. Place the RGB LED on the Breadboard. The LED has four pins - one for each of the +. Place the RGB LED on the Breadboard. The LED has four pins—one for each of the colors (Red, Green, and Blue) and one common pin (either cathode or anode). . Connect the Resistors. Attach a 220Ω resistor to each of the RGB pins of the LED. This is to limit the current and protect the LED. @@ -27,11 +27,10 @@ positive voltage source (VCC) and the other ends of the resistors to the respect negative terminals (like GPIO pins set to OUTPUT and LOW on a microcontroller). ===== Circuit Diagram -Model: image::https://docs.sunfounder.com/projects/raphael-kit/en/latest/_images/image61.png[] -Circuit Diagram: +*Schematic Diagram:* image::https://docs.sunfounder.com/projects/raphael-kit/en/latest/_images/rgb_led_schematic.png[] @@ -48,17 +47,45 @@ produced. For instance: * Magenta: Power both Red and Blue pins while keeping Green off. * White: Power all three pins +===== Testing +Use the below commands to test the component. + +[source, bash] +---- +$ curl http://localhost:8080/rgb/ledOn +---- + +* `/ledOn` - turns on RGB LED +* `/ledOff` - turns off RGB LED +* `/setRed/{val}` - sets value of red to *{val}* +* `/setRed/{val},{frequency}` - sets value of red to *{val}* and frequency to *{frequency}* +* `/setGreen/{val}` - sets value of green to *{val}* +* `/setGreen/{val},{frequency}` - sets value of green to *{val}* and frequency to *{frequency}* +* `/setBlue/{val}` - sets value of blue to *{val}* +* `/setBlue/{val},{frequency}` - sets value of blue to *{val}* and frequency to *{frequency}* +* `/setColor/{redVal},{greenVal},{blueVal}` + - sets values of red *{redVal}*, green *{greenVal}*, and blue *{blueVal}* + +* `/setColor/{redVal},{greenVal},{blueVal},{frequency1},{frequency2},{frequency3}` + - sets values of red *{redVal}*, green *{greenVal}*, and blue *{blueVal}*, + and frequencies of red *{frequency1}*, green *{frequency2}*, and *{frequency3}* + +* `/setColorHex/{hexValue}` - sets color value using its hex value *{hexValue}* +* `/setColorHex/{hexValue},{frequency1},{frequency2},{frequency3}` + - sets color value using its hex value *{hexValue}* + and frequencies of red *{frequency1}*, green *{frequency2}*, and *{frequency3}* + + ===== Troubleshooting . LED not lighting up: Check all connections, ensure the LED is placed correctly, and check the power source. . Only one color is working: One of the pins might have a loose connection. Verify each color pin's connection. -. LED is too dim: The resistor value might be too high. Ensure you're using 220Ω or -adjust according to your power source and LED specifications +. LED is too dim: The resistor value might be too high. Ensure you're using 220Ω or adjust according to your power source and LED specifications -===== Note: The Hex value format must start with "0x" not "#" while passing it as a parameter of "setColorHex()" method. For example, use "0x0000ff" for blue. +*Note:* The Hex value format must start with "0x" not "#" while passing it as a parameter of "setColorHex()" method. For example, use "0x0000ff" for blue. -===== YAML Pin Order +===== YAML Configuration The order for declaring pins for a RGB LED component in the application.yaml file is as follows *RED-PIN-INFO, GREEN-PIN-INFO, BLUE-PIN-INFO* @@ -69,24 +96,27 @@ So in the case of ---- multi-pwm: rgb-led: + name: RGB LED addresses: 17, 18, 27 + pwmTypes: SOFTWARE, SOFTWARE, SOFTWARE + provider: pigpio-pwm + initials: 0, 0, 0 + shutdowns: 0, 0, 0 + rgb-led-2: + name: RGB LED 2 + addresses: 18, 27, 22 + pwmTypes: SOFTWARE, SOFTWARE, SOFTWARE + provider: pigpio-pwm + initials: 0, 0, 0 + shutdowns: 0, 0, 0 ---- the red pin would be the one connected to GPIO 17, green to GPIO 18, and blue to GPIO 27. All lists of values for RGB LED components will follow the same order. -===== Constructors +===== Constructor and Methods -[source, java] ----- -include::../../../../../../pi4micronaut-utils/src/main/java/com/opensourcewithslu/outputDevices/RGBLEDHelper.java[tag=const] ----- - -===== Methods - -[source, java] ----- -include::../../../../../../pi4micronaut-utils/src/main/java/com/opensourcewithslu/outputDevices/RGBLEDHelper.java[tags=method] ----- +To see the constructor and methods of our RGBLEDHelper class see our javadoc link:https://oss-slu.github.io/Pi4Micronaut/javadoc/com/opensourcewithslu/outputdevices/RGBLEDHelper.html[here] +for more details. ===== An Example Controller diff --git a/pi4micronaut-utils/src/docs/asciidoc/contribute/contributingToLibrary.adoc b/pi4micronaut-utils/src/docs/asciidoc/contribute/contributingToLibrary.adoc index a2073c77..17e4effd 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/contribute/contributingToLibrary.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/contribute/contributingToLibrary.adoc @@ -1,4 +1,6 @@ == Contribute to the Pi4Micronaut Library +[.text-right] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/contribute/contributingToLibrary.adoc[Improve this doc] 1. Get Familiar with the Library diff --git a/pi4micronaut-utils/src/docs/asciidoc/contribute/newComponent.adoc b/pi4micronaut-utils/src/docs/asciidoc/contribute/newComponent.adoc index 69042bbe..aae5fc50 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/contribute/newComponent.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/contribute/newComponent.adoc @@ -1,37 +1,40 @@ === How to Create a New Component [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/contribute/newComponent.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/contribute/newComponent.adoc[Improve this doc] -If its compatible with a Raspberry Pi then it should work well with the Pi4Micronaut framework. The following steps should encompass how most components are added to the framework, but should more or different steps be needed, use the -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/contribute/newComponent.adoc[Improve this doc] link to suggest changes. +If its compatible with a Raspberry Pi then it should work well with the Pi4Micronaut. The following steps should encompass how most components are added to the library. Start by creating a new +https://github.com/oss-slu/Pi4Micronaut/issues/new/choose[Issue] to suggest changes. -1. Determine if the device is Input or Output +1. Determine the communication type for the component which you want to use. For example, Buzzer works with PWM and LCD1602 works with I2C. -2. Create a Controller: -** Controllers define and handle interactions with a given component. The Controller of a component will have a `@Controller("/example")` right above the class declaration that acts as the endpoint for requests to the component. Instead of "example", you should name the endpoint something that is identifiable to the component. Each method of the Controller should have a `@Get("/examppleendpoint")` above the method declaration. The endpoint for the method should have the same name as the method and any parameters should be included in the endpoint `/examppleendpoint/{parameter1},{parameter2}`. -** See the https://github.com/oss-slu/Pi4Micronaut/blob/develop/components/src/main/java/com/opensourcewithslu/components/controllers/rgbController.java[RGB Controller] for an example of a Controller. -** Consult the https://micronaut-projects.github.io/micronaut-docs-mn3/3.8.1/guide/#creatingClient[Micronaut Documentation] for more explanation on Controllers. -** All Controllers should be kept here: -`components\src\main\java\com\opensourcewithslu\components\controllers` +2. Setup the circuit. + +3. Add Component to the Application yml -3. Create a Helper: -** A Helper is what the Controller calls to do a action. For example, to change the color of an RGB LED the controller will take the request to change it. The Controller will then call the change color method in the helper. The helper then takes all the actions needed to change the color of the LED. -** See the https://github.com/oss-slu/Pi4Micronaut/blob/develop/micronautpi4j-utils/src/main/java/com/opensourcewithslu/outputdevices/RGBLEDHelper.java[RBG Helper] for an example of a Helper. +** The new component will need to be added to the application yml found at `components/src/main/resources/application.yml`. +** More information on the `application.yml` found in <> -** All Helpers should be kept here: `micronautpi4j-utils\src\main\java\com\opensourcewithslu\(inputdevices or outputdevices)` +4. Create a Helper: +** A Helper is what the Controller calls to do an action. For example, to change the color of an RGB LED the controller will take the request to change it. The Controller will then call the change color method in the helper. The helper then takes all the actions needed to change the color of the LED. +** See the https://github.com/oss-slu/Pi4Micronaut/blob/develop/pi4micronaut-utils/src/main/java/com/opensourcewithslu/outputdevices/RGBLEDHelper.java[RBG Helper] for an example of a Helper. -4. Add Component to the Application yml +** All Helpers should be kept here: `pi4micronaut-utils\src\main\java\com\opensourcewithslu\(inputdevices or outputdevices)` - ** The new component will need to be added to the application yml found at `components/src/main/resources/application.yml`. - ** More infomation on the `application.yml` found in <> +5. Create a Controller: +** Controllers define and handle interactions with a given component. The Controller of a component will have a `@Controller("/example")` right above the class declaration that acts as the endpoint for requests to the component. Instead of "example", you should name the endpoint something that is identifiable to the component. Each method of the Controller should have a `@Get("/exampleEndPoint")` above the method declaration. The endpoint for the method should have the same name as the method and any parameters should be included in the endpoint `/exampleEndPoint/{parameter1},{parameter2}`. +** See the https://github.com/oss-slu/Pi4Micronaut/blob/develop/components/src/main/java/com/opensourcewithslu/components/controllers/rgbController.java[RGB Controller] for an example of a Controller. +** Consult the https://micronaut-projects.github.io/micronaut-docs-mn3/3.8.1/guide/#creatingClient[Micronaut Documentation] for more explanation on Controllers. +** All Controllers should be kept here: +`components\src\main\java\com\opensourcewithslu\components\controllers` -5. Thoroughly test: +6. Thoroughly test: ** Contributors should thoroughly test their integrations ** When submitting a pull request, make sure to include how you tested the component, any circuits that you may have used, and how to run any examples you may have created. ** It is important that reviewers are able to replicated your work in order to properly test the implementation. -6. Create documentation for the component: + +7. Create documentation for the component: ** Create an .adoc file with the component name as the file name. ** Make sure to include all the information that the other components. Simply copy/paste an existing components documentation and edit as needed. - ** Add the file here: `micronautpi4j-utils/src/docs/asciidoc/components` under either input or output components. \ No newline at end of file + ** Add the file here: `pi4micronaut-utils/src/docs/asciidoc/components` under either input or output components. \ No newline at end of file diff --git a/pi4micronaut-utils/src/docs/asciidoc/img/Config_Workflow.png b/pi4micronaut-utils/src/docs/asciidoc/img/Config_Workflow.png new file mode 100644 index 00000000..fdf85bdc Binary files /dev/null and b/pi4micronaut-utils/src/docs/asciidoc/img/Config_Workflow.png differ diff --git a/pi4micronaut-utils/src/docs/asciidoc/img/PIR_Sensor_Circuit.png b/pi4micronaut-utils/src/docs/asciidoc/img/PIR_Sensor_Circuit.png new file mode 100644 index 00000000..c6620b9c Binary files /dev/null and b/pi4micronaut-utils/src/docs/asciidoc/img/PIR_Sensor_Circuit.png differ diff --git a/pi4micronaut-utils/src/docs/asciidoc/img/active_buzzer-CD.png b/pi4micronaut-utils/src/docs/asciidoc/img/active_buzzer-CD.png new file mode 100644 index 00000000..d32978ba Binary files /dev/null and b/pi4micronaut-utils/src/docs/asciidoc/img/active_buzzer-CD.png differ diff --git a/pi4micronaut-utils/src/docs/asciidoc/img/buzzer-SD.png b/pi4micronaut-utils/src/docs/asciidoc/img/buzzer-SD.png new file mode 100644 index 00000000..12d8b233 Binary files /dev/null and b/pi4micronaut-utils/src/docs/asciidoc/img/buzzer-SD.png differ diff --git a/pi4micronaut-utils/src/docs/asciidoc/img/passive_buzzer-CD.png b/pi4micronaut-utils/src/docs/asciidoc/img/passive_buzzer-CD.png new file mode 100644 index 00000000..1f0c882f Binary files /dev/null and b/pi4micronaut-utils/src/docs/asciidoc/img/passive_buzzer-CD.png differ diff --git a/pi4micronaut-utils/src/docs/asciidoc/img/touchSwitch.png b/pi4micronaut-utils/src/docs/asciidoc/img/touchSwitch.png new file mode 100644 index 00000000..6a214fc0 Binary files /dev/null and b/pi4micronaut-utils/src/docs/asciidoc/img/touchSwitch.png differ diff --git a/pi4micronaut-utils/src/docs/asciidoc/img/touchSwitchDiagram.png b/pi4micronaut-utils/src/docs/asciidoc/img/touchSwitchDiagram.png new file mode 100644 index 00000000..6f4e1bdb Binary files /dev/null and b/pi4micronaut-utils/src/docs/asciidoc/img/touchSwitchDiagram.png differ diff --git a/pi4micronaut-utils/src/docs/asciidoc/img/ultrasonic_sensor_circuit.png b/pi4micronaut-utils/src/docs/asciidoc/img/ultrasonic_sensor_circuit.png new file mode 100644 index 00000000..7f6e35c6 Binary files /dev/null and b/pi4micronaut-utils/src/docs/asciidoc/img/ultrasonic_sensor_circuit.png differ diff --git a/pi4micronaut-utils/src/docs/asciidoc/img/ultrasonic_sensor_model.png b/pi4micronaut-utils/src/docs/asciidoc/img/ultrasonic_sensor_model.png new file mode 100644 index 00000000..68ccd76e Binary files /dev/null and b/pi4micronaut-utils/src/docs/asciidoc/img/ultrasonic_sensor_model.png differ diff --git a/pi4micronaut-utils/src/docs/asciidoc/img/ultrasonic_sensor_timing_diagram.png b/pi4micronaut-utils/src/docs/asciidoc/img/ultrasonic_sensor_timing_diagram.png new file mode 100644 index 00000000..c8c84cfd Binary files /dev/null and b/pi4micronaut-utils/src/docs/asciidoc/img/ultrasonic_sensor_timing_diagram.png differ diff --git a/pi4micronaut-utils/src/docs/asciidoc/index.adoc b/pi4micronaut-utils/src/docs/asciidoc/index.adoc index ec4c45d9..c9fa8ce8 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/index.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/index.adoc @@ -32,12 +32,8 @@ include::contribute/contributingToLibrary.adoc[] include::contribute/newComponent.adoc[] -include::adding_creating_App.adoc[] - -include::usingLibrary.adoc[] - -include::components.adoc[] +== Components include::components/commun_WithHardware.adoc[] @@ -66,6 +62,11 @@ include::components/inputComponents/rfidScanner.adoc[] include::components/inputComponents/photosensor.adoc[] +include::components/inputComponents/ultraSonicSensor.adoc[] + +include::components/inputComponents/touchSwitch.adoc[] + +include::components/inputComponents/pirSensor.adoc[] include::components/outputComponents.adoc[] @@ -75,4 +76,6 @@ include::components/outputComponents/rgbLed.adoc[] include::components/outputComponents/lcd1602.adoc[] +include::components/outputComponents/passivebuzzer.adoc[] +include::components/outputComponents/activebuzzer.adoc[] diff --git a/pi4micronaut-utils/src/docs/asciidoc/introduction.adoc b/pi4micronaut-utils/src/docs/asciidoc/introduction.adoc index c5fbf5b8..24aa551a 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/introduction.adoc +++ b/pi4micronaut-utils/src/docs/asciidoc/introduction.adoc @@ -1,7 +1,7 @@ == Introduction [.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/introduction.adoc[Improve this doc] +https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/introduction.adoc[Improve this doc] diff --git a/pi4micronaut-utils/src/docs/asciidoc/style.css b/pi4micronaut-utils/src/docs/asciidoc/style.css index 67574cc9..1c9f7522 100644 --- a/pi4micronaut-utils/src/docs/asciidoc/style.css +++ b/pi4micronaut-utils/src/docs/asciidoc/style.css @@ -68,10 +68,11 @@ a { position: fixed; box-sizing: border-box; background-color: gainsboro; - max-width: 15.5%; - width: 100%; + max-width: 20%; + width: 20%; } + #toc a { color: royalblue; } @@ -126,19 +127,20 @@ h2 { overflow-y: auto; grid-area: content; padding: 1em; - max-width: 84%; + max-width: 80%; width: 100%; position: fixed; z-index: 1; max-height: 80%; height: 100%; - margin-left: 15.5%; + margin-left: 20%; margin-right: 0; margin-bottom: 1%; margin-top: 8%; padding-bottom: 100px; } + .hljs{ background: #cacbca !important; } diff --git a/pi4micronaut-utils/src/docs/asciidoc/usingLibrary.adoc b/pi4micronaut-utils/src/docs/asciidoc/usingLibrary.adoc deleted file mode 100644 index ebf04b9f..00000000 --- a/pi4micronaut-utils/src/docs/asciidoc/usingLibrary.adoc +++ /dev/null @@ -1,5 +0,0 @@ -== Using the library -[.text-right] -https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/usingLibrary.adoc[Improve this doc] - -TODO: outline the most basic use cases of the library, tbh now sure how this differs from the section above \ No newline at end of file diff --git a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/inputdevices/RotaryEncoderHelper.java b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/inputdevices/RotaryEncoderHelper.java index 228c97a8..5dfa42b4 100644 --- a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/inputdevices/RotaryEncoderHelper.java +++ b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/inputdevices/RotaryEncoderHelper.java @@ -1,6 +1,6 @@ package com.opensourcewithslu.inputdevices; -import com.opensourcewithslu.utilities.MultipinConfiguration; +import com.opensourcewithslu.utilities.MultiPinConfiguration; import com.pi4j.io.gpio.digital.DigitalInput; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -23,10 +23,10 @@ public class RotaryEncoderHelper { /** * The RotaryEncoderHelper constructor. - * @param multiPin A {@link com.opensourcewithslu.utilities.MultipinConfiguration} Object. + * @param multiPin A {@link com.opensourcewithslu.utilities.MultiPinConfiguration} Object. */ //tag::const[] - public RotaryEncoderHelper(MultipinConfiguration multiPin) + public RotaryEncoderHelper(MultiPinConfiguration multiPin) //end::const[] { DigitalInput[] allPins = (DigitalInput[]) multiPin.getComponents(); diff --git a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/inputdevices/UltraSonicSensorHelper.java b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/inputdevices/UltraSonicSensorHelper.java index bc2d4a28..09cc06a4 100644 --- a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/inputdevices/UltraSonicSensorHelper.java +++ b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/inputdevices/UltraSonicSensorHelper.java @@ -23,7 +23,10 @@ public class UltraSonicSensorHelper { * @param triggerPin The DigitalOutput pin for triggering the ultrasonic sensor. * @param echoPin The DigitalInput pin for receiving the echo from the ultrasonic sensor. */ - public UltraSonicSensorHelper(DigitalOutput triggerPin, DigitalInput echoPin) { + //tag::const[] + public UltraSonicSensorHelper(DigitalOutput triggerPin, DigitalInput echoPin) + //end::const[] + { this.triggerPin = triggerPin; this.echoPin = echoPin; initialize(); @@ -32,7 +35,10 @@ public UltraSonicSensorHelper(DigitalOutput triggerPin, DigitalInput echoPin) { /** * Initializes the Ultrasonic Sensor */ - public void initialize() { + //tag::method[] + public void initialize() + //end::method[] + { log.info("Ultrasonic Sensor Initialized"); sensorActive = true; // TriggerPin is low initially @@ -42,7 +48,10 @@ public void initialize() { /** * Begins measuring distance from sensor calling triggerAndMeasureDistance function every 100 milliseconds */ - public void startMeasuring() { + //tag::method[] + public void startMeasuring() + //end::method[] + { if (!sensorActive) { return; } @@ -110,7 +119,10 @@ private void calculateDistance(long durationInNano) { * * @return The distance value in centimeters. */ - public double getDistanceInCentimeter() { + //tag::method[] + public double getDistanceInCentimeter() + //end::method[] + { return distance; } @@ -119,14 +131,20 @@ public double getDistanceInCentimeter() { * * @return The distance value in meters. */ - public double getDistanceInMeters() { + //tag::method[] + public double getDistanceInMeters() + //end::method[] + { return distance/100; } /** * Shuts down ultrasonic sensor */ - public void stopMeasuring() { + //tag::method[] + public void stopMeasuring() + //end::method[] + { sensorActive = false; if (!executorService.isShutdown()) { executorService.shutdownNow(); diff --git a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/outputdevices/LEDHelper.java b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/outputdevices/LEDHelper.java index 9ee31db1..b88abc94 100644 --- a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/outputdevices/LEDHelper.java +++ b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/outputdevices/LEDHelper.java @@ -4,6 +4,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.concurrent.TimeUnit; + /** * The class LEDHelper contains methods that pertain to the control of a LED. * @@ -68,4 +70,16 @@ public void switchState() ledOn(); } } + + /** + * + * @param duration blink will take the duration parameter and have the led + * blink for that duration. + * + */ + + public void blink (int duration) { + + ledOutput.blink(duration, TimeUnit.MILLISECONDS); + } } diff --git a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/outputdevices/RGBLEDHelper.java b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/outputdevices/RGBLEDHelper.java index 6c380253..393c5dbc 100644 --- a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/outputdevices/RGBLEDHelper.java +++ b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/outputdevices/RGBLEDHelper.java @@ -1,6 +1,6 @@ package com.opensourcewithslu.outputdevices; -import com.opensourcewithslu.utilities.MultipinConfiguration; +import com.opensourcewithslu.utilities.MultiPinConfiguration; import com.pi4j.io.pwm.Pwm; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -19,10 +19,10 @@ public class RGBLEDHelper { /** * The RGBLEDHelper constructor. - * @param pwm A {@link com.opensourcewithslu.utilities.MultipinConfiguration} Object. + * @param pwm A {@link com.opensourcewithslu.utilities.MultiPinConfiguration} Object. */ //tag::const[] - public RGBLEDHelper(MultipinConfiguration pwm) + public RGBLEDHelper(MultiPinConfiguration pwm) //end::const[] { log.info("Init rgb"); diff --git a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/DigitalInputConfiguration.java b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/DigitalInputConfiguration.java index 8fbf916f..378aa3b4 100644 --- a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/DigitalInputConfiguration.java +++ b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/DigitalInputConfiguration.java @@ -53,12 +53,12 @@ public void setName(String name) { /** * Gets the current debounce value for the component. - * @return Long type representing the debounce of the component. + * @return Long type representing debounce of the component. */ public Long getDebounce() { return debounce; } /** - * Sets the debounce of the component. Replaces existing debounce. + * Sets debounce of the component. Replaces existing debounce. * @param debounce New debounce of type Long, */ public void setDebounce(Long debounce) { this.debounce = debounce; } diff --git a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/DigitalOutputConfiguration.java b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/DigitalOutputConfiguration.java index 608e2d71..5b47e07f 100644 --- a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/DigitalOutputConfiguration.java +++ b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/DigitalOutputConfiguration.java @@ -1,6 +1,5 @@ package com.opensourcewithslu.utilities; -import com.pi4j.io.gpio.digital.DigitalOutput; import com.pi4j.io.gpio.digital.DigitalState; import io.micronaut.context.annotation.EachProperty; import io.micronaut.context.annotation.Parameter; diff --git a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/MultiPinConfigs/DigitalInputMultiPinConfiguration.java b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/MultiPinConfigs/DigitalInputMultiPinConfiguration.java index d2aea12b..6737f29d 100644 --- a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/MultiPinConfigs/DigitalInputMultiPinConfiguration.java +++ b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/MultiPinConfigs/DigitalInputMultiPinConfiguration.java @@ -3,12 +3,14 @@ import com.pi4j.io.gpio.digital.PullResistance; import io.micronaut.context.annotation.EachProperty; import io.micronaut.context.annotation.Parameter; +import io.micronaut.context.annotation.Prototype; import java.util.Arrays; /** * This class handles the configuration of a digital input component that has multiple pins. */ +@Prototype @EachProperty("pi4j.multi-digital-input") public class DigitalInputMultiPinConfiguration { private final String id; @@ -23,7 +25,7 @@ public class DigitalInputMultiPinConfiguration { * @param id The configuration id as defined in the application.yml */ public DigitalInputMultiPinConfiguration(@Parameter String id){ - this.id = id + "Multipin"; + this.id = id + "MultiPin"; } /** @@ -106,7 +108,7 @@ public long[] getDebounces() { /** * Sets the debounces for the component. Replaces all the existing debounces. - * @param debounces String representing the dounces for the component. Each debounce seperated by a comma. + * @param debounces String representing the debounces for the component. Each debounce seperated by a comma. */ public void setDebounces(String debounces) { debounces = debounces.replaceAll("\\s", ""); diff --git a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/MultiPinConfigs/PwmMultiPinConfiguration.java b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/MultiPinConfigs/PwmMultiPinConfiguration.java index 73089631..caf5e4c4 100644 --- a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/MultiPinConfigs/PwmMultiPinConfiguration.java +++ b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/MultiPinConfigs/PwmMultiPinConfiguration.java @@ -1,21 +1,17 @@ package com.opensourcewithslu.utilities.MultiPinConfigs; -import com.opensourcewithslu.utilities.Pi4JMultipinFactory; -import com.pi4j.io.gpio.digital.PullResistance; import com.pi4j.io.pwm.PwmType; import io.micronaut.context.annotation.EachProperty; import io.micronaut.context.annotation.Parameter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - +import io.micronaut.context.annotation.Prototype; import java.util.Arrays; /** * This class handles the configuration of a PWM device that has multiple pins. */ +@Prototype @EachProperty("pi4j.multi-pwm") public class PwmMultiPinConfiguration { - private static final Logger log = LoggerFactory.getLogger(PwmMultiPinConfiguration.class); private final String id; private String name; private int[] addresses; @@ -29,7 +25,7 @@ public class PwmMultiPinConfiguration { * @param id The configuration id as defined in the application.yml */ public PwmMultiPinConfiguration(@Parameter String id){ - this.id = id + "Multipin"; + this.id = id + "MultiPin"; } /** @@ -86,26 +82,26 @@ public PwmType[] getPwmTypes() { * @param pwmTypes String of PWM types separated by commas. Software should be formatted as SOFTWARE. Hardware as HARDWARE. */ public void setPwmTypes(String pwmTypes) { - String[] pwms = pwmTypes.split(","); - PwmType[] all_pwms = new PwmType[pwms.length]; + String[] PWMs = pwmTypes.split(","); + PwmType[] all_PWMs = new PwmType[PWMs.length]; - for(int i = 0; i < pwms.length; i++){ - if(pwms[i].trim().equals("SOFTWARE")){ - all_pwms[i] = PwmType.SOFTWARE; + for(int i = 0; i < PWMs.length; i++){ + if(PWMs[i].trim().equals("SOFTWARE")){ + all_PWMs[i] = PwmType.SOFTWARE; } else{ - all_pwms[i] = PwmType.HARDWARE; + all_PWMs[i] = PwmType.HARDWARE; } } - this.pwmTypes = all_pwms; + this.pwmTypes = all_PWMs; } /** * Gets the initial states that the component is in when first initialized. * @return Array of integers representing the initial state for each pin. */ - public int[] getInitals() { + public int[] getInitials() { return initials; } diff --git a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/MultipinConfiguration.java b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/MultiPinConfiguration.java similarity index 65% rename from pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/MultipinConfiguration.java rename to pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/MultiPinConfiguration.java index d6ebbe60..afa8edde 100644 --- a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/MultipinConfiguration.java +++ b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/MultiPinConfiguration.java @@ -1,28 +1,22 @@ package com.opensourcewithslu.utilities; -import com.pi4j.io.gpio.digital.DigitalState; -import com.pi4j.io.gpio.digital.PullResistance; -import io.micronaut.context.annotation.EachProperty; import io.micronaut.context.annotation.Parameter; import io.micronaut.context.annotation.Prototype; -import java.util.Arrays; -import java.util.List; - /** - * Class for configuring multipin components. + * Class for configuring multiPin components. */ @Prototype -public class MultipinConfiguration { +public class MultiPinConfiguration { private final String id; private final Object[] components; /** - * The MultipinConfiguration constructor. + * The MultiPinConfiguration constructor. * @param id The configuration id as defined in the application.yml - * @param components The array of components that are a part of the multipin component. + * @param components The array of components that are a part of the multiPin component. */ - public MultipinConfiguration(String id, Object[] components){ + public MultiPinConfiguration(@Parameter String id, Object[] components){ this.id = id; this.components = components; } diff --git a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/Pi4JFactory.java b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/Pi4JFactory.java index 87213723..ef612a63 100644 --- a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/Pi4JFactory.java +++ b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/Pi4JFactory.java @@ -117,7 +117,7 @@ public Pwm createPwm(PwmConfiguration config, Context pi4jContext) { .address(config.getAddress()) .pwmType(config.getPwmType()) .provider(config.getProvider()) - .initial(config.getInital()) + .initial(config.getInitial()) .shutdown(config.getShutdown()) .build() ); diff --git a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/Pi4JMultipinFactory.java b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/Pi4JMultiPinFactory.java similarity index 67% rename from pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/Pi4JMultipinFactory.java rename to pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/Pi4JMultiPinFactory.java index c28950a4..980708be 100644 --- a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/Pi4JMultipinFactory.java +++ b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/Pi4JMultiPinFactory.java @@ -7,35 +7,36 @@ import com.pi4j.io.pwm.Pwm; import io.micronaut.context.annotation.EachBean; import io.micronaut.context.annotation.Factory; -import io.micronaut.context.annotation.Prototype; +import jakarta.inject.Singleton; /** - * The Pi4JMultipinFactory class is responsible for creating all the beans for all multi pin components that are being used. + * The Pi4JMultiPinFactory class is responsible for creating all the beans for all multi pin components that are being used. */ -@Prototype +@Singleton @Factory -public class Pi4JMultipinFactory { +public class Pi4JMultiPinFactory { /** - * Default constructor for Pi4JMultipinFactory. + * Default constructor for Pi4JMultiPinFactory. */ - public Pi4JMultipinFactory() { } + public Pi4JMultiPinFactory() { } /** - * Creates a MultipinConfiguration object for a multi pin digital input component. + * Creates a MultiPinConfiguration object for a multi pin digital input component. * @param config {@link DigitalInputMultiPinConfiguration} Object. * @param pi4jContext The Pi4J {@link Context}. - * @return A MultipinConfiguration object. + * @return A MultiPinConfiguration object. */ + @Singleton @EachBean(DigitalInputMultiPinConfiguration.class) - public MultipinConfiguration multiPinInput(DigitalInputMultiPinConfiguration config, Context pi4jContext){ + public MultiPinConfiguration multiPinInput(DigitalInputMultiPinConfiguration config, Context pi4jContext){ int[] addresses = config.getAddresses(); DigitalInput[] allInputs = new DigitalInput[addresses.length]; for(int i = 0; i < addresses.length; i++){ var inputConfigBuilder = DigitalInput.newConfigBuilder(pi4jContext) - .id(config.getId() + String.valueOf(i)) + .id(config.getId() + i) .name(config.getName()) .address(config.getAddresses()[i]) .debounce(config.getDebounces()[i]) @@ -45,34 +46,35 @@ public MultipinConfiguration multiPinInput(DigitalInputMultiPinConfiguration con allInputs[i] = pi4jContext.create(inputConfigBuilder); } - return new MultipinConfiguration(config.getId(), allInputs); + return new MultiPinConfiguration(config.getId(), allInputs); } /** - * Creates a MultipinConfiguration object for a multi pin pwm component. + * Creates a MultiPinConfiguration object for a multi pin pwm component. * @param config {@link PwmMultiPinConfiguration} Object. * @param pi4jContext The Pi4J {@link Context}. - * @return A MultipinConfiguration object. + * @return A MultiPinConfiguration object. */ + @Singleton @EachBean(PwmMultiPinConfiguration.class) - public MultipinConfiguration multiPinPwm(PwmMultiPinConfiguration config, Context pi4jContext){ + public MultiPinConfiguration multiPinPwm(PwmMultiPinConfiguration config, Context pi4jContext){ int[] addresses = config.getAddresses(); - Pwm[] allPwms = new Pwm[addresses.length]; + Pwm[] allPWMs = new Pwm[addresses.length]; for(int i = 0; i < addresses.length; i++){ var pwmConfigBuilder = Pwm.newConfigBuilder(pi4jContext) - .id(config.getId() + String.valueOf(i)) + .id(config.getId() + i) .name(config.getName()) .address(config.getAddresses()[i]) .pwmType(config.getPwmTypes()[i]) - .initial(config.getInitals()[i]) + .initial(config.getInitials()[i]) .shutdown(config.getShutdowns()[i]) .provider(config.getProvider()); - allPwms[i] = pi4jContext.create(pwmConfigBuilder); + allPWMs[i] = pi4jContext.create(pwmConfigBuilder); } String multiPinId = config.getId().substring(0, config.getId().length() - 8); - return new MultipinConfiguration(multiPinId, allPwms); + return new MultiPinConfiguration(multiPinId, allPWMs); } } diff --git a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/PwmConfiguration.java b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/PwmConfiguration.java index 64bb6b52..760c8b52 100644 --- a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/PwmConfiguration.java +++ b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/PwmConfiguration.java @@ -16,7 +16,7 @@ public class PwmConfiguration { private int address; private PwmType pwmType; private String provider; - private int inital; + private int initial; private int shutdown; /** @@ -71,16 +71,16 @@ public void setAddress(int address) { * Gets the initial state that the component is in when first initialized. * @return The state as an integer. */ - public int getInital() { - return inital; + public int getInitial() { + return initial; } /** * Sets the initial state that the component will be in when first initialized. - * @param inital The startup state as an integer. + * @param initial The startup state as an integer. */ - public void setInital(int inital) { - this.inital = inital; + public void setInitial(int initial) { + this.initial = initial; } /** diff --git a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/SpiConfiguration.java b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/SpiConfiguration.java index 2f6d7282..731bbf64 100644 --- a/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/SpiConfiguration.java +++ b/pi4micronaut-utils/src/main/java/com/opensourcewithslu/utilities/SpiConfiguration.java @@ -6,7 +6,7 @@ import io.micronaut.context.annotation.Prototype; /** - * This class handles the configuration of a SPI component. + * This class handles the configuration of an SPI component. */ @Prototype @EachProperty("pi4j.spi")