Difference: BShinyeiNopPPD42NS (1 vs. 4)

Revision 42022-06-04 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="DustSensors"

The Shinyei PPD42NS sensor

Line: 24 to 25
  The plot shows a measurement where a match has been lighted and the smoke blown into the sensor. The particle concentration can be measured by calculating the relative time the signal is low with respect to the measurement period (low occupancy time).
Added:
>
>
Shinyei publishes a calibration curve in the data sheet showing the relation between the low occupancy time and the number of particles in 283 ml.

shinyei_calib.png

The driver

The shinyei.py driver is implemented as a MicroPython module. It has the following methods:

  • __init__(self,P1=23,P2=19,debug=False) : creates a Shinyei object.
    P1 is the GPIO pin to which the P1 output is connected
    P2 is the GPIO pin to which the P2 output is connected
    debug allows to switch on debugging messages
  • set_debug and get_debug: writes and reads the debugging flag
  • measure: starts a measurement. Interrupts are enabled on both P1 and P2 and connected to the interrupt handlers edges_P1 and edges_P2
    The interrupt handlers save the moment in time when the signal falls (starts_P1/P2) and when it rises again (stops_P1/P2).
  • start_stop_times: allows reading the start and stop times
  • lot: calculates the difference between stop and start times and sums them (low occupancy time)
  • lot_per_cent: calculates the percentage of time the signal was low during the measurement period
  • concentration: uses the calibration function to calculate the dust particle concentration
Please compare the above with the driver code: https://github.com/uraich/dust-sensors/blob/main/shinyei/shinyei.py

The screen dump below shows a run of a shinyei demo program when very little dust is around. First, the number of events is printed (length of the start or stop times table. Then I print the times when the signal went low and when it went high again. These times are given in ms. Then the low occupancy time is calculated in ms and in % with respect to the measurement duration. Finally, the dust concentration is deduced from the calibration function.

The other print lines are debugging messages, which you can easily get rid of by setting debugging to false.

shinyei_run.png

 -- Uli Raich - 2022-06-01

Comments

Line: 31 to 53
 
<--/commentPlugin-->

META FILEATTACHMENT attachment="smoke.png" attr="" comment="" date="1654283820" name="smoke.png" path="smoke.png" size="27082" user="UliRaich" version="1"
Added:
>
>
META FILEATTACHMENT attachment="shinyei_calib.png" attr="" comment="" date="1654343008" name="shinyei_calib.png" path="shinyei_calib.png" size="36948" user="UliRaich" version="1"
META FILEATTACHMENT attachment="shinyei_run.png" attr="" comment="" date="1654344646" name="shinyei_run.png" path="shinyei_run.png" size="61351" user="UliRaich" version="1"

Revision 32022-06-04 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="DustSensors"

The Shinyei PPD42NS sensor

Line: 16 to 16
 To get a feeling about the signals emitted by the Shinyei PPD42NS we first write a very simple program (pulses.py) that reads the P1 data line every 1 ms and saves the result in an array. It does so during 10 s. After data taking, the results are printed on the serial line.

We can run the program with

Deleted:
<
<
 
ampy run pulses.py > data.txt

and thus redirect the results into a file that can be plotted with gnuplot.

smoke.png

Changed:
<
<
The plot shows a measurement where a match has been lighted and the smoke blown into the sensor. The particle concentration can be measured by calculating the relative time the signal is low with respect to the measurement period.
>
>
The plot shows a measurement where a match has been lighted and the smoke blown into the sensor. The particle concentration can be measured by calculating the relative time the signal is low with respect to the measurement period (low occupancy time).
  -- Uli Raich - 2022-06-01

Revision 22022-06-03 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="DustSensors"
Changed:
<
<

The Shinyei PPD42NS sensor

>
>

The Shinyei PPD42NS sensor

  This sensor emits a low occupancy time signal where the relative time the signal is in low state is measured.
Line: 11 to 11
 
3: INPUT(5V DC 90mA) 5V    
4: OUTPUT (P1) D7 23 through voltage divider 5V - 3.3V
5: INPUT T1 D0 26 DAC
Added:
>
>

Reading the signal

To get a feeling about the signals emitted by the Shinyei PPD42NS we first write a very simple program (pulses.py) that reads the P1 data line every 1 ms and saves the result in an array. It does so during 10 s. After data taking, the results are printed on the serial line.

We can run the program with

ampy run pulses.py > data.txt

and thus redirect the results into a file that can be plotted with gnuplot.

smoke.png

The plot shows a measurement where a match has been lighted and the smoke blown into the sensor. The particle concentration can be measured by calculating the relative time the signal is low with respect to the measurement period.

  -- Uli Raich - 2022-06-01

Comments

<--/commentPlugin-->
Added:
>
>
META FILEATTACHMENT attachment="smoke.png" attr="" comment="" date="1654283820" name="smoke.png" path="smoke.png" size="27082" user="UliRaich" version="1"

Revision 12022-06-01 - UliRaich

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="DustSensors"

The Shinyei PPD42NS sensor

This sensor emits a low occupancy time signal where the relative time the signal is in low state is measured.

The connections as are follows:

Shinyei pin WeMos Pin GPIO Comments
1: Common (GND) GND    
2: OUTPUT(P2) D6 19 through voltage divider 5V - 3.3V
3: INPUT(5V DC 90mA) 5V    
4: OUTPUT (P1) D7 23 through voltage divider 5V - 3.3V
5: INPUT T1 D0 26 DAC

-- Uli Raich - 2022-06-01

Comments

<--/commentPlugin-->
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback