Integrating Multiple Grove Sensors with an IoT Service

Yes indeed. The payload structure is what AWS requires. Thank you very much for that.

The air quality sensor reading is not accurate however. When using pin 2 I am getting a reading in the 500s which is high air pollution.

When I run the air quality sensor individually (without this integrated script of three sensors), I am getting a reading like this:

pi@raspberrypi:/usr/local/lib/python3.7/dist-packages/grove $ python grove_air_quality_sensor_v1_3.py 0
Hat Name = ‘Grove Base Hat RPi’
Detecting …
52, Air Quality OK.
52, Air Quality OK.
51, Air Quality OK.
53, Air Quality OK.
51, Air Quality OK.
52, Air Quality OK.
52, Air Quality OK.
52, Air Quality OK.

When I run the integrated sensor group, I am seeing values around 500 (high pollution). I am thinking that the pin2 does not match A0 for Grove Base Hat for Raspberry Pi?

pi@raspberrypi:/usr/local/lib/python3.7/dist-packages/grove $ grove_uv_sensor
DHT22, humidity 0.0%, temperature 0.0*
UV* Value: 0
AQ Value: 497

Update request with token: 502de80f-10d7-41d7-81d6-9f4e58b370f1 accepted!
UV Level: 0

I am running this from an indoor area with clean air, so the sensor value around 50 is accurate in my opinion.

try connecting different port, the demo script you are using 0th pin right? try to use the same pin in the AWS IoT Script too?

Also you can find the sensor is reading raw value from it’s analog port and value greater than 700 consider as High pollution.

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

Source: https://github.com/DexterInd/GrovePi/blob/master/Software/Python/grove_air_quality_sensor.py

It worked properly with pin zero:

AirSensor = GroveAirQualitySensor(0) # connected to pin0

Thank you very much for your help, Salman!

Cool :star_struck: :love_you_gesture: