Example 25: Laser Sensor
About 1 min
Example 25: Laser Sensor
Experiment Overview
A laser transmitter module controls the laser on/off via GPIO high/low level, suitable for laser beam interruption detection, laser pointers, and other applications. Paired with a photosensitive receiver, it can implement laser beam alarm systems.
Hardware Wiring
| Board Label | GPIO Pin | Connected Device |
|---|---|---|
| LASER | GPIO15 | Laser transmitter module (HIGH = emit) |
Laser modules are typically low-power Class IIIA (<5mW), powered at 3.3V or 5V.
JSON Configuration Example
{
"peripherals": [
{
"id": "laser_01",
"name": "Laser Module",
"type": 12,
"enabled": false,
"pins": [15],
"params": { "initialState": 0 }
}
]
}Peripheral Execution Linkage
Scenario: Remote Laser Control (Platform Trigger)
Feature: Control laser on/off via cloud platform commands
Web UI Configuration Steps
Step 1: Create Rule
- Click Peripheral Config in the left menu → Switch to Peripheral Execution tab
- Click New Rule button
- Fill in basic configuration:
- Rule Name:
Remote Laser Control - Report Data: ✅ Enabled
- Enable: ✅ Enabled
- Rule Name:
Step 2: Configure Trigger
Click Add Trigger button
Fill in trigger configuration:
Field Value Description Trigger Type Select Platform Trigger Receive cloud platform commands Operator Select Set Mode Received data as action parameter
Step 3: Configure Action
Click Add Action button
Fill in:
- Action Type: Select HIGH or LOW
- Target Peripheral: Select
laser_01
Click Save button
Test Method:
Send via cloud platform:
1orHIGH→ Laser ON0orLOW→ Laser OFF
Notes
- Safety: Direct laser exposure to eyes is harmful; avoid looking directly at the beam during operation
- Power Consumption: Laser module operating current is ~30mA, can be driven directly by GPIO (or via transistor)
- Heat Dissipation: Consider heat dissipation for prolonged continuous operation
- Beam Applications: Pair with a photoresistor (GPIO_ANALOG_INPUT) for beam interruption detection
