6/22/2023 0 Comments Dew point calc![]() Today = str ( today ) return ( today ) def time_now (): Humidity = int ( humidity ) return ( humidity ) def date_now (): Pressure = str ( pressure ) return ( pressure ) def get_humidity (): Temperature = float ( temperature ) return ( temperature ) def get_pressure (): Temperature = round (( temperature ), 2 ) Try : from smbus2 import SMBus except ImportError : from smbus import SMBus # sets up the variables for the sensorīme280 = BME280 ( i2c_dev = bus ) # define functions to use def get_temp (): # imports the modules for the sensor from bme280 import BME280 #!/usr/bin/env python #Dew point calculator for allsky climate and dew control # initial set up of imports import math I know I'm doing something wrong, but I don't know what. The humidity was 63 % The dew point is Ĭan anyone cast their eye over this and tell me what I might be doing wrong please?įunction is not using the returned values of T and H as numbers, or it's spitting out something that's not a number. It's not a number that it's returning, it's the whole function. So, having read a bit more, I learnt I could use print (type()) to see what's going on. Trying to print this value in the shell does not work, it prints a memory address. This should use the returned values for T and H to calculate and give me an answer, in this case: The function defined to a calculate the dew point uses the basic forumla I have cobbled together a few bits of code, to try and calculate the dew point from the T and H values, in order for the program to decide whether to switch the internal heating or cooling on (yes cooling!) or to switch the external dew heater on. I have managed to connect a BME280 sensor and can output T, H and P (pressure) automatically to a csv file - great! I've even set it to run as a service. This is for inside and outside the camera enclosure, for various reasons. I've turned to python for my rpi allsky, and want to conrtol relays based on temperature, humidity and probably more importantly, dew point. I am fairly good at hacking up bits of code, but not fluent in writing from scratch or even understanding the rules, but I have a go!Īnyway, I appreciate that this is not the best place to ask, but I don't want to sign up for another forum to be bombarded with "you're doing this wrong." and "learn the basics." ![]()
0 Comments
Leave a Reply. |