Stagnant readings from Sound and Light Sensors (Solved)

Hi,

I am modifying the default wifi_twit.py file by removing the twitter api bit and putting the rest in Software/Python folder.
I have LED connected to D3 and DHT temp/humidity sensor to D2, which are working fine. The readings changes according to the room temperature as I switch on/off the A/C. However the Sound sensor connected to A0 and light sensor connected to A1 are having the constant reading. (I have tried to make noise and cover the the light sensor). It always give me the same readings.

Here is the wifi_twit_test.py file

import time
import grovepi
import math
# Connections
sound_sensor = 0        # port A0
light_sensor = 1        # port A1 
temperature_sensor = 2  # port D2
led = 3                 # port D3

intro_str = "DI Lab's"

grovepi.pinMode(led,"OUTPUT")
grovepi.analogWrite(led,255)  #turn led to max to show readiness


while True:
    # Error handling in case of problems communicating with the GrovePi
    try:
        # Get value from temperature sensor
        [t,h] = grovepi.dht(temperature_sensor,0)

    # Get value from light sensor
    light_intensity = grovepi.analogRead(light_sensor)

    # Give PWM output to LED
    grovepi.analogWrite(led,light_intensity/4)

    # Get sound level
    sound_level = grovepi.analogRead(sound_sensor)

    # Post a tweet
    out_str ="%s Temp: %d C, Humidity: %d, Light: %d, Sound: %d" %(intro_str,t,h,light_intensity/10,sound_level) 
    print (out_str)
    time.sleep(5)
except IOError:
    print("Error")
except KeyboardInterrupt:
    exit()
except:
    print("Duplicate Tweet or Twitter Refusal")

and the log.txt file. log.txt (6.1 KB)

Could someone advise please?

Regards,
Kenny

Hi @luzhuomi,

Sorry for the delay, we were able to replicate your problem and we will come up with a fix for this shortly. Once its fixed we will get back to you here.

Thanks for your patience,
-Shoban

Thank you. Will look forward to your solution.

Regards,
Kenny

Hi @Shoban

May I know any update on this?

Regard,
Kenny

Hi @luzhuomi,

Thanks for bringing this up again, missed this on our list, we will get back to you shortly.Sorry for the wait, it will be answered soon.

-Shoban

Hi @Shoban,

Any update on this?

Regards,
Kenny

Hi @luzhuomi,

We have been trying this out and we found that the DHT sensor is blocking readings from the other sensors. So we are working on it but we are yet to diagnose the cause of the issue. We will need a little more time to sort this out, we will definitely get back on this post as soon as we fix it. Thanks a lot for your patience.

-Shoban

Hi @Shoban

Thanks for the update. Sure I will look forward to the fix.

Regards,
Kenny

Hi @luzhuomi,

Thanks for understanding.

-Shoban

Hello AS of todats date is there a fix for this???

@Shoban

@callaway8085 : can you describe the problem that you are facing. Are you trying to run the exact same program or is it something else.

@karan hello the program runs and it publishes the readings to the command line and updates every 60 seconds but the light sensor and the sound sensor show a reading of 0 also the led dont blink. It publishes to twitter also.???

This topic was automatically closed after 24 hours. New replies are no longer allowed.