Kegbot flow sensors not reading

I am attempting to configure a kegbot, using a Particle Photon and some flow meters the same as these.

I suspect I’m having a particle issue at this point as I have the server and app functioning as described. When I look in the Particle web IDE at the functions resetMeter and meterTicks they are both reading 0.

To setup the Particle I used the Desktop IDE, opened the folder I got from the kegbot github, clicked on the main.ino and then clicked compile to cloud and upload code using cloud. I thought this had worked as I was now presented with the resetMeter and meterTicks when I opened the web console.

I’m using a 2.2k resistor as a pull up between Vin and signal. I suspected the Vin wasn’t putting out enough voltage for the flow meter, as the particle documents stated that it only outputs 4.8V and the flow meter needs 5-18V. I have tried powering it off a separate supply that’s providing 9V whilst the particle is still powered via its USB. It is wired as below:

So far I have tried 3 different flow meters, pull-up resistor values of; 0, 220, 440, 820, 2k, 2.2k, 4k, 10k and 22k. I have also tried multiple cables and even changed the breadboard.

To clarify I’m not actually passing liquid through the flow meter as I want to confirm it works before I plumb it into my keezer, I’ve just been blowing into it to trigger it, enough that I can hear the wheel inside turning at a good pace. Again I’ve tried blowing more or less to see if this is affecting it.

I’m a complete novice to both the Particle and coding in general so would appreciate all the help I can get.


What code are you using?
If you are expecting an interrupt on D0, you won't get one

BTW, your frizzing should heed the color codes :wink: blue is GND, red is Vcc in the breadboard rails.
Furthermore having 9V on a GPIO pin is a bad idea (5V is the maximum accepted, beyond that you GPIO might be dead already).

1 Like


I wasn’t sure what the etiquette was for pasting other peoples code, that’s why I just put the link to their repository.

Haha yeah I noticed that after I’d already saved it and took a snip for better sizing. It’s actually wired as you suggested.

I hadn’t even thought about the V I was putting into the GPIO pin, I was to concerned that the flow meter wasn’t getting an adequate supply. You’re probably right and I’ll be down an input. But thanks for the idea, I’ll try still using an external supply for the flow meter but this time a 5V one.

So I was excited it was a simple fix and have now tried an external power supply of 5V to power the flow meter as depicted in the wiring diagram with the signal input now into D2 as I’ve never put anything into it yet so it should be fine. Again using a 2.2k resistor between Vcc and signal

Unfortunately still not seeing a response. Is their a way to check what the photon is seeing? From the kegbot threads where I found this source code no one else seems to be having issues with the code, so I’m assuming I’ve done something wrong in either the photon setup or implementation.

If you haven’t got an oszilloscope to see what the immediate sensor output is, you could use the D7 on-board LED and toggle its state on each trigger of the interrupt.
To check whether the code works without the sensor, you could just remove the sensor completely and use a jumper wire to touch D2 with GND and see if this will cause an interrupt.

Thanks heaps for your suggestions. I tested D0 - D3 to GND to see if they were acting as they should be. As you’d previously suggested I had killed some inputs through the wrong voltage, but I still had 2 working, which was progress.

I decided to power the Photon and the flow meter from the same 5V external supply so they’d have a common ground, again with a 2.2k pull-up resistor between Vin and signal and finally success!! It’s now registering the flow meters ticks as it should be.

So in summary, the photon initially likely wasn’t putting out enough to power the flow meter, I than killed some ports using too high an external supply, 2.2k does appear to be the resistor value I’m chasing, and having the Photon and flow meter using a common ground helps.

Thanks again for your help, now I just need to order another board to finish this build.


One question on your code. I am not an expert in coding, and I was wondering why you are using #define for CREATE_METER_ISR() and SETUP_METER() instead of defining functions?
Is there an added value that I am not aware of?

@Fabien, this isn’t really @Civbot’s own code, but as I see it the reason for using these macros is to save on recoding the same block over and over for multiple pins.