Skip to content

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 LabelGPIO PinConnected Device
LASERGPIO15Laser transmitter module (HIGH = emit)

Laser modules are typically low-power Class IIIA (<5mW), powered at 3.3V or 5V.

JSON Configuration Example ​

json
{
  "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

  1. Click Peripheral Execution in the left menu
  2. Click New Rule button
  3. Fill in basic configuration:
    • Rule Name: Remote Laser Control
    • Report Data: ✅ Enabled
    • Enable: ✅ Enabled

Step 2: Configure Trigger

  1. Click Add Trigger button

  2. Fill in trigger configuration:

    FieldValueDescription
    Trigger TypeSelect Platform TriggerReceive cloud platform commands
    OperatorSelect Set ModeReceived data as action parameter

Step 3: Configure Action

  1. Click Add Action button

  2. Fill in:

    • Action Type: Select HIGH or LOW
    • Target Peripheral: Select laser_01
  3. Click Save button

Test Method:

Send via cloud platform:

  • 1 or HIGH → Laser ON
  • 0 or LOW → Laser OFF

Notes ​

  1. Safety: Direct laser exposure to eyes is harmful; avoid looking directly at the beam during operation
  2. Power Consumption: Laser module operating current is ~30mA, can be driven directly by GPIO (or via transistor)
  3. Heat Dissipation: Consider heat dissipation for prolonged continuous operation
  4. Beam Applications: Pair with a photoresistor (GPIO_ANALOG_INPUT) for beam interruption detection

FastBee | fastbee.cn