Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #230 | Servo Motor Documentation #231

Merged
merged 5 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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*
ruthvikm marked this conversation as resolved.
Show resolved Hide resolved

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[]
Loading