I have a normal 3 line (V,GND,SIG) Analog pressure sensor and I want to connect and read data using Raspberry Pi GPIO. Can anyone help with a Python code?

Pressure sensor

ebay link

  • What is a standard pressure sensor? Similar looking sensors or those with the same number of wires can be very different when it comes to interface and software. Is that a digital sensor? Please edit your question and add a link to the datasheet and a link to where you purchased it. – Steve Robillard Aug 29 '16 at 7:21
  • "Normal analog pressure sensor" is meaningless. Does the device have part number? Further, just because a device is "analog" does not necessarily tell us anything about its interface. This could well be an analog device (i.e. it reads pressure) with a digital interface. Equally, it could be a digital device (i.e. tells us when a particular setpoint has been achieved) but not give any indication of what the pressure is. – KDM Sep 12 '18 at 21:29

Raspberry pi does not have any Analog input so you will need an external ADC. Your sensor is 5V, so go with a 5V torrent ADC. you can use ADS1115 because it has 4 ADC channels so you can connect upto 4 sensor to one board. it has inbuilt voltage ref so you dont need any external Vref. its a 16 bit ADC so your readings will be highly accurate. it also has gain multiplier. its input are 5V torrent.

You can find the python code for ADC ADS1115 over here

if you are looking for video tutorial for connecting an ADC with raspberry pi please check over here. interfacing ADC with raspberry Pi

| improve this answer | |

You are going to have a few problems with the Pi. These problems are not insurmountable.

  1. The first is the Pi does not have any analog inputs.
  2. Second the sensor requires 5V as input and the Pi operates at 3.3V and will not tolerate 5V.

This tutorial on reading analog values with an ADC an the PI includes Python code.

You will also need a way to convert the 5V sensor to 3.3V for the Pi (e.g. logic level shifter, a voltage divider etc.) This related question will have some additional specifics.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.