User avatar
Osprey72
Posts: 46
Joined: Sun Apr 24, 2016 7:07 pm
Location: Michigan

Pi3 as master, multiple Pi Zero W's reporting in... ... ...

Sun Jun 17, 2018 9:02 pm

Ok, here's my dilemma...I need to "wire up" a total of 698 DS18B20 temp sensors, 25 pH probes and boards, 4 CO2 sensors, 672 Hall sensors, 160 photo resistors... I know nothing of the Pi Zero or how it communicates with anything else. I have read that it has the same GPIO setup as the Pi3. Knowing that, is there any way that I can set any of the pins, say...the ones dedicated for clocking etc, to be 1 wire service? As you see, with so many thermo's...cost is quite high. Without the zero's, I'm almost at $4,000 right now. I haven't even figured in the cost to manufacture my custom flowmeters yet.

1) Can a single Pi3 handle all the Pi Zeros needed?
2) How many Pi Zeros are needed to handle all these sensors
2a) 1 temp + 1 pH probe together per tank
2b) 1 temp + 1 Hall sensor together
2c) 1 CO2 sensor + 1 photo resistor
2d) 156 photo resistor
2e) 1 ambient room temp

I know the python programming to get a GPIO to accept a w1-therm. I currently have an experimental greenhouse running and producing great results.

hippy
Posts: 6233
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Pi3 as master, multiple Pi Zero W's reporting in... ... ...

Mon Jun 18, 2018 11:17 am

DS18B20's are designed to be connected to a single wire in multi-drop mode so theoretically you would only need one GPIO pin regardless of the number of sensors.

In practice you will probably find there is a limit short of the almost 700 you have. But it might depend on how far they are from the Pi.

Hall sensors etc could possibly be handled by multiplexors, via I2C or SPI.

Having "Pi Nodes" is probably the best way forward; a Pi controlling a number of sensors each, with each connected to a "Master Pi".

droleary
Posts: 174
Joined: Fri Feb 09, 2018 3:45 am
Location: Minneapolis, MN USA
Contact: Website Skype

Re: Pi3 as master, multiple Pi Zero W's reporting in... ... ...

Mon Jun 18, 2018 2:23 pm

Osprey72 wrote:
Sun Jun 17, 2018 9:02 pm
I need to "wire up" a total of 698 DS18B20 temp sensors, 25 pH probes and boards, 4 CO2 sensors, 672 Hall sensors, 160 photo resistors.
To do what? With what topology/architecture? Under what physical constraints? With what computing demands?
1) Can a single Pi3 handle all the Pi Zeros needed?
Handle how? Do you expect to connect them all as USB devices? Serial communication via GPIO? What other demands are being placed on the central RPi?
2) How many Pi Zeros are needed to handle all these sensors
Maybe none. You don't state any real need to have any kind of computer involved at this stage. It may make more sense to use some kind of microcontroller with built in WiFi and MQTT support.

User avatar
Osprey72
Posts: 46
Joined: Sun Apr 24, 2016 7:07 pm
Location: Michigan

Re: Pi3 as master, multiple Pi Zero W's reporting in... ... ...

Tue Jun 19, 2018 2:29 am

To do what? With what topology/architecture? Under what physical constraints? With what computing demands?
Ok, trying not to sound or come off brass, but I'm building a greenhouse, as stated in my original post (see the experimental sentence at the end). Now, if I must, this unit will be around 4,800 sq ft, have around 19,000 linear ft of pipe. This is why I am thinking of choosing the Pi Zero Wireless so that I only have to run as little wiring as needed. As for computing demands, that is the question I am posing. If I need to dedicate a desktop into the system, I can do that. This is not my realm, just check the number of replies I post here. I will try again to state my need.

I am building a greenhouse. I need temp probes, carbon dioxide sensors, pH probes, flow meters, and light meters. I need them all over the greenhouse. Some can be grouped together in pairs, some will be stand alone. ALL will be reporting to a single "unit" eventually(???) which will then report to me to let me know the status of the greenhouse. I need to know if Pi Zero Wireless units can handle the task? How many I will need based upon the numbers I gave in my original post, can a single Raspberry Pi 3b handle that number of Pi Zero Wireless you think I need calling back information OR will I need multiple Pi 3b's that will in turn, report to a single Pi 3b that will, in turn, act as the sole message sender? I am trying to keep this as simple as possible.

As for topology/architecture...I cannot say that there will be a given setup. It will all depend on the crop I am growing and the needs of that crop. Racks will have to be moved around possibly. This is why I am trying to go wireless. I know I am constrained a bit with some power plugs. Those units can be managed from the ceiling or dedicated racks that don't move. It's a "semi-fluid environment"...things can change...best way to describe it.
It may make more sense to use some kind of microcontroller with built in WiFi and MQTT support.
Why? can't the Pi handle this? Should I scrap this idea and just build my own microcontroller instead? Why reinvent the wheel when I can just add rubber? I've read so much hype that the Pi and Arduino are so bad A** and now there is doubt being cast? Clarification please...

mattmiller
Posts: 2133
Joined: Thu Feb 05, 2015 11:25 pm

Re: Pi3 as master, multiple Pi Zero W's reporting in... ... ...

Tue Jun 19, 2018 7:33 am

Hi
You've come to a place mainly frequented by hobbyists (some of whom might small greenhouses with a few sensors in them) and asked for advice on a large scale (commercial?) project

So, probably not going to get the sort of answers that your looking for

Probably need to find a local person with experience in this field and get them to give your a quote on how much it would cost to look into your requirements

hippy
Posts: 6233
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Pi3 as master, multiple Pi Zero W's reporting in... ... ...

Tue Jun 19, 2018 12:50 pm

Osprey72 wrote:
Tue Jun 19, 2018 2:29 am
This is why I am thinking of choosing the Pi Zero Wireless so that I only have to run as little wiring as needed.
In my opinion the Pi Zero W is the wrong tool for the job.

You are going to have to run power to every node so you might as well use something more than two core cable to do the job.

And if you have multiple cores then you don't need wireless. You can create a serial multi-drop or ring network, can replace each Pi with a cheap microcontroller which acts as a sensor node. You would most likely end up with a star network of multi-drop or ring spurs.

Each node can control one or a set of sensors, or a set of sensors which cover a particular area.

That will also likely have a much reduced power requirement. Individual sections of the system can be powered individually. Power can be arbitrarily applied and removed without any concern of damage to the Pi's SD card, without having to worry about boot-up times or shut down procedures.
Last edited by hippy on Tue Jun 19, 2018 1:18 pm, edited 1 time in total.

hippy
Posts: 6233
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Pi3 as master, multiple Pi Zero W's reporting in... ... ...

Tue Jun 19, 2018 1:15 pm

Osprey72 wrote:
Tue Jun 19, 2018 2:29 am
How many I will need based upon the numbers I gave in my original post
4800 sq ft, 530 sq yd, 23 x 23 yd

Your 698 x DS18B20 works out about one per sq yd
Your 672 x Hall effect switches about the same

So about 25 nodes each covering a 5 x 5 yard area (25 sq yd), with 25 x DS18B20, 25 x Hall effect switches, 7 light sensors and 1 pH sensor per node.

That feels feasible to me though you might want to have more nodes each covering a smaller area with fewer sensors. It may greatly depend on how your greenhouse is laid out.

mfa298
Posts: 1387
Joined: Tue Apr 22, 2014 11:18 am

Re: Pi3 as master, multiple Pi Zero W's reporting in... ... ...

Tue Jun 19, 2018 2:00 pm

In terms of hardware needed it might help to plot out where you might want sensors on a floor plan and see what the distances between things might be. Then also have a read through datasheets and app notes for the types of sensors you want to use. I'm sure there's plenty of documentation about different one-wire type setups and the various pitfalls.

As for the performance of some central system collecting the data that's potentially going to depend on how often your collecting the data and what you're doing with it. If you wanted to collect data every second and store 2 years worth of data (very extreme example) that's going to need something a lot more powerful than collecting samples once an hour to just alert if something is outside the allowable range and you're not keeping the data after than check. (The Latter might work on a Pi3, the former might not even work on a relatively decent desktop system)
Osprey72 wrote:
Tue Jun 19, 2018 2:29 am
It may make more sense to use some kind of microcontroller with built in WiFi and MQTT support.
Why? can't the Pi handle this? Should I scrap this idea and just build my own microcontroller instead? Why reinvent the wheel when I can just add rubber? I've read so much hype that the Pi and Arduino are so bad A** and now there is doubt being cast? Clarification please...
Certainly a micro-controller based setup might make more sense. At a hobbiest level think of something like an Arduino with a bunch of sensors on it. With the right choice of micro-controller you could have something with a bunch of sensors connected and some sort of radio (wifi or some other ISM) that could potentially run for weeks (or even months) from a couple of AA batteries. Compared to something like a PiZero where you're probably having to run mains connections relatively close to each one. In a micro-controller based setup the length of time it might last may depend most on how often you want to collect and transmit the sensor data.

The point here is choosing the right tools for the job. The Pi is a fully fledged computer with full operating system. This makes it good at doing lots of diverse and clever things and appearing to do them at the same time, the expense is power consumption. A micro-controller is very good at doing a single task with deterministic timing and low power, the expense is flexibility (if you want it to do something different you have to flash it with a different program). In this context Aduino is a developer board and community built around a few specific micro-controllers (mostly a few chips from the Atmel ATMega family).

For a complete system you might want a selection of types of device (Micro-controllers with a bunch of sensors connected), distrubuted Pi's to act as data controllers for a set of sensor systems. Central system to store and process the data. The microcontroller -> pi connection might use some ISM radio or cabled serial link. Then wifi or ethernet from the set of Pi's to the central system. (Tying to have 700 Pi's on wifi is likely to lead to a lot of headaches).

droleary
Posts: 174
Joined: Fri Feb 09, 2018 3:45 am
Location: Minneapolis, MN USA
Contact: Website Skype

Re: Pi3 as master, multiple Pi Zero W's reporting in... ... ...

Tue Jun 19, 2018 2:52 pm

Osprey72 wrote:
Tue Jun 19, 2018 2:29 am
Ok, trying not to sound or come off brass, but I'm building a greenhouse, as stated in my original post (see the experimental sentence at the end).
As written, that came off as more of an aside than central to your listed requirements.
Now, if I must,
You must. Nobody here is a mind reader. You have a complex project ahead of you, and if you expect to get any useful help you need to adopt a more empathetic attitude.
This is why I am thinking of choosing the Pi Zero Wireless so that I only have to run as little wiring as needed.
As hippy noted, you're almost certainly going to have to run wiring for power. If you have other thoughts on the matter, you need to clue us in. We have no idea what already exists in your greenhouse (wired or wireless), or what the layout might be.
As for computing demands, that is the question I am posing.
You haven't posed any such questions. You have sensors, yes. You want to gather the readings (with some yet-unknown requirements), sure. But you've said nothing about what you're actually going to do with that data.
As for topology/architecture...I cannot say that there will be a given setup. It will all depend on the crop I am growing and the needs of that crop. Racks will have to be moved around possibly. This is why I am trying to go wireless. I know I am constrained a bit with some power plugs. Those units can be managed from the ceiling or dedicated racks that don't move. It's a "semi-fluid environment"...things can change...best way to describe it.
Then you need to understand that that fluidity also makes it difficult to give you any one simple answer that actually solves all your problems. It's quite possible you can wire dozens of sensors into one 0W, but also entirely possible that it only makes sense to wire just one sensor into another one. If this is something that's going to change a lot, it might make sense to go with a 0WH, but that comes with a corresponding price increase and a bit of additional complexity when it comes to the hardware/software configuration.
It may make more sense to use some kind of microcontroller with built in WiFi and MQTT support.
Why? can't the Pi handle this? Should I scrap this idea and just build my own microcontroller instead? Why reinvent the wheel when I can just add rubber? I've read so much hype that the Pi and Arduino are so bad A** and now there is doubt being cast? Clarification please...
The concept of overkill is what you're missing. The 0W is a tiny computer, but you have yet to describe anything that requires any significant computing needs that benefit from being local to the sensors. A microcontroller is more likely to be able to collect data and/or transmit it to a server for processing, all while sipping so little power that it could be run off a battery. While there could be some benefit from using the RPi platform for everything, nothing you're describing leads me to believe that such an architecture benefits you in any way. So, yes, "scrap" the notion that you don't want any microcontrollers, because a lot of what you have described seems to be screaming for something less complex than even a 0W.

ghellquist
Posts: 68
Joined: Thu Aug 02, 2012 8:47 am
Location: Stockholm Sweden

Re: Pi3 as master, multiple Pi Zero W's reporting in... ... ...

Tue Jun 19, 2018 4:28 pm

We are absolutely trying to help you. But to us the requirements seems a bit hazy. They might be read as, when misunderstood: I have a greenhouse. I want to fill it with sensors and Raspberry Pi-s.

I guess what you are trying to actually achieve is something slightly different. My guess is something like this (You actually need to decide on the purpose, not necessarily share it with us, but a hint might help):

1) I want to make a greenhouse that creates a profit
2) In order to create a profit I want to control the environment of the plants.
3) In order to control the environment I need to be able to measure it and to process the measurement into actions, both manual and automatic.
4) Reliability is very important. Too high temperature for even a short time can destroy a full crop. When devices break down, I need to have a reliable supplier near me that can service the system.
... and so on

Once you have the requirements in place, you may search for different solutions. The point is to compare different solutions given the actual goals. Most amateurs using Raspberry Pi-s have two main goals: having fun and learning new things (which sort of falls under the heading of having fun).

Your alternative solutions may include a lot of different technologies, where Raspberry Pi is one, or beting totally manual. One solution might be to go to a well-known supplier experienced in this kind of setup, another solution might be hire people to work in the greenhouse controlling the environment, and so on. Often a more complicated solution, say hundreds of sensors instead of a few, have an incremental gain. It is a good idea than to see if this incremental gain is larger than the incremental cost.

In addition, I suggest as always in projects to do a risk assessment: what can happen, how will it affect the goals and how likely is it to happen. In this case I would actually do two different assessments: one as to the situation when the system is in place, the other on the project as such. Projects tend to run over time, over budget, over resources and deliver less than expected.

The guess right now from me, is that, just maybe, you like the Raspberry Pi and would like to use it. But it might not be the best solution in order to reach your goals. We would like to point you in the direction where you reach your goals, not necessarily forcing you to use a Raspberry Pi only because we love to have fun with it.

/Gunnar

hippy
Posts: 6233
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Pi3 as master, multiple Pi Zero W's reporting in... ... ...

Tue Jun 19, 2018 4:35 pm

droleary wrote:
Tue Jun 19, 2018 2:52 pm
So, yes, "scrap" the notion that you don't want any microcontrollers, because a lot of what you have described seems to be screaming for something less complex than even a 0W.
Also, with talk of light sensors, pH sensors and flow meters, that to me suggests some analogue signalling may be involved and none of the Pi include any in-built analogue input capability.

To use a Pi with analogue inputs would require additional interfacing to be added. Most microcontrollers will include that on-chip.

How much analogue signalling you have might dictate the maximum capabilities of a node. As will whether you are prepared to create circuit boards specific for your requirements or want to use off the shelf modules and assemblies.

jbudd
Posts: 1026
Joined: Mon Dec 16, 2013 10:23 am

Re: Pi3 as master, multiple Pi Zero W's reporting in... ... ...

Tue Jun 19, 2018 8:33 pm

Your plan to have a number of gadgets, each of which gathers data from a number of sensors and reports back to a central Raspberry Pi to process the data sounds eminently practical to me.
It should be possible to make it fault tolerant, self monitoring, extensible...
The question is whether a Pi based setup can handle many hundreds of sensors. I suspect you will have to do some experiments to find out.

I have found it better to make sensor clusters with an ESP8266 microcontroller rather than a Raspberry Pi Zero or an Arduino Cheaper too.
Unlike an Arduino, the ESP8266 has Wifi on the board.
Unlike a Pi, the ESP8266 has deep sleep mode, which makes battery power practical.
How many sensors can an ESP handle? I don't know, sorry.
Like the Pi it only has one analogue input but you can add a 10 cent multiplexor for 8 inputs.

How many ESPs can a Pi get data from? Again, I don't know. But if the ESP's each only wake up once a minute say, read some data and send it to the Pi, there may not be too many concurrent connections.

It's an interesting project!

Return to “Advanced users”