I've just started playing around with my brand new Arduino Mega 2560 and - after some success - run into a problem I do not understand. Before I explain it I should mention that I'm absolutely new to Arduino, working with micro controllers and electrics in general so no background about volts/watts/amps/... is available, just starting from scratch...
I've got a ITDB02-3.2s LCD screen with touch pad connected to my Arduino board without any shield -> first success
Then I got a DHT11 temperature/humidity sensor connected, too -> second success. Finally I got the data from the sensor to be shown on the LCD -> third success
Ok, here's my problem. I control the LCD with the UTFT library and figured out that turning the lcd on and off in the code did not work. Searching the net I found a sollution and it also lead me to the idea to control the brightness of the background lights - LEDs - by connecting the LED pin of the screen to an transistor which I control over Arduino's PWM port 8. Running this setup I'm able to dim the LCD's background light. So far so good but I had to figure out that the results of the measurements through the DHT11 sensor are getting affected by the puls (correct term?) I set at the PWM port. An example would be:
- Having defined an output of 255 on the pin, the sensor reports: Temperature: 24 | Humidity: 34
- Having defined an output of e.g. 115, the sensor reports: Temperature: 26-27 | Humidity 36-37
I did several test runs so I can confirm that the different setting on the PWM port affects the data comming from the sensor.
Here's my question: What's going on?
I have no glue why the settings on the PWM port affects the readings from the sensor. Could somebody please help me figuring out what's happening and how to prevent this? I would be highly thankfull.