3. Reply We need to use "Events" from "Setup" drop-down menu. I've only had one leak in my entire life time, and I didn't need any phone to tell me about it. So I wanted to share my code - I think this can be such a useful device/project. Switch the power with S1 switch. https://bitbucket.org/pilotlt/floodsensor/src/mas Arduino Robotic Arm Controlled by Touch Interface, wifimgr.py - wifi manager for connecting to wifi network. And also this software do not allow to use modules like standalone controllers. So in this case if you try to upload another file, sometimes upload process will be failed. My "event" is shown on the picture above. In this tutorial, however, we will limit ourselves to reading out the sensor and will therefore only assume the parts that are absolutely necessary. I am using Raspbian Stretch with Desktop from here: https://www.raspberrypi.org/downloads/raspbian/. Seems like a good option since the flow processor will keep totalizing if your LoPy restarts. If not, you would most likely damage the pin. If I read it using pulses_get I cam able to get occasional sets of data, but not consistently. The values can then be sent to a predefined channel via MQTT (information on this here). I have tried several bits of code to try and read data off the sensor, but I am having trouble getting anything to work or be useable. We can query the Raspberry Pi Water Flow Sensor at any frequency (e.g. This works for me on Windows machine perfectly. Second line is for testing - it shorts circuit without water, just to let us know is the device working or not. There are two ways to force the server to do what you want. You can check the port where ESP is installed from Control panel - System - Device manager. Polling a GPIO with Python seems pretty cumbersome but if it works then Whoohoo! However, I do like your idea and glad to see younger people getting into both electronic and programming. It works. BorisV2, please don't take my common the wrong way. With the pot, are you talking about calibrating the temperature sensor? Working voltage range:DC 5-24 V Love it! Devices will not show up until the appropriate hardware is added. I currently have it plugged in to 3.3V and GND with Data going into P16. It works on Raspbian. Either way good luck with the build. In the end I really just need to port over what is happening in the Arduino code over to MicroPython to run on the Gpy. Latter I will tell why. Than if conditions for triggering an event ( sending notification to you cell phone) is satisfied, Domoticz sends the notification. Depending on the project, you will be using a few other hardware parts. Next step is to install Domoticz server on your PC. I was able to modify this tutorial: https://core-electronics.com.au/tutorials/pycom/hc-sr04-ultrasonic-sensor-with-pycom-tutorial.html to receive back some data but it only reads values at a very low speed and then stops reporting at higher 'speed'. Your browser does not seem to support JavaScript. If it finds an object, it bounces back to the module. Of course choose correct port. Does It have I2C address. NoScript). Press J to jump to the feed. I am using Adafruit MicroPython Tool (ampy) for this. So it is good for saving charge of the battery. For example did they start providing inaccurate readings or just stop working/not return any value? Such device can be used also to determine water level. You can find instructions how to install ampy here. Hardware can be disabled or deleted. Reading out a Flow Meter/Water Flow Sensor on the Raspberry Pi. First of all that is awesome! You can test notification by clicking "Test". I started by trying to program event on the /device/ page. You can use instructions here or here :). She was afraid that the hose in the boiler room can be leaky, and the water would flood the newly laid wooden floor. This topic has been deleted. I wasn't able to find code for this that worked for me. :) It works. As per the device's datasheet, the minimum working voltage for your sensor is 4.5 VDC, so I don't think it would work with it connected to 3.3 VDC. We need this module to reduce voltage from the battery to the acceptable level for ESP8266. Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. So, take your RPi and install operating system suitable for running Domoticz server. Few words about how notifications works. Probably why you're getting zeroes, because there's nothing on the output of the sensor. Click this button and choose Sensor Type "Alert".Now we have to add the device in Domoticz to become active. it is so, because of as soon as you will upload main.py - ESP8266 module will reboot and start executing main.py file. Vua lia! Find where esptool is installed (normally somewhere like C:\Program Files (x86)\Python36-32\Scripts. It is powerful enough for running Domoticz server. Pololu mini pushbutton Power Switch Very interesting tiny board. You need to have an account on Pushbullet, Pushover or other pages you would like to use. After ESP starts, find a new WiFi network called "Wifimanager". To use them like standalone controllers we need to erase factory firmware and install a new one. All that is needed for this is a persistence layer (database in which the values are stored). Do not be afraid, it is not so difficult. I'm not sure if this is a limitation of the 3.3V or that I am headed down the wrong path with the code: I tried several versions of code reading DHT sensors with Time / Interrupts, but I had no success getting anything to report back from the flow sensor. https://github.com/Liamhanninen/WaterFlowMeter. As soon as the sensor sense water, ESP switches on and sends request to Domoticz server in JSON format. Enable the device by clicking green arrow on the left (on my picture below it is blue, because of the device enabed). The advantage of using 1st way, is that it is more flexible. Depending on the data sheet and implementation, values per pulse frequency (Hz) of 7.5Q are found, with Q indicating the flow rate in litres/min. But there is an easier way :). The idea was to be notified remotely if water leaks. To do this you need TTL converter + few additional components. I see that you are polling the GPIO for a state transition. Love data! From my 15 years of experience as an medical engineer, I know that easiest way of detecting water is metal pins shorted by water. Will you be plugged into city utilities or have your own tank? 3 years ago, Yes, in case you do not need to get notifications on your phone :). - Thanks, I've had success using Atlas Scientific's embedded flow processor for water meter pulse totalizing: speed of sound in the air at 20C (68F) =. After this action all Password fields, which were empty at the first access, will appear with a long string of asterisks, even if they have not been used. Raspberry Pi vs. Arduino: Which One is Best (for Beginners)? After entering data in the fields, you have to save them by pressing the red button "Apply Settings". document.getElementById("comment").setAttribute("id","a449a099841c4244dc0c1c18be9c55c4");document.getElementById("jc72354ab5").setAttribute("id","comment"); Save my name, email, and website in this browser for the next time I comment. It let us switch the ESP module only when water is detected. This is the unique reference to this device and we need it later in our Python script to address notification. thank's, I am using the industry's most comprehensive range of corrosion-free a paddle wheel flow meter which are cost effective, excellent compatibility with liquids, foam, vapor and can offer low current consumption for battery powered applications. I am guessing the solution has to do with RMT or something but I'm out of ideas. I am using Pycharm / Atom or Anaconda Spyder On raspberry Pi, 5. Also you will need an app on your cell phone or PC. All files for this project are available from here: https://bitbucket.org/pilotlt/floodsensor/src/mas if everything is ok, restart the module, by reinserting the TTL converter to USB port of your PC. So the idea is to use one ESP like a hub for connecting other ESPs. The GPy's pins can only receive an input of up to 3.3 VDC, so you will need a voltage divider prior to your input pin to bring the voltage down. If you believe that you will check some check boxes and it will work, you are wrong :) It doesn't work in this way. You can check list of files on ESP by ampy command: From my experience it is better to upload main.py after you have uploaded all necessary files. All Rights Reserved, ESP32 NodeMCU with HC-SR04 Ultrasonic Sensor with Arduino IDE, MicroPython Programming with ESP32 and ESP8266, Installing and getting started with Thonny IDE, Flashing MicroPython Firmware with esptool.py, Flash/Upload MicroPython Firmware to ESP32 and ESP8266, MicroPython: Program ESP32/ESP8266 using VS Code and Pymakr, MicroPython Programming with ESP32 and ESP8266 eBook, ESP8266 NodeMCU with HC-SR04 Ultrasonic Sensor with Arduino IDE, Complete Guide for Ultrasonic Sensor HC-SR04 with Arduino, Flashing MicroPython Firmware with esptool.py on ESP32 and ESP8266, MicroPython: OLED Display with ESP32 and ESP8266, MicroPython: SSD1306 OLED Display Scroll Functions and Draw Shapes (ESP32/ESP8266), Getting Started with Thonny MicroPython (Python) IDE for ESP32 and ESP8266, Getting Started with MicroPython on ESP32 and ESP8266 (uPyCraft IDE), [eBook] Build Web Servers with ESP32 and ESP8266 (2nd Edition), Build a Home Automation System from Scratch , Home Automation using ESP8266 eBook and video course , ESP8266 NodeMCU Web Server (WebSocket) with Multiple Sliders: Control LEDs Brightness (PWM), Connect ESP32 to Cloud MQTT Broker (TTGO T-Call ESP32 SIM800L), MicroPython: MQTT Publish BME280 Sensor Readings (ESP32/ESP8266), https://randomnerdtutorials.com/esp8266-nodemcu-hc-sr04-ultrasonic-arduino/, https://randomnerdtutorials.com/getting-started-micropython-esp32-esp8266/, Build Web Servers with ESP32 and ESP8266 , TTL pulse proportional to the distance range. You do not need to keep ESP ON. This option supports sending notifications to Pushsafe and Pushover. Your ESP now is connected to your WiFi network and ready. I connect it to a FiPy via I2C then forward the readings to my server over MQTT. By-the-way, before I retired, I reversed engineered many old circuits and modernize them with new circuit designs including micro-controllers and programming as well. There is no one way only issue for most anything. The Setting menu with various tabs allows you to enter personal parameters necessary for a better system functioning. Also note that in the Arduino example, the sensor is connected to 5V, which the Arduino can produce - GPy can't. Looks like your connection to Forum was lost, please wait while we try to reconnect. Domoticz setup, Now that our server is ready, we can access it from any web browser, including from a tablet by entering the following URL: http://IP_domoticz:8080, Now that our server is ready, we can access it from any web browser, including from a tablet by entering the following URL: http://IP_domoticz:8080. Can u suggest some hints to me. Simplest - Python IDLE which is normally being installed with Python. EDIT: I added ingredients list to 'Stuff' section in the README. 2. Im using your script for my flow meter, but I cant find the pulse frequence.> flow = (count / 7.5) # Pulse frequency (Hz) = 7.5Q, Q is flow rate in L/min. It means that file have been uploaded. Hit "enter". In our case notifications has to be send as soon as water was detected by the sensor. 2.Use "Send notification with subject" message. I did a similar thing with a microcontroller and a flow sensor to monitor the flow rate of the coolant in my laser cutter. These flow meters are so cool. Next - this device is a part of "Smart home" system I am going to built :). Any code editor you want. Ok, now we are ready for uploading the micropython scripts to ESP8266. If anyone is able to give me guidance in the right direction I would be greatly appreciated! Have you noticed any missed steps or are the numbers sane? These are: In order to be able to connect a hose, we need a so-called tap connector. There are various application settings which can be set through the Setup | Settings menu. 1. This will be worth its weight in gold on my co2 laser cutter, If i wuld like to connect 4 flow sensor to raspberry pi what changes can be made to program. Normally those modules comes with factory firmware. According to the spec sheet on the website: Frequency: F=7.5 * Q (L / Min) error: 2% current can not exceed 10mA, 450 output pulses/liters, F=Constant * units of flow (L / min) * time (seconds) The sound travels through the air. Flow range:1-30L/min Output Waveform:Square Wave,output pulse signal. Here you can connect your ESP to local WiFi network. Now you can't know are there enough power to send alarm message or not. My desired output would be in L/min. But I did not succeed with this on Raspbian on my Raspberry Pi. Now we need to program "event" for our sensor. Last but not least, it would be advisable to set the Python script to autostart so that it sends data regularly. Some time ago, my wife asked me to make a water leakage sensor. Execute external file via "Events", by using Blockly message "Start script". But nowadays there is another option called Esplorer. Or is there a way I can test this? Than we need to connect our module to PC to erase firmware. And what is a potentiometer? The Domoticz application supports many hardware devices natively. I have programmed the sensor to send alarms every 30s, if water was detected. Create an account to follow your favorite communities and start taking part in conversations. This code looks great but my lack of understanding things still has kept me from being able to actually run it and print back any values. I've never used a 1-wire thermometer, but if it keeps giving you trouble you could try a thermistor in a wheatstone bridge. https://atlas-scientific.com/embedded-solutions/ezo-embedded-flow-meter-totalizer/. TL;DR: Looking for help getting a water flow rate sensor working on my Gpy/Expansion Board 3.1, new to MicroPython and struggling. There is also an inexpensive variant that we can quickly read using the Python programming language and also integrate into our smart home system. Notify me of follow-up comments by email. So maybe that's rated for a much slower/less pressure water flow. Fun project to program and play with. A subreddit for discussing the Raspberry Pi ARM computer and all things related to it. Select Setup|Hardware to add hardware. If I read the pin as analog I can get a value of 4095 (3.3V) at rest and the higher the pressure on the sensor it goes to 0, however I get a mixture of 'false zeros' between readings. User will have to push a button, and the battery level will be shown. Before you can use the Domoticz application to control devices or read sensors you must setup the communication to hardware device(s). One line serves to switch the device on. every second) to determine how many litres flow through it per second or minute. Press question mark to learn the rest of the keyboard shortcuts, https://github.com/Liamhanninen/WaterFlowMeter. :$. 5. 1. esptool installed, for erasing modules and flashing firmware, 2. USB to ESP8266 ESP-01 Wi-Fi Adapter Module w/ CH340G Driver. We will need to upload files: In command line type: ampy --port COM5 put C:\path to your file. The one used here had the following information: Accordingly, a part can be easily edited using tools such as Tinkercad. I think in the next generation of this sensor there will a special button for testing battery charge. The ultrasound receiver (echo pin) receives the reflected sound (echo). In this case power consumption during connection is very low and it is more faster. MQTT is very suitable for this, as we can communicate via an interface. Thanks for doing all the difficult work for! This an app with user interface, allowing to upload files to ESP modules. But thumbs up all the same. Thumbs Up! Install firmware (I took it from here: https://micropython.org/download#esp8266) by typing: python esptool.exe --port COM5 --baud 460800 write_flash --flash_size=detect 0 C:\path_to_firmware\esp8266-20180511-v1.9.4.bin. When hardware is added the overview of all defined hardware will be shown. This is awesome and it's something I've been thinking about building for my aquaponic system. # Pulse frequency (Hz) = 7.5Q, Q is flow rate in L/min. I would think the flow meter just sends an output every full rotation. I feel like that is what I should capture with the follow code, but that is not the case. Dear @JSGora, did you find some solution for the flow water sensor? some code, some tip, some info? To make it work faster. Sensor:Hall effect. Actually you can use any other suitable power source. The same also applies to hose connections: If you want to connect water hoses with different dimensions, you can print these connectors yourself. It was obvious without a phone alert. Now we can proceed to assembling all parts together, according to the block diagram below. it is possible to communicate with modules by using so called AT commands. This on below isn't mine, but it's ok to illustrate. https://www.raspberrypi.org/downloads/raspbian/. If API key is correct, you should get a test notifications to your cell phone. We need the tap connector for the flow meter, which we can best print ourselves: If you are using a different Raspberry Pi Water Flow Sensor, then pay attention to the description. In my case it is COM5. And I stayed with Pushover. You can do it buy writing a code in Python or LUA, or just by using thing called "Blockly".I choosed to use Blockly.