I was curious about why my pressure sensor does not read in the serial monitor at 115200 baud rate, but reads at 9600? Could this be due to the controller I have interfacing between my sensor and program?
Controllino ? Is that a ATmega2560 or ATmega328P ?
Perhaps they did something with the clock frequency, or perhaps the usb-serial controller that they use can not do 115200 baud.
You could do a test. Just send text to the Serial Monitor and see if it works.
Controllino is a controller/PLC that is compatible to arduino IDE and its programming, I am not sure what microprocessor is in it. The 115200 does work because I got it working with a MAX31856 temp sensor just not with my -100~100kPa pressure sensor. You don't think it could be due to the pressure sensor not able to send at that rate, do you?
Sorry I am pretty new to programming so I am learning and trying odd things. They were Const int with no decimals and I changed them to see if I could get decimal readings. Just did not change them back
The pressure sensor is an industrial grade. It is not a small that is usually seen with small controllers.
But here is where I got it from: PRessure Sensor
The rest of the specs are on the site as you scroll down.
Measuring Range: -100~100kPa
Vsupply: 24vdc
Output Signal: 0~5vdc
Connector: DIN connector @base
The code you posted is for a ratiometric sensor with a 10-90% output.
Not suitable for a 0-5volt (not ratiometric) sensor.
You basically just need this. pressureValue = analogRead(pressureInput) /1024. * pressureTransducerMaxPSI;
That will give you the right value, but is probably not very stable,
because it uses default Aref, which is the potentially unstable 5volt supply.
Better move to an external absolute (not ratiometric) A/D, like the ADS1115.
That will also give you a much higher resolution.
Leo..
Thanks for your reply. I am using a ratiometric sensor because I am trying to sense the pressure of a chamber that may undergo vacuum pressure and the pressure needs to be part of an input flow of a gas like argon gas.
I've switched my code slightly. This is working great with 9600 baudrate just not 115200.
I presume if I were to go for something like the ADS1115 then the higher baudrate will work.
Good thinking. I might not be using a ratio metric sensor. I have a supply voltage of 24Vdc and the output signal changes from 0-5Vdc based on the pressure the sensor senses.
I am not creating a pressure sensor. I believe I am just reading the output from the sensor and converting it to pressure on the serial monitor. I was curious why it does not display on serial monitor at 115200.
But doing that by first converting it to voltage and then converting it again to pressure is twice the work and twice a chance to make mistakes. Just go directly from A/D value to pressure.
pressure = analogRead(sensorPin) * sensortype; // is all you need
I see you're using a -100 to +100 sensor now.
For that one you subtract half of the A/D range (1024 / 2 = 512) as offset.