Taking PWM input and giving the logic level output

Hello Experts ,

i was doing a simple project for my water motor controller . so i was using Liquid flow sensor which gives PWM output . so i can switch on my 1 HP water motor.but was confused about programming as i had never ever worked with sensors . So any help is much appreciated

Thanks in advance

most sensors come with a sample code.

liquid flow is normally done with a interrupt then compared to time to give a reading

how are you interfacing with the project, do you have a lcd or does the project just run to a set point?

how does the pump know when to start?

gpop1: most sensors come with a sample code.

liquid flow is normally done with a interrupt then compared to time to give a reading

how are you interfacing with the project, do you have a lcd or does the project just run to a set point?

how does the pump know when to start?

i Dont have LCD but i will be using Serial monitor instead . and about the pump knowing when to start as i mostly know regarding sensor when analog value goes above the setpoint. it will trigger the port on which my relay is connected

Post a link to the datasheet for your flow sensor - without that we are all flying blind.

How do you intend the Arduino to control the 1hp motor ? (What interface will you have between the Arduino and the motor)

...R

saifkazi: i Dont have LCD but i will be using Serial monitor instead . and about the pump knowing when to start as i mostly know regarding sensor when analog value goes above the setpoint. it will trigger the port on which my relay is connected

the sensor will measure flow per minute and total flow. Most people set a total flow and then when they do something like push a button the pump will run until the total flow is matched then shut down. If you can tell us what the pump is meant to do we might be able to find a post of a project that does the same to help you get started

My idea is simple When there is a flow in a pipe I want my motor to start automatically ? And want to stop the motor when there is no flow

You say the meter outputs PWM, keep in mind this is neither analog or logic.

A simple way would be to put a basic low pass filter on the PWM - a cap and pot will do (google it) - then have an analog input either working as a threshold (thereby getting a logical signal), or integrating the signal over time and thresholding that. Whatever your project requires…

1:1: You say the meter outputs PWM, keep in mind this is neither analog or logic.

A simple way would be to put a basic low pass filter on the PWM - a cap and pot will do (google it) - then have an analog input either working as a threshold (thereby getting a logical signal), or integrating the signal over time and thresholding that. Whatever your project requires...

Thanks for your reply

In short you are telling me to convert that pwm signal from flow sensor to logic voltage which is done by lpf ? So my arduino can take input and give output to relay. Correct me if I'm wrong ? I should really start studying about different types of signal and their conversion.

saifkazi: In short you are telling me to convert that pwm signal from flow sensor to logic voltage which is done by lpf ?

Well, kind of - but I get the feeling you've got the order of operations incorrect

I should really start studying about different types of signal and their conversion.

Yes, do this. Read up on PWM, basic low pass filters (first order, cap and resistor 'RC' type, don't let the math scare you, just look at the plots and get an intuitive understanding of what a low pass filter does to a 'sharp' signal), analog to digital conversion, thresholding/comparator operations, Schmidt triggers and also the difference between internal logic (that for the intents and purposes of discussion are only logic 'states') and external logic signals (that actually use voltage to represent them). Thats a lot of reading. Someone might have a better/easier way to do this, but I still suggest all that reading will serve you well, it is basic stuff that you'll need to get your head around if you want to work with more interesting projects...

Hello experts

As I am totally new to low pass filters I don't have any idea except I know that it can convert pwm signal to analog voltage. So I was confused that what value of resistor and capacitor will works good for me?

Here's is the data sheet and specification of my flow sensor http://vi.raptor.ebaydesc.com/ws/eBayISAPI.dll?ViewItemDescV4&mobile=1&pm=1&ds=0&item=221756607105

Thanks for the help in advance

If this sensor is to be used with an Arduino, you can just check the frequency in a sketch.

You can Goggle "low pass filter design".

.

The roll of frequency of a low pass filter is a compromise between reducing the ripple of the output signal and the speed of reaction to changes in the pulse frequency. Only you can make that decision.

Hi, Please post a link or file that has the specification of your flow meter. Think you will find that it outputs so many pulses per litre, it has nothing to do with PWM. You need to count the pulses from the flow meter to measure water volume. You then count pulses over a time period to calculate flow rate.

Tom.... :) 5 posts ago you were asked for flow meter specs. Even a picture of your flow meter, showing its name plate..please..

TomGeorge: Hi, Please post a link or file that has the specification of your flow meter. Think you will find that it outputs so many pulses per litre, it has nothing to do with PWM. You need to count the pulses from the flow meter to measure water volume. You then count pulses over a time period to calculate flow rate.

Tom.... :) 5 posts ago you were asked for flow meter specs. Even a picture of your flow meter, showing its name plate..please..

Sorry I forgot about that here is the data sheet and specification of my flow meter http://vi.raptor.ebaydesc.com/ws/eBayISAPI.dll?ViewItemDescV4&mobile=1&pm=1&ds=0&item=221756607105

Hi, I worry about datasheets that don't know the difference between frequency and pwm. You meter outputs pulses, the FREQUENCY of the pulses indicates flow rate. So you need your sketch to measure frequency to give you a flow rate. You can do some maths and workout what volume is represented per pulse to get volume.

When do you want the pump to turn On and Off, at a particular volume or flow rate?

What is your electronics, programming, arduino, hardware experience?

Tom.... :)

Why do you want a low pass filter.
Don’t.
This is a digital sensor.

Pulses means flow.
Detect the time between pulses, and you can calculate liters, L/min, L/hour, etc.
enter e.g. “flow rate sensor” in the search box on top of this page for coding examples.

All of this already has been pointed out to you in this post.

Leo…

Wawa: Why do you want a low pass filter. Don't. This is a digital sensor.

Pulses means flow. Detect the time between pulses, and you can calculate liters, L/min, L/hour, etc. enter e.g. "flow rate sensor" in the search box on top of this page for coding examples.

All of this already has been pointed out to you in this post. http://forum.arduino.cc/index.php?topic=333818.0 Leo..

What I want to do is compare the value with setpoint . so I can trigger the relay at certain setpoint

Wawa: Why do you want a low pass filter. Don't. This is a digital sensor.

Pulses means flow. Detect the time between pulses, and you can calculate liters, L/min, L/hour, etc. enter e.g. "flow rate sensor" in the search box on top of this page for coding examples.

All of this already has been pointed out to you in this post. http://forum.arduino.cc/index.php?topic=333818.0 Leo..

What I want to do is compare the value with setpoint . so I can trigger the relay at certain setpoint. So I think I need to convert that value in analog signal

NO.

You could count the pulses during a certain timeframe. e.g. 5second, or 10 seconds.

Or, maybe better/faster, measure the time BETWEEN pulses.

Then you can set a threshold in your code. e.g. when the time between pulses is short, start the pump. And when the time between pulses is long, stop the pump. Leo..

Wawa: NO.

You could count the pulses during a certain timeframe. e.g. 5second, or 10 seconds.

Or, maybe better/faster, measure the time BETWEEN pulses.

Then you can set a threshold in your code. e.g. when the time between pulses is short, start the pump. And when the time between pulses is long, stop the pump. Leo..

So U are telling me when the pulses are in low state for long time then I can stop the pump correct me I am wrong.? And I should connect the pwm pin from flow sensor on digital pin ? Any program example that can help me is much appreciated . and I don't have oscilloscopes so can I measure the pwm on something?