-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Started basis of photoresistorSensor documentation * Added the preliminary information for testing * Added more information to the .adoc. Still need to add the Circuit Diagram * Incorporated Circuit Diagram into .adoc, added .png file to img folder, and add ex tag to PhotoResistorController * Updated .adoc with changes. Added index.adoc file with photoresistorSensor link. * Provided accurate circuit diagram for photoresistor with help from Aswindle. Provided updated circuit diagram for LED also with help from Aswindle. Implemented further changes from comments within pull request. --------- Co-authored-by: Alex Delgado <[email protected]> Co-authored-by: Adrian Swindle <[email protected]>
- Loading branch information
1 parent
9951e24
commit 9502888
Showing
6 changed files
with
138 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
132 changes: 132 additions & 0 deletions
132
...aut-utils/src/docs/asciidoc/components/inputComponents/photoresistorSensor.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
:imagesdir: img/ | ||
|
||
ifndef::rootpath[] | ||
:rootpath: ../../ | ||
endif::rootpath[] | ||
|
||
ifdef::rootpath[] | ||
:imagesdir: {rootpath}{imagesdir} | ||
endif::rootpath[] | ||
|
||
|
||
|
||
==== PhotoResistor Sensor | ||
[.text-right] | ||
https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/photoresistorSensor.adoc[Improve this doc] | ||
|
||
|
||
===== Overview | ||
This section provides the details of the PhotoResistor Sensor including its components, assembly instructions, and functionality. | ||
|
||
===== Components | ||
* 1 x RaspberryPi | ||
* 1 x Breadboard | ||
* 1 x LED | ||
* 1 x PhotoResistor Sensor | ||
* 1 x 220Ω Resistor | ||
* 1 x Capacitor (10µf) | ||
* 2 x 10KΩ Resistor | ||
* 4 Jumper Wires | ||
* Power source | ||
|
||
|
||
===== Assembly Instructions | ||
* Place the PhotoResistor onto the breadboard. | ||
* Place the LED onto the breadboard with the Cathode pin in the negative side of the breadboard. The Anode pin will be placed onto the main section of the breadboard. | ||
* Place a 220Ω resistor next to the anode pin of the LED, then place the other pin in line on the main section of the breadboard. | ||
* Place one side of the Capacitor onto the negative side of the breadboard. | ||
* Place the other side of the Capacitor into the breadboard inline with a jumper wire and a 10KΩ Resistor. | ||
* Place the PhotoResistor Sensor onto the breadboard inline with the Capacitor, 10KΩ Resistor. The PhotoResistor should have a 10KΩ pin on either side of its' pins. | ||
* The 10KΩ resistor pin should then be placed in line away from the PhotoResistor pins. | ||
* Place a jumper wire from GND pin to the negative side of the board. | ||
* Place a jumper wire from GPIO4 next to the positive pin of the Capacitor and the 10KΩ Resistor. | ||
* Place a jumper wire from GPIO17 and place it next to the 220Ω Resistor | ||
* Place a jumper wire from GPIO27 to the pin of the 10KΩ. | ||
|
||
===== Circuit Diagram | ||
|
||
image::photoResistor-CD.png[] | ||
|
||
===== Functionality | ||
PhotoResistor is a DigitalInput and DigitalOutput type that controls the LED's behavior based on changes in light intensity. | ||
|
||
|
||
===== Testing | ||
Use the below command to test the component. | ||
|
||
[source, bash] | ||
---- | ||
$curl http://localhost:8080/photoResistor/enable | ||
---- | ||
|
||
* `/enable` - Initializes the PhotoResistor | ||
|
||
[source, bash] | ||
---- | ||
$curl http://localhost:8080/photoResistor/getDarkness | ||
---- | ||
|
||
* `/getDarkness` - returns the darkness level | ||
|
||
[source, bash] | ||
---- | ||
$curl http://localhost:8080/photoResistor/disable | ||
---- | ||
|
||
* `/disable` - Disables the photoresistor | ||
|
||
[source, bash] | ||
---- | ||
$curl http://localhost:8080/photoResistor/threshold/i | ||
---- | ||
|
||
* `/threshold/{i}` - Sets the threshold for the darkness. | ||
|
||
===== Troubleshooting | ||
LED not lighting: | ||
|
||
* Verify that the appropriate resistors are being used (220Ω) | ||
* Double check the power source | ||
|
||
PhotoResistor not working: | ||
|
||
* Ensure that the darkness level is appropriately set | ||
* Verify the PhotoResistor is correctly placed into the breadboard | ||
* Verify the correct resistor is used (10KΩ) | ||
|
||
===== YAML Configuration | ||
The PhotoResistor as it appears in the YAML file: | ||
|
||
[source, yaml] | ||
---- | ||
digital-input: | ||
photo-resistor-input: # <.> | ||
name: Photo Resistor Input # <.> | ||
address: 4 # <.> | ||
debounce: 100000 # <.> | ||
pull: PULL_DOWN # <.> | ||
provider: pigpio-digital-input # <.> | ||
digital-output: | ||
photo-resistor-output: | ||
name: Photo Resistor Output | ||
address: 27 | ||
shutdown: LOW | ||
initial: HIGH | ||
provider: pigpio-digital-output | ||
---- | ||
|
||
|
||
===== Constructor and Methods | ||
To see the constructor and methods of the PhotoResistorHelper class see our java doc link:https://oss-slu.github.io/Pi4Micronaut/javadoc/com/opensourcewithslu/inputdevices/PhotoResistorHelper.html[here] for more details. | ||
|
||
|
||
===== Example Controller | ||
|
||
====== This controller sets up the photoresistor sensor | ||
|
||
[source, java] | ||
---- | ||
include::../../../../../../components/src/main/java/com/opensourcewithslu/components/controllers/PhotoResistorController.java[tag=ex] | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters