Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 4 1 2 3 ... LastLast
Results 1 to 25 of 82

Thread: Well system monitoring... Use Teensy?

  1. #1
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,414

    Well system monitoring... Use Teensy?

    I live out in the country on some acreage. and this morning, I spent some time, having some maintenance done on our well systems. Each time I work on the system, it makes me feel like I should do something to monitor the system, before it bites me in the ...

    Rough system information:

    The pump house is somewhere between 50 and 100 yards from the house and the trees are growing like mad between the buildings. The Pump House/Wells are on a different Meter/Transformer than the House and unfortunately I did not run any wires between the pump house and the House.

    The Pump house has a reasonably large tank (2800 gallons) and a pressure pump/tank. The tank has a low float switch to not allow the pressure pump to run if the tank is out of water.

    The Tank also has another pressure switch toward the top, that turns on the wells to refill the tank. The water goes through some filters before actually making it to the tank. Currently the system will run both wells when the tank asks for water, and they will only shut off when the tank is full, which shuts off the power to the wells, or if the wells run dry, the well saver will shut the pump off...

    Some things, I think that would be good to monitor and potentially Alarm:

    1) Water Tank level: Not sure the easiest way to measure. The tank is probably 7" tall, so maybe some form of distance measure, like mentioned in: http://www.raspberrypi.org/forums/vi...c.php?p=376722 Would be good to measure, and if it gets too low, some form of alarm.

    2) How often and how long is the pressure pump running. The pump runs on 220, so don't want to hook it up directly to teensy. What is a good way to measure when voltage is there? (Same issue on some other things as well)

    3) When are the two pumps running? (Side note: Would like to see if there is a good way to run these pumps separately. That is ideally one pump runs and then maybe next time the other pump...)

    4) Why did the pumps start/stop - Tank float goes down far enough to start the pumps. Do they turn off because the float went back or did the well go dry and the pump saver came on...

    5) ... (maybe door switch, maybe water on floor...)

    Now assuming I can use a teensy to collect the data. Next question is what to do with it? Could record to SD card or the like.

    But if I only go to the pump house every few weeks, and there is a problem that is probably not the best solution. Wireless connection to house? XBee? Or maybe some other wireless? I don't want wifi that far out in the property? Have second unit as receiver, that maybe connects to my home network. Maybe have simple web page showing info/history? Maybe send me email when something does not look right?

    Does this make sense? Suggestions? I should continue to do some more searches to see if there is a ready made system that does most of this.

    Thanks
    Kurt

  2. #2
    Senior Member Constantin's Avatar
    Join Date
    Nov 2012
    Location
    In the yard with a 17' Dia. Ferris Wheel
    Posts
    1,408
    Quote Originally Posted by KurtE View Post
    1) Water Tank level: Not sure the easiest way to measure. The tank is probably 7" tall, so maybe some form of distance measure, like mentioned in: http://www.raspberrypi.org/forums/vi...c.php?p=376722 Would be good to measure, and if it gets too low, some form of alarm.

    2) How often and how long is the pressure pump running. The pump runs on 220, so don't want to hook it up directly to teensy. What is a good way to measure when voltage is there? (Same issue on some other things as well)

    3) When are the two pumps running? (Side note: Would like to see if there is a good way to run these pumps separately. That is ideally one pump runs and then maybe next time the other pump...)

    4) Why did the pumps start/stop - Tank float goes down far enough to start the pumps. Do they turn off because the float went back or did the well go dry and the pump saver came on...

    5) ... (maybe door switch, maybe water on floor...)

    Now assuming I can use a teensy to collect the data. Next question is what to do with it? Could record to SD card or the like.

    But if I only go to the pump house every few weeks, and there is a problem that is probably not the best solution. Wireless connection to house? XBee? Or maybe some other wireless? I don't want wifi that far out in the property? Have second unit as receiver, that maybe connects to my home network. Maybe have simple web page showing info/history? Maybe send me email when something does not look right?

    Does this make sense? Suggestions? I should continue to do some more searches to see if there is a ready made system that does most of this.

    Thanks
    Kurt
    I presume that's 7' not 7 inches. That would make for a pretty wide tank... Anyhow, a wireless connection is what this calls for, IMO, and there are some pretty cheap systems out there to make the link from one house to the next. I'd consider a ultrasonic approach to measuring the tank water level. Seems to be fairly accurate and allows a wider range differential than most other approaches. You could use the cap touch library / sensors built into the teensy 3 as well, I suppose to capture a limited number of fill heights.

    2) Use a current switch like the CR magnetics series. No contact, simple on/off output. Perfect for this sort of application and less than $20.

    3) I'd consider an opto-isolator - but a really simple one. A neon light or similar rated at full voltage (230?) in a tube with a photoresistor on the other end. Ideally, it would be a pre-confectioned light, i.e. with mounting hardware. KISS.

    4) Install a couple of pressure transducers to help determine how hard the pumps are working against the filters - i.e. detect if the filters are full.

    5) Floor water is a good thing to detect. Easy too.

    6) Wireless connection to house via 900/866/433MHz link. Cheap and easy. Then another Teensy with a TFT in house to display the data.

  3. #3
    Senior Member johnnyfp's Avatar
    Join Date
    Jan 2014
    Location
    New Zealand
    Posts
    260
    Have a look at this product for inspiration Water Level Sensor Kit

  4. #4
    Senior Member duff's Avatar
    Join Date
    Jan 2013
    Location
    Las Vegas
    Posts
    969
    If it were me I would get a 220 to 110 converter and use wifi (private local network). You can use directional antenna's to get a link, we do this all the time in forested watersheds. At one of my field sites that has power i use these, pretty cheap and come stock with mesh capabilities. I choose to reflash them with the openwrt firmware instead which is my favorite router firmware so far. Openwrt allows you setup any type network you want and since its linux you can setup vpn too. Also since you would have 110 you could easily power your teensy with pauls ethernet adapter and pull up a nice web page with all your data.

    At one of our river monitoring stations I use these sensors and if this is drinking water, non contact is probably best. They work good but cliam a 1mm resolution but I haven't seen it more like 5mm if using the serial output. Whats nice about these is you can you 3/4 inch pvc to mount them how you want and they will hold much better than the indoor ones. I've used both.

  5. #5
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,414
    Thanks,

    Yep 7 feet...

    The pump house has a 100 amp 220v sub-panel, so getting 110 is not a problem. As a couple of you have mentioned, could hookup private wifi.

    Wifi side comments: I am a little gun shy on this as earlier I tried wireless connection between two of our buildings, when the cat5 I wired between the two buildings was not working properly. That wire is about 400-450 feet long, which exceeded the 100m max. I should have used a fiber optic... My first attempts for wireless connection failed and I did not want to mount any external antenna on the house. So I now currently have them connected using the cat5 through a set of DSL type modems... Also I should look at OpenWRT again. Several years ago, my main network switch was using Openwrt and did not have any issues, until the units hardware failed. Now currently using Netgear Prosafe, which hangs at least once a week...

    Back on topic:
    for 2) 3) Need to look at the current switches and the like. As you mention, I would like to KISS

    4) The filters are actually more advanced as the water looks sort of milky from glacial silt, The water goes through a pre-filter which removed some metal and then goes through a forward osmosis system, which removes most everything else. Both of these automatically back flush.

    6) May have to try one of these other type links for the fun of it.

    duff - the sensor you show looks similar to the one (http://www.maxbotix.com/Ultrasonic_Sensors/MB7040.htm) mentioned in the link I mentioned in the first post. As for resolution I am not that concerned as the majority of the time, the tank should always stay up near the top. I mainly need a system that lets me know something is going wrong. For example if the tank keeps slowly getting lower and lower over days or weeks, I know that something is wrong. So a resolution of several inches would be more than sufficient.

    Than again something like Johnnyfp mentioned probably makes a lot of sense. Again KISS. I keep debating with myself if I should simply start off simple like that and see if that takes care of it as for the most part the other things are secondary as long as the tank stays full and the pressure system is working...

    Still thinking....

  6. #6
    Senior Member duff's Avatar
    Join Date
    Jan 2013
    Location
    Las Vegas
    Posts
    969
    the MB7040 is not designed for tanks, you will get lots of ringing and false measurements though i did give you the wrong one here is the Maxbotix guide. http://www.maxbotix.com/SelectionGui...-tank.htm#tank

  7. #7
    Senior Member
    Join Date
    Jan 2013
    Posts
    966
    Not sure these could cover a distance of 100 yards but they are cheap and I believe the RadioHead Library that make a lof of their functionality work on the Teesny 3.x is in the works or already working:

    Hope RFM69HCW

  8. #8
    Senior Member onehorse's Avatar
    Join Date
    Apr 2014
    Location
    Danville, California
    Posts
    921
    You could also use the 2.4 GHz nRF24L01+ radios. They are very cheap, robust, easy to use and there is an excellent library for them written by maniacbug. You could overcome the distance limitation by having one or more relay stations between the working point and you house; one master can communicate with up to six slaves. They are low power and could run off of a LiPo battery for weeks or months.
    I am in the process of designing an nRF24L01+ radio add-on shield for the Teensy 3.1...
    Last edited by onehorse; 07-30-2014 at 04:33 PM.

  9. #9
    Senior Member Constantin's Avatar
    Join Date
    Nov 2012
    Location
    In the yard with a 17' Dia. Ferris Wheel
    Posts
    1,408
    Quote Originally Posted by onehorse View Post
    You could also use the 2.4 GHz nRF24L01+ radios.
    Any radio along those lines will benefit from a good external antenna, which will obviate the need for a relay. Think Yagi, Dish, etc. with a high dbi and great directionality (which means you need to align them carefully!). You can blow through vegetation, etc. even with rain.
    Last edited by Constantin; 07-30-2014 at 09:00 PM.

  10. #10
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,414
    Thanks again!

    I may have to try out the 2.4GHZ radios as they sound interesting and cheap, or I might start off with XBees as I have several of them and one of my breakout boards already has XBee setup. As you mention, a good set of external antennas would probably do wonders!

    It will also be interesting to compare costs between using 3 of these versus 2 with external Ant. I should mention, that between the garage is between the well house and the house. So could put relay there. Sounds like I need to put in an order of stuff for some stuff to experiment with. Any suggestions on which nRF24L01+ radio?

    Sparkfun has a few including:
    https://www.sparkfun.com/products/705
    https://www.sparkfun.com/products/691

    Ebay: lots including:
    http://www.ebay.com/itm/NRF24L01-2-4...item2582d08d37
    http://www.ebay.com/itm/2PCS-Arduino...item35d7074840
    ...

    Thanks again

  11. #11
    Senior Member onehorse's Avatar
    Join Date
    Apr 2014
    Location
    Danville, California
    Posts
    921
    These have worked well for me. But just about any will do, they are a commodity. I would buy them on the basis of price alone since they all "should" work about the same. The only thing I don't like about the original Nordic design of the nRF24L01+ breakout is the non= 0.254 mm jumper spacing; you can't easily use them with a breadboard. Jumper wires work well though! But this is one reason I am designing a more convenient solution with a Teensy 3.1 add-on board.

  12. #12
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,414
    Thanks, I ordered some from Amazon to play with.

  13. #13
    Senior Member
    Join Date
    Jan 2013
    Posts
    966
    Well...as you ordered already THIS may not interest you anymore. Posted it anyway just in case....

  14. #14
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,414
    Not sure yet, maybe have to see about those as well. The nRF24L... were cheap enough to order to play with, but may play play with some others as well! Again looks like it is cheap enough to try out and see if I like them or not.

    Edit: Ordered a set of 3 adapters for these from OSHPark as well as 2 more Teensy's. I still have 2 unused Teensy's, to try out my adapter boards.

    Kurt
    Last edited by KurtE; 07-31-2014 at 03:02 AM.

  15. #15
    Senior Member pictographer's Avatar
    Join Date
    May 2013
    Location
    San Jose, CA
    Posts
    664
    Saw an interesting water level sensor over on Adafruit. I don't think this exact model would work because it's only 8 inches long, but the idea of a sealed sensor that measures water depth with a force sensitive resistor seems pretty robust and easy to work with. At Milone Technologies' website sizes up to 32 inches are available.

  16. #16
    Senior Member johnnyfp's Avatar
    Join Date
    Jan 2014
    Location
    New Zealand
    Posts
    260
    This project uses a drain pipe and capacitive sensing. http://njhurst.com/electronics/watersensor/

  17. #17
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,414
    Pretty interesting sensor. It would probably be fine, but I don't see anything in the PDF or the like that mentions that it is safe and/or approved to be installed in water systems... So far I think I will go with one of the maxbotix or the like, which has nothing in contact with the water.

    Still trying to figure out if there is an easy way to detect if AC 120v or 240v is present on a circuit without having to physically connect something to that circuit. I know I have my little pocket device that beeps and lights up, that I use to check if a circuit is active, so obviously doable. Also there may be a circuit I can tie into where the top float, controls giving power to the two wells. I think it is a lower voltage relay circuit as to not pass the full currents going to the two wells, which are on seperate 240v circuit breakers, through the float switch...

    Thanks again, I received the two different types of radios, which I will start playing with. Have not received my two new T3.1s yet from Oshpark as I ordered with the Radio adapter boards, which have not been sent out to fabrication...

    Kurt

  18. #18
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,414
    I have not done much toward the actual possible project of monitoring the well system, or likewise secondary project of maybe monitoring and controlling some stuff in Chicken Coop (like maybe relays to control opening the chicken door, controlling when lights turn on and off, both by time and/or temperature and/or external light level... Again more just playing around.

    But I have been playing around with the nRF24L01 wireless devices. So far I have only tried having two of them talk to each other when they are pretty close to each other (like 4'), Both connected to T3.1s one connected to main dev machine other connected to NUC running UBuntu.

    They both work using the modified RF24 library (http://forum.pjrc.com/threads/25922-...highlight=rf24) ...

    Was wondering about the radiohead (installed as part of Teensyduino 1.20rc2) library and noticed that the examples had examples for the nrf24 so tried them and they failed. The call RH_NRF24::init failed. I hooked up logic analyzer (plus added print statements) and figured out that the call:
    if (spiReadRegister(RH_NRF24_REG_1D_FEATURE) != (RH_NRF24_EN_DPL | RH_NRF24_EN_DYN_ACK))
    was failing. No valid data was being returned... Logic Analyzer showed a value of 0...

    Looking at traces from the LA using RF24 library I could see SPI was running at 4mhz and Radiohead was running under 1mzh (700+khz).
    So I changed the line in init:
    from:
    _spi.setFrequency(RHGenericSPI::Frequency1MHz);
    to:
    _spi.setFrequency(RHGenericSPI::Frequency4MHz);

    And then things improved. Note: I had to unpower and repower the Teensy/nrf24L01 before the changes fully took. My guess is not all nrf24_client/server sketches may have complete reconfigured what the GettingStarted2 sketch RF24 library had done. They both both ran without error but did not respond to each other. After I restarted both Teensys, they would start to talk. Note: the communications was not always reliable. It would go for many seconds saying it did not get a response and then it would start getting responses for awhile...

    Note: I started playing with radiohead library as I also just received 3 Hope RFM69 chips plus adapters from OSHPark (plus a couple T3.1), which I may also experiment with.

    What I am now wondering with the nRF24 radios, should I continue to use RF24 library and dig more into radiohead...

    Kurt

  19. #19
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,828
    nRF24 has many problems in these kind of apps.
    Re the RFM69 with Teensy and AVR, here's a video (of sorts) of work I've been doing with RadioHead + a bulk data transfer app with remote reprogramming of the MCU...

    With apology for the video's unpolished form...

    https://vimeo.com/103387066?utm_sour...Z8NzcwMQ%3D%3D

    Can use most any of the RadioHead drivers for various radios, mostly HopeRF's sub-GHz ones.
    Last edited by stevech; 08-14-2014 at 04:39 PM.

  20. #20
    Senior Member
    Join Date
    Dec 2013
    Location
    Brasilia, Brazil
    Posts
    164
    In terms of water level sensor, I can only recommend this article, which highlights the options and provides a simple and effective solution.

    The hardware consists of nothing more than a tube with two external wires that will not make any contact with the water, hence no corrosion issues and the title of the article: Measure Water Level Without Getting Wet.

    I believe that Teensy 3's Touch Sensor inputs could even obsolete the additional hardware mentioned in the article. It may be sufficient to just connect the sensor between a touch-enabled input and ground and to use the touchRead() function.

    A similar project, together with radio (RF24) and/or Ethernet is on my Todo-list for about a year now and always more important things get into the way. If you get this done, please let me know.

  21. #21
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,414

    Detecting Water system problems before...

    ... You run out of water!

    Every few years, I keep thinking of doing something about this. Usually after the water stops flowing out of the tap.

    Yesterday was one such day. The water pressure dropped off, so I walked up to our well house (which is maybe 50 yards from the house, tapped on the 2800 gallon water tank and it was empty. Luckily float valve in tank keeps pressure pump from running... Checked our two wells. One of them turned on for a few minutes and cycled off (no water, needs time to recharge), and the main one did not turn on at all... Luckily called well pump company who was out in a couple hours and found the well controller was dead, which they replaced (actually replaced both) and now we have water again

    Each time something like this happens, I think I should do a project to monitor the system.

    Maybe this time I will do something!

    Current thinking, maybe use a current sensor like: https://www.sparkfun.com/products/11005 where I connect one of these to one power leg of each pump (2 wells and pressure pump), where I can hopefully detect when each of these run and for how long. I am guessing measuring the current for both legs of the motor would not gain me a lot more useful data. This hookup I believe would have told me that my main pump was not working. Monitoring the main pressure pump may also give me heads up if it runs a lot when I don't think it should be.

    Tank Depth: As mentioned earlier (couple of years ago), there are a few options on detecting the water level. Another option would be to use something like the spark fun sensor https://www.sparkfun.com/products/13835. Could mount a few of these into a pipe I lower in from the top of the tank...

    But I am also wondering if I start off with just the current sensors, if at a minimum I can deduce that the tank is full or was full recently. That is currently when the water level drops in the tank a electrical float valve drops and it turns on power to both well. The wells will turn off in one of two ways. If the tank fills up, the float valve will raise up and turn off power to the pumps, so if I am recording the amps going to the pump(s), they should more or less drop straight off (Tank full). The other way they should turn off, is when the pump empties the well, the current usage drops off, which is detected by the Well controller (Pump saver), which then shuts off the pump and starts a timer (like 100 minutes), which gives the well time to recharge. With this I would assume I would see a current drop on the sensor, which I could then deduce Tank not full.

    Sounds at least like enough of a working theory to maybe try out.

    Next part is getting the data from the well house to my house, which is maybe 50 yards away with trees and the like. There are no electrical wires in common. I talked about this on the Trossen forums and one suggestion was to get a couple of the Adafruit Feathers with LoRa 900 mhz radio. They do look sort of interesting, But I do like using Teensy when it makes sense.

    Suggestions?

  22. #22
    Senior Member johnnyfp's Avatar
    Join Date
    Jan 2014
    Location
    New Zealand
    Posts
    260
    Hi,

    Heres another product that you could get inspiration from, that I've bought for my water tanks. https://am.gallagher.com/nz/products...systems/G98131.

    I took the remote pump controller to see what drives it, and basically it's a 915Mhz RF Mesh Module and a PIC (Over priced for what it was), So I would have gone down the Zigbee or Mesh network route and connected all the sensors and controller circuits into this mesh, if I did it myself.

    Looking at putting together an irrigation system based on that so that I can control valves and pumps.

  23. #23
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,414
    Thanks, Looks interesting, but so far I don't think the US stores sell them.

  24. #24
    Senior Member johnnyfp's Avatar
    Join Date
    Jan 2014
    Location
    New Zealand
    Posts
    260
    Oh no, I wouldn't sugguest you actually buy one. I paid nearly $800USD for the tank and remote pump system. Which is way too much, and if you have the time, I would take Ideas from it and build your own with a teensy and RF module for a tenth of the price.
    It is literally just that anyway, with some molded plastic, but being NZ and only 4million of us, we pay through the nose for things as there is no demand or competition.

  25. #25
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,828
    Quote Originally Posted by johnnyfp View Post
    Hi,

    Heres another product that you could get inspiration from, that I've bought for my water tanks. https://am.gallagher.com/nz/products...systems/G98131.

    I took the remote pump controller to see what drives it, and basically it's a 915Mhz RF Mesh Module and a PIC (Over priced for what it was), So I would have gone down the Zigbee or Mesh network route and connected all the sensors and controller circuits into this mesh, if I did it myself.

    Looking at putting together an irrigation system based on that so that I can control valves and pumps.
    Not Zigbee unless you must have a mesh/repeater. And for a potable water tank, you need a super reliable data link with a supervision mode and lost-link alarms. My brother struggled with this as the prez of a small private water company (20 subs). He had a leased pair of wires from ma Bell for years but they fell into disrepair and Ma Bell abandoned them.

    I'd recommend a pair of Digi International X2 (small one)
    http://www.digi.com/products/xbee-rf...portx2gateways
    In US: 902-928MHz band. In EU, 868MHz. Same products, different part number.
    And use a pair of yagi antennas. Keep the link to one hop, no mesh repeaters. No use of 2.4GHz.

    Out of the box it'll work, and you can make it supervised lost-link alarm. Lost power at pump, etc.
    If you are gung-ho, you can program these things in Python 2.4 to do whatever. I did so on a large project with 100 of them. Software Dev is freeware.

    The connectPort X2's were under $100 ea as I recall. Wireless to Ethernet bridging with Python code in the bridge, stock or add your own.
    Last edited by stevech; 06-08-2016 at 01:50 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •