This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I get signalk data into node red
#1
Hi, been playing around with node red, which is already installed o the latest raspian. Very nice.
Han anyone managed to get signalK data in there? So far got nmea from 10110 and mqtt in but struggling with signalK
Looks great though.. here with some ds18 thermometers ..

[Image: rfYrIaE.png]
Reply
#2
Hi,

Good news, Node-red included in version 0.9.0
Unfortunately I'm not at the boat, but I tested at home with some sensors (pressure/temp) and (my lifting keel) connected.
It looks like that these signals are translated in signalk messages. I can display these message on both Node-Red dashboard as on Freeboard. See enclosed picture.

G.


Attached Files Image(s)
   
Reply
#3
yep, try version 0.9 alpha. I'd never used node-red or even done any java scripting before and within an hour had a bunch of dashboards running off signal K data. I found I had to use some of the delay/smoothing functions to avoid too many data points going to the charts I was using though (because I wanted charts of pressure tracking over several days).
Reply
#4
(2016-12-11, 06:10 AM)desolina-nz Wrote: yep, try version 0.9 alpha. I'd never used node-red or even done any java scripting before and within an hour had a bunch of dashboards running off signal K data. I found I had to use some of the delay/smoothing functions to avoid too many data points going to the charts I was using though (because I wanted charts of pressure tracking over several days).

I got node-red running again on 0.9.0 alpha. Had to throw away .node-red/flows_openplotter.

I also get a the message a lot of datapoints  ?
Can you explain why you add the delay function and how you implement smoothing functions ? 


thx G.
Reply
#5
(2016-12-12, 08:56 PM)gniersma Wrote:
(2016-12-11, 06:10 AM)desolina-nz Wrote: yep, try version 0.9 alpha. I'd never used node-red or even done any java scripting before and within an hour had a bunch of dashboards running off signal K data. I found I had to use some of the delay/smoothing functions to avoid too many data points going to the charts I was using though (because I wanted charts of pressure tracking over several days).

I got node-red running again on 0.9.0 alpha. Had to throw away .node-red/flows_openplotter.

I also get a the message a lot of datapoints  ?
Can you explain why you add the delay function and how you implement smoothing functions ? 


thx G.

There is probably a better way to do this... but I first used the delay function to only output say 1 data point every 3 seconds. Then I used the smooth function to average the values over the last 200 points (giving a 10 minute average). Then I used the delay function again to only output 1 value every 10 minutes. I sent this feed to a graph to show 10 min average values, which work well for looking at wind/pressure/temperature over several days and doesn't build up too many data points.

I'm away from home for the next week, but can send you a copy of my node-red when I'm back. I would be keen to get some feedback on it! As I said, perhaps there is a better way of doing this?
Reply
#6
Sad 
Thx Desolina,

Managed to implement some smoothing functions. Working well now :-)
Found some good sources to learn something more of node-red. http://noderedguide.com/nr-lecture-1/

In the example node-red script deliverd with openplotter, we can read the signal-k data.

My question now is is it also possible to write to the Signal-K on openplotter ? 
I see that there are several Input UDP ports defined in openplotter. But not specifically for node Red.
Somebody knows this and has an example ?

Thx

G.
Reply
#7
(2016-12-14, 04:33 PM)gniersma Wrote: My question now is is it also possible to write to the Signal-K on openplotter ? 
I see that there are several Input UDP ports defined in openplotter. But not specifically for node Red.
Somebody knows this and has an example ?
Yes. There is no special port for this. For notifications you should use 55558. For other sensor use 55559.
Here is an example to send RPI cpu temperature to SignalK as 'environment.inside.heating.temperature' [Image: biggrin.png]
Code:
[{
        "id": "f5fa759f.be894",
        "type": "inject",
        "z": "4deb498f.fbcfd8",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "5",
        "crontab": "",
        "once": true,
        "x": 134,
        "y": 120,
        "wires": [["adb4b4a8.9c10c8"]]
    }, {
        "id": "adb4b4a8.9c10c8",
        "type": "exec",
        "z": "4deb498f.fbcfd8",
        "command": "vcgencmd",
        "addpay": false,
        "append": "measure_temp",
        "useSpawn": "",
        "timer": "",
        "name": "getCPUtemp",
        "x": 323,
        "y": 161.5,
        "wires": [["2705f134.792f86"], [], []]
    }, {
        "id": "7b5088a.c5f0af8",
        "type": "debug",
        "z": "4deb498f.fbcfd8",
        "name": "",
        "active": false,
        "console": "false",
        "complete": "payload",
        "x": 740,
        "y": 147.5,
        "wires": []
    }, {
        "id": "2705f134.792f86",
        "type": "function",
        "z": "4deb498f.fbcfd8",
        "name": "msg.payload",
        "func": "cpu_temp = parseFloat(msg.payload.replace(\"temp=\",\"\").replace(\"'C\\n\",\"\"));\ncpu_temp = cpu_temp + 273.15\nmsg.payload = '{\\\"updates\\\": [{\\\"source\\\": {\\\"type\\\": \\\"ARMTEMP\\\",\\\"src\\\" : \\\"RPIMCU\\\"},\\\"values\\\":[{\\\"path\\\": \\\"environment.inside.heating.temperature\\\",\\\"value\\\":'+cpu_temp+'}]}]}\\n';\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 533,
        "y": 210,
        "wires": [["7b5088a.c5f0af8", "c17f4c75.737088"]]
    }, {
        "id": "c17f4c75.737088",
        "type": "udp out",
        "z": "4deb498f.fbcfd8",
        "name": "sendSK",
        "addr": "localhost",
        "iface": "",
        "port": "55559",
        "ipv": "udp4",
        "outport": "",
        "base64": false,
        "multicast": "false",
        "x": 742,
        "y": 221,
        "wires": []
    }
]
Reply
#8
Hi, good work and good Christmas gift.  Smile
I downloaded the new version and it looks very interesting, and with great news.
I'm at home, and I only have to test four DS18B20 temperature sensors, connected to the resistor.
I set the 1w sensors as:
Environment.inside.engineRoom.temperature
Environment.inside.freezer.temperature
Environment.inside.heating.temperature
Environment.inside.mainCabin.temperature

I can view the temperatures on signalK

I have problems from here  Huh . I do not know node-red. How to configure it? To see the signalk data in nose-red.

sorry for my English

Saludos,
Reply
#9
Smile 
Thx E-sailing  !

This helped me, it is working now   I attached my Node-red flow. I decided to create an USB/serial input in node-red for my sensor. Because i needed to do some calculations, before putting them on screen. Output is going to Node red-dashboard and to Signal-K.  I assume it can be done with phyton code, but I'm not a programmer.

A related questions, i don't know if you have an answer on that;
- Is it also possible to create a websocket input on signal_k ?

Code:
[
   {
       "id": "415562e4.2dfcac",
       "type": "serial in",
       "z": "aa01f3b2.e669b",
       "name": "usb/serieel to keel sensor",
       "serial": "2f409b78.9c8354",
       "x": 184,
       "y": 195,
       "wires": [
           [
               "4acab7b5.8f0c78"
           ]
       ]
   },
   {
       "id": "98efb80a.2575a8",
       "type": "debug",
       "z": "aa01f3b2.e669b",
       "name": "",
       "active": false,
       "console": "false",
       "complete": "false",
       "x": 953,
       "y": 109,
       "wires": []
   },
   {
       "id": "a5e270f4.cff88",
       "type": "ui_gauge",
       "z": "aa01f3b2.e669b",
       "name": "keel sensor",
       "group": "30a1bf4e.9a766",
       "order": 0,
       "width": 0,
       "height": 0,
       "gtype": "gage",
       "title": "Hefkiel %",
       "label": "units",
       "format": "{{value | number:0}}%",
       "min": 0,
       "max": "100",
       "colors": [
           "#00b500",
           "#e6e600",
           "#01b500"
       ],
       "x": 548,
       "y": 300,
       "wires": []
   },
   {
       "id": "4acab7b5.8f0c78",
       "type": "json",
       "z": "aa01f3b2.e669b",
       "name": "",
       "x": 205,
       "y": 302,
       "wires": [
           [
               "a63710c0.72f29",
               "b8e4e78.1b0e018"
           ]
       ]
   },
   {
       "id": "a63710c0.72f29",
       "type": "range",
       "z": "aa01f3b2.e669b",
       "minin": "0",
       "maxin": "150",
       "minout": "0",
       "maxout": "100",
       "action": "scale",
       "round": true,
       "name": "",
       "x": 365,
       "y": 302,
       "wires": [
           [
               "a5e270f4.cff88",
               "e76e582d.8d7a68"
           ]
       ]
   },
   {
       "id": "b8e4e78.1b0e018",
       "type": "function",
       "z": "aa01f3b2.e669b",
       "name": "Calc draft",
       "func": "msg.payload = msg.payload + 140;\nreturn msg;",
       "outputs": 1,
       "noerr": 0,
       "x": 365,
       "y": 383,
       "wires": [
           [
               "c8c5854c.d0e478"
           ]
       ]
   },
   {
       "id": "c8c5854c.d0e478",
       "type": "ui_text",
       "z": "aa01f3b2.e669b",
       "group": "30a1bf4e.9a766",
       "order": 0,
       "width": 0,
       "height": 0,
       "name": "Disp Cal draft",
       "label": "Draft (cm)",
       "format": "{{msg.payload}}",
       "layout": "row-spread",
       "x": 557,
       "y": 381,
       "wires": []
   },
   {
       "id": "97056651.6e98a8",
       "type": "function",
       "z": "aa01f3b2.e669b",
       "name": "msg.payload",
       "func": "lift_ratio = msg.payload\nmsg.payload = '{\\\"updates\\\": [{\\\"source\\\": {\\\"type\\\": \\\"ArduinoSensor\\\",\\\"src\\\" : \\\"GNISENSE\\\"},\\\"values\\\":[{\\\"path\\\": \\\"design.keel.lift\\\",\\\"value\\\":'+lift_ratio+'}]}]}\\n';\nreturn msg;",
       "outputs": 1,
       "noerr": 0,
       "x": 802,
       "y": 185,
       "wires": [
           [
               "98efb80a.2575a8",
               "6068a22a.ebd23c"
           ]
       ]
   },
   {
       "id": "e76e582d.8d7a68",
       "type": "delay",
       "z": "aa01f3b2.e669b",
       "name": "",
       "pauseType": "rate",
       "timeout": "5",
       "timeoutUnits": "seconds",
       "rate": "1",
       "nbRateUnits": "30",
       "rateUnits": "second",
       "randomFirst": "1",
       "randomLast": "5",
       "randomUnits": "seconds",
       "drop": true,
       "x": 546,
       "y": 202,
       "wires": [
           [
               "97056651.6e98a8"
           ]
       ]
   },
   {
       "id": "6068a22a.ebd23c",
       "type": "udp out",
       "z": "aa01f3b2.e669b",
       "name": "sendSK",
       "addr": "localhost",
       "iface": "",
       "port": "55559",
       "ipv": "udp4",
       "outport": "",
       "base64": false,
       "multicast": "false",
       "x": 979,
       "y": 234,
       "wires": []
   },
   {
       "id": "2f409b78.9c8354",
       "type": "serial-port",
       "z": "",
       "serialport": "/dev/ttyACM0",
       "serialbaud": "115200",
       "databits": "8",
       "parity": "none",
       "stopbits": "1",
       "newline": "\\n",
       "bin": "false",
       "out": "char",
       "addchar": false
   },
   {
       "id": "30a1bf4e.9a766",
       "type": "ui_group",
       "z": "",
       "name": "Keel information",
       "tab": "e01159e6.0f0f28",
       "order": 2,
       "disp": true,
       "width": "6"
   },
   {
       "id": "e01159e6.0f0f28",
       "type": "ui_tab",
       "z": "",
       "name": "Magic Machine",
       "icon": "dashboard"
   }
]

(2016-12-15, 03:02 PM)dione Wrote: Hi, good work and good Christmas gift.  Smile
I downloaded the new version and it looks very interesting, and with great news.
I'm at home, and I only have to test four DS18B20 temperature sensors, connected to the resistor.
I set the 1w sensors as:
Environment.inside.engineRoom.temperature
Environment.inside.freezer.temperature
Environment.inside.heating.temperature
Environment.inside.mainCabin.temperature

I can view the temperatures on signalK

I have problems from here  Huh . I do not know node-red. How to configure it? To see the signalk data in nose-red.

sorry for my English

Saludos,

Open the browser on your open-pi. There you see the Node-red tab. (or localhost:1880) open and you get a example code which read Signal-k data based on navigation data and output this to node-red dashboard
You should modify this code to make it suitable for your temp
Reply
#10
Hi,

Just starting to play around with openplotter and recently with 0.9.
I have manged hook up a DS18B20 to openplotter via 1W. Then I've added it to node-RED but on the dashboard it shows the value in Kelvin..

Can anyone help me with the correct function to change this value to celcius (sustract 273.15). Is this done in Node-RED or earlier in openplotter/signalK

Thanks in advance
/Christoffer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)