Hello, I have no programming experience first and for most. so please try not to use to many acronyms because i will get lost. this is the basses i'm trying to do.
One using arduino to read analog input. convert to actual data i need then print to serial so i can use a raspberry pi4 and node-red to have a dashboard displaying my data.
i am using arduino wifi rev2. and raspberry pi4, theyl are connected with usb cable.
i am receiving the data on my pi4 however can not seem to figure out how to sepperate the data properly, from looking at ALOT of videos i am lost. bassiclly what will be the easiest way to have a speration in my data so i can split in pi4 easier. I'm leaning to the Json method. howeever confused.
here is my code. i have right now. keep in mind please i am new and have done more copy and paste and trial and error to get what i have so far. Any help would be appreciated. however from all my searching and finding people with same issue i have seen to many times "oh that should be easy search google." please refrain from those kind of comments.
Cheers.
Oh this is a project to calculate volume in a brewing kettle.
// CODE //
#include <ArduinoJson.h>
const int pressureInput = A0; //select the analog input pin for the pressure transducer
const float pressureZero = 102.4; //analog reading of pressure transducer at 0psi
const float pressureMax = 921.6; //analog reading of pressure transducer at 100psi
const int pressuretransducermaxPSI = 30; //psi value of transducer being used
const int baudRate = 9600; //constant integer to set the baud rate for serial monitor
const int sensorreadDelay = 250; //constant integer to set the sensor read delay in milliseconds
const float watercolumn = 27.72;
const float tanka = 1017.36;
const float gallonconvert = .004329;
float tankValue;
float pressureValue = 0; //variable to store the value coming from the pressure transducer
float pressureValuePSI = 0; //variable to store the PSI calculated value
void setup() {
Serial.begin(baudRate);
}
void loop()
{
//reads value from input pin and assigns to variable
pressureValue = analogRead(pressureInput);
//conversion equation to convert analog reading to psi
pressureValuePSI = ((pressureValue-pressureZero)*pressuretransducermaxPSI)/(pressureMax-pressureZero);
// Calculate tankValue in Gallons
tankValue = (pressureValuePSI*watercolumn*tanka*gallonconvert);
//Serial.setCursor(0,0); //sets cursor to column 0, row 0
//prints 1st record label. COMMENT out if you only want the values
Serial.print("Gallons");
Serial.print(",");
//prints 1st record value: tankValue - Gallons calculation, 2 digits after the decimal point
Serial.print(tankValue, 2);
//prints record separator character
Serial.print(",");
//prints 2nd record label COMMENT out if you only want the values
Serial.print("PSI");
//prints 2nd record value: pressureValuePSI - PSI conversion, 1 digits after the decimal point
Serial.print(",");
Serial.println(pressureValuePSI, 1);
Serial.print(",");
//Serial.print(" "); //to clear the display after large values or negatives
delay(sensorreadDelay); //delay in milliseconds between read values
}
// END OF CODE //