Skip to content

alexmrqt/micropython-sds011

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

A MicroPython driver for the SDS011 particle sensor (PM10 and PM25). This sensor uses serial communication.

Installation

On a LoPy, just put sds011.py in the lib/ directory. On a NODEMCU ESP32 put sds011.py in the root directory.

Usage Notes

First, import the library:

import sds011

Next, initialize a UART object (here P21 in TX and P22 is RX):

uart = UART(1, baudrate=9600, pins=('P21','P22'))

For NODEMCU ESP32 choose:

uart = UART(1, baudrate = 9600, rx = 16, tx = 17)

Since we have the UART bus object, we can now use it to instantiate the SDS011 object:

dust_sensor = sds011.SDS011(uart)

Reading from the Sensor

To read from the sensor:

dust_sensor.read()
    print('PM25: ', dust_sensor.pm25)
    print('PM10: ', dust_sensor.pm10)

About

SDS011 pollution sensor for Micropython

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%