Large Scale Water Temperature Monitoring

Hi all, I have a need to monitor the water temperature in a large number of water tanks in the greenhouse. Right now I have 24 that need monitoring. We will be building another greenhouse the first of next year that will have over 100 tanks that need to be monitored. I have the sonoff t-h16 setup to record and manage temperature for the fans and shutters and can use them for the tubs but that is totally the wrong application. I would have ton of sonoff’s all over the place. Looking for something smaller, easier and hopefully less expensive.

Thoughts?

I’d look at something a little more DIY, but this sounds like it is a commercial operation (aquaponics?) so that wouldn’t necessarily be an option for you. If it is an option I’d get some NodeMCU’s with the ESP Easy or Tasmota firmware and load them up with as many temp sensors as will fit on the available GPIOs. Tasmota has a lot to recommend it for this as they have a centralized administration server now where you can configure and upgrade them all from one place.

I think the NodeMCU supports 16 or 17 GPIOs so you can have up to 17 per device. I’d scale that back to 15 myself so you would have 15 tanks per NodeMCU with a couple of spare pins for expansion should you need it.

You will probably want to go through the process of designing a circuit board to wire everything up to at some point. I’ve seen tutorials and it is actually pretty easy and astonishingly affordable. This will give you a cleaner looking device and platform where it is easier to swap out parts as needed. Eagle seems to be the software of choice for designing the PCB and LadyAda has a good list of vendors you can send your design off to and get back the completed board. Its old but should be relatively current.

Given you have so many tanks, it might be worth while looking at an RPi 0W which has over 20 GPIO pins out of the box. You can monitor the same number of tanks with half as many units. Depending on where you are and your timelines for shipping this could be more cost effective. Personally I’d prefer a microcontroller for an application like this. There is less to monitor and less that can go wrong. And do not discount the Tasmota centralized admin server. Though the RPi 3B now supports SD card less PXE booting from a central server so that also could be an attractive approach.

It adds more moving parts, but they also make expanders for both the RPi and the NodeMCU which can give you some more GPIOs on the same board. You can get over 20 on the NodeMCU for $2 per unit. Around $10 per RPi can get you around 40 GPIO per RPi 3B. You would have to decide if the addition of this extra part is worth the extra effort to get it working and having an extra potential point of failure.

Temperature sensors are one of the easiest things to integrate with microcontrollers and RPis so there will be tons of resources to get you started.

That’s how I would do it at least. Good luck!

Thats some great feedback Rich, thanks! Not aquaponics just aeroponics. Not doing the fish thing in with the plants.

I had a brain cramp on this too. I use an opensprinklerpi at home for my irrigation and another at the greenhouse to turn valves on and off. I thought, what if you just ran the sensor wires from the opensprinkerpi to the tubs instead of valve wires and reprogrammed the pi to be used to monitor temp? Their setup is perfect for connecting a bunch of things together. I have sent them a request to see if they would be able to do the coding on that. If not, I might find someone else that could and just buy the opensprinklerpi.

thoughts on that?

opensprinklerpi is basically an RPi with a HAT that expands the GPIO pins (and of course the software). From a hardware perspective it is pretty much the same as an RPi with a GPIO expansion HAT. From a hardware perspective opensprinklerpi would only support 8 sensors, assuming you could get the vendor to rewrite their software to flip the pins from out to in. You would be much better off using something more generic that could get you theoretically up to 40 sensors on a single RPi and then get someone to code the sensors code.

$75 per 8 tanks does not seem cost effective to me when you can spend <$20 for upwards of 40 tanks. For the cost of one opensprinklerpi you can support sensors for all of your tanks.

Have you looked at one wire sensors? eBay has a 5 pack for $8 look around may find less expensive. These are water proof. I have used these to measure air temperature in the past they work great. It would depend on how often you have to take a measurements to how many controllers you need. There are several arduino projects and I know pi supports it also. Google around, I have attached some links to reference the waterproof version I am speaking of.

https://m.ebay.com/itm/5X-DS1820-Waterproof-DS18b20-Digital-Thermal-probe-temperature-sensor-Arduino/361952633484?hash=item54460ee28c%3Ag%3Agt8AAOSw7U5Y-3L9&_nkw=ds+1820+waterproof&_from=R40&rt=nc&_trksid=p2380057.m4084.l1313.TR1.TRC0.A0.H0.Xds+1820.TRS0

I had also a project with an ESP8266 and ten 1-wire temperature sensors (the ones @Thedannymullen recommended). The software for ESP8266 was ESP-Easy.

I think ESP and 1-wire sensors will be a good solution to measure many temperatures…

Andreas

1 Like

Hey Rick, that is a great point! So that took me on another hunt.

If I were to get something like this

Pi Screw Terminal Block Breakout Module
to just put on the pi that is running the greenhouse openhab could i not just hook my wires into that pi and use the one wire binding to connect to the sensors? That would allow me create things/items and integrate with rules if needed and of course graphing.

Thoughts on that?

1 Like

Hey Danny, thanks! Yes, I bought a pack and use one of them to control temp on my hottub. I am adding another to it for redundancy. That is what I thought i would use for the tubs as well. It’s just how to hook a bunch of them up and not use a sonoff (which is what I am using with the hottub).

1 Like

Hi Andreas, I did some reading on that last night. Was hoping to avoid working through another operating system. Yeah, i know, its not that hard but just one more thing to learn/manage. I do have a couple of wemos di’s that will run esp-easy and they have hat’s that i could get so that just may very well end up my option.

Thanks!

I’m not as familiar with the one wire stuff but as far as I know that should work pretty well. I like that HAT. I might pick one up for a couple of my Pi based sensors. This looks like the best option I’ve seen. It won’t give you extra GPIO pins but it will give you nice and secure connections.

I found this:

This should give you a feel for what you are in for if you go down this route.

All the sensors can share the same power and ground (you will probably want to split them up between the available power and ground pins on the Pi). You can probably use those through hole points on the bottom the hat to solder these connections instead of using a wiring nut for a little bit more secure of a connection. But I’m a rank amateur at this stuff. You probably shouldn’t take hardware wiring/soldering advice from me. :slight_smile:

You could then use OH on each RPi to monitor and report all the sensor readings but that is probably not the way I would go. I would want a central server to get and consolidate all the sensor readings, not a separate server for each separate set of 10-20 tanks. So I would copy someone’s DS18B20 Python code and have it report the sensor readings to one central OH using MQTT. That video has a good example of what this code would look like.

@I would suggest some type of esp8266 as @imhofa suggested. If esp easy supports one wire natively then less software to write.

On the one wire hardware they make hubs and other things to build reasonably sized networks with no issues. You will probably need to build out a little prototype board, but I am fairly certain it should be easy.

In the past I was going to use cat 5 to connect everything.

Because of the scale that @boilermanc is facing there are some significant concerns to take into consideration.

One of them is how the connections are made in a secure (meaning they won’t disconnect) manner. The HAT he linked to provides a pretty solid approach to wiring the sensors up to the device. You can’t solder the sensors to the board because given over 100 sensors, at least one of them is going to go bad at some point and he will need a way to swap them out without resorting to a soldering iron.

Do you know if NodeMCU or any of the other ESP8266’s have something similar to the HAT he posted? Something that exposes the GPIO as screw terminals? That would be pretty cool. The usual jumper cables will not suffice IMHO. I’ve only a handful of sensors and over the years I’ve found the female jumpers get lose and lose their connection to the pin. Given the 100+ sensors that two is almost a certainty to occur at some point.

For something at this scale, access to how all the sensors connect, the ability to replace sensors when they go bad, and the ability to more easily see what wire is connected to what pin is far more important than the amount of time that might be spent on some software.

The cases these will get put into is also going to be important. You might need to custom design something and have it 3D printed if you can’t find a case that will support the device and the hat with all the wires leading to it. Given this is a wetish environment I think a case is going to be pretty important. You might get away with a central cabinet that will fit the N+ RPis or NodeMCUs or whatever in which case something off the shelf might be just fine.

You also want to pay attention to management of the devices. If you go with an RPi you are looking at up to 7 RPis to support your 125 tanks (probably a lot less as you will want to wire these sensors up in serial so you have 5-10 sensors per GPIO pin). That isn’t too bad to manage individually but there are plenty of tools available to help you manage, monitor, and administer them centrally. With a NodeMCU I think you are looking at needing 9 devices (again, probably less if you wire the sensors in series). That is starting to get a little much to manage individually. This gives Tasmota a leg up on Esp Easy in my book because there is a central Tasmota administration service that lets you monitor, configure, and manage all the ESPs (and your Sonoffs for that matter) from a single server.

If only Tasmota supported the analog GPIO pin without requiring a recompile I’d jump over to that instead of the ESP Easy I’m using now.

I mentioned it above, but will mention it here as well. You don’t really need one GPIO per sensor with 1-Wire sensors. You can wire them up in series on a single bus. However, you will start to run into some of those problems where you have to understand electronics more than I do for sure as you get more sensors on the same bus and/or the bus wire gets longer and longer.

Commercial solutions for this kind of task would use Modbus (many sensors may be daisy-chain connected over a serial bus)

There is A screw shield i have used with the arduin o form factor. There is also a d1 mini screw shield.

I had trouble finding the links on my phone.

I would like to understand more on the mechanical setup of @boilermanc tanks before I made further proposals on how to wire and how many controllers. For example if all the tanks were in a space the size of a small closet i think one wiring solution would be needed. If the tanks are spread across a large warehouse another solution may be more feasible.

Once the mechanical setup of the tanks is know then I believe that’s the time to start looking into number of sensors per gpio and number of controllers.

With one wire the way I was going to setup my sensors was with cat5 and rj45 p lugs. Basically you layout a small circuit board with 2 rj45 plugs and 2 screw terminals. You run your patch cord near all tanks then cut them and crimp in two rj45 plugs and install your circuit boards. There was a guy that sold a board like this many years ago, but he does not sell them anymore. Have a look schematics here. Examp!e of what I was speaking of.

https://web.archive.org/web/20101104014913/http://www.hobby-boards.com:80/catalog/product_info.php?cPath=25_27&products_id=55

1 Like

Many thanks for helping me work through this. I really enjoy that I can create these type of solutions through the types of tools you have been discussing. There’s really two types of greenhouse growers, those that have NO technology other than an analog timer and a Granger Thermostat control for their fans and shutters and then the other group who buy the super expensive commercial equipment that is not flexible nor extensible. I have shown my solution to several people in the industry and they are literally speechless. And there is so much more I really want to do!

In any case, whatever the solution ends up being it will be in a waterproof metal cabinet that I have my rpi and Sonoff’s in now. I have a plexi glass window on it and some day i want to put some pll inside it!

As for the setup. The current greenhouse if fairly contained. The longest run will be 30 feet ish. All the other towers are inside that. We will be setting up some more towers tomorrow and we have a photoshoot complete with a drone fly through on Thursday. After I get the edited content i’ll share it. It’s pretty cool.

The new greenhouse will be very different. It will be a 100 foot long and 28 foot wide greenhouse. I guess I have a choice of running a long wire or setting up stations along the greenhouse to run the sections. I am thinking the later.

The sensor will just run through the tank side where the pump wire runs and lay in the tank.

I would agree with you @rlkoshak I just want screw that I can connect wires.

I guess I don’t really understand why I dont put that hat on the current pi, connect all the wires, set them each up as a thing in openhab and go from there. Does that overwhelm the pi? Seems that all it is doing is collecting data.

That said, i know enough about architecture to know that offloading tasks to other devices can help as well. Just seems like your not really pressing the pi. Its not doing much else except checking the temp and running a couple of rules. But I can certainly try the esp path as well.

2 Likes

Yes with a house that big multiple stations would probably creat a little less clutter. I think the pi hat would work great as long as you can have it near a group of sensors.

On whether too many sensors would overwhelm the pi. You could try to make assumptions but you could also just try it possibly. Purchase one setup and try on the bench and see if everything functions correct. If it runs for a few days you are probably ok.

Like anything, we would all take different approaches no approach is necessarily incorrect, it is based on where our strengths are. So I say do what your comfortable with, that you know works.

I figured your OH server was in your house and I don’t think you can run 100+ senses off of one RPi without running into some of the limits with 1-wire. As work most things TANSTAAFL. With long bus runs and too many sensors on the one wire performance and electrical issues grow.

So I’m recommending multiple RPis or ESP8266s or Arduinos which all report the reasons to your one OH server for aggregation, charting, etc.

It’s the number of sensors you need (100+) combined with potentially needing to reduce the length of the bus wires. It won’t overload the RPi but it might be beyond what 1-wire can handle.

I agree with Danny. This is probably something you will want to prototype to see where the limits of the technologies actually are and design and those limitations.

If you wanted to DIY it, Wemos device with a battery (£7 such as this) for each tank / group of tanks.
You can put it to sleep for an 30-60 minutes at a time, wake up, check->send-sleep. A battery would run for years.

Example - https://openhomeautomation.net/esp8266-battery

A neater package might be custom firmware on a sonoff.

Thanks Danny, I think that I will do just that. I usually test things on my home openhab. It’s not so mission critical. I think I will get that hat and just test it with one sensor. Then add a second and see what happens. The current greenhouse will not have a ton of towers in it for now. I have them in two groups of 12 for now so I could run a pi for each set i guess. So maybe just start with one set or 12 and go from there.

Once I we get the big house up and going then yes, would split it to many devices (whatever those end up being) and run it in zones.

1 Like

All agreed. I would feel very skeptical of being successful with 100 on a pi. Will break things out when we get to the big house. For now I think I will try this with the current pi after I test some things at home. I’ll update this thread as i go along. I don’t always move to fast on this stuff so may take a while. Have tooooo many projects going!

1 Like