Pressure sensor

Thread Starter

snake0012

Joined Jul 24, 2020
9
Hi guys
I need your help to making work the pressure sensor MPS20N0040D (module with hx7110) , I uploaded the sketch , but I can't get a right graphic , it's seems to be not fonctional !!!
It's the same graphe with & without the module connected
To the arduino !!!
Please help
Best regardsFB_IMG_1597758059368.jpg
 

Thread Starter

snake0012

Joined Jul 24, 2020
9
/*
Pressure Sensor test Code
*/

const int analogInPin = A0; // Sensor connected to A0

int sensorValue = 0; // value read from the pressure sensor via the amplifier stage
float outputValue = 0; // value output to the Serial port

void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}

void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);

// print the results to the serial monitor:
Serial.print("sensor = " );
Serial.print(sensorValue);

Serial.println();

delay(1000);
}
 

djsfantasi

Joined Apr 11, 2010
6,787
Read the analog pin twice.

You can put the double read in setup() if you want.

The analog input needs to be initialized to charge the internal capacitance. A double read does that. Since you are only using one analog input, a single double read is all that is necessary. If you are using multiple pins, a double read must be done each time you change pins. In this case the double read can be done for each read. Discard the first value.
 

djsfantasi

Joined Apr 11, 2010
6,787
Copy the line
sensorValue=AnalogRead(...”​
and paste it back in on the next line. That will perform the double read needed.
 

djsfantasi

Joined Apr 11, 2010
6,787
So there is definitely a change!

Is this what you expected?

Sensors are “noisy”. You might need to take an average of the last few values.

Something like this:
C:
// global value; add before setup()

#define maxValues 5
int indexValue
dim lastValues[maxValues-1];
.
.
.
// in loop() after last anslogRead()

// save current value
lastValues[indexValues] = sensorValue
indexValues++;
if(indexValues >=maxValue) indexValues=0; // loop to beginning of list

// calculate average
sensorValue=0;
for(int indexTemp=0; indexTemp <maxValues; indexTemp++) sensorValue += lastValues[indexTemp];
sensorValue /= maxValues;
 

djsfantasi

Joined Apr 11, 2010
6,787
Then the pressure is not sending it’s output in a manner that the Arduino can understand.

How do you have it wired? You know that the MPS20N0040D requires an amplifier so the Arduino can read it’s value. I’m not familiar with the MPS20N0040D, so can’t be much help with an amplifier.

But there are modules which interface the sensor with an Arduino. I suggest you perform some searches.

My coding suggestions would be necessary, even with the module.
 

Thread Starter

snake0012

Joined Jul 24, 2020
9
Yeah I know I have the sensor with hx710b !!!
How I can verify if the sensor is working?
How I can check that the arduino board is ok?
Thnx
 

djsfantasi

Joined Apr 11, 2010
6,787
Yeah I know I have the sensor with hx710b !!!
How I can verify if the sensor is working?
How I can check that the arduino board is ok?
Thnx
Where did you buy your sensor parts? Can you provide a link?

Also, I’d asked earlier how is you sensor (and hx710b) wired. Please provide a schematic. Even a photo of a hand drawn one


The input to the Arduino isn’t providing a signal. Your last graph (which regardless of what you say, is very different from your first graph. It looks like the input is of an unterminated wire.

You can test the Arduino by connecting the sensor input pin to ground. The pin should return a zero. Then, connect it to the Arduino 3.3V pin and the value should be around 675.
 
Last edited:

Picbuster

Joined Dec 2, 2013
1,022
Hi guys
I need your help to making work the pressure sensor MPS20N0040D (module with hx7110) , I uploaded the sketch , but I can't get a right graphic , it's seems to be not fonctional !!!
It's the same graphe with & without the module connected
To the arduino !!!
Please help
Best regardsView attachment 215023
Start to measure with a mV meter and see what happens.
Measure the output with changing pressure (use data sheet). when it works
do Next step
create a adjustable voltage source running up to 100mV ( pot meter and resistor). (100mv is max output for your sensor)
And put this into to input circuit.
remark:
Your input want to see a scale from 0 to reference voltage. reference could be VDD or a separate chip (best way to go)
The ratio reference/(maximal sensor output)
gives you information about amplification needed.
The number of ADC bits will define the density of measurement. Avoid to play in the 'few bits' measurement this will create all types of electronic pains and mishaps.

Picbuster
 

LesJones

Joined Jan 8, 2017
2,695
From what I can see of your code you are reading an analogue with the Arduino. As you say that you are first feeding the analogue value from the MPS20N0040D into a HX710b (24 bit ADC) you are reading digital data with an analogue input. Also the HX710b needs a clock signal from the microcontroller to the HX710b to clock the digital data out. You will need to write the code to generate the clock signal and read the digital data. I don't know much about "C" type code (As I write in assembler.) but there may be a .h file available to read the data from the HX710b.

Les.
 

djsfantasi

Joined Apr 11, 2010
6,787
Here’s an article that describes using an H710b with a pressure sensor. It’s a description; it’s not a how-to article.

As LesJones described, the output of the Hx710b is a serial output, but it’s a proprietary interface. There apparently is not a H710b library, but you can search for the Arduino Hx711library may work as both chips use the same proprietary serial communications.
 
Top