-->
Page 1 of 2

Arduino library for Nova SDS021 (or SDS011) dust sensor

PostPosted: Tue Apr 03, 2018 2:31 pm
by peut
Hi,

I recently bought a Nova SDS021 dust sensor. It measures particles of 2.5 and 10 nmeter.
It works by sending both measurements over a 3.3v uart connection.

Only software I could find was a library that worked fine at https://github.com/ricki-z/SDS011.
But this library does not cover all possibilities, especially the sleep mode as documented in
the manual (https://github.com/gitpeut/cdn.sparkfun.com/assets/parts/1/2/2/7/5/Laser_Dust_Sensor_Control_Protocol_V1.3.pdf).

So I wrote a library that covers the whole manual.
It can be found here:

https://github.com/gitpeut/SDS021

As far as I know everything works as expected.
Have fun
Jose

Re: Arduino library for Nova SDS021 (or SDS011) dust sensor

PostPosted: Wed Apr 18, 2018 6:02 pm
by cren
Hi, while i wanna use the example code SDS021_querymode from your library SDS021-master, i cannot run it, arduino says 'class HardwareSerial' has no member named 'printf'. Do you know how to solve it?

Re: Arduino library for Nova SDS021 (or SDS011) dust sensor

PostPosted: Thu Apr 19, 2018 1:28 am
by peut
Hi,
My guess is you are using an AVR microcontroller. Arduino does not support printf out of the box for these
microcontrollers.
You can enable it, as described here :
https://playground.arduino.cc/Main/Printf

Replacing printf in the library is not easy as I have used it extensively.

Sorry.

Re: Arduino library for Nova SDS021 (or SDS011) dust sensor

PostPosted: Thu Apr 19, 2018 3:27 pm
by peut
Hi,

My guess is you are compiling this not on an ESP8266, like I used to develop this library.
I forgot that on many processors, printf is not enabled by default.
I have used printf extensively throughout the library and the examples, itquite some work to remove it
from the library.
For now, your best bet is to have a look at the following page and follow some of th einstructions to
enable printf in Arduino:

https://playground.arduino.cc/Main/Printf

I will have a look in a week or so to remove printf or make it conditionally being used.

Good luck.