Gas smoke sensor MAX6675, pressure sensor, arduino and raspberry pi

Hi.
At home we have wood heating system. I wish to display the smoke gas temperature on my node-red dashboard in form of a gauge. I want it connected to my raspberry pi.

I have a smoke gas sensor called MAX6675 who work with Arduino. I managed to get it to display correct temp on Arduino IDE on my windows PC.

How should I proceed to forward it from Arduino to raspberry/node-red?

I also want to display a gauge for pressure in the dashboard. I have an analog sensor named SKU237545, which I also managed Arduino IDE to read the pressure from. I followed youtube videos online on how to do this.

Anyone got some thoughts or methods on how to proceed?

If it's a simple arduino (eg with just a serial port) then just use a serial in node in Node-red (making sure you turn off the Arduino IDE first) set to the same baud rate - and start by sending it to a debug node to see what arrives - once that works you can manipulate the date (ie split out temperature and pressure) and then send to a node-red-dashboard gauge node for display.

If you need more help, show us the output of the debug node so we can see how the data is formatted, then we can suggest how to split it up.

1 Like

Hi. Now I have connected my Arduino to my raspberry and I get a output from the analog pressure sensor in the debug node.
"A0 : msg.payload : number 101".
I tried creating pressure by blowing air against the sensor and the value went up and down, so I know its connected.
Next challenge for me is to make node-red change the value from eg 101 to the correct bar pressure.

How can I program node-red to calculate the right output, eg. "Pressure is: 1.65 bar".

Here is a script I used earlier with only the Arduino. I guess the equations is the key.

void setup() {
Serial.begin(9600);
}

void loop(){
int sensorVal=analogRead(A1);
Serial.print("Sensor Value: ");
Serial.print(sensorVal);

float voltage = (sensorVal*5.0)/1024.0;
Serial.print("Volts: ");
Serial.print(voltage);

float pressure_pascal = (3.0*((float)voltage-0.47))*1000000.0;
float pressure_bar = pressure_pascal/10e5;
Serial.print("Pressure = ");
Serial.print(pressure_bar);
Serial.println(" bars");
Serial.print("Pressure = ");

delay(100);

}

if it’s a linear scale you could use a range node to rescale the numbers you get to the right values.

As its already a number you should be able to feed it straight into a ui_gauge node for display

That's true. Hope its a linear scale. I'll look into it and come back to you

Perhaps you mixed up the sensors names ? MAX6675 is the temperature sensor, not the gas smoke detector, right ?

I have both a MAX6675 temperature sensor (for my wood burner), and a pressure sensor (pressure transducer) for measuring the water pressure. Sorry for my bad structure.

Thanks. I am curious to see the outcome of the testing with the sensor pressure. I have no previous experience on this but it seems reasonable to me that the voltage read by the sensor has a linear correlation with the measured pressure. It would be great if you could publish the results of the testing.

I'll be busy with work the next days, but I managed to get some values that were close to the correct values. I'll make a new post when I have installed the sensor and keep you updated on how it goes.

1 Like

Hi again. I need some help to make node-red display correct pressure.
Now I get the analog value from the reader to node-red through mqtt.

The value is currently 168. But it needs run through an equation to display bar.

"float voltage = (sensorVal*5.0)/1024.0;
_ Serial.print("Volts: ");_
_ Serial.print(voltage);_
_ float pressure_pascal = (3.0((float)voltage-0.47))*1000000.0;_
_ float pressure
*bar = pressure_pascal/10e5**;
"

I tried linear function in node-red, but the value turn out incorrect.

Any help?

EDIT:

I think I made it myself:

msg.payload = msg.payload5/1024;
msg.payload = (3
msg.payload-0.47)*1000000.0;
msg.payload = msg.payload/10e5;
return msg;

See if the attached flow can help you.

[{"id":"ea32e141.0bc61","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"cc68cc86.92fd","type":"inject","z":"ea32e141.0bc61","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":200,"wires":[["dc42dff4.557f7","3f3a2480.577f2c"]]},{"id":"dc42dff4.557f7","type":"range","z":"ea32e141.0bc61","minin":"0","maxin":"1024","minout":"0","maxout":"5","action":"scale","round":false,"property":"payload","name":"","x":410,"y":200,"wires":[["59eda731.898d78","9086eb08.762b88","ca4f0e49.8b7e8","9f11ad6d.1fad7"]]},{"id":"df3c145f.5c50e8","type":"inject","z":"ea32e141.0bc61","name":"","topic":"","payload":"168","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":320,"wires":[["dc42dff4.557f7","3f3a2480.577f2c"]]},{"id":"41c683bb.bd5d9c","type":"inject","z":"ea32e141.0bc61","name":"","topic":"","payload":"100","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":260,"wires":[["dc42dff4.557f7","3f3a2480.577f2c"]]},{"id":"ccac7a76.854c28","type":"inject","z":"ea32e141.0bc61","name":"","topic":"","payload":"500","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":380,"wires":[["dc42dff4.557f7","3f3a2480.577f2c"]]},{"id":"59eda731.898d78","type":"function","z":"ea32e141.0bc61","name":"Calculate bar","func":"let floatVoltage = msg.payload;\nlet bar = 3*10 * (floatVoltage - 0.47);\nmsg.payload = bar;\nreturn msg;","outputs":1,"noerr":0,"x":580,"y":200,"wires":[["fa7d669f.9ffa98"]]},{"id":"9086eb08.762b88","type":"function","z":"ea32e141.0bc61","name":"Calculate Psi","func":"let floatVoltage = msg.payload;\nlet bar = 14.5038 * 3 *10 * (floatVoltage - 0.47);\nmsg.payload = bar;\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":260,"wires":[["9fb0e4b7.580588"]]},{"id":"ca4f0e49.8b7e8","type":"ui_text","z":"ea32e141.0bc61","group":"adff068.b3270f8","order":2,"width":0,"height":0,"name":"","label":"Float Voltage","format":"{{msg.payload}}","layout":"row-left","x":610,"y":140,"wires":[]},{"id":"9f11ad6d.1fad7","type":"debug","z":"ea32e141.0bc61","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":60,"wires":[]},{"id":"fa7d669f.9ffa98","type":"ui_gauge","z":"ea32e141.0bc61","name":"","group":"adff068.b3270f8","order":3,"width":0,"height":0,"gtype":"gage","title":"","label":"bar","format":"{{value | number:2}}","min":0,"max":"150","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":750,"y":200,"wires":[]},{"id":"9fb0e4b7.580588","type":"ui_gauge","z":"ea32e141.0bc61","name":"","group":"adff068.b3270f8","order":4,"width":0,"height":0,"gtype":"gage","title":"","label":"Psi","format":"{{value | number:1}}","min":0,"max":"2200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":750,"y":260,"wires":[]},{"id":"3f3a2480.577f2c","type":"ui_text","z":"ea32e141.0bc61","group":"adff068.b3270f8","order":1,"width":0,"height":0,"name":"","label":"Sensor Reading","format":"{{msg.payload}}","layout":"row-left","x":400,"y":340,"wires":[]},{"id":"dd52b459.46e378","type":"inject","z":"ea32e141.0bc61","name":"","topic":"","payload":"1024","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":440,"wires":[["3f3a2480.577f2c","dc42dff4.557f7"]]},{"id":"adff068.b3270f8","type":"ui_group","z":"","name":"P1","tab":"e8a3a4b3.313f18","disp":true,"width":"6","collapse":false},{"id":"e8a3a4b3.313f18","type":"ui_tab","z":"","name":"Pressure","icon":"dashboard"}]

r-02

Thank you. Interesting to see how you configured it. Here is mine

[{"id":"403c2eb7.d6c82","type":"mqtt in","z":"9e0fb892.22a158","name":"","topic":"trykkbar","qos":"0","broker":"23553b5a.367cc4","x":328.1666946411133,"y":178.55558395385742,"wires":[["c2913406.f21558"]]},{"id":"3854dbfc.dba554","type":"debug","z":"9e0fb892.22a158","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":679.1666717529297,"y":177.1111125946045,"wires":[]},{"id":"722aa836.e4c5f8","type":"ui_gauge","z":"9e0fb892.22a158","name":"","group":"62b81b4e.de2a24","order":1,"width":0,"height":0,"gtype":"gage","title":"Bar","label":"Bar","format":"{{value}}","min":"0","max":"15","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":691.1666717529297,"y":262.4444465637207,"wires":[]},{"id":"c2913406.f21558","type":"function","z":"9e0fb892.22a158","name":"calculation","func":"msg.payload = msg.payload*3/1024;\nmsg.payload = (3*msg.payload-0.47)*1000000.0;\nmsg.payload = msg.payload/10e5;\nreturn msg;","outputs":1,"noerr":0,"x":485.1666946411133,"y":177.22222328186035,"wires":[["3854dbfc.dba554","722aa836.e4c5f8"]]},{"id":"23553b5a.367cc4","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.90","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"62b81b4e.de2a24","type":"ui_group","z":"","name":"Servo Control","tab":"3b8ce097.b6d24","order":2,"disp":true,"width":"6","collapse":false},{"id":"3b8ce097.b6d24","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Good, is there a reason you change the multiplication factor in your code from 5 to 3 ?

Theoretical formula

"float voltage = (sensorVal*5.0)/1024.0;

msg.payload = msg.payload*3/1024;
msg.payload = (3*msg.payload-0.47)*1000000.0;
msg.payload = msg.payload/10e5;
return msg;

Only for testing, because my supply at the current time had 3v supply.