Test DHT22 Sensors with Arduino and MATLAB

This project shows how to use MATLAB and Arduino to acquire and fix data from a bundle of DHT22 sensors, live plot, and export the results.

Sep 5, 2018

15395 views

10 respects

Components and supplies

1

Capacitor 10 µF

1

Jumper wires (generic)

1

Pushbutton switch 12mm

1

Resistor 1k ohm

5

Resistor 10k ohm

1

Breadboard (generic)

1

Arduino UNO

5

DHT22 Temperature Sensor

Apps and platforms

1

Arduino IDE

1

MATLAB

Project description

Code

humCorr.m

matlab

MATLAB function used to correct the humidity readings from the value of one sensor. Not called if lines 66-68 of the main script DHT22_5sensor.m are commented. Ignore or edit this function according to your needs.

DHT22_5sensor.ino

arduino

Arduino sketch to read sensors data and pass them to the computer by the serial port.

humCorr.m

matlab

MATLAB function used to correct the humidity readings from the value of one sensor. Not called if lines 66-68 of the main script DHT22_5sensor.m are commented. Ignore or edit this function according to your needs.

DHT22_5sensor.ino

arduino

Arduino sketch to read sensors data and pass them to the computer by the serial port.

DHT22_5sensor.m

matlab

MATLAB code to read serial data from the Arduino. Please check your port number on line 18. First acquisition should be without correction. For the first time leave lines 66 to 68 commented. I have used an external tool to verify temperature and humidity readings and it appeared that sensor number 5 read both correctly in several condition. I have written the humCorr.m function to fix the other sensors readings from the value of sensor number 5. If interested in correction, manipulate humCorr.m function and/or lines 66-68 according to your needs.

Downloadable files

Connections

Breadboard view

Connections

Connections

Breadboard view

Connections

Comments

Only logged in users can leave comments

Anonymous user

2 years ago

how did you read data from digital pins.Shouldn't it be connected to the pwm pins?

Anonymous user

2 years ago

Yes, they are connected to the pwm pins.

Anonymous user

5 years ago

how did you read data from digital pins.Shouldn't it be connected to the pwm pins?

Anonymous user

2 years ago

Yes, they are connected to the pwm pins.

Anonymous user

6 years ago

Hallo again, Today I continue to experiment with same project but with Mega2560 board. It doesn't matter what kind of board is ! As I write yesterday humidity outside was actually lower than inside in the room. Today the weather is rainy and it's about 70% RH. I'm working with uncommented 66-68 rows in the code. Now I measure RH in the room & it's between 41-45%.When I measure RH with another instrument(Astman) measured value is 52%.Becase sensor 3 is close to this value I change sensor 5 with sensor 3. When I replace these two sensors I notice that when sensor 5 is removed all sensors can't work. Is there anybody who try to experiment with this project?