Our new Node-RED package

Our new Node-RED package

Some time ago, we published a Node-RED node which allowed you to use a Yoctopuce sensor in a Node-RED schema. This week, we publish other nodes which enable you to use Yoctopuce modules other than sensors, such as Yocto-Relays, Yocto-Buzzers, and so on.





In a previous post, we explained how to install and use the YSensor node in a node-RED schema. This solution however has two problems. First, the code wasn't well optimized, which caused disconnections when several YSensor nodes where used in the same schema. Second, it wasn't possible to use our actuator modules (Yocto-Relay, Yocto-Buzzer, and so on).

Our new package node-red-contrib-yoctopuce provides answers to these two issues.

As installing and using this package is very similar, we are going to concentrate on what's new. If you don't know how to install a Node-RED package, you can read our post on Node-RED, the process is identical, you must simply use the new package node-red-contrib-yoctopuce.

Configuring the connections


In this package, the information to connect to the YoctoHub are not directly in the Node-RED node, but are grouped into a "Configuration Node". You can't see this "Configuration Node" on the schema but it is shared by all other nodes. In this way, there is a single connection to the YoctoHub per schema, while before each node created a new connection.

Concretely, when you add your first Yoctopuce node, you must enter the connection information. For the following ones, you simply select the same configuration.

The connection information is shared between all the nodes
The connection information is shared between all the nodes



The parameters of a Yoctopuce node


Note: If you are not at ease with the logical structure of Yoctopuce modules, we recommend that you start by reading this post.

Yoctopuce nodes correspond to module functions. Consequently, for each Yoctopuce node, you must provide the following information:

  • the YoctoHub (or VirtualHub) on which the module is connected
  • the hardware identifier or the logical name of the function you want to use


You can also assign a name which is displayed in the schema. This name has nothing to do with the logical name of Yoctopuce modules, it is used by Node-RED only to make the schema more readable.

The configuration window of a  YSensor node
The configuration window of a YSensor node




The new Yoctopuce nodes


The YFunction node

It's the simplest node of the package. It allows you to inject in a schema the published value of the function as soon as it changes. The message payload is a string of characters.

The YFunction node
The YFunction node



The YSensor node

This node is equivalent to the node used in our previous package. The YSensor node has only one output which publishes the value of the corresponding Yoctopuce sensor. You can use this node only with functions which inherit from the YSensor class (YTemperature, YVoltage, and so on) and the message payload is a floating point number.

We added the possibility to use periodical notifications, instead of using the current value.

The YSensor node
The YSensor node



YBuzzer

This node enables you to control the volume and the current frequency of the buzzer. You can also directly send a series of notes which the buzzer plays.

The YBuzzer node
The YBuzzer node



YColorLed

This node enables you to change the color of the RGB leds of the Yocto-Color.

The YColorLed node
The YColorLed node



YColorLedCluster

This node enables you to change the color of NeoPixel leds which are connected to a Yocto-Color-V2. It also enables you to start a preprogrammed animation.

The YColorLedCluster node
The YColorLedCluster node



YCurrentLoopOutput

This node enables you to modify the current of a 4-20mA loop driven by a Yocto-4-20mA-Tx.

The YCurrentLoopOutput node
The YCurrentLoopOutput node



YDigitalIO

This nodes enables you to change the state of the digital I/O port. Only bits configured as output in portDirection are taken into account.

The YDigitalIO node
The YDigitalIO node



YDisplay

This node enables you to display the content of a message on a Yocto-MiniDisplay, Yocto-Display, or Yocto-MaxiDisplay. It also enables you to start a display sequence that has been recorded beforehand.

The YDisplay node
The YDisplay node



YLed

This node enables you to change the state of a signal led, such as those available on the Yocto-Buzzer.

The YLed node
The YLed node



YPwmOutput

This node enables you to control the PWM output of a Yocto-PWM-Tx. You can modify the frequency or the duty-cycle.

The YPwmOutput node
The YPwmOutput node



YRelay

This node enables you to change the state of a relay. This node accepts the "A", "B", "ON", and "OFF" commands. You can also commute the relay to a given state only for a specified duration.

The YRelay node
The YRelay node



YSerialPort

This node enables you to send data on a serial port with a Yocto-RS485, Yocto-RS232, or Yocto-Serial.

The YSerialPort node
The YSerialPort node



YServo

This node enables you to control the position of a servomotor.

The YServo node
The YServo node




YVoltageOutput

This node enables you to control the output voltage of a Yocto-0-10V-Tx.

The YVoltageOutput node
The YVoltageOutput node



YWatchdog

This node enables you to reset the sate of the Yocto-WatchdogDC.

The YWatchdog node
The YWatchdog node



Notes

You can configure most output nodes to modify distinct attributes of a function, for example, the YBuzzer node enables you to modify the volume or the frequency of the buzzer. But a node can modify only one attribute at a time. Therefore, if you need to modify the volume and the frequency in a schema, you need to add two nodes and specify the same Hardware ID for these two nodes.

A node can modify only one attribute at a time
A node can modify only one attribute at a time



In the same way, you can use an input node and an output node for the same function. For example, if you use a relay, you can command the relay state with a YRelay node and obtain its current state with a YFunction node. It is very useful, for example with a Yocto-LatchedRelay which can have its state overridden by the switch located on the module.

You can use two nodes of different types for a single function
You can use two nodes of different types for a single function



Conclusion

This new Node-RED package is available directly in your "Manage palette" menu, but if you want to install it manually, you can also obtain it from the Node-RED site: https://flows.nodered.org/node/node-red-contrib-yoctopuce

Add a comment No comment yet Back to blog












Yoctopuce, get your stuff connected.