Skip to content

Commit

Permalink
Fixes #230 | Servo Motor Documentation (#231)
Browse files Browse the repository at this point in the history
* Created the basis of the Servo Motor documentation

* Implemented links to other files now that the controller and helper are merged. Need both Circuit Diagram & Schematic Diagram.

* Implemented circuit diag. & schematic diag. into .adoc. Added both diagrams to img folder.

* Implemented requested changes.
  • Loading branch information
adelgadoj3 authored May 1, 2024
1 parent 58a2115 commit 3bd63e8
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
:imagesdir: img/

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

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


==== Servo Motor

[.text-right]

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

===== Overview
This section provides details of the Servo Motor. Specifically, the Micro Servo 9G - SG90, which is a positional servo with a range from 0 to 180 degrees. These details include the components and assembly instructions.


===== Components
* 1 x RaspberryPi
* 1 x Breadboard
* 1 x T-extension Board
* 1 x Servo-Motor
* 3 x Jumper Wires
* Power source (appropriate voltage, typically 3.3V)

===== Assembly Instructions
* Connect a jumper wire to 3.3V
* Connect a jumper wire to GPIO 18
* Connect a jumper wire to GND
* Connect the 3.3V jumper wire to the SIG pin (Color: Red)
* Connect the GND jumper wire to the GND pin (Color: Brown or Black)
* Connect the GPIO 18 jumper wire to the VCC pin (Color: Orange)


===== Circuit Diagram

image::servo-motor_CD.png[]

*Schematic Diagram*

image::servo-motor_SD.png[]

===== Functionality
Servo motor is a PWM type and will rotate the arm between the angles of 0 to 180 degrees.

===== Testing the Circuit
Use the below commands to test the component.

[source, bash]
----
$curl http://localhost:8080/servoMotor/enable
----

* `/enable` - Turns the Servo Motor on.

[source, bash]
----
$curl http://localhost:8080/servoMotor/disable
----

* `/disable` - Turns the Servo Motor off.

[source, bash]
----
$curl http://localhost:8080/servoMotor/setAngle/{angle}
----

* `/setAngle/{angle}` - Sets the indicated angle for the Servo Motor.

===== Troubleshooting
- Servo Motor not rotating:
* Verify that all wires are placed into the correct locations on the Breadboard
* Verify that the wires are placed correctly into the wire receiver for the Servo Motor
* Verify that the Servo Motor is enabled


===== YAML Configuration
[source, yaml]
----
pwm:
servo-motor:
name: Servo Motor
address: 18
pwmType: SOFTWARE
provider: pigpio-pwm
initial: 0
shutdown: 0
----

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

===== Example Controller

====== This controller uses the Servo Motor to move the arm once prompted by the commands

[source,java]
----
include::../../../../../../components/src/main/java/com/opensourcewithslu/components/controllers/ServoMotorController.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.
2 changes: 2 additions & 0 deletions pi4micronaut-utils/src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,5 @@ include::components/outputComponents/lcd1602.adoc[]
include::components/outputComponents/passivebuzzer.adoc[]

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

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

0 comments on commit 3bd63e8

Please sign in to comment.