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;

Resistor color code

A resistor is the most important electrical component in almost every electronic circuit, it can limit current to any load such as led, transistor, op amp, etc. 

We must read resistor color code if we want to know the resistive value, tolerance, temperature coefficient. Resistors have different color bands (3,4,5,6) the more color bands the more resistor's information.

Now let's start with 3 bands resistor color code.

The above resistor has only 3 bands First digit, Second digit, and multiply. A 3 bands resistor color code has fixed +/-20% tolerance that means if color code value is 1,000 ohms the real life resistive value may be +/- 200 ohms. 

4 band resistor color code

A 4 bands resistor color code has tolerance value color strip, the resistor on an above picture has 5% tolerance. This type of resistor uses in a regular circuit such as television,radio,washing machine.

5 bands resistor color code

A 5 bands resistor color codes have third digit color bands.
1(first digit) 0(second digit) 0(third digit) = 100 x 0.1(multiply) = 10 ohms +/- 1% (brown) tolerance. The resistor is good for opamp,power amp negative feedback because it has a very accurate resistive value.

6 bands resistor color code
A 6 bands resistor color code. The sixth band uses for temperature coefficient value, this type of resistor use for the circuit that must be precise over wide range temperature.

SMD resistor code

SMD resistor use number instead of color code, the last digit use as a multiplier for the first, second, and third digit (some SMD resistor has four numbers). The multiplier value increase by a factor of ten each time number increase by 1. 

The last digit value:
0 = x 1
1 = x10
2 = x100
3 = x1000
4 = x10,000
5 = x100,000
6 = x1,000,000
7 = x10,000,000
8 = x100,000,000
9 = x1,000,000,000

680 = 6 8 x   1 = 68 ohms
681 = 6 8 x 10 = 680 ohms.
682 = 6 8 x 100 = 6800 ohms or 6.8 kilo-ohms
1111 = 1 1 1 x 10 = 1110 ohms or 1.11 kilo-ohms

You may see 0R5, 4R7 resistor code and may don't know how to read it, now your problem will be gone.
0R5 = 0.5 ohms
4R7 = 4.7 ohms
The R value is like a "." for a resistor code.