BrandinGrindstaff / GMpi

A growth chamber sensing system using the Raspberry Pi as a platform
27 stars 6 forks source link

GMpi config.txt #2

Open LauRodriguez opened 4 years ago

LauRodriguez commented 4 years ago

Hello,

I am using the GMpi package, the config.txt file has been generated but I am stuck in the threshold configuration since I am not sure which conversion has to be done to set the values in decimal since for temperature, humidity and light, the units of measurement are different.

I appreciate any guidance that can be provided.

mmabry commented 4 years ago

Hello,

Would it be possible for you to add your config.txt file here so that we can better understand your question?

We are unsure what you mean by converting to set values in decimal.

LauRodriguez commented 4 years ago

Hello Makenzie,

Thank you for your reply.

My confusion is with these values:

minimum_light_threshold=-5.920000076293945

maximum_light_threshold=18.15999984741211

minimum_temp_threshold=23.600000381469727

maximum_temp_threshold=30.399999618530273

minimum_humidity_threshold=55.20000076293945

maximum_humidity_threshold=66.79999923706055

By checking I can see it does 10 readings:

for i in range(10):

tsl = tsl2591.Tsl2591() # initialize light sensor

full, ir = tsl.get_full_luminosity() # read raw values (full spectrum and IR)

lux = tsl.calculate_lux(full, ir) # convert raw values to lux

humidity, temperature = Adafruit_DHT.read_retry(int(which_dht), int(which_data_pin))

light[i] = lux

temp[i] = temperature

humid[i] = humidity

for each array it gets the min/max

minLight = min(light)

maxLight = max(light)

minTemp = min(temp)

maxTemp = max(temp)

minHumid = min(humid)

maxHumid = max(humid)

there is some hard coded buffers in the script

The buffer variable adds a buffer to max and min values to prevent

unwarranted alerts

Please feel free to adjust these values.

light_buffer = 10

temp_buffer = 3

humidity_buffer = 5

Then it generates the min/max thresholds by taking min(sensor)-threshold / max(sensor) + threshold

It looks like the values it took when generating the config is:

light : 5.9 - 8.1

temp = 26.6 - 27.4 celsius

humidity - 60.2 - 61.8 %

I just want to make sure that I am understanding the code correctly because if I set the wrong values I will never get the slack notifications.

Regards,

Lauren

On Fri, Aug 7, 2020 at 10:58 AM Makenzie Mabry notifications@github.com wrote:

Hello,

Would it be possible for you to add your config.txt file here so that we can better understand your question?

We are unsure what you mean by converting to set values in decimal.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BrandinGrindstaff/GMpi/issues/2#issuecomment-670613223, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSGR6JABCHHBAYQ5O2MNK3R7QXBZANCNFSM4PWAR7TA .

BrandinGrindstaff commented 4 years ago

Hi Lauren,

First of all, thank you for your interest in the GMPI. If I understand your question correctly, you are asking if “min(sensor)-threshold / max(sensor) + threshold” is how the buffer works and is applied to the min/max values for the alert thresholds? If so, yes, I believe that is correct. You could test this theory by inserting a print statement so that you could see all values stored in the array (noting min and max), and then by changing buffer values to see if they give you a predictable output based on the above mentioned formula. I would also recommend intentionally setting thresholds out of range of what the sensors are reading in your testing environment to intentionally throw error messages to your slack to test that this feature is working correctly, and then return thresholds to previously calculated values, or rerun program to generate new threshold values. Best of luck in your endeavors!

Regards,

Brandin Grindstaff

On Fri, Aug 7, 2020 at 6:40 PM LauRodriguez notifications@github.com wrote:

Hello Makenzie,

Thank you for your reply.

My confusion is with these values:

minimum_light_threshold=-5.920000076293945

maximum_light_threshold=18.15999984741211

minimum_temp_threshold=23.600000381469727

maximum_temp_threshold=30.399999618530273

minimum_humidity_threshold=55.20000076293945

maximum_humidity_threshold=66.79999923706055

By checking I can see it does 10 readings:

for i in range(10):

tsl = tsl2591.Tsl2591() # initialize light sensor

full, ir = tsl.get_full_luminosity() # read raw values (full spectrum and IR)

lux = tsl.calculate_lux(full, ir) # convert raw values to lux

humidity, temperature = Adafruit_DHT.read_retry(int(which_dht), int(which_data_pin))

light[i] = lux

temp[i] = temperature

humid[i] = humidity

for each array it gets the min/max

minLight = min(light)

maxLight = max(light)

minTemp = min(temp)

maxTemp = max(temp)

minHumid = min(humid)

maxHumid = max(humid)

there is some hard coded buffers in the script

The buffer variable adds a buffer to max and min values to prevent

unwarranted alerts

Please feel free to adjust these values.

light_buffer = 10

temp_buffer = 3

humidity_buffer = 5

Then it generates the min/max thresholds by taking min(sensor)-threshold / max(sensor) + threshold

It looks like the values it took when generating the config is:

light : 5.9 - 8.1

temp = 26.6 - 27.4 celsius

humidity - 60.2 - 61.8 %

I just want to make sure that I am understanding the code correctly because if I set the wrong values I will never get the slack notifications.

Regards,

Lauren

On Fri, Aug 7, 2020 at 10:58 AM Makenzie Mabry notifications@github.com wrote:

Hello,

Would it be possible for you to add your config.txt file here so that we can better understand your question?

We are unsure what you mean by converting to set values in decimal.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/BrandinGrindstaff/GMpi/issues/2#issuecomment-670613223 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ABSGR6JABCHHBAYQ5O2MNK3R7QXBZANCNFSM4PWAR7TA

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/BrandinGrindstaff/GMpi/issues/2#issuecomment-670785757, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJRG6OCTRD2K3OKNZHUABZTR7SGG5ANCNFSM4PWAR7TA .