0
\$\begingroup\$

I made a circuit to read from a dust sensor that operates with a 5V rail. The microcontroller I am using is supplied with a 3.3V rail, and it shares the same ground as the dust sensor.

As the output of the dust sensor is an op-amp with low source impedance, I thought I could shift the level of the sensor output to interface with the microcontroller with simply a 2:1 voltage divider, but this does not work well. I did not realise when I designed the board that the sensor has a 10k resistor to ground on the output of its op-amp (shown as "0-5V signal"):

schematic

simulate this circuit – Schematic created using CircuitLab

The dust sensor's signal should smoothly vary between 5V and 0V depending on the air quality. With the above setup, the signal either jumps between around 1.7V and 0.3V with almost no transition in between.

Is there a way to compensate my voltage divider values in the presence of this resistor, such that the 0-5V signal is still translated to within the 0-3.3V range?

The dust sensor is a Shinyei PPD42NS. The circuit diagram can be found here.

\$\endgroup\$
9
  • 2
    \$\begingroup\$ Please add a partnumber and link to datasheet for the dust sensor into your question. \$\endgroup\$
    – Transistor
    Commented Sep 29, 2017 at 16:56
  • \$\begingroup\$ @Transistor: done. \$\endgroup\$
    – Sean
    Commented Sep 29, 2017 at 17:04
  • 2
    \$\begingroup\$ The resistor should not have any impact on your voltage divider. It's in parallel to a voltage source (The Op-amp). \$\endgroup\$
    – next-hack
    Commented Sep 29, 2017 at 17:10
  • 1
    \$\begingroup\$ The output stage of that sensor is configured as a comparator, so it will only be in either high or low state. I suggest you check the voltage out without anything connected to verify the high out voltage. As @next-hack says the 10K will not affect the output, it is there simply to make sure the output is low when power is removed from the sensor. \$\endgroup\$
    – Trevor_G
    Commented Sep 29, 2017 at 17:11
  • 1
    \$\begingroup\$ High out is only Vcc-2V so you don't need to adjust it. \$\endgroup\$
    – Trevor_G
    Commented Sep 29, 2017 at 17:17

3 Answers 3

3
\$\begingroup\$

The output stage of that sensor is configured as a comparator, so it will only be in either high or low state. That is, no intermediate voltages.

According to the opamp spec, Voh = Vcc-2V. Since you are driving it with 5V Vcc, your voltages should already be in range of your 3.3V logic.

If it is not you could use a suitable divider, or you can always do it this way.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
5
  • \$\begingroup\$ Thanks. I was confused when I saw the sudden jumps from high to low at the output, and thought it was a problem with my level shifting, but as you say it's actually the intended behaviour (you are supposed to perform a boxcar average over many seconds to extract the dustiness). The high level is unfortunately above the op-amp spec, around 3.45V, so I can't just leave it as-is. It looks like the voltage divider the way I designed it is working correctly. Thanks! \$\endgroup\$
    – Sean
    Commented Sep 29, 2017 at 17:23
  • \$\begingroup\$ @Sean see update \$\endgroup\$
    – Trevor_G
    Commented Sep 29, 2017 at 17:26
  • \$\begingroup\$ @Sean: "You are supposed to perform a boxcar average over many seconds to extract the dustiness." I doubt that this will work. If the environment is over the dust threshold the output will stay on - it won't give you a PWM-like output. \$\endgroup\$
    – Transistor
    Commented Sep 29, 2017 at 17:28
  • \$\begingroup\$ @Transistor: this blog post shows measurements from the unit, where the dustiness is recovered from the comparator output, apparently by averaging... or am I misinterpreting that? \$\endgroup\$
    – Sean
    Commented Sep 29, 2017 at 17:31
  • \$\begingroup\$ That's interesting. Looking back to the first stage amplifier I now see that it's AC coupled. This suggests that the device is actually pulsing for each particle sensed! Maybe you can do what you want and my answer may be bonkers. \$\endgroup\$
    – Transistor
    Commented Sep 29, 2017 at 17:38
2
\$\begingroup\$

enter image description here

Figure 1. Dust sensor schematic. Source: Taking Space.

As explained in the text of the article:

Sections c and d of the op-amp are set up as comparators to provide output pulses for the P1 and P2 outputs at the connector. Voltage divider R10 and R11 determine a threshold of 1.09V for P1. Similarly, R12 and R13 determine a threshold of 2.5V for P2, P1 and/or P2 will pulse low so long as the input voltage exceeds their respective thresholds. Note that any time the signal is high enough to activate P2, P1 will be active also.

That means that outputs (2) and (3) will be either on or off and not analog as you had hoped.

It seems to me that you could tap off opamp 'b' at point (1) to get the required signal for your ADC. You should probably replicate R7, C4 onto your ADC input to provide the same level of filtering (4 to 8 Hz, if I remember correctly).


Alternative approach:

Applying an additional resistor or a voltage to the external threshold input could adjust the P2 threshold either up or down.

This means that you could apply a sawtooth ramp voltage to 'thresh' and monitor P2 to see at what voltage it switches. It's a bit more work but avoids hacking the dust sensor board.

\$\endgroup\$
3
  • \$\begingroup\$ Thanks a lot. Any idea why the designers chose to have the analog reading at point (1) output as discrete triggers? Is that easier for designers of air purifiers somehow, or less susceptible to noise? \$\endgroup\$
    – Sean
    Commented Sep 29, 2017 at 17:26
  • \$\begingroup\$ It is designed to provide a two-level dust signal to digital inputs. This, presumably would allow easy interface to most digital devices, relays, etc., and keeps the analog setpoints completely within the sensor. This would be analogous to having an adjustment pot on an industrial photo-sensor: it is very simple to interface yet still adjustable on the sensor, if required. \$\endgroup\$
    – Transistor
    Commented Sep 29, 2017 at 17:31
  • \$\begingroup\$ @Sean seems to me this sensor is designed to allow you to count dust particles per unit time, or volume if it's from something where the air flow rate is known. \$\endgroup\$
    – Trevor_G
    Commented Sep 29, 2017 at 17:41
2
\$\begingroup\$

Is there a way to compensate my voltage divider values in the presence of this resistor, such that the 0-5V signal is still translated to within the 0-3.3V range?

Since the sensor output is digital, rather than an analog voltage converter, I'd simply use a 3.3 V logic buffer chip with 5-V tolerant inputs. For example, 74LVC1G125. After accounting for assembly costs, using a single logic chip will likely be cheaper than 2 or 3 passive parts needed for a voltage divider solution.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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