1
\$\begingroup\$

I have a Shinyei PPD42 that's connected to my Raspberry Pi B+ using a voltage divider to get the output of the PPD42 to 3.3 V. According to the specification sheet, P1 emits digital output when >1 μm sized particles are detected and P2 emits digital output when >2.5 μm sized particles are detected. Using the ratio of LOW pulses in 30 seconds, you can use a formula to determine estimated pcs/0.01cf, μg/m^33, and AQI. The LOW pulses, according to the specification sheet, are supposed to be 10ms - 90ms in duration.

I've followed some great resources that describe how to physically setup the sensor (vertical orientation, covering the sensor with tape/paper but leaving the air inlet/outlets uncovered, keep away from an air stream, etc).

I've run different projects (written in C) as well written my own code (in Python) to get the calculated values. However, what I'm finding is that regardless of the project I use, P1 and P2 almost never provide a LOW pulse. So, I end up getting a lot of zeros. For example, I ran the previously mentioned project overnight and didn't see a single calculation above 0 for the whole night.

If I remove the tape from the sensor opening, and move my hand up and around the opening, I do start to different values for the calculations. This is obviously just because of the change of light, but it's been an interesting way to make sure that the photo diode is still working.

I've tried to use my phone's camera to see if I can see the infrared LED (as seen in this deconstruction of the PPD42). I can't seem to pick up the PPD42's infrared LED on my camera but I can pickup infrared LED from my TV's remote.

I have a digital multimeter where I tried to debug P1 and P2 without connecting to my Raspberry Pi. I should be able to see the voltage drop from ~4V to ~0.7V when particles are detected (according to the specification sheet). Unfortunately, the multimeter just measures ~4V all the time. My guess on this is that the expected pulse duration of 10-90ms is probably too short for the multimeter to measure? Or, is this further indication that I'm never getting pulses from the PPD42? I have a second PPD42 that behaves the exact same (I just recently purchased them both new from eBay).

Is there anything else I should be doing to debug this sensor and see how I can get LOW pulses? Could both of my units be defective?


Here's some test results from @SamGibson's suggestions:

  1. I don't have an oscilloscope or logic analyzer handy.
  2. I followed the instructions to connect a red LED + 3 K resistor (anode on 5 V end). The LED is OFF by default. Wouldn't this indicate a constant LOW pulse from P1 or perhaps it's the opposite? The LED blinks on/off when I move the box around and wave my hand around the sensor opening (I removed my tape). On its own, I get a small LED blink on/off every minute or so.
  3. I used my multimeter to measured the voltage across the IR LED (back of the board) and got ~1.4 V.
  4. Pointing in my remote control at the photodiode and holding a button does turn on the LED. However, I noticed that it blinks at a fast rate. I confirmed with my camera that my remote control's LED blinks on its own very quickly. I'll have to find another IR source to test with constant IR light.
  5. When I measure the voltage on P1, I get 4.5 V and 4.7 V (I measured ~15 minutes apart so that's why I got 2 different values). This seems to be higher than the HIGH/LOW pulse range according to the spec sheet. If I recall correctly, I previously measured this to ~4 V, so I'm not sure what could have happened to cause a different measurement.

I've confirmed that the IR LED seems to be functioning. I used my Nintendo Wii Remote's IR camera and the Wii U's "Sensitivity" view. I pointed the Wii Remote's IR camera at just the right angle inside the PPD42's sensor opening and was able to see a dot on the Wii U's "Sensitivity" view. So, I seem to be back to square one. So, the unit appears to be functioning but it's just not sensitive enough.

\$\endgroup\$
  • \$\begingroup\$ Have you looked at seeeddoc.github.io/Grove-Dust_Sensor and takingspace.org/wp-content/uploads/… ? It is unlikely that two sensors are bad. You could also look at groups.google.com/forum/#!topic/airqualityegg/L5j7CO1dZQA where they talk about adding a resistor to increase sensitivity. \$\endgroup\$ – crj11 Jul 27 '18 at 12:09
  • \$\begingroup\$ @crj11 Yes I've looked at both of those resources (the first one inspired me to purchase the PPD42 and the 2nd one is linked in my post). The extra resistor added is to Pin5 is to control sensitivity of P2 >2.5 μm. I've heard that P1 is unreliable... so I guess I can look more into just P2. EDIT: I should say that I've also tried using a small DC fan to keep the airflow consistent with no luck. \$\endgroup\$ – TheCloudlessSky Jul 27 '18 at 15:36
  • \$\begingroup\$ Using a fan make the things worse. This detector relies on a constant air flow, the one that was used at the time of calibration. A particle will trigger a pulse with a length given by the size and the speed of the particle. A large particle passing with higher speed through the detector will show like a small particle triggering only P1 output. First, put a 27k ohm resistor from the tresh output to GND (this brings P2 threshold same as P1) and see if you have the same result on both outputs. Let us know the result. \$\endgroup\$ – Dorian Jul 30 '18 at 9:28
  • \$\begingroup\$ You should have a voltage around 1V on the tresh pin. \$\endgroup\$ – Dorian Jul 30 '18 at 9:36
1
+50
\$\begingroup\$

I have a Shinyei PPD42 that's connected to my Raspberry Pi B+

The PPD42 outputs could be close to 5V (original spec was minimum 4.5V, newer spec is minimum 4V), but Raspberry Pi inputs should not exceed the RPi supply voltage of 3.3V, so some form of level translation is needed for higher-voltages. See this related discussion about connecting that sensor to an ESP8266. (Update: You've kindly explained that you did use a voltage divider between the PPD42 output and the RPi input. However I'll leave this info here for future readers who might not realise this is required.)

All my test suggestions below are with the PPD42 outputs disconnected from the Raspberry Pi.

as seen in this deconstruction of the PPD42 [...] I can't seem to pick up the PPD42's infrared LED on my camera but I can pickup infrared LED from my TV's remote.

This is a very bad sign. You have a confirmed working IR detector (because your camera can "see" the TV IR remote's LED) but which does not show IR emitted from the PPD42 LED. :-( The IR LED in the PPD42 should be lit continuously.

My guess on this is that the expected pulse duration of 10-90ms is probably too short for the multimeter to measure?

Even for a working PPD42 (see below) that's true. According to its datasheet, at its maximum specified detection rate, the PPD42 outputs low pulses for only (typically) 13% of the time, and so its output would still be high for most of the time.

Your only indication of low pulses on a digital multimeter, might be an apparent slight instability in the reading; on an analog multimeter, you might see brief "flicks" of the needle, certainly on 90ms low pulses. This is one area where analog multimeters can allow us to infer more information than basic digital meters, and is why some digital multimeters have a faster-updating (but less accurate) "bar graph" display, as well as the slower-updating (but more accurate) main display.

Or, is this further indication that I'm never getting pulses from the PPD42?

In your specific case, due to the apparent lack of IR from its LED, I suspect this could be true for your sensors. Using an oscilloscope, a logic analyser, or an old style logic probe would confirm for sure.

Could both of my units be defective?

It's impossible to rule out that possibility, with the information so far.

Is there anything else I should be doing to debug this sensor and see how I can get LOW pulses?

  • An oscilloscope or logic analyser (even a cheap one) would quickly allow you to know one way or the other, whether you are getting any pulses on either PPD42 output.

  • Since 10ms - 90ms light pulses should be visible to the human eye, you could also try building a low-current voltage probe using a high efficiency (e.g. red) LED and a fairly large resistor (to minimise loading of the PPD42's output) which still allows you to see the LED lit clearly. I'd start with around 3k and wouldn't use less than a 1k resistor.

    Connect the LED + resistor between the P1 output and 5V (LED anode towards 5V, of course) and look for brief light pulses. No brief light pulses = no low pulses from the PPD42 (at least, none of the correct length - very, very short flashes wouldn't be visible to the human eye).

  • Also, as you saw in the PPD42 deconstruction document which you linked, there is a closeup of the PCB and a reverse-engineered schematic (†). You could therefore measure the voltage across the IR LED (LED1).

    We don't know the LED's specification, but that document says the LED Vf should be around 1.4V. A multimeter measurement of around 5V (with a 5V supply) would indicate that the LED has failed "open", whereas a measurement of around 0V would indicate it has failed "short".

  • You have some evidence from your "hand-waving" test, that the photodiode and following circuitry may be working. Therefore another test would be to try using your IR remote control's LED, pointed at the photodiode in the sensor (with the sensor's housing opened, of course) and keeping one of the remote control's buttons depressed. If that does cause pulses on the PPD42 P1 and/or P2 outputs, that would increase our concern about the sensor's own IR LED.

    However if there are still no output pulses, we cannot infer anything from that result. That's because there could be a valid reason (even though I don't know it) why the (typically 38kHz) IR remote control's flashes might be filtered or otherwise ignored, even in a working sensor.

If you are able to do any of those tests, then we can try to interpret the results.

(†) I believe there are some errors in that schematic e.g. R14 and R15 (both 10k) are shown as pull-downs, whereas my interpretation of the PCB image is that they are pull-ups to 5V, and the PPD42 specification also says the outputs are op-amp outputs with 10k pull-up.

Of course I could be wrong, as I no longer have a PPD42 sensor to make my own measurements. I just recommend caution in believing the (very helpful, but perhaps slightly incorrect) schematic, until you have confirmed its accuracy yourself.


Replies to test results added to main question:

  1. I don't have an oscilloscope or logic analyzer handy.

Understood. A cheap USB logic analyser (e.g. a Saleae clone) costs < $10 and can be used with open-source Sigrok / PulseView PC software. Depending on how important this issue is to you, it may be worthwhile getting one. Oscilloscopes obviously cost more, but can show signal quality in a way that logic analysers cannot. Both might help in this situation.

  1. I followed the instructions to connect a red LED + 3 K resistor (anode on 5 V end). The LED is OFF by default.

With the LED + resistor was connected between P1 and 5V:

LED On = Low output on P1
LED Off = High output on P1

Wouldn't this indicate a constant LOW pulse from P1 or perhaps it's the opposite?

It's the opposite. I thought it was easier for you to look for short flashes of the LED lighting (each flash of light meaning P1 output was going low), rather than looking for short gaps in a normally lit LED.

The LED blinks on/off when I move the box around and wave my hand around the sensor opening (I removed my tape).

That's effectively the same result as your previous "hand-waving" test where, with the sensor open, you were getting different values in your RPi pulse-counting software.

On its own, I get a small LED blink on/off every minute or so.

(I'm assuming that this is with the sensor closed and so in a normal test setup.)

This is new information.

Before, it seemed there was no output from the sensor, as you said:

what I'm finding is that regardless of the project I use, P1 and P2 almost never provide a LOW pulse. So, I end up getting a lot of zeros. For example, I ran the previously mentioned project overnight and didn't see a single calculation above 0 for the whole night.

Now it seems that there are low pulses from the PPD42 - just not very many of them! I believe that this is only possible, if the sensor's IR LED is producing some output. However the lack of IR output visible on your camera contradicts this hypothesis. Perhaps the sensor's IR LED has a very focused beam, and your camera was not at the right angle to see it? Or perhaps the IR LED is just very weak (faulty? wrong type fitted?).

Whatever the reason, this apparent contradiction between two data points (IR LED seems to be working, as you get some sensor output pulses; yet IR LED seems not to work, as not visible using IR-sensitive camera) is something I would focus on understanding.

  1. I used my multimeter to measured the voltage across the IR LED (back of the board) and got ~1.4 V.

That's a sensible value.

  1. Pointing in my remote control at the photodiode and holding a button does turn on the LED. However, I noticed that it blinks at a fast rate. I confirmed with my camera that my remote control's LED blinks on its own very quickly.

That gives more and more confidence that the sensor's photodiode and amplification, filter & output circuitry are basically working.

I'll have to find another IR source to test with constant IR light.

I'm not sure how that would help - perhaps if you can fit that constant IR source (another IR LED?) in place of the existing sensor's IR LED, you can see if the number of output pulses increases? I can't think how else to use a constant IR source which isn't physically in the correct place, relative to the photodiode and its lens. Of course that will end up with an uncalibrated sensor.

  1. When I measure the voltage on P1, I get 4.5 V and 4.7 V (I measured ~15 minutes apart so that's why I got 2 different values). This seems to be higher than the HIGH/LOW pulse range according to the spec sheet. If I recall correctly, I previously measured this to ~4 V, so I'm not sure what could have happened to cause a different measurement.

Different DC voltages measured with a multimeter are difficult to interpret in this situation, for the reasons explained before. They probably mean that there were different proportions of low pulses, resulting in different average DC values displayed on the meter. However I don't see how it's possible to rule out that the normal, static "logic high" voltage has changed.


Based on the new information that there are occasional low pulses in the sensor's output, here's another test:

  • The sensor relies on convection to draw air into the optical path between IR LED and photodiode lens. That convection process is driven by the resistor at the bottom of the board getting hot. One possible reason for a very insensitive sensor, would be if that resistor wasn't getting hot. Is the "heater resistor" (RH1) getting hot?
\$\endgroup\$
  • \$\begingroup\$ Thanks for the details. I'm going to go though and use some of your tips to see what works/doesn't work and will report back. In regards to your original concern, I've always used a voltage divider to get the output of the PPD42 to 3.3 V. I can confirm that the RPi inputs aren't damaged (e.g. using a button to monitor for input). \$\endgroup\$ – TheCloudlessSky Jul 30 '18 at 19:03
  • \$\begingroup\$ @TheCloudlessSky - Hi, "I've always used a voltage divider to get the output of the PPD42 to 3.3 V" That's good. Obviously I didn't know that, so I couldn't assume it. I'll update my answer and your question with that new info. I look forward to hearing the results :-) \$\endgroup\$ – SamGibson Jul 30 '18 at 19:08
  • \$\begingroup\$ I've updated the OP with test results. \$\endgroup\$ – TheCloudlessSky Jul 30 '18 at 20:17
  • \$\begingroup\$ @TheCloudlessSky - Thanks. I've copied your update into my answer and added my analysis here, as it wouldn't fit into comments below the question. Convention here tends to be that new information related to an answer, gets replied to in that answer, so I'm following that. As I interpret your update, there seems to be some important new information i.e. there are low pulses from the sensor, just not very many (you said the LED flashed every minute or so), so that's new. I've added suggestions of where I would focus further investigation and a new test at the bottom re: the heater. HTH \$\endgroup\$ – SamGibson Jul 30 '18 at 21:51
  • \$\begingroup\$ To clarify from my OP, when the sensor's opening was covered with tape, I ran it for ~12 hours and almost always got 0. There were a few non-zeros but just not nearly as sensitive as what other people seem to get. This time with the LED, the tape was off so the flash. So, the blink roughly every minute was more likely that the sensor's opening didn't have the tape and it was affected by ambient light (something that the spec sheets/other people say can happen). I can also confirm that the resistor at the bottom of the board (the one inside the black shield) is indeed hot. \$\endgroup\$ – TheCloudlessSky Jul 30 '18 at 23:25
1
\$\begingroup\$

The particle sensor works by detecting the light current particles reflected from IR light focused to an intersecting path of the Photo Diode (PD) at a 45 degree angle.

Possible problems:

  • The lens is dirty ( clean with Q tip )
  • There is too much ambient light ( avoid if the PD lens is clear or no black filter)
  • Your pulse counter is missing pulses ( verify )

    • what is the minimum pulse width that can be detected?
  • the airflow is too high ( avoid all forced airflow or wind)

  • excessive ripple on +5V ( verify )

Reasons

The sensor relies on very tiny particles moving slowly by a controlled slow heat rise and slow air flow pump. It the particles move too fast the low pass filter before and after the output stage will reduce the full pulse height from reaching the 1V & 2.5V thresholds for a negative pulse output. The beam focused emitter beam path is about the same size as the 5mm PD so the particle detection moving past a 5mm depends on a slow speed with a 39ms=T low pass filter so that particles reflections of 10ms minimum are about the threshold of detection.

This translates to 5mm/10ms or 0.5m/s as the maximum velocity for a particle and that is controlled by the heater resistor.

Simple test methods without a scope.

  • Make an optical pulse counter using a CD4024 with 7 binary outputs that can direct drive a 5mm LED with about 2mA with a 5V supply due to high internal RdsOn
    • make one for each output P1, P2
  • calibrate the sensor according to factory methods with aerosol particles

enter image description hereenter image description here

Connect P1,P2, 5V, gnd with telephone wire to breadboard. Reset to Gnd and LEDs Anode to each output and cathode to gnd (Vss), +5V to Vdd. add e-cap across 5V rail. ( no series R needed for CD4xxx on 5V) add optional pushbutton for Reset ("1") with 10k to gnd or equiv.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.