Hi all,
I am working with my son to use a hall effect water flow sensor, measure the frequency, convert the results to gallons per minute, and post the results on the cloud. I cannot get the Arduino Nano 33 IoT to use the pulseIn function to measure frequency.
I have flashed the following code on the Uno and on the Nano 33. On the Uno, I get realistic and non-zero results. When I flash the Nano 33, I get zeros.
Can someone help resolve this issue?
Is there another way to measure pulses for a frequency measurement?
You're leaping ahead too fast. You can never troubleshoot the whole thing, it's like trying to fix a car engine by feeling the hood.
Find ways to test each individual function separately, then put them together.
Right now, you should just be trying to confirm that pulses are present on the input pin. Write some simple test sketches that do only that. For example you could just turn on the onboard LED whenever the input is high.
Thanks. You tried but as so often it's a sales site, not a technical document. I don't find what type of output it is. It's a minimum 5 volt device and it outputs 5 volt pulses. Fine, but what is the voltage level between the pulses. Is an oscilloscope available to check the pulses?
Again, if the controller is a 3.3 volt logic controller it can be damaged by 5 volt pulses.
Well, this is the "Project Guidance" category. So probably, yes.
Is there another way to measure pulses for a frequency measurement?
Yes. You can count pulses during a longer fixed interval. It's sort of the "Pulse counting for Dummies" method (when used with relatively slow pulses).
You should find this obvious. If the measurement is "pulses per minute", when you count all the pulses that you receive for one minute, there it is, you have it.
Alright, so with your inputs, I was able to figure it out.
Starting with the UNO, I retested and got things working (data out). I measured the sensor inputs with my DMM and was getting something (assuming it was digital out) when investigating the sensor out. (one step at a time per @anon57585045 )
Moving over to the Nano 33 IOT, I measured the same and noticed that the sensor input 5V was not working. It turns out that although the breakout board has 5V, it is not actually connected to the Nano 33... which aligns with @cattledog comments (Nano 33 does not support 5V).
Fortunately, the sensors appear to work with 3.3V despite the amazon 'data sheet'. After plugging it in there, I'm getting the expected output.