November 05, 2023

SignalK, measuring temperature

Updated 2023-11-05 !

An introduction to the SignalK, Marine application, is given here.

A very easy way to measure temperature with Raspberry Pi, RPi, is to connect one wire (1W) DS18B20 (DS)temperature sensors direkt to the RPi GPIO.

Here You find a post where the temperatures are transfered via WiFi

Using the NodeRed(NR) plugin, in SignalK(SK), will forward the temperature measure to a SignalK path, despite You maybe don't have any advanced programming skills.

You can even send the temperature on to a NMEA 2000/0183 network with sufficient hardware.

Start with installing the DS hardware following the instructions in this post, Basic setup.

NR is browser-based editor for the Internet of Things and is installed in SK as a plugin, @signalk/signalk-node-red, via the admin UI.

Here is a link to a quick NR intro and the link to NR website.

In NR, opened via admin UI(Webapps), install the node module node-red-contrib-ds18b20-sensor

Then copy this flow to Your clipboard and import it to NR.

The flow is started every 5 seconds, change to what is appropriate in Your case, with the inject node.

The  rpi-ds18b20 node will create an array with detected DS sensors.

The split node will create a separate  message for every detected DS sensor.

In the function node, values are changed with Java code.

tempIn = msg.payload.temp + 273.15;
tempDsId = msg.payload.file

switch(tempDsId) {
  
    case "28-0417a20e6dff" :
      SkPath = "propulsion.starboard.exhaustTemperature"; 
      break;
    
    case "28-051693ec41ff" :
      SkPath = "propulsion.port.exhaustTemperature"; 
      break;
      
    case "28-123493ec41ff" :
      SkPath = "environment.inside.engineRoom.temperature"; 
      break;
    
    default:
      return msg[null]; 
}

msg = {};
msg.payload = tempIn;
msg.topic = SkPath;
msg.DsId = tempDsId;

return msg;

The program fetches the actual temperature, converts it from Celsius to Kelvin, and the DS serial number(DS id).

The next part matches the actual DS id and sets the appropriate SignalK pathHere You should change so it matches Your setup. 
If no match the node will return null.

The last part just sets the output preparing for the last node signalk-send-pathvalue  which is sending the values to the SK Node server.

In my case an Actisense NTG-1 is installed and I want to display the 
"engineRoom temperature" in my N2K instruments. The signalk-to-nmea2000 plugin, in Node Server, will do the job.

In the Plugin Config click "Active"  and enable "Engine Room Temperature" and then "Submit".

130312, mentioned in the config, is the N2K pgn that will be created.

Setup is complete and You will see the temperature in Your N2K instruments.

My instruments hadn't the possibility to display the exhaust temperatures so instead I used  the nice WilhelmSK app diskussed here. 

A SignalK/Node-Red post setting up alarm for exhaust/temperature

2 comments:

  1. Thanks for sharing this! I am having trouble duplicating the flow. I copied and imported it but I can't figure out how to save it after modifying it to fit my application. Also I don't see the path it is sending to SignalK. Which block would that be in? Thanks, Al

    ReplyDelete
    Replies
    1. Click on ”Deploy” which will save and run Your flow. The path is stored in “msg.topic” set in the function node. Check the objects content, activating and showing debug messages.

      Delete

Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !