Smartroom

by WoutVC in Circuits > Raspberry Pi

447 Views, 1 Favorites, 0 Comments

Smartroom

20200615_114546.jpg

Do you ever feel like laying in your bed and not wanting to get up? Do you ever feel like getting up to open your shutters is to much to ask for? Then I have the perfect solution for you. Introducing Smartroom, take control of your room with your mobile phone, tablet or even your computer!

Supplies

In the next step I will be showing the list of supplies that you will need. Most important of all you will need to have a Raspberry Pi and your computer.

Gathering All of Your Supplies

20200613_161110[2].jpg
20200613_161117[2].jpg
20200601_181134[1].jpg
20200606_151819[1].jpg
20200601_181152[1].jpg
20200612_194805[1].jpg
20200612_194650[1].jpg
20200612_194711[1].jpg
20200612_201803[1].jpg
20200609_110639[1].jpg
20200612_194618[1].jpg
20200614_155354[1].jpg
20200614_155335[1].jpg
20200614_155320[1].jpg
20200614_155308[1].jpg
20200614_155258[1].jpg
20200614_155246[1].jpg
20200614_155416[1].jpg

Most important, the supplies! I have placed everything in an Excel spreadsheet.

Building the Housing

20200613_161117[1].jpg
Scan_20200601.png
Scan_20200601 (2).png
20200601_145347[1].jpg
20200601_145349[1].jpg
20200609_172830[1].jpg
20200609_153836[1].jpg
20200604_165230[1].jpg
20200604_165159[1].jpg
20200601_181152[1].jpg
20200606_151819[1].jpg
20200601_181134[2].jpg
20200601_145354[1].jpg
20200613_105614[1].jpg
20200613_110128[1].jpg
20200609_174359[1].jpg
20200613_134635[1].jpg

For the housing I used an MDF panel size 122 cm by 61 cm, you can find those at any DIY store. Cut them with a circle blade saw with the dimensions in the drawing. The panels are then glued together with the Soudal Fix All glue. Painting is optional but gives it a nice touch :), I used the types of paint as seen in the pictures above. For the curtains I made a single sheet of the thinnest fabric I had. I also had a plastic tube laying around with a 90 degree angle. I cut those in pieces for the sensors to fit in.

Making the Circuit

breadboard_project1_v2_bb.jpg
schema_project1_v2_schem.jpg

This isn't the smallest electrical circuit but this is what makes this project fun. Try to avoid crossing jumping wires. The wires that don't go to the same breadboard should be longer. You can either solder two wires or connect male to female wires with each other.

Download the Code From Github

You can download the code for this project on my Github, the link is https://github.com/howest-mct/1920-1mct-project1-V... Click on Code and download the backend and frontend.

Make an SSH connection between your PI and Visual Studio Code, if you don't know how, here is a little tutorial. https://code.visualstudio.com/remote-tutorials/ssh...

In VS Code, create a new folder and call it whatever you want, seriously, it doesn't matter. Paste all the files from the Backend in that folder. Part one done. Now navigate to /var/www/ on VC Code and paste the frontend files in there. The coding part is now done!

Create the MySQL Database

Capture.PNG
Capture.PNG

The program I use for creating databases is MySQL Workbench. You can find the download link here. https://dev.mysql.com/downloads/workbench/

Create a wireless connection, refer to my settings, make sure that the SSH hostname is the IP address of your RPi.

Now go to the icon under File in the top left of the screen, click on it, it should open a plain SQL File. paste the smartroomdb.txt code in there and run it (the yellow lightning bolt). Now you are golden!

Downloads

Testing the Smartroom

Capture.PNG
104031171_281340326573087_8618976809212767571_n.jpg

Now that most of the technical parts are done, go to your just created folder in VS Code and start the app.py. There is a little starting icon on the top right corner. Now go to your browser and type in your RPi's IP address. You should see the site.

This website is created mobile first! So yes you can use this project on your phone. Just type in your RPi's IP address.

You can also let the project start when your Raspberry Pi starts. If you want to do this you will have to create a service of app1.py. Follow this tutorial https://www.raspberrypi.org/documentation/linux/u...

You will have to change main.py to app1.py and change the directory to the directory where app1.py is located. Test if everything works in the electrical circuit. If so, move on to the next step!

Putting the Circuit Inside Your Housing

104116230_1504670066370504_3049319273061558021_n.jpg
104099394_792114151323353_5465190362737951893_n.jpg
104070622_1480012095532291_2241356011922108052_n.jpg
83332553_556251508388937_4884909566431965057_n.jpg

You have reached the last part, congratulations!

Two holes will need to be drilled in the walls. One where the dressing is and one underneath the desk. You can use a regular drill for that. After that the breadboard with the MCP3008 and the L293D go underneath the dresser and the other breadboard goes underneath the bed. Cable management is up to you. I used a couple of sticky pads that I found in my local DIY store (Hubo).

Enjoy the Smartroom!

20200615_114537.jpg
20200615_114546.jpg
20200615_114557.jpg

You are now fully set up to use the smartroom, no more getting up to open your shutters!