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;

power your amp board from laptop usb, is it a good idea?

It 's easy to power your small amplifier board from a laptop USB port because you don't need to find another power source and worry about battery empty.

However, there is some drawback when you use USB port as your amplifier board power supply.
First, you need to know that USB 2.0 can supply current up to 500 mAh/hour or USB 3.0 can supply current up to 900 mAh/hour but small class d amplifier board require over 6 watts of power for full output power (pam8403 board power consumption without calculating 17 percent loss in an amplifier board) That mean laptop USB port need to supply at least 1200 mAh/hour to amplifier board.

What will happen if you use laptop USB port as an amplifier power source?

- Your amplifier will not bring output more than 2.5 watts of music power. You don't have to worry about the output power if you play music not loud or play action movies/games.

- If you trying to play loud music and your laptop USB port can not handle it your laptop USB port's circuit may damage.

- Computer USB port has the output current limit that means you may hear sound distort when deep bass playing because of its lack of power supply current.

How to make your amplifier board sound better when using USB port as a power supply?

- Use USB 3.0 type if your laptop or computer has it. USB 3.0 can supply current up to 900 mAh/hour.

As you can see below image a USB 3.0 port color is blue not black like USB 2.0 port's color.
- Add audio grade capacitor to amplifier board power supply because it helps amplifier bass respond and performance. See how to add power supply filter capacitor.

- Use 8 ohms impedance loudspeakers if you can find. The  8 ohms loudspeaker consumes current around 1/2 times of 4 ohms impedance loudspeaker but amplifier's output power decrease half too.

- Add built-in rechargeable battery in your amplifier project and every problem will be gone but you need to charge it when the battery empty and you also need battery charging circuit too.

Enjoy your DIY projects!!!