Arduino Automatic Temperature& Humidity Controller for Pets





Introduction: Arduino Automatic Temperature& Humidity Controller for Pets

    Jack and Jose, a pair of beautiful hamster, has accompanied me over 100 days and nights. Their soft white fur makes me quiet and warm, especially when I coding in the winner.

    But the very tragic things happened in the last week. As the cold air from Siberia, Shenzhen has suffered low temperature and humidity for than 10 days. The temperature is about 10 degree, makes me fell chilling every day. The very bad thing happened: Jack and Jose, leaved me away……

    It was such a sad afternoon. After I buried them, I had a new idea on my way home: I need to create a house, a house with floor heating, air conditioning, for my further new friends.

Step 1: Module Preparing

As a software engineer, I am not good at hardware, So i decided to use the most easy-to-use platform: Arduino

After browsing on the web, I got the following modules:

1. Crwoduino: an Arduino compatible platform, with some upgrading features to make it easy to use.

2. Temperature & Humidity Sensor and a 4.7K Resistor. I need this sensor to report the controller the current temperature and humidity.

3. LCD Keypad Shield. With this LCD I can monitor the current temperature and humidity, thus to make this project practical in my daily life.

4.2-Channel Relay Module. As the Ultrasonic Nebulizer uses power more than 5V, so a relay module was used to control the Ultrasonic Nebulizer on/off.

5.A Ultrasonic Nebulizer to increase the air humidity.

6. Screw Shield , this shield helps me connecting the wires easier.

7. Thermal Tablet: this thermal tablet acts as heater for the pet house.

8. Some Wires or Wires would be needed

Basically, the temperature& humidity sensor reports to the Crowduino how cold it is now. If the Crowduino “think” it is too cold, then it will open the thermal tablet to warm the hamster or the ultrasonic nebulizer to begin the air humidification.

Step 2: Temperature& Humidity Measurement

    The Basic Connection of all the modules(Crowduino, temperature sensor, relay module…) as above image.

    First, connect the temperature& humidity sensor AM2302 to Crowduino board. Using the wire jumper, connect the AM2302 power supply pins to Corwduino VCC and GND, connect the “SIG” pin of AM2302 to A1 of Crowduino.

    Note that a 4.7K pull up resistor is needed between “SIG” of AM230 and VCC. Actually, you can also find  many temperature and humidity module that had integrated the pull up resistor on the module, so you do not need to add the pull up resistor by yourself and thus the story would be easier .

Step 3: Connect the Relay to Crowduino, to Control the Ultrasonic Nebulizer and Thermal Tablets.

    Connect the “IIN1”and “IN2” of the 2-channel relay module to A4 and A5 pin of Crowduino (or Screw Shied), power the relay module using jumper wires. In this way, Crowduino can control the 2 relays separately to power on/off the ultrasonic nebulizer and thermal tablets.

    At last, connect the ultrasonic nebulizer and thermal tablets to relays. For the ultrasonic nebulizer, I cut off it is positive wire, and connect its one end to the relay1 “COM” port (the port in the middle), connect the other end to relay1”NO” terminal. For the thermal tablets, it would easier, solder its terminals to DC jack and connect to relay2 with the same way of ultrasonic nebulizer

    After the connecting, the basic hardware for hamster new house completed.

    To monitor the current temperature and humidity, I added a keypad shield to my system. Plug the Keypad Shield on the Screw shield. Actually, this shield is optional if you do not care about the measured current temperature and humidity.

Step 4: Upload the Programs to Crowduino

    Download the below program and open it on your Arduino IDE.

    In this program, I set the trigger temperature to 9 degree and the trigger humidity to 45, that is, when the temperature measured by the sensor is below 9 degree, the crowduino would control the relay module to power on the thermal tablets, to make the hamster warm; when the relative humidity below 45%, the ultrasonic nebulizer would be powered on to increase the humidity of air.
   Of cause, if you want the change the trigger temperature or humidity, just modify the "temLowTrigger" and "humLowTrigger" to temperature&humidity that you want to trigger the thermal tablet and ultrasonic nebulizer.

  i f you are not familiar with Arduino and its programming, you can  refered this page.

Step 5: Test and Install

     While system is running, the current temperature& humidity can be monitored via the LCD Keypad Shield.

    Insert the thermal tablet at the bottom of the hamster house, i also added some wood flour  as they keep the house warm like  quilt. The thermal tablet will be active when the temperature below 9 degree and can be up to about 40 degrees; Put the ultrasonic nebulizer in water with depth of about 0.3 meters, it will be active when the relative humidity below 45%. 

    After testing, the system works perfect, the thermal tablet begin to warm up when the temperature is low, and the ultrasonic nebulizer begin to work, with beautiful blinking LED. With this system, I believe my hamster would be happy when I keep pet next time.

    Wish my Jack and Jose happy and warm in the heaven! 

Pet Contest

Second Prize in the
Pet Contest



    • Oil Contest

      Oil Contest
    • Clocks Contest

      Clocks Contest
    • Woodworking Contest

      Woodworking Contest

    We have a be nice policy.
    Please be positive and constructive.




    Thank you for all your notes in the code. It really helps me learn.

    You'd have to connect a dehumidifier to the relay and trigger it to turn on at a certain humidity reading. Be careful though, some relay's are limited at 1A-2A, and many dehumidifiers draw far more.

    I am very sorry for the death of your 2 beloved hamsters Jack and Jose. Let their souls rest in peace. I also lost my pet rabbit Messi and i understand your feelings.Thank you for making this instructable jack1986.

    Jack and Jose will be honored by the steps you took to prevent the mishap from repeating itself . Will the wiring and electronics be separated from the enclosure ? The reason I ask is your new friends may chew on any exposed parts which could be tragic. Under a glass sheet or cutting board comes to mind , but I am sure there are better options to keep things safe .

    Very nice project , thank you for sharing !


    1 reply

    You could take and thermal glue the thermal pad to the underside of the glass aquarium. It would be messy, but it would flawlessly transfer the heat from the pad into the glass, generating the same effect, but with absolutely no parts inside of the enclosure. also, you could have the humidifier in a corner of the enclosure, and have a fine wire mesh, with gaps no bigger than 1 mm, and seal that corner of the enclosure, forming (looking down from the top) a triangle out of that corner. I feel that this would provide adequate protection.

    I am so sorry you lost your beautiful hamsters. I lost mine last year and it still hurts. They are very dear little creatures. Thank you for this great tutorial.

    So sorry. I feel the same about my little citters (Gerbils). We had a very bad snow storm this winter and the power lines came down and the mayor told us to expect no power for a few days. We drove our critters to a friend with power when the house became too cold for them (14 Cel). ALSO at night we drop the temperature to 18 Cel and that may be too cold for our gerbils, so we have a "foot" heater to keep them warm. It radiates consistant heat. This photo shows them sleeping in the food dish because it is warmer by the heater.


    My condolences on your loss of Jack and Jose. I applaud you by turning your grief into ingenuity and elbow grease, though! Would this heat enough as an undertank heater? I ask because I find anytime wires are accessible, a hamster/gerbil/what-have-you WILL eat the wires.

    Hey, nice idea. I'm just missing the powerOff trigger teperature and humidity. Dont let your little friends overheat and get a too moist enviroment.

    thermal tablets are usually used on the outside of the cage. When using a glas or plastic cage this works great. If you have a insulating cage I would suggest making a false glas bottom to go over the thermal tablet. Makes it easier to clean too!

    I'm sorry for your loss. But, it is heartwarming to know that out of this tragedy you were able to develop a system that can be used to protect future furry friends. Thank you for sharing and thank you for all the little ones lives you have saved by sharing.

    How do you prevent them from eating the wires or heater pad? My daughter has a hampster and it will try to eat anything that is not food.

    Is your thermal tablet waterproof? I would hate to see some fried hamsters due to the electrical conductivity of urine.

    This is a good idea. I've been working on doing the same thing but with a smaller form factor (and cheaper) arduino so I can leave it in the installation.

    1 reply

    The tablet won't fry the hamsters, it just runs 12V, but I wouldn't
    place it at the bottom, I had hamsters and they started to smell bad
    after a week or so, heating the padding would keep the hamsters warm but
    will also spread the urine odor.

    P.D: I've noticed the hamster cage is made out of plastic, make sure they have a good ventilation too.