Cooling and Detecting System for Dogs.

by Bryan_V in Circuits > Raspberry Pi

460 Views, 2 Favorites, 0 Comments

Cooling and Detecting System for Dogs.

Coolant.png

Hello, my name is Bryan and I have two dogs. I was wondering how i could cool them off in a trailer on a hot day.

My solution is to make a cooling and detecting system. The detecting system is to make sure that the system is active when the dogs are in the trailer. For this I use a load cell, HX711 (scale) and an ultrasonic sensor (distance). To measure the temperature I use a ds18b20. So can you establish the desired temperature. You can also make an alarm when you give a minimum and maximum temperature as input. For the alarm I use an active buzzer. To cool the dogs off you will need a fan. You can also use a display so you dont need to visit the website. And as last you will need a button to turn on/off all your sensors. We will also make a database to save all the data from the sensors and use it. And we can't forget to make a housing for this project ofcourse.

Now you know a little more, lets start with this project.

Supplies

The budget for this project is around € 122.

Tools

For this project you will need:

  • Raspberry Pi 3 model B
  • Adapter (5V)
  • SD card
  • UTP cable
  • Raspberry PI T-cobbler
  • 18650 battery shield v3
  • NCR 18650 B
  • Breadboards
  • Resistors
  • Jumpers
  • HC-SR04 ultrasonic sensor
  • ds18b20
  • Load cell
  • HX711
  • Geekcreit® IIC / I2C 1602
  • Potentiometer
  • Fan
  • NPN transistor
  • Pushbutton
  • Active buzzer
  • Wood

Downloads

Make Circuit

Coolant2_bb.png
CoolantSchematic2.png

There 's nothing special about this. Just follow the fritzing scheme and everything will be alright. Be carefull, make sure you use the right pins and resistors. It's better that you check your circuit twice before we continue.

Making Database

ERD.png

Now we will make a database so we can save the data from your sensors and use them if we need it. To make this database you will need to make a model on MySQL Workbench. If you copied my model you can forward engineer it and your database is ready to use.

Code

Annotation 2019-06-17 134539.png
week02 pi one wire.jpg
week02 pi one wire2.jpg
week02 pi one wire3.jpg
week02 pi one wire4.jpg
week02 pi one wire5.jpg
week02 pi one wire5_LI.jpg
pi.png

You can download the code on my github repository. Just follow this link: https://github.com/NMCT-S2-Project-1/nmct-s2-project-1-BryanVermaeren. What can you find: HTML, CSS, JS, Python (code + classes) and my database (query).

First of all change the ID number in the code. Every ds18b20 (temperature sensor) has an own ID number. How to know what your ID number is? Just follow these steps.

1. Enable de one-wire interface

Type this command in the terminal.

sudo raspi-config

Now enable the one-wire.

2. Load one-wire module

Type this command in the terminal.

sudo nano /boot/config.txt

Uncomment the next line:

dtoverlay=w1-gpio

Save the file.

3. Reboot

Type this command in the terminal.

sudo reboot

4. Find ID number

Go to this directory on your terminal.

cd /sys/bus/w1/devices/w1_bus_master1

In this folder you will find your ID.

Now replace my ID with yours in the path from your temperature sensor.

If you have downloaded everything place the HTML, CSS, and JS on your apache server on your raspberry pi. If you dont have an apache server yet, just type this two commands in the terminal and wait until everything is finished.

sudo apt-get update
sudo apt-get install apache2

You can upload the files by using FileZilla or another program who uses sftp file transfer. Upload the files to /var/www/html . The frontend is ready.

Now the backend. Make a directory on your raspberry pi where you will save the files. An example is 'home/pi/folder'. I used pycharm to upload the files but you can also use different programs for it. After that we will autorun this file everytime the raspberry pi boots up. There are many ways to do it but I prefer the one that I used.

First go to this file.

sudo nano /etc/rc.local

Place the following lines between 'fi' and 'exit 0':

cd '/home/pi/folder' (the directory where you saved it)
sudo python3.5 -u -m flask run --host=0.0.0.0 --port=5000

Save the file.

If you did everything right, everything is ready to use. Make sure your raspberry pi is connected to the wifi.

Housing

Annotation 2019-06-17 140755.png
Annotation 2019-06-17 140639.png
Annotation 2019-06-17 140857.png
Annotation 2019-06-17 140711.png
Annotation 2019-06-17 140819.png
Scale_Project_load_cell_on_base_plates.jpg

For this you can decide how you want it. I used a wooden box and made a little adjusments so everything would fit in and visible. You can see my display, button, potentiometer, ds18b20, and active buzzer. And the ultrasonic sensor, fan , weight sensor (load cell, HX711) are connected with a long cable so you can place them anywhere. Make sure everything is visible and can fit in your housing. You can look how I did it.

Important! Make the weight sensor like I did it or the design that I found on the internet. Otherwise you won't be able to measure the weight.

If you did everything right, the project is done. I hope your happy with the result ;).