OpenSensors.io
Published © CC BY-SA

How to Measure Air Quality on OpenSensors

How to measuring the air quality of the Open Data Institute using an Arduino and a Shinyei PPD-42.

BeginnerFull instructions provided18,429
How to Measure Air Quality on OpenSensors

Things used in this project

Story

Read more

Code

final-code.py

Python
import serial
import paho.mqtt.client as mqtt
import time

mqttc = mqtt.Client(client_id="939")
mqttc.username_pw_set("Louis", password="AbcDEFgH")
mqttc.connect("opensensors.io")

ser = serial.Serial('/dev/ttyACM0')  # open first serial port
while True:
message= ser.readline()
print message
mqttc.publish("/users/Louis/ODI/airquality", payload=message, qos=0, retain=False)
time.sleep(1); 

Github

Credits

OpenSensors.io

OpenSensors.io

11 projects • 128 followers
OpenSensors is a real time Internet of Things data exchange.
Thanks to Louis Schamroth Green.

Comments