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 connect volume control to an amplifier

I saw a comment on my Youtube video, he asked me how to connect any amplifier module to a volume control or potentiometer. I think so many people who want to start an electronic project must know this basic wiring too, I hope this wiring diagram will help an electronic DIYer like me.

First thing you need to know:

  • use shield wire for an input signal to volume control and from volume control to amplifier if you don't want you amplifier suffers from parasitic oscillation (sound like JeeeeJeeeee).
  • keep a wiring as short as possible.
  • use low resistive value volume control (5-10 kilo-ohms) if the amplifier has random parasitic noise when you turn a volume control up or down.
  • volume control is a potentiometer.
Volume control principle is a signal divider, the more volume control output(yellow line) near input signal source(pink line) the most signal flow to an amplifier. When you lower a volume control the resistive value between a volume control output and an input signal are increase and cause some input signal divided and flow to a ground because of resistive value between volume control output and ground decrease.

You can see I use a capacitor to block DC current to an amplifier input, but if you use board amplifier you shouldn't use the blocking capacitor because a board amplifier module(pam9610,pam8403,ta2024 as reference) always attaches the input D.C. blocking capacitor in an amplifier module.

What is an input D.C. blocking capacitor value?
You can use 1 microfarad, 16 volts, in some case increase or decrease input capacitor value can make sound different. If you use a lower value such as 0.47 microfarad you will hear sound brighter but less bass, so you can change the value that suits your listening style.

Where is the input of an amplifier module?

Below picture shows the input of an amplifier board

This is PAM 8610 board  has two channel (stereo), you can see two input but one ground.
See the first picture and you will see a ground from a signal source, that is the ground you connect to an amplifier board. As I explain above you can eliminate D.C. blocking capacitor because PAM 8610 board has the onboard-dc-blocking capacitors.

You can use a volume control output as the yellow mark in the first picture connect to Left or right channel input on the amplifier board, you must use twin channel volume control for a two-channel amplifier for better sound, and frequency respond.

If you need your amplifier board more sensitivity, you can make preamplifier that boost 10 times voltage gain for you project here >>> How to make simple preamplifier


  1. hi,, which it is the value of the capacitors?

    1. You can use 1 micro farad capacitor, voltages at least 16 Volts. You also can use film type capacitor that has better audio performance but size are very bigger.

  2. hello Phethai,

    you have amazing post about electronics , many people seearch this. Im an electronics hobyist.

    Thanks for sharing.
    Visit my site also at

  3. according with pam8610 datasheet, this chip have a pin for volume. but some manufactors dont use it. can u make a volume for this native voloume pin?

  4. Very informative thread Phethai..I want to use this amp with my guitar...output of guitar is obviously mono...can I join +ve with both left and right input of this circuit and -ve with the ground so that I get output on both left and right speakers...??

    1. You can join both amplifier channels input (L and R) and connect it to guitar output without any problem and connect ground to the guitar output ground.
      Join +ve to left and right input of this circuit make amplifier destroyed, don't do it!!!

  5. Thanks for your response friend...I am not expert in electronics...I find both of the above situations explained by you the same..please explain..also please confirm whether it is safe joining input L&R of amp circuit..afterwards connecting guitar's ground to amp's ground and guitars phase to joined input LR.

    1. power amplifier input impedance very high, if the power amplifier input(L R) use the same ground, you can join both input without any problem.
      Second answer: You need an XLR preamplifier, so you can't connect the XLR output to a power amplifier directly.

  6. Bro can we do something like connecting 2 amplifier module from one input source

    1. It's easy, just connect each amplifier module to each DC blocking cap and connect another DC blocking cap leg(both of them) to volume control output on the first picture in this page(yellow line, remove DC blocking cap in the first picture).

      A power amplifier module input resistance is very high ( 30 kilo-ohms to fews mega-ohms or more with a j-fet input amplifier) and normally the AV/line out audio source resistance is around 10 kilo-ohms, so you can parallel input of power amplifier module without any problem (depending on input resistance of the power amplifier module).


Post a Comment