User Tools

Site Tools


arduino:sds011

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
arduino:sds011 [2020/01/04 16:56] – created aistisarduino:sds011 [2020/01/06 08:23] (current) – aistis
Line 10: Line 10:
 https://create.arduino.cc/projecthub/plouc68000/portable-fine-dust-pm10-analyzer-with-large-oled-digits-1c20c2 https://create.arduino.cc/projecthub/plouc68000/portable-fine-dust-pm10-analyzer-with-large-oled-digits-1c20c2
  
 +https://nettigo.pl/attachments/398
 +
 +{{:arduino:pasted:20200104-214331.png}}
 +
 +<code python>
 +import serial
 +import matplotlib.pyplot as plt
 +
 +s = serial.Serial(port='COM5',baudrate=9600)
 +plt.figure()
 +plt.grid()
 +plt.title('particale concentration in my room');
 +i=0
 +while True:
 +    res = s.read(size=10)
 +    a = int.from_bytes(res[2:3], byteorder='big', signed=False)
 +    b = int.from_bytes(res[4:5], byteorder='big', signed=False)
 +    print("{},{}".format(a,b))
 +    plt.scatter(i, a, c='r')
 +    plt.scatter(i, b, c='b')
 +    plt.legend([r'PM10 $\mu g \/ \slash m^{3}$', r'PM2.5 $\mu g \/ \slash m^{3}$'])
 +    plt.pause(0.05)
 +    i+=1
 +s.close()
 +</code>
 +
 +
 +{{:arduino:pasted:20200106-082303.png}}
arduino/sds011.1578149798.txt.gz · Last modified: by aistis