-
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 #268 from oss-slu/263-document-dc-motor-control-mo…
…dule-for-pi4micronaut DC Motor documentation
- Loading branch information
Showing
4 changed files
with
114 additions
and
2 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
112 changes: 112 additions & 0 deletions
112
pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/motor.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,112 @@ | ||
:imagesdir: img/ | ||
|
||
ifndef::rootpath[] | ||
:rootpath: ../../ | ||
endif::rootpath[] | ||
|
||
ifdef::rootpath[] | ||
:imagesdir: {rootpath}{imagesdir} | ||
endif::rootpath[] | ||
|
||
==== Motor | ||
|
||
[.text-right] | ||
https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/motor.adoc[Improve this doc] | ||
|
||
===== Overview | ||
|
||
This section provides details of the DC motor, including its components and assembly instructions. | ||
|
||
===== Components | ||
|
||
* 1 x RaspberryPi | ||
* 1 x Breadboard | ||
* 1 x T-Extension Board | ||
* 1 x DC Motor | ||
* 8 x Jumper wires | ||
* 1 x L293D Motor Controller IC 1 | ||
* 1 x battery pack with 4 AA or AAA batteries | ||
* Power source (appropriate voltage, typically 3.3V) | ||
|
||
===== Assembly Instructions | ||
|
||
* Connect the ground (GND) pin of the Raspberry Pi to the ground rail on the breadboard. | ||
* Place the L293D Motor Controller on the breadboard. | ||
* Connect a jumper wire from the L293D to the ground rail on the breadboard. | ||
* Connect the motor to the breadboard, attaching both terminals in line with the L293D. | ||
* Connect a jumper wire from pin 17 to the L293D. | ||
* Connect the battery pack to the breadboard. | ||
* Connect a jumper wire from the positive end of the battery pack to the L293D. | ||
* Connect a jumper wire from the negative end of the battery pack to the ground rail on the breadboard. | ||
* Connect a jumper wire from pin 18 of the Raspberry Pi to the L293D. | ||
* Connect a jumper wire from pin 4 of the Raspberry Pi to the L293D. | ||
* Connect a jumper wire from the 5V pin of the Raspberry Pi to the L293D. | ||
|
||
|
||
===== Circuit Diagram | ||
|
||
image::motor_bb.png[] | ||
|
||
===== Schematic Diagram | ||
|
||
image::Motor_schem.png[] | ||
|
||
===== Functionality | ||
|
||
Motor can be enabled or disabled, change speed to custom value 0 to 100, and switch directions between clockwise and counterclockwise. | ||
|
||
===== Testing | ||
|
||
Use the below commands to test the component. | ||
This will cause the motor to turn. | ||
|
||
[source,bash] | ||
---- | ||
$ curl http://localhost:8080/motor/enable | ||
---- | ||
|
||
* `/enable` - Enables the motor. | ||
* `/disable` - Disables the motor. | ||
* `/setSpeed/{speed}` - Sets the speed of the motor to custom value 0 to 100. | ||
* `/setClockwise/{clockwise}` - Sets the direction of the motor; "true" for clockwise, "false" for counterclockwise. | ||
* `/switchDirection` - Switches the direction from clockwise to counterclockwise or vice versa. | ||
|
||
===== Troubleshooting | ||
|
||
* Motor does not turn on | ||
- Ensure all connections are secure and correct. | ||
- Check for appropriate voltage from power source. | ||
- Check the L239D for proper orientation and placement. | ||
- Ensure the software configuration matches the hardware setup. | ||
- Look for any error messages in the console or logs. | ||
|
||
* Motor turns on but does not respond to commands | ||
- Check the software configuration for any discrepancies. | ||
- Ensure the L239D is functioning properly. | ||
- Check for appropriate voltage from power source. | ||
|
||
===== YAML Configuration | ||
|
||
[source,yaml] | ||
---- | ||
pwm: | ||
motor: | ||
name: Motor | ||
address: 17 | ||
pwmType: SOFTWARE | ||
provider: pigpio-pwm | ||
initial: 0 | ||
shutdown: 0 | ||
---- | ||
|
||
===== Constructor and Methods | ||
|
||
To see the constructor and methods of our MotorHelper class see our javadoc link:https://oss-slu.github.io/Pi4Micronaut/javadoc/com/opensourcewithslu/outputdevices/MotorHelper.html[here] | ||
for more details. | ||
|
||
===== An Example Controller | ||
|
||
[source,java] | ||
---- | ||
include::../../../../../../components/src/main/java/com/opensourcewithslu/components/controllers/MotorController.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.