Skip to content

Commit 26a8941

Browse files
images show up and other .adoc changes
1 parent 5da2286 commit 26a8941

3 files changed

Lines changed: 35 additions & 22 deletions

File tree

pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/IRObstacleAvoidance.adoc

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,32 @@ endif::rootpath[]
1313
https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents/irObstacleAvoidanceSensor.adoc[Improve this doc]
1414

1515
===== Overview
16-
This section provides the details of the IR Obstacle Avoidance Sensor, including its components, assembly instructions, and functionality.
16+
This section provides details for the IR Obstacle Avoidance Sensor, including its components, assembly instructions, and functionality.
1717

1818
The IR (Infrared) Obstacle Avoidance Module is a proximity sensor that detects objects and obstacles within a short distance (2-30cm) using infrared reflection. It is commonly used in robotics for collision avoidance, object detection, and boundary sensing. The module features adjustable sensitivity via a potentiometer, digital output for easy integration, fast response time, low power consumption, and operates on 3.3V to 5V power supplies.
1919

2020
===== Components
21-
* 1 x Raspberry Pi (Pi 3, 4, or Zero recommended)
21+
* 1 x Raspberry Pi 4
2222
* 1 x IR Obstacle Avoidance Module
23-
* 3 x Jumper Wires (Female-to-Male or appropriate connectors)
24-
* 1 x Breadboard (optional, for prototyping)
23+
* 5 x Male-to-Male Jumper Wires
24+
* 1 x Breadboard
2525
* Power supply for Raspberry Pi
2626

2727
===== Assembly Instructions
28-
* Place the IR Obstacle Avoidance Module onto the breadboard or connect directly to the Raspberry Pi.
29-
* Connect the **VCC** pin of the IR module to **5V** on the Raspberry Pi (Physical Pin 2 or 4).
30-
* Connect the **GND** pin of the IR module to **Ground** on the Raspberry Pi (Physical Pin 6, 9, 14, 20, 25, 30, 34, or 39).
31-
* Connect the **OUT** (or **DO**) pin of the IR module to **GPIO 17** on the Raspberry Pi (Physical Pin 11).
28+
* Place the IR Obstacle Avoidance Module onto the breadboard.
29+
* Connect the **VCC** pin of the IR module to **3.3V** on the Raspberry Pi.
30+
* Connect the **GND** pin of the IR module to **Ground** on the Raspberry Pi.
31+
* Connect the **OUT** (or **DO**) pin of the IR module to **GPIO 17** on the Raspberry Pi.
32+
* Use the remaining two jumper wires to secure the module to the breadboard, following the provided circuit diagram.
3233
* Verify connections to ensure no loose wires or short circuits.
33-
* Adjust the potentiometer (small blue or orange screw) to set detection sensitivity:
34-
- Turn **clockwise** to increase sensitivity (detect closer objects).
35-
- Turn **counter-clockwise** to decrease sensitivity (detect farther objects).
34+
* Adjust the potentiometer to set detection sensitivity:
35+
- Turn **clockwise** to increase sensitivity.
36+
- Turn **counter-clockwise** to decrease sensitivity.
3637

37-
> **Tip**: Use 5V for better detection range and performance, though 3.3V is supported. Ensure the module's IR LEDs face forward.
38+
> **Tip**: Use 3.3V for compatibility with Raspberry Pi GPIO. Ensure the module's IR LEDs face forward.
3839

3940
===== Circuit Diagram
40-
image::irObstacleAvoidance-CD.png.png[]
41+
image::irObstacleAvoidance-CD.png[]
4142

4243
===== Schematic Diagram
4344
image::irObstacleAvoidance-SD.png[]
@@ -50,27 +51,39 @@ Use the following commands to test the component:
5051

5152
[source, bash]
5253
----
53-
$curl http://localhost:8080/irObstacleAvoidance/isObstacleDetected
54+
$curl http://localhost:8080/ir-obstacle/status
5455
----
55-
* `/isObstacleDetected` - Returns `true` if an obstacle is detected, `false` if the path is clear.
56+
* `/status` - Returns `true` if an obstacle is detected, `false` if the path is clear.
5657

5758
[source, bash]
5859
----
59-
$curl http://localhost:8080/irObstacleAvoidance/getState
60+
$curl http://localhost:8080/ir-obstacle/state
6061
----
61-
* `/getState` - Returns the raw digital state (`HIGH` or `LOW`).
62+
* `/state` - Returns the raw digital state (`HIGH` or `LOW`).
6263

6364
[source, bash]
6465
----
65-
$curl http://localhost:8080/irObstacleAvoidance/getStatusMessage
66+
$curl http://localhost:8080/ir-obstacle/message
6667
----
67-
* `/getStatusMessage` - Returns a human-readable status (`"Obstacle detected"` or `"No obstacle"`).
68+
* `/message` - Returns a human-readable status (`"Obstacle detected"` or `"No obstacle"`).
69+
70+
[source, bash]
71+
----
72+
$curl http://localhost:8080/ir-obstacle/wait/{timeoutMillis}
73+
----
74+
* `/wait/{timeoutMillis}` - Waits for obstacle detection within the specified timeout (in milliseconds) and returns `true` if detected, `false` otherwise.
75+
76+
[source, bash]
77+
----
78+
$curl http://localhost:8080/ir-obstacle/init
79+
----
80+
* `/init` - Initializes the sensor and adds an event listener to print `"Obstacle Detected"` or `"No Obstacle"` to the console when the sensor state changes.
6881

6982
===== Troubleshooting
7083
**Sensor Always Reports Obstacle Detected**:
7184
* Adjust potentiometer counter-clockwise to decrease sensitivity.
7285
* Ensure the module is not facing a reflective surface.
73-
* Verify VCC is connected to 5V, not 3.3V.
86+
* Verify VCC is connected to 3.3V.
7487
* Test with a white object to confirm detection.
7588
* Check GPIO state with `gpio readall`.
7689

@@ -79,7 +92,7 @@ $curl http://localhost:8080/irObstacleAvoidance/getStatusMessage
7992
* Verify OUT pin is connected to GPIO 17.
8093
* Confirm `application.yml` has the correct GPIO address.
8194
* Test with a reflective object (e.g., white or shiny surface).
82-
* Measure OUT pin voltage with a multimeter (should switch between 0V and 5V).
95+
* Measure OUT pin voltage with a multimeter (should switch between 0V and 3.3V).
8396

8497
**Inconsistent Detection**:
8598
* Increase debounce time in `application.yml` to 20000 (20ms).
@@ -89,7 +102,7 @@ $curl http://localhost:8080/irObstacleAvoidance/getStatusMessage
89102
* Add a 100µF capacitor across VCC and GND near the module.
90103

91104
**Module Won't Power On**:
92-
* Verify 5V at VCC with a multimeter.
105+
* Verify 3.3V at VCC with a multimeter.
93106
* Check GND connections.
94107
* Ensure `application.yml` is correctly configured.
95108
* Test GPIO manually with `gpio mode 17 in` and `gpio read 17`.
7.18 KB
Loading
98.1 KB
Loading

0 commit comments

Comments
 (0)