All Analog-Sensors gets Error 5 in python


#1

Hi there,

When I connect a analog-sensor like air-quality-sensor or light-sensor I become an input/output Error 5 in python shell. All other sensors which are digital or i2c sensors works perfectly. Only the analog-sensors are not working. Can you help me?

sorry for my english :slight_smile:


#2

It’s fine :slight_smile: Could you provide the code you were using?
Plus welcome to the forums :smile:


#3

thank you :blush:
I have used the example from dexter:import time
import grovepi

Connect the Grove Air Quality Sensor to analog port A0

SIG,NC,VCC,GND

air_sensor = 0

grovepi.pinMode(air_sensor,“INPUT”)

while True:
try:
# Get sensor value
sensor_value = grovepi.analogRead(air_sensor)

    if sensor_value > 700:
        print "High pollution"
    elif sensor_value > 300:
        print "Low pollution"
    else:
        print "Air fresh"

    print "sensor_value =", sensor_value
    time.sleep(.5)

except IOError:
    print "Error"

Air Quality Sensor Wiki Page Completely Down
#4

Sorry, forgot to ask what error messages do you get or outputs if any?
I was also unable to access the page, I’ll report the page is down. Until then I’ll do my best I can to figure this out.


#5

Hi @leon.luethi,

As @graykevinb said, can you post a screenshot of the error message that you get and also follow this guide, generate a test log and post it along with your reply. If possible can you post a few pictures of your setup when you get this error to help you better.

-Shoban


#6

Thanks @Shoban. I’d like to add that the wiki has been undergoing changes and @cleoqc showed me the new link: http://wiki.seeed.cc/Grove-Air_Quality_Sensor_v1.3/

More about that on the thread:

http://forum.dexterindustries.com/t/air-quality-sensor-wiki-page-completely-down/2291/2


#7

thank you for your help @graykevinb @Shoban! :slight_smile:
Today I startet my raspberry with the connected air_quality_sensor an re-run the script. I don’t know but now it works… I can not reproduce the fail. So strange!


#8

Well glad it’s working! :slight_smile:
Yah, These bugs can be odd at times.
Maybe you had it plugged in wrong and it got wiggled when you tried again or something. Anyways glad it works. emphasized text Have fun with it!