Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: #247

Closed
swekley opened this issue Feb 2, 2019 · 21 comments
Closed

Request: #247

swekley opened this issue Feb 2, 2019 · 21 comments

Comments

@swekley
Copy link
Contributor

swekley commented Feb 2, 2019

Hi,

I've ordered a co2 sensor to be able to regulate the co2 in a greenhouse, and an infrared temperature sensor to measure the temperature inside a plant. TerrariumPI doesn't support these yet, but I think it would be great if you could support these sensors as both have multiple purposes. I've added links to python codes/libraries of these sensors below.

co2: MH-Z19

IR temp: GY-906 MLX90614ESF

@stuartabrown
Copy link

The IR temp sensor sounds interesting. As I understand heating for reptiles it's useful to distinguish between air temperature (which is less easy for a reptile to benefit from) and substrate temperature (which a reptile can more easily generate energy from). I measure the substrate temp via an IR gun (this sort of thing https://www.ebay.co.uk/p/EXO-Terra-Infrared-Digital-Pocket-Thermometer/2254714221?iid=252315602703&chn=ps). Could the GY-906 MLX90614ESF replicate those measurements?

theyosh added a commit that referenced this issue Feb 2, 2019
@theyosh
Copy link
Owner

theyosh commented Feb 2, 2019

Ah new sensors... @swekley there is only a new policy: New features will cost you some pictures ;) #210

The CO2 sensor is a bit strange, because you can't specify the address. But it is added to the branch issue/247. So if you do a git pull && git checkout issue/247 you should get the new code for the CO2 sensor. As I am unable to test it, I have you to ask for feedback when you add the sensor to your system.

In order to make sure it is all working, a rerun of the installer is needed. So after the git pull rerun the installer and reboot. When adding the sensor, just put any text in the address field. It does not matter

@theyosh
Copy link
Owner

theyosh commented Feb 2, 2019

The IR Temp sensor is a bit unhandy, as it does provide different temperature types... So I have to find a way to add multiple temperatures from the same sensor as multiple sensors in my software like some humidity sensors that also provide temperatures. Need some more thinking about it...

@swekley
Copy link
Contributor Author

swekley commented Feb 2, 2019

@stuartabrown The sensor does exactly the same as the IR gun. If the plant temperature differs more than ~2 degrees from the environment temperature it will slow down the photosynthesis of the plant. kinda the same with reptiles :)

@theyosh Wow I didn't expect it to be added this quick. I've ordered the sensors a week ago but they will be shipped somewhere this month because of chinese new year.. so I will test when I receive the sensors.

About the IR temp sensor, it does ambient temperature and object temperature. Maybe you could add object temperature as sensor type, or am I getting it wrong?

I wanted to post my setup already but then I decided to build it all in an aluminium box. I'll post some pictures on monday when I'm home

@stuartabrown
Copy link

@swekley, that IR sensor does look awesome. Do you know if there is a max distance from sensor to surface to be measured?

@theyosh
Copy link
Owner

theyosh commented Feb 4, 2019

@swekley I would just use the temperate other way around. Because ambient temperature can also be measured with multiple other temperature sensors in the same room.

Temperature at the object, that is the specialty of this sensor, and therefore, I think that should be the normal temperature. So I am thinking of creating an address that looks like: I2C_address,A where the A is for ambient.

@Natrixz
Copy link

Natrixz commented Feb 4, 2019

I wouldn’t mind testing this either.
Might actually suit my needs to measure the slab of stone where my temp sensor for the hotspot is on

theyosh added a commit that referenced this issue Feb 5, 2019
@theyosh
Copy link
Owner

theyosh commented Feb 5, 2019

Added support for MLX90614 sensor.

use the normal I2C address for object temperature. Add a second sensor with the same address but than add ',a' for ambient temperature in stead of object temperature.

Both values will be handled as just temperatures.

This is all not tested jet. Just ordered some MLX90614 sensors to test with..

@swekley
Copy link
Contributor Author

swekley commented Feb 16, 2019

I have received the MLX90614 and confirm that the module itself is working really good. I haven't tried it on the Pi I use for TerrariumPi yet but I will do that this weekend.

@theyosh
Copy link
Owner

theyosh commented Feb 16, 2019

Nice, thanks for the update

@swekley
Copy link
Contributor Author

swekley commented Feb 24, 2019

Somehow my relays stopped working, and so did 1wire since i changed the 1wire pin to bcm 20.
Anyway, when I add the mh-z19 to terrariumpi I get this

Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 862, in _handle return route.call(**args) File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 1740, in wrapper rv = callback(*a, **ka) File "/home/pi/TerrariumPI/terrariumWebserver.py", line 46, in webserver_headers return fn(*args, **kwargs) File "/home/pi/TerrariumPI/terrariumWebserver.py", line 88, in wrapper return func(*a, **ka) File "/home/pi/TerrariumPI/terrariumWebserver.py", line 282, in __update_api_call result['ok'] = self.__terrariumEngine.set_config(path,postdata,request.files) File "/home/pi/TerrariumPI/terrariumEngine.py", line 1159, in set_config update_ok = self.set_sensors_config(data) File "/home/pi/TerrariumPI/terrariumEngine.py", line 713, in set_sensors_config self.__load_sensors(data) File "/home/pi/TerrariumPI/terrariumEngine.py", line 186, in __load_sensors self.__unit_type) File "/home/pi/TerrariumPI/terrariumSensor.py", line 462, in __new__ raise terrariumSensorTypeException('Power switch of type \'{}\' is unknown. We cannot controll this sensor.'.format(hardware_type)) File "/home/pi/TerrariumPI/terrariumSensor.py", line 431, in __init__ super(terrariumPowerSwitchTypeException, self).__init__(message, *args) NameError: global name 'terrariumPowerSwitchTypeException' is not defined

same for the MLX90614

Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 862, in _handle return route.call(**args) File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 1740, in wrapper rv = callback(*a, **ka) File "/home/pi/TerrariumPI/terrariumWebserver.py", line 46, in webserver_headers return fn(*args, **kwargs) File "/home/pi/TerrariumPI/terrariumWebserver.py", line 88, in wrapper return func(*a, **ka) File "/home/pi/TerrariumPI/terrariumWebserver.py", line 282, in __update_api_call result['ok'] = self.__terrariumEngine.set_config(path,postdata,request.files) File "/home/pi/TerrariumPI/terrariumEngine.py", line 1159, in set_config update_ok = self.set_sensors_config(data) File "/home/pi/TerrariumPI/terrariumEngine.py", line 713, in set_sensors_config self.__load_sensors(data) File "/home/pi/TerrariumPI/terrariumEngine.py", line 186, in __load_sensors self.__unit_type) File "/home/pi/TerrariumPI/terrariumSensor.py", line 462, in __new__ raise terrariumSensorTypeException('Power switch of type \'{}\' is unknown. We cannot controll this sensor.'.format(hardware_type)) File "/home/pi/TerrariumPI/terrariumSensor.py", line 431, in __init__ super(terrariumPowerSwitchTypeException, self).__init__(message, *args) NameError: global name 'terrariumPowerSwitchTypeException' is not defined

theyosh added a commit that referenced this issue Feb 24, 2019
@theyosh
Copy link
Owner

theyosh commented Feb 24, 2019

Hmm, you are still on branch issue/247? Do a git pull. This will add a lot of new code and requires a rerun of the installer. After that reboot the Pi and try adding only the MH_Z19 sensor. Not the other one.

Lets just test one sensor at a time.

@swekley
Copy link
Contributor Author

swekley commented Feb 26, 2019

I've just ran a git pull and reinstalled, nothing changed. Both sensors still give the same error when i try to add them separately

@theyosh
Copy link
Owner

theyosh commented Mar 2, 2019

Strange... But are you sure that you are on the branch issue/247? Because I cannot reproduce those errors. I can just add them. I do get errors that the sensors are not working due to not having one.

But I am able to add them through the webinterface....

@swekley
Copy link
Contributor Author

swekley commented Mar 2, 2019

I tried git pull && git checkout issue/247 but it gave some error about issue/247 that it couldn't find it i think.. I'm not at the place where I have terrariumpi running so I'm now installing terrariumpi on a new pi 3b+ and might just use that pi in my environment next week if it'll work now. Do I still have to run git checkout issue/247 on a new installation?

@stuartabrown
Copy link

stuartabrown commented Mar 2, 2019

@swekley it depends (I think) on whether @theyosh has merged that issue branch into master. If not you will need to switch to that branch once installed 'git checkout issue/247'

Edit, yes I think you will need to, https://github.com/theyosh/TerrariumPI/tree/issue/247?files=1 (view on desktop) shows that the issue branch is ahead of master

@swekley
Copy link
Contributor Author

swekley commented Mar 3, 2019

After modifying terrariumSensor.py I confirm both sensors are working. the only thing that needs to be changed is that it'll run the co2 command in python 3 when using 3.

@theyosh
Copy link
Owner

theyosh commented Mar 4, 2019

Cool! I updated the code to fix that issue. As well, I saw that the sensor can also readout temperature. So that is added also. Could you test that also? Jut add the mh_z19 sensor a second time with temperature option.

@swekley
Copy link
Contributor Author

swekley commented Mar 5, 2019

Temperature works fine. I didn't even know it had that feature 😋
image

@theyosh
Copy link
Owner

theyosh commented Mar 5, 2019

Cool. I had the feeling it would work, So this code is also in the master branch. So now you can switch back to the master branch and update to the latest master.

git checkout master

git pull

restart

It should trigger again an installer run due to again new modules :) But then it should run with your new sensors... Thanks for testing!

@theyosh
Copy link
Owner

theyosh commented Mar 12, 2019

Ok, I close this now, as the code is in the master branch and working. Thanks again for testing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants