My Domotica

by M_Florian in Circuits > Electronics

195 Views, 0 Favorites, 0 Comments

My Domotica

20210614_192319.jpg

My Domotica is a system that makes your house safer and easier to control. I build this project because I am interested in home automatisation and I like doing it. You can control the temperature, alarm and a light with the site. The light automatically turns on and off with the help of a motion detector. At last there is a smoke detector for the safety.

Supplies

These are the components that are needed for this build.

  1. Raspberry PI
  2. Resistors :
    • 220 Ohm
    • 110 Ohm
  3. LCD screen
  4. Buzzer
  5. TMP36
  6. MCP3008
  7. 74HC595 shift register
  8. 3v-5v step up module
  9. 5v - 230v relais
  10. Lamp
  11. mini PIR
  12. BC547 transitor
  13. Raspberry Pi 5v fan
  14. 5v and 3v source
  15. MQ-135 smoke detector
  16. Potentiometer

The total price is around €64

Tools Required

  1. Soldering iron
  2. File
  3. Drill
  4. Screws
  5. Woodwork tools

Circuit Diagrams

schema_schema.png

LCD screen

On the LCD screen you can see the ip-adress to wich you can surf to go to the site. You can also see the temperature on the screen. The 74HC595 is a shift register used to control the LCD screen. If I dont use a shift register, the LCD screen would take up to much IO pins.


TMP36

The TMP36 is a temperature sensor. The temperature sensor has an analog output, thats why I use the MCP3008.

MCP3008

The Raspberry Pi can't read analog signals so that is why we use the MCP3008. The MCP3008 is an analog to digital converter(ADC). This is used to convert analog signals that come from sensors and convert them into digital signals.


MQ-135

The MQ-135 is a smoke detector that can give an analog and digital output. I use the analog output and connect it to the MCP3008

Mini PIR

The mini PIR is a pyroelectric infrared motion sensor. The sensor gives an analog signal when it detects movement. It can detect movements from 3 meters far. This sensor is also connected to the MCP3008.

Buzzer

The buzzer is used as an alarm. It is connected to a 110 Ohm resistor. If you give the buzzer a digital signal it will make a loud sound.

Raspberry Pi Fan

This is the fan to control the temperature. If the temperature is to high the fan will turn on. The fan is controlled with an BC547 transistor. This is because the fan runs on 5v but the RasPi(Raspberry Pi) can only supply 3v so I used a transistor.

Lamp

The lamp is controlled by a relais that switch 230v and 30A. It is a 5v -230v relais, this means you give a 5v signal. Like I said before the RasPi can only suply 3v so that is why I use a 3v-5v step up module. I can use a transistor here because the transistor can't deliver enough current.

Making the Circuit

200346819_537778010918359_953312354507695314_n.jpg
199911500_720942268600056_469496099293628855_n.jpg

First off I started by reading the temperature sensor and putting that on my site. Once that worked I started by connecting all the other electronic devices. I use 2 breadboards to connect the components with the Raspberry Pi.

If you look at my diagrams you can recreate the whole circuit.

Setting Up the Pi

Before I started programming I had to set up the RasPi.

Step 1: Connecting the RasPi to the internet:

use the command:

"wpa_passphrase >> /etc/wpa_supplicant/wpa_supplicant.conf"

Replace by the name of your wifi at home and by your wifi password.

Then use the command "wpa_cli -i wlan0 reconfigure" to reset the network card of the RasPi. If you then use

"ping www.google.com" you should get a connection.

Step 2: Full update/upgrade:

  • Use the command "apt update" to update the RasPi.
  • Then "apt upgrade" to upgrade the RasPi. If they ask if you are sure press 'y'.

Step 3: Installing apache:

  • "apt install apache2 -y" to install apache, webserver.

Step 4: Install MariaDB:

  • U can find a lot of tutorials to do this so I will just leave a link here.
  • MariaDB is used for the database.

The Code

I use Visual Studio Code for my coding. You can find my code here

The Database Schematics

db.PNG

The database is very simple and is easy to understand. Each component is listed in the component table and then every measurement is stored in the meting table with the componentid of the right component.

Making the Case

131363653_3030179773932528_4094834809101274467_n.jpg
199820328_172192678117129_7157641365195963934_n.jpg

Step 1: Drawing and cutting

First off I started by drawing the case on my wood with a pencil. When that was done I cutted it with a saw and used a file to smoothen the edges so I don't get splinters.

Step 2: Painting

Once everything was cut I painted the inside of the house white and the outside red. The roof is kinda black.

Putting It All Toghether

200011406_396441178567458_6998403041548997319_n.jpg

Step 1: Screwing it together

Once the paint was dry I started by screwing everything together so it looks like a nice house.

Step 2: Mounting everything in the case

Then I assembled everything in the case and made wholes so every component fits perfect.

Decorating

131629608_289047572941135_6821956436884334569_n.jpg
200789470_387656985984927_1050103266680683513_n.jpg
199531592_141561154615109_2376037402554817926_n.jpg
20210614_192319.jpg

At last I decorated a little bit because it was kinda empty. Then I was done. I finished my project. I can control the temperature with my site, turn on my lamp (wich it automatically does because of my motion sensor) and control my alarm.