PMS7003

package module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

PMS7003 Go Driver

PMS7003 Particulate Matter Sensor is a kind of digital particle concentration sensor,which can be used to obtain the number of suspended particles in the air. It and output them in the form of digital interface. This go package provides an easy interface to connect and get the reading in a typed interface

This sensor can be inserted into multiple instruments related(like Raspberry Pi, EPS, or anything that allows you to read over a serial port)

Based on the particle reading it can be used to determine the air quality index.

// TODO: add how to guide

same code is available at https://github.com/shivasaxena/PMS7003/blob/main/cmd/main.go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mode

type Mode string
const (
	ActiveMode  Mode = "ACTIVE"
	PassiveMode Mode = "PASSIVE"
)

type PMS7003Device

type PMS7003Device struct {
	// contains filtered or unexported fields
}

func Open

func Open(serialDevice string, mode Mode) (device PMS7003Device, err error)

func (*PMS7003Device) Close

func (r *PMS7003Device) Close()

func (*PMS7003Device) Read

func (r *PMS7003Device) Read() (sensorValue PMS7003SensorValue, err error)

func (*PMS7003Device) Sleep added in v0.0.2

func (d *PMS7003Device) Sleep() (err error)

func (*PMS7003Device) WakeUp added in v0.0.2

func (d *PMS7003Device) WakeUp() (err error)

type PMS7003SensorValue

type PMS7003SensorValue struct {
	// StartByte1, StartByte2                                                                    byte
	Framelen                                                                                  uint16 // :2
	PM10CF10Standard, PM25CF10Standard, PM100CF10Standard                                     uint16 // 2:4, 4:6, 6:8
	PM10Atmospheric, PM25Atmospheric, PM100Atmospheric                                        uint16
	ParticlesGT03, ParticlesGT05, ParticlesGT10, ParticlesGT25, ParticlesGT50, ParticlesGT100 uint16
	Unused                                                                                    uint16
	Checksum                                                                                  uint16
}

func (PMS7003SensorValue) String

func (t PMS7003SensorValue) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL