I have a 2560r3 with a dust sensor. 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?
might need a pull up on the data line?
Worth an effort Thank you
'm at a loss as to why this is failing.
The data sheet says:-
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.
From the Grove_-_Dust_sensor datasheet, 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.
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?
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.
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.
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?