Arduino Forum

Topics => Science and Measurement => Topic started by: rrjwilson on Oct 21, 2014, 05:48 pm

Title: Dust sensor wire length causing read problems
Post by: rrjwilson on Oct 21, 2014, 05:48 pm
I have a 2560r3 with a dust sensor (https://www.coolcomponents.co.uk/dust-sensor.html).
When plugged in directly to the board is works fine.
When plugged (soldered really) into its extension cable 25cm length it reads intermittently.
When plugged (soldered really) into its larger extension cable 35cm length it fails to read.
Resistance across the wire with both extensions is negligible so without an oscilloscope I'm at a loss as to why this is failing.
Does anyone have ideas? 
Title: Re: Dust sensor wire length causing read problems
Post by: robtillaart on Oct 21, 2014, 06:10 pm
might need a pull up on the data line?
Title: Re: Dust sensor wire length causing read problems
Post by: rrjwilson on Oct 22, 2014, 10:44 am
Worth an effort
Thank you
Title: Re: Dust sensor wire length causing read problems
Post by: Grumpy_Mike on Oct 22, 2014, 07:01 pm
Quote
'm at a loss as to why this is failing.
The data sheet says:-
Quote
The sensor gives out a PWM output that is linearly proportional to the particle concentration in the air.
So this is a PWM signal, the capacatance of the line is vital in maintaining signal integrity.
Title: Re: Dust sensor wire length causing read problems
Post by: dlloyd on Oct 22, 2014, 10:34 pm
From the Grove_-_Dust_sensor datasheet (http://www.seeedstudio.com/wiki/images/4/4c/Grove_-_Dust_sensor.pdf), it looks like the sensor already has a 10K pullup resistor.

Output Method Negative Logic, Digital output,
Hi : over 4.0V(Rev.2) Lo : under 0.7V
(As Input impedance : 200k) OP-Amp output, Pull-up resistor : 10k


It doesn't look like they're using a rail to rail op-amp. From the characteristics, I suspect the output signal at the sensor itself is rather weak with poor rise/fall time. A weak signal to begin with might explain why it doesn't take much cable length to cause issues.

I would still try adding a pull-up resistor of 10K at the Arduino input. Note that they don't specify the max output current of the op-amp, so lowering this value too much will either overload the output or lift the minimum voltage to a value where the Arduino considers it continuously HIGH.

Images of the PPD42NS dust sensor's PCB the web reveal a 14-pin surface mount op-amp If this is non rail-rail type, then the minimum output current from the remaining op-amps available at Digi-Key is 4mA. This would indicate that its safe to use a pullup as low as 3.6K.
Title: Re: Dust sensor wire length causing read problems
Post by: rrjwilson on Oct 23, 2014, 10:35 am
Well with Arduino having internal pullups (and no references to only certain pins having them) I've tried using INPUT_PULLUP but get the same result.
What about a low pass filter and using the ADCs instead?
Will it have enough grunt to cope?
Title: Re: Dust sensor wire length causing read problems
Post by: Grumpy_Mike on Oct 23, 2014, 11:33 am
Quote
What about a low pass filter and using the ADCs instead?
That will involve sending a analogue signal down a line, that is more tricky than sending a digital one down.

Your best bet is to have a transistor at the sensor end and buffer the signal.

In this case the internal pullups are not very good as they are only 30K or so and thus are weak.
Title: Re: Dust sensor wire length causing read problems
Post by: dlloyd on Oct 23, 2014, 02:04 pm
Have you tried adding a pull-up resistor of 10K or 4.7K at the Arduino input?

If the sensor PCB has 10K (this is unclear from the specs), then adding an external pullup resistor at the Arduino input should improve the signal as follows:

10K should give up to 2x improved signal strength and rise time.
4.7K should give up to 3x improved signal strength and rise time.

If the signal quality is still too poor to work, adding a transistor (as per Grumpy_Mike) or digital buffer or Schmitt-trigger IC are possibilities (may need some small edits to code to deal with signal inversion). However, at this point it would seem that you have a defective device.
Title: Re: Dust sensor wire length causing read problems
Post by: TomGeorge on Nov 09, 2014, 01:07 pm
Hi, have you checked to see what the power supply is at the sensor after the long length of wire?
Did it come with a manual with more info than is supplied on the web site?

Tom... :)