FPiDroid House Beta : an Advanced Smart House

by skorpyon1992 in Circuits > Microcontrollers

3188 Views, 22 Favorites, 0 Comments

FPiDroid House Beta : an Advanced Smart House

20150414_172716.jpg

FPiDroid House represents a monitoring and control network for smart houses, using FPGAs, embedded systems and web technologies. The main purpose of this project is to have a possibility to add and connect dinamically a lot of devices (each of them having their own state machine). These state machines are implemented over FPGA as modules , which work in parallel. Before implementing this project, or even develop it further you MUST know the following:

· HDL design (medium);

· Computer Architecture knowledge (medium to high);

· Microcontrollers (medium);

· C, Python, HTML, CSS, Javascript (medium);

There are a lot of steps to implement this project, but i will try to explain as much as I can. Some helpful information can be found at the following links :

http://www.arm.com/products/processors/cortex-m/cortex-m-system-design-kit.php

http://infocenter.arm.com/help/topic/com.arm.doc.ddi0432c/DDI0432C_cortex_m0_r0p0_trm.pdf

http://infocenter.arm.com/help/topic/com.arm.doc.dui0497a/DUI0497A_cortex_m0_r0p0_generic_ug.pdf

http://nineways.co.uk/ARM_IHI0033A_AMBA_AHB-Lite_SPEC.pdf

http://www.arm.com/products/designstart/index.php

https://www.digilentinc.com/Data/Products/NEXYS3/Nexys3_rm.pdf

NOTE : This project is still in beta mode, still has a few bugs and other minor issues ( such as uncommented code, untranslated variable and function names), but I will update as soon as possible the final version of it. This project is the result of a few months intensive work and more than an year of studying computer architecture, programming languages and other things, so it won't be easy to understand and replicate everything, or make it functionally from the first hit.

Get/purchase the Items You Need

· For the lighting system: LEDs, PCB, cables;

· For the window blinds : a cartridge sliding mechanism, L298N IC, 8 x 1N4001 Diodes, 2 x 100 nF capacitor, 2 x 0.47 Ohm 1W resistor, 2x Sharp GP2Y0D805Z0F, PCB, cables, 12 V 600-1000 mA power supply;

· For the temperature sensor board : DS1620 IC, 3x 200 ohm resistors, 1 x 100 nF capacitor, PCB, cables;

· For the heating system : 100 Watt incandescent Light Bulb, 1 x JQX-15F ( 220 V 20 A, or any compatible relay), 2x 1Kohm resistors, 1x 10Kohm resistor, 2N3904 transistor, 1N4148 diode, 1 LED, connectors, PCB, cables;

· For the cooling system : 12 V PC FAN, 1 x LEG-5 or any compatible relay, 2x 1Kohm resistors, 1x 10Kohm resistor, 2N3904 transistor, 1N4148 diode, 1 LED, connectors, PCB, cables, 12v 500 mA power supply;

· For the alarm : 1x buzzer, resistors ( 1K, 2.7K, 0.47K, 0.1K, 0.27K, 0.27K, 47K, 47K, 0.27K, 0.18K, 10K), diodes ( 3x 1N4148), pins, sockets, transistors ( BC547), capacitors (0.015 uF, 100uF, 0.01uF, 0.047uF, 100uF, 2.2uF, 473nF, 4.7uF), potentiometer, LED (LD274), fototransistor (BPW40), BS-115C relay, NE555 IC, LM741 IC, PCBs, cables , 12V 500 mA power supply;

· 1,2 or more Nexys 3 FPGA boards (one should be enough to simulate the smart house);

· 1 Raspberry Pi for each FPGA board, power supplies.

· For the remote control : TSOP 4838 38KHz IR receiver, and a NEC format remote control;

Install Xilinx ISE 14.2 and Digilent Adept 2.15.3 .

You have to install Xilinx ISE 14.2 in order to modify the FPGA project, and Digilent Adept 2.15.3 to program the FPGA board.

Create a Test Program

test1.png

Create a test program (which will be useful to modify you IR module from Verilog, according to your remote control). Add irreceiver.v and irreceiver.ucf and connect TSOP4838 pins to corresponding constraint ( see irreceiver.ucf and Nexys 3 reference manual).

Load the .bit file to FPGA (with Digilent Adept) and test. NOTE: you will need a NEC format remote control.

Write down the binary values (showed on LEDs) by each button you press. you will need the values to modify the main project ( you have to adjust the code according to your remote control, otherwise local control won't be available).

Create the Circuits

20150414_201054.jpg
20150414_201102.jpg
20150414_201115.jpg
20150414_201132.jpg
20150414_201153.jpg
20150414_201206.jpg

Create the circuits from the following schemas and solder components.

More details how to make the H-Bridge : https://www.instructables.com/id/Dual-H-Bridge-L298-Breakout-Board-Homemade/

Connect circuits to power supplies, to FPGA pins ( they are written on the schemas, see reference manual for more details ).

Xilinx Project

Open the following project and modify irreceiver module. Synthetize, translate and generate programming file. NOTE: in order for this project to work , you need to obtain Cortex-M0 DesignStart IP core.

Downloads

Install Keil MDK5 and Cortex M0 Processor Support

Downloads

Test the Local Control of the House.

SnapShot 152.png

I have put a reference photo of Digilent Adept software. Upload xilinx project .bit file on SPI memory (select SPI flash, at FPGA programming file to flash , browse for .bit file, and then hit "Program") and .bin file from MDK project on BPI memory ( select BPI flash, browse for .bin file, put address 0 at start address, choose Hex, and hit Write) . Test devices, and their local control.

Raspberry Pi Setup

Instal raspbian on an SD card.

Raspberry Pi installation

Install sleekXmpp from git repo : sleekxmpp

Install python from repository;

Install pyserial : pyserial

Install Apscheduler from here : https://pypi.python.org/pypi/APScheduler/2.1.2

Install OpenFire Server

Install OpenFire XMPP server following this tutorial :

Installation

Configuration

Create at least two users using admin panel : http://localhost:9090/ .

Raspberry PI Script Setup

Setup configuration file ( uploaded in archive ).

Apache and Website

Setup apache on Raspberry Pi.

Copy the website on the corespondent apache folder.

Make Some Final Tests and Enjoy!

20150414_172702.jpg
20150414_172720.jpg
20150414_172729.jpg
20150414_172737.jpg
20150414_172740.jpg
20150414_172747.jpg
20150414_172755.jpg
20150414_172800.jpg

Load Xilinx and Keil MDK projects to FPGA boards. Connect the FPGA to raspberry pi (through Nexys 3 USB-UART port). Open a terminal on raspberry pi or connect with SSH or Putty. Browse to the script folder and start python script from the command line with the following command : python script.py -c configuration. Make sure that xmpp and apache are running before starting the script. Take a smartphone, tablet or PC and login to the website (http://[raspberryPi IP address]/[folder of web application]). Login and start testing. (controllers ID must be a list of smart houses IDs separated by comas , e.g. rpi1,rpi2,rpi3 or user1 etc).

If you need any help for configurations and additional steps (until i will upload the final version) do not hesitate to contact me! Thanks for watching and enjoy!

Youtube Videos

Digilent Design Contest 2015 - FPiDroid House
FPiWeb House Test Phase