A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

Using Node-Red with Ciseco LLAP devices

I’ve been using the Ciseco wireless modules for a while now and after seeing Node-Red I wanted to use the Ciseco modules as both an input and output to the nodes. This post describes how to setup the Serial In and Serial Out nodes to use either the USB SRF Stick or the XRF and a FTDI breakout module.

The Serial In node node should be dragged to the workspace and by double clicking on it, you will get the edit dialog.


This one has already been configured, but selecting the Add new serial port… option and clicking the Pencil icon will allow you to define a new port


In this example I have used /dev/ttyUSB0, alternatives could be /dev/ACM0. Select the correct speed and clear the newline character. The node should be named something suitable, such as LLAP In. Do the same with the Serial Out node, this time there should already be a serial port defined. Select this and give the node a name, for example LLAP Out.


Once you have the serial nodes defined, you can start to build up the received LLAP messages. This i sdone with a function as each time the Serial In node receives a character it passes it on. The function identifies the start character, builds up the message and then passes it to the next nodes.

The output of the LLAP Parse function will store the LLAP node ID in the msg.topic property and the rest of the message in property msg.payload. For example, if the received string is aT4TMPA19.56 then msg.topic will contain T4 and msg.payload will contain TMPA19.56. The function looks like this:


Code, for cut and paste:

// name: Parse LLAP message
// outputs: 1
// anything stored in context is kept available for next time we get called
context.buff = context.buff || "";
context.count = context.count || 0;

// wait for an a and reset the buffer and counter
if (msg.payload == "a") { context.count = 0; context.buff = ""; } // this does mean the a must NOT appear elsewhere in the message

// add payload to the buffer and increase the count
context.buff = context.buff + msg.payload;
context.count += 1;
// when we reach 11 then output the whole message, assumes length is the a plus 11 - may need to tweak...
if (context.count == 12) {
msg.topic = context.buff.slice(1,3); // return the first two chars as the topic
msg.payload = context.buff.slice(3); // return rest of the buffer as the payload
return msg;
return null;

All the nodes can now be put together to send received messages to other services, or use other inputs to generate LLAP messages to send out.



Thanks to @Dave CJ for helping out with the LLAP parsing function while I get my head round Node.Js.

Bookmark this post: bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Comments are closed.