Pressure Sensor Analog A0 input bouncing voltages

Hi All,

Im trying to get readings from my pressure sensor as in image: sensor.jpg).

I am getting very normal readings from the meter (image: reading.jpg) but then i connect black to A0 to the arduino with the basic sketch;

int analogPin = 0;
void setup() {
// put your setup code here, to run once:
void loop() {
// put your main code here, to run repeatedly:
// read the raw data coming in on analog pin 0:
int lightLevel = analogRead(analogPin);
// Convert the raw data value (0 - 1023) to voltage (0.0V - 5.0V):
float voltage = lightLevel * (5.0 / 1024.0);
// write the voltage value to the serial monitor:

The voltages bounce around from 0-5v.

Ive also included the circuit diagram for the pressure sensor (image: circuit.jpg).

Can someone please help me?

Many thanks in advance.

Code seems fine. Diagram looks good too.

Have you made the ground common for Arduino and sensor ?

Share image of your hardware setup and read How to use analogRead Arduino Command.

That diagram looks like the sensor outputs digital ( ON / OFF) signals, not analog (0 to 5V), can you post a datasheet link or brand name / part number?

Thanks Jack, I’ll share the hardware setup.

No i dont have a common ground actually. The sensor is running at 12v but the output is ranging from 5v-0v.

Hi Karma, I feel you might be right! I cant really find the exact datasheet but it based on the Panasonic DP-100 sensor. I have attached the manual. I think it actually be the Standard model rather than the Multifunction version.

On the last page it is blanked out for Analog output for this model so i think you are right! Its super weird as the voltage does change as the pressure changes! If that is the case that is simply On/Off then how to i at least be able to read that signal?

Thanks so much for your assistance guys!!

mn_63120_2801_en_dp100.pdf (1.72 MB)

If its either of the PNP versions it will destroy the Arduino pin if you don't use a series resistor
(10k or more recommended).

If its the NPN standard type you need pinMode INPUT_PULLUP and use digital pins, its not got
analog out.

If its the NPN multifunction one pin is digital and needs INPUT_PULLUP, the other is supposedly
0..5V analog.

BTW its the white wire that is analog, if any is.

[ All assuming that manual is the right one... ]

Hi MarkT,

Thank you so much. Yes it is the NPN version. Do i still need resistors for this one as well?

I will try it on the black.

Would this code be sufficient you think?

void setup() {
//start serial connection
//configure pin 2 as an input
pinMode(2, INPUT_PULLUP);


void loop() {
//read the pushbutton value into a variable
int sensorVal = digitalRead(2);
//print out the value of the pushbutton


That indeed should work for an NPN output.

No i dont have a common ground actually. The sensor is running at 12v but the output is ranging from 5v-0v.

You have to make the ground common for your sensor and Arduino. Otherwise you won’t get the sensor values.