Go Down

Topic: LED dimming affects sensor data (Read 2 times) previous topic - next topic


The digital signal from the sensor consists of long (70uS) and short (28uS) pulses.  Timing is critical, so interrupts are disabled by the library (you are using the DHT library, yes?).

Also, noise could be an issue with that protocol.  You have a low for a period, then a high for a period - the period of that high, up until it goes low, is what determines if it's a 0 or a 1.  If you get a bit of noise, that period could be measured wrongly.

If it is the PWM signal inducing noise, you could try to counter it by reducing the pull-up resistor on the data line to say 4.7K?.  You could also try ensuring that your PWM signal is as far away from the data line as practicable.
Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10


I tried now with a 4.7K? pull-up resistor but without success. Then I took the data line cable and changed its pin from 7 to 13 on the Arduino board. Unfortunately this did not solve the problem. Do you see anything else I could try?


1. Decoupling capacitors should be connected as close to the device they are decoupling as possible. Plug that 100nF capacitor directly into the same 2 breadboard rows that the DHT11 is plugged into.

2. Use one ground pin on fhe Mega to connect just the DHT11 and its decoupling capacitor. Use a different one to connect the backlight or the transistor controlling the backlight. Similarly for the +5V supply.

The above changes will reduce the extent to which the switched backlight current induces noise on the DHT22 power and ground lines, which may be what is causing the problem.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Go Up