-
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.
Merge pull request #206 from oss-slu/issue_199
Touch Switch Documentation Issue #199
- Loading branch information
Showing
5 changed files
with
129 additions
and
3 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
124 changes: 124 additions & 0 deletions
124
pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/touchSwitch.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,124 @@ | ||
: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/micronautpi4j-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 | ||
|
||
Model: | ||
|
||
image:touchSwitchDiagram.png[] | ||
|
||
Circuit Diagram: | ||
|
||
image:touchSwitch.png[] | ||
|
||
===== Functionality | ||
|
||
Once the touch switch has been enabled, touching the sensor will turn the LED light on | ||
and removing your finger from the sensor will turn the LED light off. | ||
|
||
===== Testing the Circuit | ||
|
||
To enable the touch switch: | ||
|
||
[source, bash] | ||
---- | ||
curl http://localhost:8080/touchSwitch/enable | ||
---- | ||
|
||
To disable the 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 Pin Order | ||
|
||
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] | ||
---- |
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