## Help with analog inputs, 0-5V sensors

Archiv3r
Posts: 2
Joined: Sat Apr 20, 2019 6:55 pm

### Help with analog inputs, 0-5V sensors

Hello,

I am working on a project where I will have 3 analog sensor inputs, and according to them I will either open or close the motorized ball valve.
2 of those are pressure sensors with output range 0-4.5 V
1 is a temperature sensor that can work either on 0-3.3V or 0-5V.

pressure sensor - https://www.amazon.co.uk/Thread-Stainle ... ay&sr=8-15

temp sensor - https://www.amazon.co.uk/MXECO-Waterpro ... way&sr=8-1

motorised valve - https://www.amazon.co.uk/gp/product/B00 ... S4VD&psc=1

From what I understood Pi cannot read analog inputs so I need ADC before it. I found some tutorials online but they all seem complicated and involve doing some wiring (i am not an electrical engineer) like MCP3008 and ADS1115.
Then I found this - https://thepihut.com/products/adc-pizero
Which seems like a solution to my problem, it is an ADC with 4 input ports that can work with 5V.
interested in your opinions and critique.

Kind Regards,
Arch

JohnsUPS
Posts: 129
Joined: Fri Jul 06, 2018 2:13 am
Location: USA

### Re: Help with analog inputs, 0-5V sensors

In the case of the pressure transducer, consider how it is to be used.

For example, if you want to have different things happen when the pressure transducer is seeing different pressures (like how much air pressure is in a tank and you want a variable readout of the pressure), then you'd probably want and ADC in front of the Pi because you're looking at the whole analog range.

If on the other hand you only want to turn the valve on or off at a certain pressure, you don't need an ADC at all. You can use a comparator circuit. Think of it as a 1 bit ADC. What this does is compare two voltages on it's input, and sets the output hi or low depending on that comparison. You set a reference voltage on one input, and the other input is attached to your transducer. When the analog output of your transducer surpasses your predefined threshold, the output changes states. Feed this into a GPIO pin and have your code do what you need it to do.

Archiv3r
Posts: 2
Joined: Sat Apr 20, 2019 6:55 pm

### Re: Help with analog inputs, 0-5V sensors

JohnsUPS wrote:
Sun Apr 21, 2019 12:23 am
In the case of the pressure transducer, consider how it is to be used.

For example, if you want to have different things happen when the pressure transducer is seeing different pressures (like how much air pressure is in a tank and you want a variable readout of the pressure), then you'd probably want and ADC in front of the Pi because you're looking at the whole analog range.

If on the other hand you only want to turn the valve on or off at a certain pressure, you don't need an ADC at all. You can use a comparator circuit. Think of it as a 1 bit ADC. What this does is compare two voltages on it's input, and sets the output hi or low depending on that comparison. You set a reference voltage on one input, and the other input is attached to your transducer. When the analog output of your transducer surpasses your predefined threshold, the output changes states. Feed this into a GPIO pin and have your code do what you need it to do.
Well, you are right, I only need to turn the valve on and off at certain pressure. but I would prefer it that I can actually read this data for information purposes (how efficient is the system etc).
what do you think of adc pi zero addon ?
basically, I am looking for a black box that solves my problem, I put it on upwork so i hope someone will help me there too.

JohnsUPS
Posts: 129
Joined: Fri Jul 06, 2018 2:13 am
Location: USA

### Re: Help with analog inputs, 0-5V sensors

Arch,
Because you are interested in a span of the analog output and not just a trip point, then yes, you're going to need some sort of ADC between your sensor and the Pi.

The ADC PiZero addon board looks like it would work. It provides eight analog inputs, so you'll have room for expansion if necessary. 17 bits is a lot of resolution, and for this application you probably don't need more than eight. Looks like eleven is the minimum, but you can always truncate

Unless you do some digging (I haven't looked myself), you probably aren't going to find a complete plug-n-play solution for your application. To truly get exactly the results you're looking for, you're probably going to have to do some coding to tailor the operation of the system to your needs.

Return to “Automation, sensing and robotics”