Puck.js as a water meter? #4172
Replies: 1 comment
-
Posted at 2023-04-03 by @gfwilliams A magnetometer senses a magnetic field, so in order to sense water you'd have to maybe have something like a float with a magnet on it. But yes you can do that and in fact I did do that as an example in a talk I did once. Another option is if you have a float attached to a lever, you can put the Puck on that lever and use the accelerometer to measure the angle of the lever. Posted at 2023-04-03 by @gfwilliams Or are you talking about connecting the Puck to the front of a household water meter and sensing where the magnet is on that? If so, yes, you can do that. I did try with mine and it seemed doable, but then soon after the water company replaced it with a digital one! Posted at 2023-04-03 by user130485 Yes, was thinking about sitting it on top of a meter. Currently using a Cyble pulse sensor like this one Posted at 2023-04-03 by @gfwilliams Yes, it should work fine - at least on mine the dial of the meter with a magnet on never really moved that fast, so you could get away with keeping the magnetometer running at it's default 0.63 sec period, and with that it's ~8uA so you'd hope the Puck would be able to run for 6 months reasonably easily, possibly more if you're careful with the code. Posted at 2023-04-03 by user130485 Thanks! Would give it a go. You would not have any old code samples by chance? =) Posted at 2023-04-03 by @gfwilliams Something like this should help:
So that'll output the x/y/z and also an angle (assuming you had the Puck mounted flat against the meter with the magnetometer where the middle of the meter hand is). It'll only do it reliably once the hand has gone around one whole rotation (so it can set up the min/max values). Then each time, I guess you just want to check the angle against what it was last time, and if it's moved clockwise then you add that onto what you have for the amount of water that was consumed. Posted at 2023-04-03 by user130485 Much appreciated! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2023-04-02 by user130485
Hello
Anyone tried to use puck.js as a water meter, since it had a magnetometer?
Beta Was this translation helpful? Give feedback.
All reactions