datasheet: dsm501.pdf 
DMS501A ‑ 2mm pin pitch, DMS501B ‑ 2.54 mm
5V, 90mA
1 minute stabilization after power up
sum time of low (0.7v) for measurement interval, divide by time
PINOUT I/O DESCRIPTION

Pin number	Pin name	Description	
#1	Control	Vout 1 control	
#2	Vout 2	Vout 2 output factory calibrated PWM output for density of particles over 1 �m.	
#3	Vcc	Positive power supply DC 5V	
#4	Vout 1	Vout 1 output (PWM)	
#5	GND	Ground	

control pin 1
resistor between pin 1 and ground (square pin on board) to control vout 1 output (pin 4)

Resistor value	Description	
open	Preset sensitivity (over 2.5 �m)	
47K	Half sensitivity (over 1.75 �m)	
18.2K	Equal sensitivity of Vout 2 (over 1 �m)	

arduino
• Nice library, but inside repository https://github.com/richardhmm/DIYRepo/tree/master/arduino/libraries/DSM501 
• interrupt driven version https://github.com/Sovichea/dsm501‑interrupt/ 
I tried both of them and on my module they don't report sane results when compared with other sensors.
platformio
https://primalcortex.wordpress.com/2020/05/23/an‑esp8266‑air‑quality‑monitor‑based‑on‑the‑dsm501a‑dust‑sensor/ 
https://github.com/fcgdam/ESP8266_AirQuality 
dpavlin@nuc:/nuc/esp8266/ESP8266_AirQuality$ git remote -v
origin  https://github.com/fcgdam/ESP8266_AirQuality (fetch)
origin  https://github.com/fcgdam/ESP8266_AirQuality (push)

# edit config
dpavlin@nuc:/nuc/esp8266/ESP8266_AirQuality$ vi src/secrets.h

dpavlin@nuc:/nuc/esp8266/ESP8266_AirQuality$ pio run

dpavlin@nuc:/nuc/esp8266/ESP8266_AirQuality$ pio run -t upload --device-port /dev/ttyUSB2

Pins:

Wemos D1 +5V	DSM501a +5V	
Wemos D1 D6	DSM501a PM 1.0 pin	
Wemos D1 D5	DSM501a PM 2.5 pin<	
Wemos D1 GND	DSM501a GND pin	

description of similar sensor
https://github.com/opendata‑stuttgart/meta/blob/master/files/ShinyeiPPD42NS_Deconstruction_TracyAllen.pdf 
power supply
It really needs quiet power supply to get any readings which are not just noise.