QasimFSH
Posts: 6
Joined: Mon Apr 23, 2018 12:25 am

Mean of 60 temperature sensors

Wed Apr 25, 2018 6:04 am

Hi All,

I want to maintain the temperature of three levels of my building (company), and they are quite large in area. I have planned to mount temperature sensors with some distance at different spots on my ceilings, making a total of around 50-60 sensors on each level. I plan to gather the temperature from each sensor, and then use their mean as the temperature that floor/level. Is it possible, if yes, then how? Once I have the temperature, I will use it according to turn on/off the ac, but summing up the temp. and then getting the mean is the issue here.

Thank you.

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

Re: Mean of 60 temperature sensors

Wed Apr 25, 2018 6:29 am

QasimFSH wrote:
Wed Apr 25, 2018 6:04 am
but summing up the temp. and then getting the mean is the issue here.
That should be pretty trivial in most languages. Some might even have a function for it.

If your new to programming then Python might be the thing to look at.

PiGraham
Posts: 3400
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Mean of 60 temperature sensors

Wed Apr 25, 2018 7:29 am

QasimFSH wrote:
Wed Apr 25, 2018 6:04 am
Hi All,

I want to maintain the temperature of three levels of my building (company), and they are quite large in area. I have planned to mount temperature sensors with some distance at different spots on my ceilings, making a total of around 50-60 sensors on each level. I plan to gather the temperature from each sensor, and then use their mean as the temperature that floor/level. Is it possible, if yes, then how? Once I have the temperature, I will use it according to turn on/off the ac, but summing up the temp. and then getting the mean is the issue here.

Thank you.
Calculating the mean of some values is simple enough. Add them up and divide by the number of values.
What is the issue?

It might be better to use temp in different zones to control the HVAC locally in those zones. Otherwise you may find the top floor is too hot and the ground floor is too cold when the mean of all floors is ideal.

pfletch101
Posts: 186
Joined: Sat Feb 24, 2018 4:09 am

Re: Mean of 60 temperature sensors

Wed Apr 25, 2018 9:40 pm

I suspect that the OP's question may have more to do with gathering the data than with the trivial problem of calculating the mean of 3*60 values! I can't immediately think of a (wired or wireless) approach that would be likely to work without using a fair number of Pis as data collection hubs. Does anyone have any bright ideas on the data collection side?

asandford
Posts: 1999
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Mean of 60 temperature sensors

Wed Apr 25, 2018 10:33 pm

pfletch101 wrote:
Wed Apr 25, 2018 9:40 pm
I can't immediately think of a (wired or wireless) approach that would be likely to work without using a fair number of Pis as data collection hubs. Does anyone have any bright ideas on the data collection side?
Is there a limit (system, not the physical problems) on the number of one-wire-bus (Dallas) temp devices the Pi can have?

If some active devices were required, they could publish temps over something such as MQTT.

QasimFSH
Posts: 6
Joined: Mon Apr 23, 2018 12:25 am

Re: Mean of 60 temperature sensors

Wed Apr 25, 2018 11:02 pm

I suspect that the OP's question may have more to do with gathering the data than with the trivial problem of calculating the mean of 3*60 values! I can't immediately think of a (wired or wireless) approach that would be likely to work without using a fair number of Pis as data collection hubs. Does anyone have any bright ideas on the data collection side?
Exactly. How many sensors can be accommodated in one Pi? Or is there any multiplexing technique for this?

Thanks

User avatar
scruss
Posts: 1797
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Mean of 60 temperature sensors

Wed Apr 25, 2018 11:25 pm

If you wanted to get clever, you could deploy multiple ESP8266 sensor boards + DHT22 sensors over wifi. You can put an ESP8266 from batteries and make it deep-sleep between readings: batteries last for months! The readings can be collected over MQTT.

Basic idea: How to Run Your ESP8266 for Years on a Battery
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

User avatar
rpdom
Posts: 12804
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: Mean of 60 temperature sensors

Thu Apr 26, 2018 5:43 am

asandford wrote:
Wed Apr 25, 2018 10:33 pm
pfletch101 wrote:
Wed Apr 25, 2018 9:40 pm
I can't immediately think of a (wired or wireless) approach that would be likely to work without using a fair number of Pis as data collection hubs. Does anyone have any bright ideas on the data collection side?
Is there a limit (system, not the physical problems) on the number of one-wire-bus (Dallas) temp devices the Pi can have?
I think there was a soft limit of 10 devices at one point, but it was possible to change that.

However, the Pi now supports multiple one-wire buses in config.txt. Almost any GPIO can be used, so I suppose 60 devices on one Pi might be possible. I don't have 60 devices to hand to test it with.

PiGraham
Posts: 3400
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Mean of 60 temperature sensors

Thu Apr 26, 2018 6:38 am

QasimFSH wrote:
Wed Apr 25, 2018 11:02 pm

Exactly. How many sensors can be accommodated in one Pi? Or is there any multiplexing technique for this?
That depends on the interface and that depends on such things as distance between sensors and Pi, availability of power, accessibility to sensor locations etc. You haven't given us much to go on.
Some assumptions:
1. The total distance might be more than 100m if you are covering multiple floors in an industrial building.
2. There is mains power nearby all sensor locations

From 1. I assume cabling will be a major issue for cost, work to install, signal integrity

If you already have Wi-Fi coverage throughout the entire building that will be an attractive option. Use 8266 devices with temp sensors. Run DC power from mains PSUs to serve clusters of sensors.
MQTT is probably a good option for communicating readings.

If you have Ethernet coverage throughout the whole building (or can extend to achieve that) then that could be a good option. Possibly utilise power over Ethernet to power smart nodes (Pi or other).

If you don't have Wi-Fi coverage consider installing it. It you have easy access to cable runs look at long distance serial bus systems. RS485 might be a good option.

You might consider 1-wire with multiple nodes. You probably can't cover the building with a single branch.
https://www.maximintegrated.com/en/app- ... mvp/id/148

Maybe a Pi per floor or part floor serving a number of sensors.

Run a device on the network (another Pi) to iterate through temp readings to compute mean temperatures for zones and control HVAC.

Idahowalker
Posts: 329
Joined: Wed Jan 03, 2018 5:43 pm

Re: Mean of 60 temperature sensors

Thu Apr 26, 2018 12:30 pm

QasimFSH wrote:
Wed Apr 25, 2018 6:04 am
Hi All,

I want to maintain the temperature of three levels of my building (company), and they are quite large in area. I have planned to mount temperature sensors with some distance at different spots on my ceilings, making a total of around 50-60 sensors on each level. I plan to gather the temperature from each sensor, and then use their mean as the temperature that floor/level. Is it possible, if yes, then how? Once I have the temperature, I will use it according to turn on/off the ac, but summing up the temp. and then getting the mean is the issue here.

Thank you.
This is just me, I'd use an Arduino Mega for each floor and have them send data to a Raspberry Pi that would, using the information gained from the Arduino's, to make 'decisions.'
Being a programmer: She says go to the store get 1 bottle of milk, if they have eggs bring back 6. She gets mad cause I brought back 6 bottles of milk.

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

Re: Mean of 60 temperature sensors

Thu Apr 26, 2018 3:19 pm

I would say there are numerous ways to put 60 temperature sensors on each floor.

From a single microntroller controlling all 60 sensors, through a number of micros each controlling fewer sensors, to 60 micros each controlling a single sensor.

The connections from each micro could be wired or wireless, WiFi, Bluetooth, Zigbee etc. Sensors could be 1-wire, I2C or SPI, perhaps even analogue.

Without knowing what criteria to judge on, what requirements, physical or budget constraints there are, it's difficult to say what may be best or most appropriate.

Paul Hutch
Posts: 282
Joined: Fri Aug 25, 2017 2:58 pm
Location: Blackstone River Valley, MA, USA

Re: Mean of 60 temperature sensors

Thu Apr 26, 2018 8:40 pm

Given that this is for a companies building and based on the questions I assume you have no experience doing this, it may turn out to be a good deal cheaper in the long run to buy a pre-made system designed for this type of application. It at least wouldn't hurt to look at the cost of a commercial system e.g. http://monnit.com

HomeBoyLV
Posts: 2
Joined: Mon Feb 08, 2016 8:28 am

Re: Mean of 60 temperature sensors

Thu May 10, 2018 8:18 am

Not that I am any sort of electrical guru, what you are trying do do seems pretty trivial. I don't know your temp sensor, but the onea that came with the kits I've uswd are all analog. Look for "analog IC switches". My first search turned up chips with 16 pins to switch. An ernest search will probobly turn up more. You have enough GPIO pins to control 8, 8 lane switches ( pay attention to how the chips selection work). If you really need 180 points, things get a bit triccker. Not difficult though. You'll juat need switches to drill down to the control pins as well.

HomeBoy Out

jdb
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1784
Joined: Thu Jul 11, 2013 2:37 pm

Re: Mean of 60 temperature sensors

Thu May 10, 2018 12:45 pm

Read this:

https://www.maximintegrated.com/en/app- ... mvp/id/148

1-wire would be a recommended protocol because of the built-in unique serial number for each device. With many devices connected to a common bus or interface, you quickly run out of i2c addresses (as most sensors have maybe 3 address straps) or SPI chip selects.

It's also going to be the cheapest. Stepping up from 1-wire, you would have to go to RS485 or CANbus with the associated line drivers/protocol swizzlers.
Rockets are loud.
https://astro-pi.org

adeguntoro
Posts: 87
Joined: Wed Sep 14, 2016 11:11 am

Re: Mean of 60 temperature sensors

Thu May 10, 2018 5:09 pm

1-wire like DS18B20 should be good for this work. And dont forget to calibrate the sensor.

User avatar
scruss
Posts: 1797
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Mean of 60 temperature sensors

Sat May 12, 2018 1:47 pm

Don't forget the cost of cabling all of those one-wire sensors and the even larger cost of the labour to install 'em all. Wireless deployed remote nodes may end up orders of magnitude cheaper.

(For the same reasons, wind turbines use GPS modules on each turbine to keep their aviation lights in sync. Even when GPS units were expensive they were much cheaper than any amount of cabling.)
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Paul Hutch
Posts: 282
Joined: Fri Aug 25, 2017 2:58 pm
Location: Blackstone River Valley, MA, USA

Re: Mean of 60 temperature sensors

Tue May 15, 2018 1:36 pm

As scruss points out it's the cabling that is the catch to this situation. The OP says it's a large area commercial building with three stories and 50 to 60 sensors per story for a total of 150 to 180 sensors. This could be many miles of wires through a potentially very noisy environment and having to meet local standards for commercial/industrial wiring so it could takes tens of thousands of dollars just for the wiring. With the scale of this proposed project, commercially available sub-$50 wireless sensors from an established company are very likely to be price competitive and substantially less risky (technologically and financially) than a DIY solution.

PiGraham
Posts: 3400
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Mean of 60 temperature sensors

Tue May 15, 2018 6:33 pm

Paul Hutch wrote:
Tue May 15, 2018 1:36 pm
As scruss points out it's the cabling that is the catch to this situation. The OP says it's a large area commercial building with three stories and 50 to 60 sensors per story for a total of 150 to 180 sensors. This could be many miles of wires through a potentially very noisy environment and having to meet local standards for commercial/industrial wiring so it could takes tens of thousands of dollars just for the wiring. With the scale of this proposed project, commercially available sub-$50 wireless sensors from an established company are very likely to be price competitive and substantially less risky (technologically and financially) than a DIY solution.
Agreed

Return to “Advanced users”

Who is online

Users browsing this forum: Stan92 and 19 guests