Project 2: Arduino, DHT11, DC motor and LCD display

in arduino •  6 years ago  (edited)

Description:

  • Read humidity and temperature data from DHT11 sensor
  • Display humidity and temperature data on LCD module
  • Turn on the fan (DC motor) when the temperature reaches 25C
  • Increase the fan speed as the temperature increases up to 40C.

Components Used:

  • Arduino UNO R3 - micro-controller
  • DHT11 sensor - gathers humidity and temperature data
  • 3V-6V motor - spins the fan
  • LCD 1602 module - displays the sensor data
  • 9V battery - power source for the DC motor
  • PN2222 transistor - to turn on and off DC motor
  • 1kOhm resistor - prevent large current from flowing into the transistor base
  • 5kOhm resistor - pullup resistor for DHT11
  • 10uF capacitor - smooths out the noise from the DC motor
  • 1N4007 diode - prevent inductive spike from the DC motor
  • 10kOhm potentiometer - control the contrast of the LCD module
  • Jumper cables

Fan off below 25C
photo1.jpg

Fan on above 25C (high RH from breathing on the sensor)
photo2.jpg

Notes:

  • 5kOhm pull up resistor on DHT11 Vcc pin and data pin
  • RW pin on LCD module to write only by connecting to ground
  • Connect the grounds of the 9V battery and Arduino, but do not connect the power source.
  • Electrical noise from the motor could corrupt data writing to LCD module. Solution: wrap wires around the motor to shorten the wires. This reduces noise. Adding a capacitor also helps too.
  • Inductive spike from the DC motor could kill transistor without a path to direct inductive energy.
  • Schottky diode for higher frequency

Code:
https://gitlab.com/hopop55/Project2_Arduino_DHT11_DCmotor_LCDdisplay/blob/master/humidity_lcd2.ino

Resources:

  • Inductive spike from the DC motor

  • How to deal with electrical noise from the DC motor
    https://www.pololu.com/docs/0J15/9

  • Authors get paid when people like you upvote their post.
    If you enjoyed what you read here, create your account today and start earning FREE STEEM!