Humidity sensor with led alarm | Arduino project

This page contains Arduino Humidity sensor with led alarm source code. This project is good for someone who wants to make a humidity meter or hygrometer with led alarm if humidity and temperature over a threshold. It's easy to make and doesn't require an external power supply, just use power from an Arduino UNO R3 board (USB power compatible with this project).

Electronic components list:
1 x Arduino Uno R3
1x 20 x4 I2C LCD display
1 x AM 2320 humidity/temp sensor
1 x 5 mm led ( 2 x if you plan to use led for pin 13 instead built-in led)
1 x 1000 ohms resistor ( 2 x if you plan to use led for pin 13 instead built-in led)
Any USB power adapter, 500 mA current at least.

Here is the Arduino code:
AM 2320 library
LCD display i2c library

#include <Wire.h>
#include <AM2320.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 20, 4);
AM2320 th;
int led2 = 12;

how to make an automatic faucet

Now you will not forget to close your faucet or waste water when you pick a soap to wash your hand or face. This project shows you how to make an automatic faucet, you can even use the faucet that water valve damage because of this circuit use solenoid valve to control water.

Electronic components you need:
1 Arduino Uno R3
1 TR1 = IRF 540n N channel MOSFET
1 Sensor1 = IR sensor
1 IR1 = IR led
R1 = 10 kilo-ohms
R2 = 100 ohms
R3 = 4.7 kilo-ohms
1 12 volts solenoid valve
12 volts 1 Ampere adapter

The Arduino code is very simple and you don't need to load any special module to make this project works

 created 29 Dec. 2008
 modified 9 Apr 2012
 modified 20 Oct 2017
 by Tom Igoe

 This example code is in the public domain.


// These constants won't change.  They're used to give names
// to the pins used:
const int analogInPin = A0;  // Analog input pin that the ir sensor is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to

int sensorValue = 0;        // value read from the IR
int outputValue = 0;        // value output to the PWM (analog out)

void setup() {
  // initialize serial communications at 9600 bps:

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);
  // map it to the range of the analog out:
  outputValue = map(sensorValue, 0, 1023 , 0, 255);
  // change the analog out value:
  analogWrite(analogOutPin, outputValue);

  // print the results to the serial monitor:
  Serial.print("sensor  = ");
  Serial.print("\t output = ");
if (sensorValue < 500)
  digitalWrite(LED_BUILTIN, HIGH);
else if (sensorValue > 500)
   digitalWrite(LED_BUILTIN, LOW);

  // wait 2 milliseconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:

Change this code from 500 to 600 if you want to increase detector range.
if (sensorValue < 500)
  digitalWrite(LED_BUILTIN, HIGH);
else if (sensorValue > 500)
   digitalWrite(LED_BUILTIN, LOW);

See the video below about how to connect every component to Arduino.