Gas meter - Receive magnetic pulses with an ESP8266

  Переглядів 65,653

MakerMeik

MakerMeik

День тому

Donations: paypal.me/MeikDangmann
Unfortunately, an error has slipped into the calculation of the binary numbers. Correctly the right side of the decimal point should look like this:
1/2^2 + 1/2^3 + 1/2^6 = 0.25 + 0.125 + 0.015625 = 0.390625
For the small numbers I noted above the binary digits, I should not have started with 0, 1, 2, 3... but with 1, 2, 3, 4...
Links:
Code, KiCAD-Files:
github.com/MakerMeik/Gasmeter...
3D-Model of the Case on Thingiverse:
www.printables.com/de/model/1...
Songs:
"8-bit-Laserstrahl" by betatronik (CC BY-NC-SA)
"Auf Dem Wind (calm)" by betatronik (CC BY-NC-SA)
"Make-New" by Ketsa (CC BY-NC-ND)
"Towel Defence Ending" by sawsquarenoise (CC-BY)
"Hachimantai Snow" by Maarten Schellekens (CC BY-NC)
"Poor Boy" by Pedro Santiago (CC BY-NC-SA)
"D2" by Maarten Schellekens (CC BY-NC)
"Long Story" by Sergey Cheremisinov (CC BY-NC)
"Salt Lake Swerve - Chillout Remix" by Maarten Schellekens (CC BY-NC)
"Mallet Play" - Maarten Schellekens (CC BY-NC)
"Tuesday Night - Radio Edit" by Maarten Schellekens (CC BY-NC)
"Salt Lake Swerve - Chillout Remix" by Maarten Schellekens (CC BY-NC)
"Just Wondering" by Maarten Schellekens (CC BY-NC)
Photos/Videoclips:
Wikinaut (CC-BY-SA)
Tim Reckmann (CC-BY)
Magic TV (CC0)
Alexas_Fotos (CC0)
juwelfahim48 (CC0)
Danil_Shostak (CC0)
motionstock (CC0)
torstensimon (CC0)
TheMarcKnight (CC0)
INESby (CC0)
jplenio (CC0)
Ra Boe (CC BY-SA 3.0)
Digital_Expert (CC0)
Sources:
circuitdigest.com
arduino.cc
businessinsider.com
0:00 Intro
0:42 ESP-32-cam project
1:54 Abstract
2:45 A reed switch with problems
3:02 Interrupts
5:21 Without interrupts
6:05 The precision of floats
7:09 Binary
9:30 Server side
10:28 Conclusion
10:57 What is the purpose and how to save money
12:22 Outro

КОМЕНТАРІ: 138
@MakerMeik
@MakerMeik 2 роки тому
Some of my viewers have pointed out to me that even "double" variables are liable to cause errors over time and will lead to mismatches in the long run. It seems that it is common practice to solve such problems better with integers or unsigned integers. The decimal places are obtained by dividing the result by 100, as in my case. I amended this in my code on Github. I do the shifting of the decimal place in Node-Red. You can also find the flow on Github. One additional tip is to buy the plastic encapsulated reed switches instead of the normal glass ones as they are prone to breaking. The viewer @gadjetsvideo brought this to my attention in connection with my window sensor video. Also, I did not mention in the video that reed switches have different sensitivities to the magnetic field. This is indicated with AT (ampere turns). The viewer @Benedek T. seems to be experienced in this field and recommends reed switches with 6-8 AT for this purpose. Thank you, @Benedek T., for your feedback. Unfortunately, an error has slipped into the calculation of the binary numbers. Correctly the right side of the decimal point should look like this: 1/2^2 + 1/2^3 + 1/2^6 = 0.25 + 0.125 + 0.015625 = 0.390625 For the small numbers I noted above the binary digits, I should not have started with 0, 1, 2, 3... but with 1, 2, 3, 4...
@aleksandersuur9475
@aleksandersuur9475 2 роки тому
When counting discrete events like pulses it's good practice to use integers, the calculation that one pulse means 0.01m3 or whatever need not happen at the same time as counting.
@MakerMeik
@MakerMeik 2 роки тому
Very good suggestion, which has also been posted here several times in the comments now. I have modified the data type in the code on Github now. Many thanks for your feedback.
@GertStalpaert
@GertStalpaert 2 роки тому
Thanks for this very informative video! I've learned so much from it. I really love that you added you earlier attempts and the reason why you had to change them. 👍
@Pici3k
@Pici3k 2 роки тому
I would even make it an unsigned int, simply dividing by 100 at the very end where it is presented to the user if needed. 😉
@michaelzoller9884
@michaelzoller9884 2 роки тому
You nailed it 👍
@MakerMeik
@MakerMeik 2 роки тому
Thanks for the hint, now that you and also some others have given me the tip, it falls like scales from my eyes. ;-) I think I will change that in the code on Github soon as well.
@tbavister
@tbavister 2 роки тому
This was a standard practice in financial systems; nowadays I see lots of floating point amounts flying around in JSON structures and I wonder if there is an auditor at the far end of the line wondering why nothing balances anymore!
@laupetre
@laupetre 2 роки тому
@@tbavister i work with financial systems, and we do calculations using `double` ; we still have regression issues reported for differences smaller than 2c , that we sometimes close as rounding errors, other times rewrite the used formulas
@MakerMeik
@MakerMeik 2 роки тому
I have modified the data type to "unsigned int" in the code on Github now. Many thanks for your feedback.
@abc321meins
@abc321meins 2 роки тому
Nice project, I have to check if my gas meter also got a magnet! Just a few tips: 1. Never do heavy lifting operations (like mqtt) in the ISR handler directly! Set a var in the ISR and do the MQTT stuff in the main loop. 2. You could send the readings to the MQTT broker with the retain flag set. This way the broker stores the latest value for you. If you got a power loss simply subscribe to the topic of the reading after the reboot. The broker will send you the latest value, you can store it in memory, unsubscribe and start sending new values. Have a good day!
@MakerMeik
@MakerMeik 2 роки тому
Thanks, these are very interesting tips you have for me. I'll try to heed them next time.
@DasIllu
@DasIllu 2 роки тому
For debouncing, there are usually libraries available for all popular uC platforms. Since the reed switch acts like an ordinary switch, no modifications to the code are needed. On the other hand, if your gas consumption was high enough you could simply attach a coil to the meter and measure the frequency with an oscilloscope ;-)
@respekt995
@respekt995 2 роки тому
I had exactly, EXACTLY the same issue like you had but sometimes when I over-complicate things, I go to my wife to ask for help.. That´s why I flashed the ESP with tasmota, configured the reed-sensor as a switch and have a rule in tasmota that everytime the switch goes "OFF" it should add +1 to a counter value variable stored in tasmota and also send this value over mqtt to home assistant.. As simple as it is, works flawessly and I do not have any debounce issues.
@CdrSpock
@CdrSpock 2 роки тому
Top content und super erklärt, danke! Das Intro finde ich klasse ^^
@ChrisHalden007
@ChrisHalden007 2 роки тому
Great project. Thanks
@Brickkzz
@Brickkzz 2 роки тому
Loving it! I have a meter that flashes a diode with variable frequency to indicate electricity use. I am thinking of using a photo resistor for this
@eindeend
@eindeend 2 роки тому
A photo resistor might be too slow for that purpose. I think a photo transistor would be a better choice.
@devilmastah
@devilmastah 2 роки тому
Photo resisitor works perfectly (i am using one).
@h07d0q
@h07d0q 2 роки тому
Try to find out if it supports SML on an IR diode. I set this up with a modded TCRT5000
@gaborwraight8426
@gaborwraight8426 2 роки тому
Servus! Thank you very much for this great inspiration and explanation. I got myself a reed sensor board with a poti to set the sensitivity. With this, I get perfect readings for the pulses from the meter. I listen to the pulse in node-red and just increment on every pulse. Then I send it to a sensor value in Homeassistant and visualize it with the beautiful new Energy Dashboard. Works great so far. Might need some re-calibration after time but looks very promising right now. I also built the power meter solution from your video and I'm loving it. Energy data was a big hurdle for me so far but with this approach it's more than affordable and works great. Thanks again for nudging me in the right direction!
@MakerMeik
@MakerMeik 2 роки тому
Thanks for your kind feedback. I just watched the Home Assistant video on your channel and I'm impressed with what you've already implemented in your home. It was very inspiring for me as well. I was recently a guest on the Digitale-Dinge-yt-channel and presented (in German) a few other projects of mine for which there probably won't be a video anymore: ukposts.info/have/v-deo/iYODi4BkpW2nzqc.html Feel free to click in or jump through, maybe there's one or two other interesting projects for you.
@johngriffiths3467
@johngriffiths3467 2 роки тому
Gabor. Hi. Can you advise how your setup is working. I've followed everything Michael has published but not getting any responses in mqtt or node-red. I've flashed the main.cc to an esp-01 successfully, powered with a 3.3v source and made all the inter-connections wiring-wise. How would I find the esp on my netwrok if I allowed the router to assign the ip address? Can you help me along to get this projcet working as successfully as yours appears to be? Many thanks.
@gaborwraight8426
@gaborwraight8426 2 роки тому
@@johngriffiths3467 Hi, not so easy as I've made a lot of changes starting with the sensor. You could check your routers network page for devices to find the IP of the esp. Unfortunately that won't help. You will need to debug to find your issue. For that you need your esp connected to your pc via usb. I could copy my code on a page somewhere but it's not plug and play. You will most certainly need to know how to debug. Cheers
@gaborwraight8426
@gaborwraight8426 2 роки тому
@@johngriffiths3467 also simulating the pulse with a magnet helps a lot to debug. You need to check first if your detecting the pulses. Then keep going from there
@johngriffiths3467
@johngriffiths3467 2 роки тому
@@gaborwraight8426 Thanks for the response. I'm not getting ANYTHING. Nothing in mqtt Explorer, nothing in Node Red. Do I have to update the config.yaml with anything regards sensors? First this I need to do is establish if the esp-01 is on the network and go from there. I beleive everything isle is 'waiting' for the esp-01 to send something. Thanks anyway.
@Rhys_Beer
@Rhys_Beer Рік тому
I hope you upload some more content soon always enjoy your videos
@MakerMeik
@MakerMeik Рік тому
done ;-) ... and more will come. It can only take a few months sometimes ... so it is worth to remain a subscriber.
@NicksStuff
@NicksStuff 2 роки тому
The major advantage of using interrupts is that your MCU can be in deep sleep in between, using nearly no power. To debounce, you can do it with a library (or just a delay)........or manage it on the server side: the ESP sends a "bip" at every state change and your server interprets the "bips" coming within a second to be of the same meter value
@pr0engineer873
@pr0engineer873 2 роки тому
Not sure if it was mentioned, but you should consider using a Schmitt trigger to handle and eliminate the bouncing.
@RandalGJunior
@RandalGJunior 2 роки тому
Watermeters works the same way but instead a "pulse" on zero, it stays switched up during 5 liters and switched down another 5 liters. But it's a nice hint to read more than one time and "average" the readings to exclude any bouncing.
@321murf123
@321murf123 2 роки тому
awesome stuff
@radist2s
@radist2s 2 роки тому
Opening song is awesome!
@jensschroder8214
@jensschroder8214 2 роки тому
Perhaps count every impulse with 1 and add it up. Only divide by 100 at the very end. 1 is always stored in 1 bit without a comma or fraction. 0.01 is count in a fraction. Or count a separate variable to 100. Then set this to 0 and increase the output variable by 1. Float is only useful to take from a sensor and display it immediately without calculating. Or compare float by larger or smaller, but do not compare float with equal. Float is only an estimate.
@OrbitTheSun
@OrbitTheSun 2 роки тому
In my case, I just stuck the reed switch to the glass pane of the meter with scotch tape. The reed switch can then be connected to the ESP without any additional components if one connection goes to ground and the other to a GPIO. Then only the internal pull-up resistor of the GPIO has to be activated.
@NicolasP1973
@NicolasP1973 2 роки тому
Nice project and tank you for your video. If you multiply your 1000 you don’t need float and you will be always accurate on the ESP. And you just need to divide you number by 1000 before displaying or send to influx DB.
@MakerMeik
@MakerMeik 2 роки тому
Very good suggestion, which has also been posted here several times in the comments now. I have modified the data type in the code on Github now. Many thanks for your feedback.
@JonyMemonyk
@JonyMemonyk 2 роки тому
You can get rid of all problems with an bipolar position sensor ( the switch version will be inconsistent in time )
@joachimkeinert3202
@joachimkeinert3202 Рік тому
I am going to build this project. I think about placing a resistor (maybe 100 ohms) in series to the reed switch to improve the damping. The current sketch w/o such a resistor would cause an high current through the reed contacts as the capacitor is immediately put parallel to the power supply if the contact is closed. That might damage the contact in the long run. Suggestions, comments? Also can you include some info about the power supply (3.3 V)?
@Abi3761
@Abi3761 6 місяців тому
0:26 I like to see gas meter moving!
@iwayini
@iwayini 2 роки тому
Very interesting. Thank you. Balancing the radiators would be cool. :)
@SDogo
@SDogo 2 роки тому
An easy a simple solution will be casting the variable as a integer and then only saving the tick count (after applying the de-bounce logic obviously). Since the device has a webui, you can do calculations at the client side and show how many "ticks" have passed since the count started. A little json magic and a bit of js math will solve the problem quite easy (at least that's the way I'm doing the things with my esp8266 sensors).
@amrzakaria5290
@amrzakaria5290 2 роки тому
very nice , i like it.
@shakerileiwat4341
@shakerileiwat4341 2 роки тому
Awesome ♥
@ismaelgoldsteck5974
@ismaelgoldsteck5974 2 роки тому
A Photosensor on the white dashes would probably work really well
@MakerMeik
@MakerMeik 2 роки тому
To be honest, I think that this will be even more complicated than the solution with the reed switch. But there is a German UKpostsr who did this once with an old electricity meter. That looked quite interesting. Maybe the subtitles will help you to understand his approach. ukposts.info/have/v-deo/mopyjpl_q6p3wok.html
@benedekt.5909
@benedekt.5909 2 роки тому
Just a note: as someone who developed commercial knockoffs for gas meter pulse sensors, it is nontrivial to choose a reed switch, since these magnets in the meters vary quite a bit in strength. I recommend using 6-8 AT ones, and leaving LONG LEADS on them, to help with magnetic fields (this might be a myth, but in my experience, it helps with sensitivity problems).
@MakerMeik
@MakerMeik 2 роки тому
Many thanks for your advice. I was not aware of that to be honest, although it should have been obvious. I have included your hint in my pinned comment with corrections and suggestions for improvement.
@DDC251992
@DDC251992 Рік тому
Is it possible to have more details or pictures about the wiring of the ESP with capacitor and resistor?
@mawoodmain
@mawoodmain 2 роки тому
A hall effect sensor would proably be a better bet then a reed switch, sovles the bounce problem and should last longer in practice.
@MakerMeik
@MakerMeik 2 роки тому
Unfortunately, with the hall-effect sensor I had here, the magnetic pulse of the gas meter could not be captured. Maybe I did something wrong. I had changed polarity and positioning several times and checked with a separate magnet. Maybe I should have ordered again other hall-effect sensors and test!?
@christian84726
@christian84726 2 роки тому
and for the number variable use integer or long, so u don't get rounding issues at all, in note red u move the comma afterwards
@MakerMeik
@MakerMeik 2 роки тому
thanks, i have corrected that in my code on github in the meantime
@andrew2004sydney
@andrew2004sydney Рік тому
Maybe put a capacitor in series with the relay so that even if the meter stops on 0 and holds it stuck on, the capcitor will make sure that only a pulse is delivered to the input pin.
@MatSmithLondon
@MatSmithLondon Рік тому
So many comments to make. 1) Re all the problems you had with floats etc., why are you trying to represent this number in your code at all? Can't your ESP01 just send a signal periodically when e.g. 1 unit passes? Then Node-RED does all that counting stuff. 2) General advice about interrupts: they are only required when coding a microcontroller if you have done things that introduce delays in code. This is best avoided. Instead of delays, use timers - far more powerful. Only use ISR when you are needing to sort out deep sleep / battery efficiency etc. 3) If there's switch bounce, deal with it in code. Always better that way. Then you can more easily tweak debounce time to suit. Also if there's accuracy drift over time, you can change this later. Combined with the fact you are using timers instead of delays, it's really easy to code a debounce detection. There is even a cool library you can use if you prefer not to get your hands dirty...
@arekx
@arekx Рік тому
Wouldn't existing esphome firmware with pulse meter sensor and debounce feature be simply better? (no need to maintain own firmware; much more tested; more features etc). Video about balancing heaters didn't materialize? (very interesting topic)
@mikeydk
@mikeydk 2 роки тому
Your video inspired me to do the same thing. Instead of 3D printing the case and putting a reed switch in, I just ordered the original one instead. I also made a config in ESP Home so it easily gets into Home Assistant. For debounce the signal I set it so a signal must be 1 second long, (I might raise that if needed) if it is less it will be discarded. If the signal has been stable for 1 second it will count one pulse up, then wait for the signal to go low stable for 1 second again. Now I just need to wait for the IN-Z61 to arrive so I can attach it to my gas meter. :)
@camerongreco2146
@camerongreco2146 Рік тому
Do you know how far a magnetic pulse output is good for? Got 26 gas meters and I got one that's up to 200 feet.
@testman9541
@testman9541 2 роки тому
Did you evaluate counting inside esp32 ulp using the embeded hall sensor ? Or using ole Schmitt trigger as an alternative ?
@MakerMeik
@MakerMeik 2 роки тому
I have not tried that. But I had first tried it with a Hall effect sensor, because I was aware that the bouncing of the reeds can cause problems. Unfortunately, my Hall-effect sensors were not sensitive enough for the magnetic pulses. But there are alternatives with higher sensitivity. I don't know if the sensitivity in the ESP32 is sufficient. I only see the additional problem that you have to get very close to the readout point and the recess is quite small. But if you find out something about this, I would be happy if you would share your experience with me and the other viewers.
@coin777
@coin777 2 роки тому
Give me the video on the balancing Mike :)
@Elm337
@Elm337 2 роки тому
Cooles Video, stellst du auch den Node red Flow zu Verfügung?
@MakerMeik
@MakerMeik 2 роки тому
Klar, ist erledigt ;-) github.com/MakerMeik/Gasmeter_with_reed/blob/main/Node-RED-flow.json
@Elm337
@Elm337 2 роки тому
Dank dir :)
@mruniverse5704
@mruniverse5704 2 роки тому
Good Job. But why don`t You try espeasy. They have counter and debouncer?
@jbwork5220
@jbwork5220 Рік тому
Hiyou have two way´s to read the gas counter. What it the best way? ESPcam or mgnetoc pulses?
@MakerMeik
@MakerMeik Рік тому
In general, I would summarize that you should always prefer the solution with the lower complexity. And here this is the variant with the magnetic pulses. But note my pinned comment with my later findings: For this special case, integers are even better suited than doubles for storing the current numerical value. The system with the magnetic pulses and the reed sensor has been running absolutely reliably for more than a year now.
@lelandclayton5462
@lelandclayton5462 2 роки тому
The Reed switch is bouncing so wouldn't something like a schmitt trigger correct that and give you a single rising/falling edge?
@martin_hansen
@martin_hansen 2 роки тому
No a Schmidt trigger, will only help if you have a slowly rising signal where the period when the signal is electrically in the undefined area between 0 and 1 long enough to confuse the CPU. That is most likely not the reason here.
@martin_hansen
@martin_hansen 2 роки тому
If you want to illustrate the switch bounce in a video. Take a steel or glass ball. Drop it on a hard surface, and you can see and definitely hear the bouncing. This is what is happening inside a switch, just on a macro level. Möjn aus Dänemark ;-)
@MakerMeik
@MakerMeik 2 роки тому
hehe ... thanks, actually when I was editing the video myself I was aware that the microscope shot doesn't exactly show the described effect. But there would have been 1000 other details I would have changed on the video. Since my BBC film team is currently on vacation and I had to do everything by myself this time, I was forced to take shortcuts in some places 😂 But good suggestion, I could have done the "bouncing" much better without much effort. If I should touch the topic again, I will take up your idea. Liebe Grüße zurück aus Deuschland 👋😄
@steveb1600
@steveb1600 2 роки тому
Great project ,thank you for sharing. BUT Why there is a magnet inside gas meter???
@sandiomarfaier6166
@sandiomarfaier6166 2 роки тому
para o reed swicht ler o pulso
@pepethefrog7193
@pepethefrog7193 2 роки тому
Why not use a hall sensor? Why not count ticks instead of "0.1 of something" ? Ticks in long integer :) How did you reduce heating costs by balancing? Doesent the local termostat in each room do that already?
@MakerMeik
@MakerMeik 2 роки тому
Since I was aware of the bounce problem of the reed switches even before the solution shown, I actually tried it with a Hall sensor first. Unfortunately, the magnetic pulse was not strong enough to trigger a switch with my sensor. I don't want to exclude that I made a mistake or that my Hall sensors simply don't have the necessary sensitivity. The Integer tip has meanwhile been given to me by some viewers too and of course you are absolutely right. I will change that in the code on Github ;-) If balancing has not been done on your system, it is very likely that your heating system will have to supply a much higher flow temperature to keep the last radiator warm. With the valve under the thermostat you control the flow rate in the radiator, so that even when the thermostat demands full heating power, enough hot water still gets to the radiator at the end. By the way, a radiator should be hot at the top and cold at the bottom. After all, it should give off the heat to the room. If the hot water even ends up running back to the central heating system, this is anything but optimal. But I think I will make the video about it soon. Since you can save a lot of money, you can also try to check that already.
@pepethefrog7193
@pepethefrog7193 2 роки тому
@@MakerMeik TY for the heating explanation. I see the problem of one thermo going full open and last room getting cold. Another thing to learn.
@kosa-angrykpany6489
@kosa-angrykpany6489 2 роки тому
@@MakerMeik Did You tried to read analog values of the hal sensor? I once have one that was not switching digital input in weak magentic field but the analog reading levels was all I need. I think it was AH3503
@MakerMeik
@MakerMeik 2 роки тому
Thanks for your tip. No, I wasn't aware of that and that's why I didn't even come up with the idea. I will have another look at it when I get the chance.
@hitsov
@hitsov 2 роки тому
Damn, nice project but I got a "smart meter" meaning no dial to read with a camera unless I wake up the display by pressing q button and no magnet to read the counter... Sucks big time. The smart meter itself updates once per day or two so it's slow AF and the reading is somewhere on the energy provider's website
@MisterkeTube
@MisterkeTube 2 роки тому
Don't use double! Use fixed point instead, i.e. store your value as an integer and assume that each increment is for 1/100th (or 1/1000th or whatever fixed divider you define) of a m3 ...
@MakerMeik
@MakerMeik 2 роки тому
Very good suggestion, which has also been posted here several times in the comments now. I have modified the data type in the code on Github now. Many thanks for your feedback.
@janlukes5833
@janlukes5833 2 роки тому
Love the ending with hydronic balacing. I recently got my own house with gas heating and was wondering if I need to do it, since my plumber just install the pipes and left :)
@MakerMeik
@MakerMeik 2 роки тому
You should at least check whether the radiator valves are still in the home position, as was the case with me. Then you have a clear indication that your plumber has "forgotten" to do this. If so, I would definitely ask for it. Even if he charges for it, you will save so much in the end that it will be worth it for you. Here in Germany, the companies are obliged to do this at no extra charge.
@nkronert
@nkronert 2 роки тому
Looking forward to the hydraulic balancing video!
@babblo
@babblo 2 роки тому
You should use the debounce library to filter the input
@MakerMeik
@MakerMeik 2 роки тому
Cool, I didn't know that one. I will have a look at it soon. Thanks for the tip.
@PA3GUQ
@PA3GUQ 2 роки тому
@@MakerMeik Debouncing is just a simple trick. The firmware should see a '1' level a couple of times in a row, say 5. If you see it once and the next sample is low again, you start again. You accept the high level only if you have seen the '1' 5 times in a row. The same at falling edges. That's how you can solve your issue in just a few lines of code.
@MakerMeik
@MakerMeik 2 роки тому
hmmm ... but that's exactly how I solved it and also explained in my video, right?
@PA3GUQ
@PA3GUQ 2 роки тому
Ehm... not sure. I think you don't restart counting when the switch bounces back to the old state. But to be honest, I can't follow the piece of code so quickly. What I usually do is scan the switch in the main loop, so you scan eg every 100ms. Then you increase a counter when input='1' and reset it when it's '0'. If you see enough '1''s, you will reach 10 (eg). At that point you say "input is '1'"". I think you pause the loop when you start doing the debounce procedure. You can't do anything in between at that time (maybe not required here, but maybe next time it is). Anyway, it works, Cheers :-)
@AndrejsZavadskis
@AndrejsZavadskis 3 місяці тому
why there is no device selling for this ?
@martinrocket1436
@martinrocket1436 2 роки тому
little funfact: floats are called floats because the position of the comma can float. If you look at your meter, you can see that the comma is printed at one place and can't move. Your meter actually works with an integer and the unit is 10־³m³
@MakerMeik
@MakerMeik 2 роки тому
You are absolutely right. And also many other viewers have already pointed out here in the comments that int or unsigned int would have been the better choice. That is why I have modified the data type in the code on Github now. Many thanks for your feedback.
@akhan999
@akhan999 7 місяців тому
Would have been more useful to go through each part and what’s needed
@tooneepoo
@tooneepoo 2 роки тому
I'd like to see the radiator balancing later, an unsigned int now and maybe hear cringe reduced English in the far future. N.B. In those olden days folks used high quality reed relais with capacitor for debouncing in keyboards.
@MakerMeik
@MakerMeik 2 роки тому
I will certainly work on the balancing video soon. The thing with the integer is now clear, I will update the code on Github shortly. Only the thing with the "cringe reduced english" will be difficult. After all, it's my trademark and certainly adds a lot to the entertainment value of my videos for native speakers. xD The important thing is that you understand me. If I would make my videos in German, I would share my (half-)knowledge only potentially with one hundredth of the world. If we want to see ourselves as Europeans or even as citizens of the world instead of getting caught up in trivia, then I guess we have to live with the fact that most people are not native speakers. But hey, I'll try my best anyway. Maybe you learn a little German in the meantime, then we can meet halfway ;-)
@danm3929
@danm3929 2 роки тому
Hi.I tried to access the link, but it is no longer valid. can you help me with the sketch for the 3D printer please? Thanks
@MakerMeik
@MakerMeik 2 роки тому
Thingiverse sometimes has a few problems. The model is also available here: www.printables.com/de/model/109985-gas-meter-receive-magnetic-pulses-with-an-esp8266 I will re-uploaded it to thingiverse too: www.thingiverse.com/thing:5338232
@johngriffiths3467
@johngriffiths3467 2 роки тому
Very much interested in this project but still feeling my way in HA and ESP. So bought an ESP32 NodeMcu WiFi board and reed switch. I've got the Node-RED flow installed but now I'm stuck. Do I have to flash the ESP32? What's the best way to get this project off the ground and at least giving readings (calibrations can follow - part of the fun). Anyone involved in this project able to provide help to a newbe?
@MakerMeik
@MakerMeik 2 роки тому
Since I don't have HA in use myself, I can't help you with your problem so easily. I have made the code available on Github. If you have a MQTT broker in addition to Node-RED, you should be able to flash this code to an ESP32 to use it. I'm not sure if you know how to do that. I use Platform IO with VS code for this. If you are a beginner, you might do better with the Arduino IDE. But even there you need some steps to make it work. Maybe you start with some basic videos before you start with the MQTT topic used here. I hope this helps you to get started.
@johngriffiths3467
@johngriffiths3467 2 роки тому
@@MakerMeik Hi. Thanks for replying. Yes I do have Arduino IDE and I'm OK with flashing the ESP32 thanks. I'm still awaiting delivery of the reed switches but I intend breadboarding the circuit and using a switch in place of the reed. Agreed regards MQTT. I continue to plod along and hopefully get this project running eventually. Again thanks.
@johngriffiths3467
@johngriffiths3467 2 роки тому
@@MakerMeik Hi Michael. Since we last communicated I've progressed quite well. (not bad for a 71 year old!) ESP-01 built and flashed and Node-RED created along with MQTT. I've got a couple of questions I hope you can easily answer: 1.IP Addressing; Can I assume that the gateway IP address should be the same as the MQTT address? (Line 17) and 2: what does the IP address on Line 16 refer to? I'm nearly there. Thanks.
@MakerMeik
@MakerMeik 2 роки тому
Glad to see you working through the issue so persistently. You can even delete lines 16 through 18, as well as line 39 (Wifi.config(ip,....)) if it confuses you. Then you force your router to give your ESP a free IP address. This is probably the normal case for most users. If you, like me, prefer to assign a fixed IP, you do it in those lines. Then you have to define the fixed address in the router as well as here in line 16 to 18. The gateway in line 17 is usually the IP address of your router. Thus, the IP address of your MQTT broker (Mosquitto) should probably be different. For example, the IP address of your Raspberry Pi running Mosquitto. You enter this address in line 11 (const char* mqtt_server = ....). The reason that the addresses are the same in my example is confusing and comes from the fact that my server still does some of the routing. So it's best to ignore that. ... I wasn't aware of it when I uploaded the code, otherwise I would have changed it. I hope this helps. And I hope that I can still do these things when I'm 71 years old, like you do :-)
@johngriffiths3467
@johngriffiths3467 2 роки тому
@@MakerMeik As always your response is well received Michael. All noted regarding the addressing. I'll let the router assign a free address as you suggest. Hopefully I can start testing with a magnet tomorrow to simulate the meter. Node-RED needs no changes. For info I'm using an old wireless doorbell receiver housing, using 3 AA and a buck regulator for the 3.3v. should last a while. Anyway, thanks again for your support.
@davidbeiler6364
@davidbeiler6364 Рік тому
how can i tell if my gas meter has a pulse?
@MakerMeik
@MakerMeik Рік тому
Just test it with a simple circuit with LED, like I did it in the video. Maybe you can also find the manufacturer's specification. A small compass could also give a hint.
@christian84726
@christian84726 2 роки тому
hi, they are needed to be adjusted to the amount of flow, to maintain a certain temperature in relation to an outside temperature. If the size of a radiator is chosen correctly to the size of the room, then u are right they all have nearly the same flow but in most cases, the flow is different like the gas pedal of a car and every room is a different car but all of them need s to have to maintain the same speed or in ur case room temperature. For this, u need a special computer program to count the resistance in the pipes to even get to set up the pump flow to a correct value, to be able to provide the flow to every room that is needed. That is also the problem why some installation technicians failed to do they install what they guess is good sometimes and often they overbuild the system and the rooms were heated too much un some rooms when u try now to set up the flow u will end up imbalance the system so much that sometimes it gets worse and create loud flow noise when u try to limit the flow, u should get someone to do it for you even the software for this is expensive and most time not sold to individuals because u need the knowledge and training to use this software corectly
@lutzmuller5703
@lutzmuller5703 Рік тому
Kannst du das Video auch auf Deutsch machen?
@sandiomarfaier6166
@sandiomarfaier6166 2 роки тому
Hi, do you have the code for the arduino? I need to make one of those hydrometer too.
@MakerMeik
@MakerMeik 2 роки тому
The link to the code on Github was already in the video-description: github.com/MakerMeik/Gasmeter_with_reed
@sandiomarfaier6166
@sandiomarfaier6166 2 роки тому
friend, I didn't find secrets.h in the library. how did you install it?
@MakerMeik
@MakerMeik 2 роки тому
On Github you can find a template for this file in the folder "include". You create this file yourself. If you use PlatformIO, you can also put it in the "include" subfolder, like I did. If you use the Arduino IDE instead, it is enough to put the file in the same folder as the project file ".ino".
@joopterwijn
@joopterwijn 2 роки тому
You could have counted in while numbers in the code and dived the number in the spreadsheet curve…..
@MakerMeik
@MakerMeik 2 роки тому
Thanks for the hint, now that you and also some others have given me the tip, it falls like scales from my eyes.
@MakerMeik
@MakerMeik 2 роки тому
I have modified the data type to "unsigned int" in the code on Github now. Many thanks for your feedback.
@kamilosxd678
@kamilosxd678 2 роки тому
For this type of calculation it's best to use some custom variable type with FIXED decimal point.
@MakerMeik
@MakerMeik 2 роки тому
Very good suggestion, which has also been posted here several times in the comments now. I have modified the data type in the code on Github now. Many thanks for your feedback.
@stylesoftware
@stylesoftware 2 роки тому
Fun project, note to programmers of ESP/Arduino. Both float and double are poor when using arithmetic, better to use a long, then divide in to a float for output readings only.
@MakerMeik
@MakerMeik 2 роки тому
Very good suggestion, which has also been posted here several times in the comments now. I have modified the data type in the code on Github now. Many thanks for your feedback.
@hanssprungfeld4110
@hanssprungfeld4110 2 роки тому
Warum keinen Hall Sensor?
@MakerMeik
@MakerMeik 2 роки тому
Since I was aware of the bounce problem of the reed switches even before the solution shown, I actually tried it with a Hall sensor first. Unfortunately, the magnetic pulse was not strong enough to trigger a switch with my sensor. I don't want to exclude that I made a mistake or that my Hall sensors simply don't have the necessary sensitivity.
@stephan42
@stephan42 2 роки тому
I love the project. Some issues though. First, the calculation is wrong. 0.5 + 0.25 + whatever is certainly more than 0.4. The issue here is, that your first digit after the decimal point stands already for 2^-1. Second, as others pointed out, using double instead of float is just kicking the can down the road. It has essentially the same issues as float, just less often. A better solution would be to use an integer type and count hundredths.
@stephan42
@stephan42 2 роки тому
Oh, and 2^-5 = 0.03125.
@MakerMeik
@MakerMeik 2 роки тому
Oh no, I was indeed too sloppy. You are of course right, the correct calculation must look like this: 1/2^2 + 1/2^3 + 1/2^6 = 0.25 + 0.125 + 0.015625 = 0.390625 For the small numbers I noted on top of the binary digits, I shouldn't have started with 0, 1, 2, 3.... to the right of the decimal point, but with 1, 2, 3, ... But I can tell you, making a video like this requires all your senses. Shooting video, editing, text, music, programming, soldering, 3D models, and printer, ... I had unfortunately overlooked the fault ... I hope the Probelm is to be understood nevertheless at the end. And the thing about the integers divided by one hundred also makes perfect sense to me. I will at least change that in the code on Github. Thanks for your feedback and for thinking along.
@MakerMeik
@MakerMeik 2 роки тому
I have modified the data type to "unsigned int" in the code on Github now. Many thanks for your feedback.
@yetzt
@yetzt 2 роки тому
ooof. never ever use floats for data. use two ints, one for the whole number, one for the fraction, increment the whole number when the second int flips over. also use two states, one for ioen and one for closed, only switch state when ioen or closed for n amount of time. then you can increment by state change.
@archmannn
@archmannn 2 роки тому
Is it not illegal to mount anything on meters?
@MakerMeik
@MakerMeik 2 роки тому
I don't think so. The recess in my gas meter is there specifically for this purpose. There is also a device from the manufacturer itself. That does nothing else. If the do-it-yourself solution seems too risky, you can buy the "original". Nevertheless, I think that the 3.3 V of my do-it-yourself solution is not critical. Even if I touch the metal of the counter with it, not much will happen with the mass of metal. Especially not inside the pipes.
@CC-ke5np
@CC-ke5np 2 роки тому
You are not allowed to tamper with the meter in any way. Attaching something is suspicious and in worst case they might start an investigation for fraud. They might bill you for labour costs changing the meter for the investigation. This had happened to my "bad tenant" who attached a magnet to the power meter of his flat. There was an instant €1200 bill for labour costs before the actual investigation had started. Then he had to pay for the meter he broke, the generously estimated stolen electricity and there were criminal charges. I don't know how much that had cost him, I managed to evict him soon afterwards. He had put the labour bill into my mailbox since it is my house so it was my meter and he thinks he has the right to break my stuff he reasoned. But since the attachment to your meter is obviously not magnetic and you can look inside, nobody would start any trouble.
@MakerMeik
@MakerMeik 2 роки тому
As other viewers have already noted, you can also buy the original "IN-Z61" sensor from the manufacturer. And it works exactly the same way in the end. Anyone who takes a technical or even criminological look at my sensor will see that it has no effect whatsoever on the meter reading and that the recess in the meter was designed precisely for this purpose. So I hope that I will be spared from too ambitious meter readers. My annual gas consumption fluctuates very little anyway.
@patrickmaartense7772
@patrickmaartense7772 2 роки тому
Nice project, just to much data: simple solutions : do not use read switch , use a hall sensor, they have no noise. and use some de-bouncing code , best to wait 25ms after a changing before a retrigger is allowed), a hall sensor should not need a de-bouncing as there is no mechanics involved.
@laukikragji7951
@laukikragji7951 2 роки тому
What i would have done differently 1) Hardware Debouncing with correct RC values 2)Esp should just act like Wifi trigger let node red increment the counter(so no float problems & simple code) 3) try not o make it battery powered 4)Complete change of technology have you seen the self powered RFID buttons that work with batteries i would have thought to use that instead of ESP
@christian84726
@christian84726 2 роки тому
again don't use ever, never never use float or double, it unnecessary because of the problem u already see for urself, even the gas meter don't use it, it uses whole numbers and someone painted a dot on the meter for better reading ;-) that is always a rookie mistake, even in databases
@MakerMeik
@MakerMeik 2 роки тому
thanks, i have corrected that in my code on github in the meantime
ESP8266 as Window Sensor with years of battery life
17:57
MakerMeik
Переглядів 175 тис.
Every Apartment needs this Upgrade! (WhatsApp/Telegram Notifications)
10:05
😱СНЯЛ СУПЕР КОТА НА КАМЕРУ⁉
00:37
OMG DEN
Переглядів 1,4 млн
Try these 16 Brilliant ESP32 projects!!!
11:18
ToP Projects Compilation
Переглядів 512 тис.
DIY ESP32 AC Power Meter (with Home Assistant/Automation Integration)
10:58
DIY-LED-Controller für 5€ (WLED-Tutorial)
13:33
Make Magazin
Переглядів 154 тис.
10 заповедей по пайке. Учимся паять
12:05
Best power saving mode - Much Deeper Deep Sleep ESP8266
10:30
DIY TECH BROS
Переглядів 94 тис.
Slash Your Gas Costs Today! Home Assistant's Proven Strategies
9:26
Smart Home Junkie
Переглядів 8 тис.
Use Utility Meter integration to Track gas, power and water
8:59
BeardedTinker
Переглядів 65 тис.
Extracting Firmware from Embedded Devices (SPI NOR Flash) ⚡
18:41
Flashback Team
Переглядів 490 тис.
Arduino Projects - 12 GREAT Ideas for you!!!
9:00
ToP Projects Compilation
Переглядів 331 тис.
🤯Самая КРУТАЯ Функция #shorts
0:58
YOLODROID
Переглядів 2,7 млн
Распаковка айфона под водой!💦(🎥: @saken_kagarov on IG)
0:20
Взрывная История
Переглядів 11 млн
Клавиатура vs геймпад vs руль
0:47
Balance
Переглядів 807 тис.