LiveSmart
This instructable will guide you through the steps of creating "LiveSmart", a full automatic House with a web interface.
Supplies
Below are the supplies you'll need in orde to follow this guide.
Note that some steps could be done differently, like soldering instead of using a breadboard. This will just guide you through the process and supplies I used in my design, feel free to make any changes you want.
Hardware
- Raspberry PI 4
- MCP3008
- button
- 10k resistor
- 220 resistors (x4)
- 2x16 LCD
- RFID-Reader
- LDR
- DS1820
- White Led
- Red Led
- Servo motor
- Fan (12V)
- enough cables
- external power supply (12V)
- Tip120 transistor
Making the Case
Making the case for this project is our first objective, this'll make installing the hardware easier.
Lasercutting
Download the included .AI files and take them to your closest laser-cutting-shop along with your multiplex plates. And then lasercut those plates with the provided file.
Putting it together
Just put them togheter like shown on the picture.
The Electronics
This section is rather easy to explain, just follow the scheme included here.
Downloads
Setting Up the Raspberry PI
Woohoo, now on to the fun part! Setting up the raspberry pi :D
Installing the raspberry pi
Creating the image
First off, you'll need to download both of the linked files.
- Win32 Disk Imager
- Raspian OS
Now follow these steps:
- Insert your micro-SD card into your computer
- Open Win32 Disk Imager
- Select the .img file you just downloaded
- Click 'write'
In order to get access to the pi, we'll need just a few more steps
- Go to the SD-card's boot directory
- Create a text file called "ssh.txt"
- Delete the ".txt" extension
- Open the file "cmdline.txt"
- At the end of the file, add ip=169.254.10.1 (but keep this on the same line as all the other text.
Setting up the pi
Plug 1 end of an ethernet cable in your pc and the other end in your pi.
Now power the pi, wait a solid 5min to be sure the pi has started correctly.
Open your favorite SSH client (I use Putty) and connect to the IP we gave the pi in the steps above.
Default username and password are "pi" and "raspberry". In raspi-config, enable I2C.
Getting the pi on wifi
In order to get your raspberry pi on your wifi, copy and paste the following commands:
sudo -iwpa_passphrase "mySSID" "myPASSWORD" >> /etc/wpa_supplicant/wpa_supplicant.conf<br>wpa_cli <br>interface wlan0 <br>reconfigure
Don't forget to replace "mySSID" and "myPASSWORD" with the SSID and PASSWORD of your router.
Downloading packages and scripts
We'll need to install some packages and scripts in order to get this project up and functional, so please enter following commands:
sudo apt install mariadb-server<br>sudo apt install apache2 -y <br>pip install Flask Flask-Cors Flask-MySQL Flask-SocketIO PyMySQL
Setting up the Database
In order for us to use the program to its full potential, we're going to need to install our database! So let's do this shit!
mysql_secure_installation
When it asks for our password, just press enter, as we have not yet created a user.
Next it's going to ask us if we want a root password, select yes, and enter the desired password. Select yes on all the remaining questions.
sudo -i<br>mysql grant all priveleges on rpiUser.* to ''@'%' identified by ''; <br>FLUSH PRIVELEGES
make sure you create a user called student with the password W8w00rd
Downloading the Application Itself!
We're almost there, just hang in with me a little bit longer!
Follow some commands (once again):
cd /home/pi<br>git clone <a href="https://github.com/VerkerkeMartijn/Project_one_Live_Smart.git">https://github.com/VerkerkeMartijn/Project_one_Liv...</a><br>sudo cp -R Website/ /var/www/html/<br>sudo cp -R LiveSmart/ /home/pi/LiveSmart sudo mysql -u root -p << DATABASE.sql sudo nano /etc/rc.local
At the end of the file that just opened, just before the exit, add the following line:
python3 /home/pi/LiveSmart/app.py $
And thats it, enjoy your mini smart home!