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 dynamically 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:
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 a 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.
Step 1: 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
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.
Step 3: Create a test programCreate 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).
irreceiver.v
4 KB
irreceiver.ucf 380 bytes
Create the circuits from the following schemes and solder components.
More details how to make the H-Bridge: http://www.instructables.com/id/Dual-H-Bridge-L298-Breakout-Board-Homemade/
Connect circuits to power supplies, to FPGA pins (they are written on the schemes, see reference manual for more details).
Step 5: Xilinx projectOpen the following project and modify IR receiver module. Synthetize, translate and generate programming file.
NOTE: In order for this project to work, you need to obtain Cortex-M0 DesignStart IP core.
Xilinx ISE.rar 2 MB
http://www2.keil.com/mdk5/install/http://www.keil.com/dd/chip/4803.htm
Open following project, build and compile.
Keil MDK.rar 56 KB
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.
Step 8: Raspberry Pi SetupInstall Raspbian on an SD card.
- 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 XMPP server following this tutorial:
Create at least two users using admin panel: http://localhost:9090/
Step 10: Raspberry PI script setupSetup configuration file (uploaded in archive).
Raspberry Pi - Instructables.rar1 KB
- Setup Apache on Raspberry Pi.
- Copy the website on the corespondent Apache folder.
- Web Instructables.rar 820 KB
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 upload the final version) do not hesitate to contact me! Thanks for watching and enjoy!
Step 13: Youtube Videos
Comments