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;

Infrared proximity sensor circuit diagram

An infrared proximity sensor is a sensor that detects any object when it close to the sensor. The circuit is an important part of an automatic faucet, robot, and touchless switch.

An above image is an infrared proximity sensor circuit diagram. The circuit is simple and easy to make, it has 2 transistors, 4 resistors, an IR LED, an IR phototransistor, and a purple or white or green LED (use as an indicator so you can remove it if you want)

Electronic components list

This circuit's maximum detection range is 10 centimeters, you can decrease the detector range by changing R2 resistor. Use 7805 regulator IC if you want to use the circuit with 12 volts power supply.
The infrared proximity sensor consumes around 50 milliamps per hour when standby and consumes around 80 milliamps(add a relay that consumes 30 milliamps) so you need an external power supply because battery life will not last long. The reason that makes this circuit consume much energy because IR LED need at least 50 milliamps to make IR light strong enough for an IR Sensor.
If you're not familiar with resistor color code see how to read it here

Proximity sensor circuit diagram

The red line does not touch the purple line so be careful.
Note: another leg of R2 connect to Vcc, Replace it with 50 K variable resistor if you want to adjust the sensor range.

See testing video (set video to 720p if the content missing)