Introduction: DIY Smart Home for Pet

Hello friends. We meet here because we have in common are people who love animals.

Today I share with you the project takes up a lot of my time. Hope you enjoy it.

- Automatic feeding in real time. Automatically turn on the fan and LED warning when the temperature exceeds the allowed threshold. Update parameters from the pet's home to your phone continuously. Automatically switch to battery when power off.

My project has 2 parts: Designing a house + Smart system for the house.

- Designing a house: It is not difficult but it will take a lot of time if you do not have professional tools like me.

- Smart system for the house: This is an extremely interesting part. I believe it will be useful for your IoT projects later. For shared source code on the Internet you will often see the command placed in the " loop () ". This is extremely bad. It will cause your IoT project to hang.

The opening is probably like that. Let's get started

Step 1: Designing a House

- I will give you my house size. Please select your favorite materials and cut them to the size as in the picture. I really hope to see more amazing designs from you.

- The house is divided into 4 main parts. 1st floor, 2nd floor, ceiling and roof.

- The ceiling is because I don't have enough materials to make it so I send the image for you to refer to the size.

- It's easy for made. You can see video on my YouTube channel for easy visualization.

- Some useful tools will help a lot for you. They are very cheap but really great.

1. https://www.banggood.com/Double-Head-YT-180A-Wood-...

2. https://www.banggood.com/6pcs-HSS-14-Inch-Hex-Shan...

3. https://www.banggood.com/6pcs-6-19mm-Chamfer-Cutte...

4. https://www.banggood.com/Woodwork-Guide-Oblique-Ho...

5. https://www.banggood.com/90-Degree-Right-Angle-Cor...

Step 2: Smart System for the House - P1

- This part is extremely interesting. There are code that takes me a few days. At first I chose Arduino and rtc module. But it's a bit more components. I have switched to using esp8266. The project components consist of only 3 main components.

1. NodeMcu Lua ESP8266 ESP-12F WIFI Development Board

https://www.banggood.com/Geekcreit-Doit-NodeMcu-Lu...

2. DHT22

https://www.banggood.com/AM2302-DHT22-Temperature-...

3. 5V 4 Channel Relay Module

https://www.banggood.com/5V-4-Channel-Relay-Module...

Of course you will need the power cord, docking device, fan, signal light, sevor or Dc gear motor as I am using.

Using sevor is the optimal solution. Unfortunately my order has not been delivered. I temporarily use Dc gear motor.

In the next part, I will talk about how to use esp8266 and provide the code for you.

Step 3: Smart System for the House - P2

1. To start you will need to download Arduino IDE from here. And install it.

https://www.arduino.cc/en/Main/Software

2. To enter: File→ Preferences, textbox Additional Board Manager URLs then add link:

http://arduino.esp8266.com/stable/package_esp8266c...

3. Tool→Board→Node MCU 0.9 Select the COM port corresponding to the corresponding NodeMCU module.

4. Installing NTP Client Library

Tools > Manage Libraries…

typing ‘ntpclient’. Look for NTPClientby Fabrice Weinberg. Click on that entry, and then select Install.

5. Installing DHT Client Library

Tools > Manage Libraries…

typing ‘dht’. Look for DHT sensor library by Adafruit.. Click on that entry, and then select Install.

Step 4: Smart System for the House - P3

- Time zone you can see here:

https://www.ntppool.org/en/

- You need to adjust the UTC offset for your timezone in milliseconds.

Ex: For UTC -5.00 : -5 * 60 * 60 : -18000

For UTC +7.00 : 7 * 60 * 60 : 25200 as my code

For UTC +0.00 : 0 * 60 * 60 : 0

Time is very important. Because we feed our pet in real time.

Step 5: Smart System for the House - P4

Code for my friends:

- In this example I set the time to automatically feed 3 times. 5:38 - 11.38 - 17:38. Please change to suit your needs.

- If you have additional features. Please keep void loop () clean as mine. It is extremely important. By otherwise your system will be suspended.

- In the code I also describe in detail. You can change the notification color as you like. Just fix it

- There is a simple way to find your favorite color. Just paste the color code into the google search page

- You may get an error when updating the code. Please unplug the relay and select update again

Step 6: Smart System for the House - P5

Connecting components:

- DHT 22:

+ NodeMCU --- DHT 22

+ D4 --- D0

+ GND --- GND

+ VCC --- 5V

You can see more here:

https://learn.adafruit.com/adafruit-io-basics-temp...

- Relay:

+ NodeMCU --- Relay

+ VCC --- 5V

+ GND --- GND

+ D5 --- In2 ---> Automatic Feeder

+ D6 --- In1 ---> Cooling Fan

+ D7 --- In3 ---> Led

+ D8 --- In4 ---> Heater Fan

You can see more here:

https://www.instructables.com/id/NODEMCU-10-ESP826...

You can view my attached clip for easier visualization of the automatic feeding system. And how to connect components.

Step 7: Smart System for the House - P6

Our systems feed pets in real time. And time is taken from the internet so we need solutions to keep power 24/24.

- I use Automatic Switching Board. It is very cheap and works great. You may need at least two. 1 for smart home system and 1 for your wifi.

https://www.aliexpress.com/item/32850710046.html?s...

- Some other necessary components

1. LM2596 DC-DC Voltage Regulator Adjustable Step Down

https://www.banggood.com/LM2596-DC-DC-Voltage-Regu...

2. Create your own 3s battery pack. I created my 3s4p battery pack

https://www.banggood.com/3S-20A-Li-ion-Lithium-Bat...

Step 8: Smart System for the House - P7

1. You will need blynk application for this project. Link:

https://blynk.io/

2. Let's start a new project.

- Download Blynk app

- Create New Account in Blynk app

- Create New Project

- Get Auth Token

Check your inbox to see if you get an email from Blynk with the Auth Token. You will need it later.

- Install Blynk Library

http://help.blynk.cc/en/articles/512105-how-to-ins...

- More about blynk here:

3. Please set the parameters as my photo. So you've completed a great project for your pet.

Step 9: Future Plans

I plan to upgrade the system with a few details in the future.

1. Automatically pump drinking water when pet stands in the right position.

- Update: Available

But I don't have enough time to use it for my system

2. Check the status of food and water. Our pet will not be hungry when we forget to give up food.

3. Thank you for reading. I really need your suggestions to improve.

I have more than 300 subscriptions on my YouTube channel. Please subscribe to support me. I need 700 more subscribe to enable making money. Google will pay more to help me complete more interesting projects. Best regards.

Pets Challenge

Participated in the
Pets Challenge