satishsv006:
So i want the code which will run for this purpose
The premise is that you make an attempt first. That is, write some code and test it. If it doesn't do what you want, then ask here. Before posting read the 'how to use this forum' sticky at the top of this topic, especially about how to post your code.
If you just want it done there is a 'gigs & collaboration' topic where you can solicit someone to develop the code for you - at a price.
after 100 ml, flow sensor should send signal to pump to stop so that i could get 100 ml.
That's half a cup.... Tiny amount really.
By definition of "after" it's already too late, and depending on your mechanical design and layout you may still get an extra "pipeful" so to speak delivered.
I see here that the meter works between 1 and 30 L/min. For 0.1L that's going to be between 6 seconds (slowest) and 0.2 seconds (fastest).
Even at 6 seconds, will your pump shut off fast enough to prevent getting way too much liquid?
But in theory you can count 450/10 = 45 pulses and turn the pump off, that's easy.
A peristaltic pump, running time based, gives a very accurate dose. They tend to be quite slow, though - the fastest I have do about 80 ml/min. Surely there are faster ones around.
Alternative: regular water pump (use a fairly slow one) and a scale under the cup. Cut off the pump just before the 100 ml (about 100 gr depending on your liquid) to allow for reaction times, experiment to get this right. The slower the pump the more accurate you will be able to get.
Other alternative: syringe with linear actuator. Possibly the most accurate and reproducible of the setups but requires more complex hardware. Use two one-way valves and you can suck liquid in from your reservoir and expel it into your output container.
i used the following codes. And it is giving 0 L/hr on my serial monitor every time either flapper rotates or not. But when i pulled out the signal wire it is giving some reading like of 2.33 L/hr, which is incorrect.
Please tell me, this code is wrong or my sensor is not working properly.
i saw on internet, users are getting some value with this code but i am not getting?
What you can do is to get a cup that holds 120 ml and put two input pins at the 100ml point. One of the pins is a digital input pulled low by say a 100k resistor. the other would be 5v. When the liquid level reaches 100ml the liquid shorts the 5v to the input. The pump is stoped and a solenoid opens to empty the cup.
I don't know what liquid you are measuring but you should check that the pulldown resistor has the right value for the conductivity of the liquid you are trying to meter. 10K worked fine for me on spring water but will be to low for methanol wich has much lower conductivity.
A more elegant solution would be to ditch the solenoid and instead use a pythagoras cup. You would probably have to make it yourself but i think the simplicity of the solution is quite nice.
Edit: As mentioned above you should use a smaler pump because this one is designed for 1 - 30L/m.