npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-red-contrib-servo

v1.0.0

Published

A Node-RED node to control servo operations using configurable topics for 'from', 'to', and 'duration' values.

Downloads

27

Readme

node-red-contrib-servo

node-red-contrib-servo is a Node-RED node designed to control servo motors by stepping from one position to another. It receives values via topics for from, to, and duration to control the motor's movement. This node handles the precise positioning of servo motors and includes error handling to ensure the input values are valid.

Features

  • Configurable via Topics: Specify the from, to, and duration parameters dynamically using MQTT or inject nodes.
  • Start/Stop/Resume Functionality: Control the motor's movement using commands like start, stop, and resume.
  • Error Handling: Ensures that the from, to, and duration parameters are valid numbers before initiating motor movement.
  • Accurate Movement: Avoids unnecessary resets of the servo motor to its home position after stepping, maintaining its accuracy.

Installation

Install via the Node-RED palette manager or run the following command in your Node-RED user directory (typically ~/.node-red):

npm install node-red-contrib-servo

Usage

  1. Send Control Messages:

    • Use start, stop, and resume commands to control the servo motor.
    • Send these commands with a true payload via MQTT or inject nodes.
  2. Set Movement Parameters:

    • Send numeric payloads for from, to, and duration to set the servo's stepping range and speed.

Example Flow

Here’s a simple example flow to control the servo motor:

[{"id":"inject_start","type":"inject","z":"flow_id","name":"Start","props":[{"p":"payload","v":"true","vt":"bool"},{"p":"topic","v":"start","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"start","payload":"true","payloadType":"bool"},{"id":"inject_stop","type":"inject","z":"flow_id","name":"Stop","props":[{"p":"payload","v":"true","vt":"bool"},{"p":"topic","v":"stop","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"stop","payload":"true","payloadType":"bool"},{"id":"servo_node","type":"servo","z":"flow_id","name":"Servo Controller","from":"","to":"","duration":"","x":400,"y":200,"wires":[[]]}]

In this flow:

  • Use an inject node to send the start, stop, and resume commands.
  • Use another inject node to send numeric payloads for from, to, and duration to control the servo motor.

Topics

  • start: Starts stepping the servo motor from the from position to the to position within the defined duration.
  • stop: Pauses the stepping.
  • resume: Resumes the stepping from where it was paused.
  • from: Defines the starting position for the servo (numeric payload).
  • to: Defines the target position for the servo (numeric payload).
  • duration: Defines the time (in milliseconds) it takes for each step (numeric payload).

Error Handling

The node will check the input parameters for validity:

  • from, to, and duration must all be valid numbers.
  • If an invalid value is received, an error message will be displayed in the debug panel.

Node Status

  • Blue Dot: Ready to receive commands.
  • Blue Ring: Stepping in progress.
  • Red Ring: Stepping paused.
  • Green Dot: Stepping completed.

License

This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.