Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Counting of pulses from flowmeter seems unreliable #5

Open
SvenRoederer opened this issue Jul 3, 2019 · 4 comments
Open

Counting of pulses from flowmeter seems unreliable #5

SvenRoederer opened this issue Jul 3, 2019 · 4 comments
Labels
bug component: counter hardware involves changes to hardware

Comments

@SvenRoederer
Copy link
Collaborator

During the last event I found that the same size kegs have very different total number of counts. This leads to an unusable prediction of the fill-level.

I assume, this is caused by the counting-code of the RPi-software. As far as I remember it's using "poll"-mode for the pulses. It's quite realistic that the pulse-frequency is to high or the gpio-lib to slow. Currently we are using https://pypi.org/project/RPi.GPIO/

Options to fix this:

  • find a better library
  • use a dedicated counting-circuit
@MicDiFebo
Copy link
Collaborator

Beernary counting should be based on realtime-interrupt-counting like it was on our prototype with an Atmel µC. The pulse frequency of the counting device itselve is not really high - as far as I remember we have 171 pulses per liter. Even if you would leave the tap open for a minute and beer is floating constantly i guess you will only have about 10 liters. That means 1710 pulses/minute or 28,5 Hz - not very high ;-)

@SvenRoederer
Copy link
Collaborator Author

As of the low frequency the effect of a missing pulse is roughly 6ml, only.
But have a reliable counting again a "realtime-interrupt-counting" seems the best option for now. Adding some µC for this which :

  • counts pulses on one end
  • talks to the RPi on the other end via serial-port
    seems to be enough.

Serial communication should at least have two commands:

  • "getcount" - returns the number of counted pulses (unsigned int)
  • "resetcount" - resets the counter to 0

Having this installed we can still have the RPi-counting connected on parallel and compare the difference of counted pulses and try to improve the RPi-code

@SvenRoederer
Copy link
Collaborator Author

As discussed on chat, the serial port of the RPi is planned for the serial RFID reader (see PR #6). So a regular serial (rs232 like) connection is not possible. I see following options:

  • adding a 2nd serial port of the RPi (USB <--> serial; probably there is some driver "GPIO <---> rs232" around)
  • using RS485 to build a serial-bus with RPi, Reader and Counter-chip)
  • finding a I2C or SPI counter chip (I had no luck with this)
  • adding an SPI / I2C interface to the counting-controller

@SvenRoederer
Copy link
Collaborator Author

SvenRoederer commented Jul 31, 2022

During MCH2022 I installed a small Arduino to count the pulses in parallel to the RPi. It's connected to the RPi via USB (cable looped out to the external USB-ports) for power and serial-interface.
Arduino-Code added with 6ab59d9

@ziehmon ziehmon added the bug label Jul 19, 2023
@ziehmon ziehmon changed the title counting of pluses from flowmeter seems unreliable Counting of pulses from flowmeter seems unreliable Jul 19, 2023
@ziehmon ziehmon moved this from Todo to In Progress in Chaos Communication Camp 2023 Aug 7, 2023
@SvenRoederer SvenRoederer added the hardware involves changes to hardware label Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component: counter hardware involves changes to hardware
Projects
Development

No branches or pull requests

3 participants