Fyi, I use this sensor. https://www.seeedstudio.com/Water-Flow-Sensor-YF-B1-p-2878.html
On Thursday, August 24, 2017 at 9:38:08 AM UTC+7, Maximillian wrote: > > I think I could get around ~40 pulse per each call of flowMeter. > getFrequencySync() in a Thread.sleep(100) loop. > > Is it still unsafe to just use the getFrequencySync() method for that > amount of pulse? > > Or maybe I can just lower the sleep time to maybe Thread.sleep(50) for > better accuracy? > > Thanks for the hint, I'll try to look into that. > > > On Thursday, August 24, 2017 at 6:18:52 AM UTC+7, Ytai wrote: >> >> What's the maximum pulse rate for your application? >> >> On Wed, Aug 23, 2017 at 3:36 PM, Maximillian <[email protected]> >> wrote: >> >>> Can you give more hint about how to count? >>> >>> I'm not really sure how to do it. >>> >>> Big thanks >>> >>> On Wednesday, August 23, 2017 at 11:56:20 PM UTC+7, Ytai wrote: >>>> >>>> Sampling the frequency and integrating will give you an estimate of the >>>> total. If it's not accurate enough, you'll need to count. >>>> >>>> On Aug 22, 2017 2:51 PM, "Maximillian" <[email protected]> wrote: >>>> >>>>> Hi Ytai, >>>>> >>>>> This is my current code (trimmed for this post) >>>>> >>>>> >>>>> int FLOW_METER_PIN = 14; >>>>> >>>>> volatile float pulseFreq, totalPulse; >>>>> >>>>> PulseInput flowMeter = ioio_.openPulseInput(FLOW_METER_PIN, >>>>> PulseInput.PulseMode.FREQ); >>>>> >>>>> >>>>> totalPulse = 0; >>>>> >>>>> public void loop() throws ConnectionLostException, InterruptedException >>>>> { >>>>> >>>>> pulseFreq = flowMeter.getFrequencySync(); >>>>> totalPulse += pulseFreq; >>>>> //display totalPulse value to a textView; >>>>> >>>>> Thread.sleep(100); >>>>> } >>>>> >>>>> >>>>> Current behavior is already as I expected, the totalPulse textView will >>>>> updated only when the hall sensor is spinning (flow detected) >>>>> >>>>> If I use the getFrequencySync() method, I think the loop is paused, >>>>> waiting the flowMeter to receive input. >>>>> >>>>> If it received input, the totalPulse will increase by the amount of >>>>> pulseFreq from getFrequencySync(). >>>>> >>>>> I haven't tested with real water yet (I just blow the flow sensor to >>>>> make the hall spin for early development test) >>>>> >>>>> My question, is it correct to use this approach with the >>>>> getFrequencySync() method? >>>>> Or I still need to hack the DigitalInputImpl to count the pulses? >>>>> >>>>> Thanks >>>>> >>>>> On Wednesday, August 23, 2017 at 4:18:28 AM UTC+7, Ytai wrote: >>>>>> >>>>>> It is known, but there isn't currently a plan to add it. If anyone >>>>>> wants to contribute a patch, I will happily consider adopting it. >>>>>> >>>>>> On Aug 13, 2017 8:21 PM, "Maximillian" <[email protected]> wrote: >>>>>> >>>>>>> Is this still a known missing feature? As this post is from 2013.. I >>>>>>> need to use flow sensor as well.. >>>>>>> >>>>>>> On Monday, September 9, 2013 at 10:31:46 AM UTC+7, Ytai wrote: >>>>>>>> >>>>>>>> This is known missing feature. You can work around this by hacking >>>>>>>> DigitalInputImpl to count the pulses: its setValue() method will get >>>>>>>> called >>>>>>>> on every edge. >>>>>>>> >>>>>>>> >>>>>>>> On Fri, Sep 6, 2013 at 11:21 AM, jorge sb <[email protected]> >>>>>>>> wrote: >>>>>>>> >>>>>>>>> Hi. I want to connect a hall sensor flow meter to ioio. >>>>>>>>> Perhaps, I could use "PulseInput" but after reading ioio-wiki, I >>>>>>>>> see that I can't do it with it. >>>>>>>>> Really, I need a simple pulse counter but without loosing any >>>>>>>>> pulse. >>>>>>>>> With flow meter I will like to get: >>>>>>>>> - Total liquid flow (accumulated countered pulses) >>>>>>>>> - Instant flow (reading difference between two counts in a >>>>>>>>> measured time). >>>>>>>>> >>>>>>>>> With this sensor I could get a pulse every 50 msec or less at max >>>>>>>>> rate. >>>>>>>>> I think I could loose pulses doing periodic read of digital input. >>>>>>>>> >>>>>>>>> Some suggestion. >>>>>>>>> Thanks. >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> You received this message because you are subscribed to the Google >>>>>>>>> Groups "ioio-users" group. >>>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>>> send an email to [email protected]. >>>>>>>>> To post to this group, send email to [email protected]. >>>>>>>>> Visit this group at http://groups.google.com/group/ioio-users. >>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "ioio-users" group. >>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>> send an email to [email protected]. >>>>>>> To post to this group, send email to [email protected]. >>>>>>> Visit this group at https://groups.google.com/group/ioio-users. >>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>> >>>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "ioio-users" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To post to this group, send email to [email protected]. >>>>> Visit this group at https://groups.google.com/group/ioio-users. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "ioio-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at https://groups.google.com/group/ioio-users. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- You received this message because you are subscribed to the Google Groups "ioio-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/ioio-users. For more options, visit https://groups.google.com/d/optout.
