node-red-contrib-reterminal-dm 0.1.6
The node accessing for Seeed Studio reTerminal DM various data such as buzzer, LED, light, touch positions.
node-red-contrib-reterminal-dm
A Node-RED package for accessing Seeed Studio reTerminal DM device features including buzzer, LED control, light sensor, and touch panel functionality.
About reTerminal DM
The reTerminal DM is an enhanced version of the reTerminal series, featuring additional hardware capabilities for industrial and IoT applications.
Installation
Navigate to your Node-RED user directory ~/.node-red
and install:
npm i node-red-contrib-reterminal-dm
Or install via Node-RED Palette Manager:
- Go to "Palette Manager" menu in your Node-RED interface
- Search for "node-red-contrib-reterminal-dm" in the Node-RED Library
- Click "Install"
Available Nodes
Input Nodes (Sensors)
Light Sensor
- Node:
reTerminal Light Sensor
- Description: Continuously reads light sensor values
- Output: JSON object with light sensor data
- Configuration:
- Poll Interval (ms) - configurable sampling rate (default: 1000ms)
- Output Format:
{ "light": 1023 }
Touch Panel
- Node:
reTerminal Touch Panel
- Description: Detects touch events and position coordinates
- Output: JSON object with touch position data
- Output Format:
{ "position": { "x": 240, "y": 180 } }
Output Nodes (Actuators)
USR Red LED
- Node:
reTerminal LED Usr Red
- Description: Controls the user red LED on the reTerminal DM
- Input: Boolean payload
true
- Turn LED onfalse
- Turn LED off
- Status Display: Shows current LED state
Buzzer
- Node:
reTerminal Buzzer
- Description: Controls the built-in buzzer
- Input: Boolean payload
true
- Turn buzzer onfalse
- Turn buzzer off
- Status Display: Shows current buzzer state
Quick Start Flow
Import this flow to get started quickly:
[{"id":"light_example","type":"light_sensor","name":"Light Sensor","pollInterval":1000,"x":150,"y":100,"wires":[["light_debug"]]},{"id":"light_debug","type":"debug","name":"Light Data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":400,"y":100,"wires":[]},{"id":"touch_example","type":"touch_panel","name":"Touch Panel","x":150,"y":200,"wires":[["touch_debug"]]},{"id":"touch_debug","type":"debug","name":"Touch Data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":400,"y":200,"wires":[]},{"id":"led_on","type":"inject","name":"LED On","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":150,"y":300,"wires":[["usr_red_led"]]},{"id":"led_off","type":"inject","name":"LED Off","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":150,"y":340,"wires":[["usr_red_led"]]},{"id":"usr_red_led","type":"led_usr_red","name":"USR Red LED","x":400,"y":320,"wires":[]},{"id":"buzzer_on","type":"inject","name":"Buzzer On","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":150,"y":420,"wires":[["buzzer_node"]]},{"id":"buzzer_off","type":"inject","name":"Buzzer Off","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":150,"y":460,"wires":[["buzzer_node"]]},{"id":"buzzer_node","type":"buzzer","name":"Buzzer","x":400,"y":440,"wires":[]}]
Node Usage Examples
Reading Light Sensor Data
The light sensor node automatically outputs data at the configured interval. Connect it to a debug node or function node to process the light values.
Detecting Touch Events
The touch panel node triggers when the screen is touched, providing X and Y coordinates. Use this for creating interactive interfaces.
Controlling LEDs
Send boolean true
/false
messages to LED nodes to turn them on/off. You can use inject nodes, function nodes, or any other source of boolean payloads.
Operating the Buzzer
Similar to LEDs, send boolean payloads to control the buzzer. Useful for alerts, notifications, or audio feedback.
Technical Notes
- Light Sensor: Uses configurable polling intervals via
setInterval
with proper cleanup on node shutdown - Touch Panel: Utilizes child process spawning to handle touch events asynchronously
- Hardware Dependencies: Requires the
npm-reterminal-dm
package for hardware access - Resource Management: Intervals and child processes are properly cleaned up when nodes are closed
Dependencies
npm-reterminal-dm
: ^1.1.1 - Core library for reTerminal DM hardware access
Compatibility
- Node-RED version: Compatible with current Node-RED releases
- Hardware: Seeed Studio reTerminal DM device
- Platform: Linux-based systems with proper hardware access
Version History
- v0.1.5 - Current release with light sensor, touch panel, USR red LED, and buzzer support
License
ISC License
Support
- Repository: GitHub Repository
- Issues: Report Issues
- Author: cgjgh
Acknowledgments
This package utilizes the npm-reterminal-dm
library for easy access to reTerminal DM hardware features. Special thanks to the library maintainers for providing a simple interface to the device capabilities.