node-red-contrib-notecard 1.1.0
A Node-RED node to talk to the Notecard via Serial or Raspberry PI's I2C port
# note-nodered
Node JS library with Custom Node Red package for communication with Blues Wireless Notecard over I²C or Serial (UART) connections.
This Node Red package enables you to control the Notecard by developing flows in Node Red where a server is connected to the Notecard. For I²C connections, a Raspberry Pi or similar host is required.
Installation
Add Notecard Package
With Node Red pallet manager search for node-red-contrib-notecard
For manual installation, follow the steps suggested by the following video: https://youtu.be/2bmWBU2xnHc
You can access the source in the repo here: https://github.com/blues/note-nodered
Enable I2C or Serial on Raspberry Pi
The I2C interface on the Raspberry Pi must be enabled if using a Notecarrier-PI Hat
The serial interface on the Raspberry Pi must be enabled if using a Notecarrier-A* or Notecarrier-B.
Assuming you are using a Raspbian-based operating system distribution on the Raspberry Pi:
Usage
Add a Notecard Request
node to a Node Red flow from the node pallet on the left-hand side of the interface.
Populate input message payload
field with a JSON object conforming to a Notecard request.
The Notecard response will appear in the payload
field of the output as a JSON object.
Configuration
The Notecard Request
node must select a Notecard
configuration node.
If there is no configuration node available, select Add new notecard-config
, and click the edit button.
Configuration Node Settings
The default Notecard Configuration node settings support the default Raspberry Pi and Notecard configurations. In most cases, additional configuration is not required.
Connection
Select the connection type used to communicate with Notecard. When using the Notecarrier-Pi, make sure I2C
is selected. If using a USB port, select serial
.
Bus Number The I2C bus number must be set to the port number being used by the I2C module on the Raspberry Pi. It is a value between [0, 7] inclusive.
Address The default address for the Notecard is 0x17 (23). If that has been changed, then set the address value to the new Notecard address.
Port
Serial port which Notecard is connected to when using serial
communication option.
Baud Rate The baud rate in bits-per-second used to communicate with Notecard over serial. Use 115200 only if using the Auxiliary Serial Port.
Sending Notecard Requests
The Notecard Request
node accepts Notecard requests formed as JSON object.
Set the value of the input msg.payload
to a Notecard request.
Here is an example using an Inject
node:
Response
The Notecard Request
will output the response from the Notecard in the msg.payload
field as a JSON object.
{
"_msgid":"ece314b1.2b8478",
"payload":{
"body":{
"org":"Blues Wireless",
"product":"Notecard",
"version":"notecard-1.5.2",
"ver_major":1,
"ver_minor":5,
"ver_patch":2,
"ver_build":12200,
"built":"Dec 7 2020 19:28:29"
},
"version":"notecard-1.5.2.12200",
"device":"dev:xxxxxxxxxxxxxxx",
"name":"Blues Wireless Notecard",
"type":11,
"sku":"NOTE-NBNA500"
},
"topic":""
}
Examples
The examples directory contains example Node Red flows:
Simple Flow Example Layout
Compatibility
Version 1.x.x is not backwards compatible with version 0.x.x. There is no expectation of support for importing flows developed with previous versions of this package.
Version 1.x.x does not support JSON strings as request inputs or response outputs. All requests and responses are formatted as a JSON object.
Migration
Notecard Request
nodes are a drop in replacement in the diagram if using JSON objects for input and output.
Be sure to set the Notecard Config node in each case.
Any JSON string inputs need to be parsed to JSON objects prior to input into this node.
Contributing
We love issues, fixes, and pull requests from everyone. By participating in this project, you agree to abide by the Blues Inc code of conduct.
For details on contributions we accept and the process for contributing, see our contribution guide.
Running the Tests
If you're planning to contribute to this repo, please be sure to run the tests before submitting a PR.
Tests can only be run on Raspberry Pi connected to Notecard over I2C
Navigate to the root folder and execute
npm test
More Information
For additional Notecard SDKs and Libraries, see:
- note-python for Python support
- note-c for Standard C support
- note-go for Go
- note-arduino for Arduino
To learn more about Blues Wireless, the Notecard and Notehub, see:
License
Copyright (c) 2021 Blues Inc. Released under the MIT license. See LICENSE for details.