Project

General

Profile

Users Guide » History » Revision 25

Revision 24 (Hammel, 20 Sep 2019 16:29) → Revision 25/67 (Hammel, 20 Sep 2019 16:33)

h1. Ironman Users Guide 

 table{border-collapse;width:100%}. 
 |={font-size:140%;margin-bottom:15px;background-color:#fdd}. This document is under development and is likely not accurate at this time. | 

 {{>toc}} 

 In this document the term _host system_ refers to a Linux desktop or laptop that will be used to download and install software 
 onto an SD card. 

 h2. Overview 

 _*Ironman*_ is a home automation project based on the PiBox build system.    It supports a Nest-like monitor for controlling Arduino based sensors, cameras and remote voice control. 

 |!http://redmine.graphics-muse.org/attachments/download/114!| 
 |={font-size:120%;margin-bottom:15px;background-color:#dff}. *Design Intent of the Ironman Project* | 
 |=. Mark I release is in progress.    Mark II and Mark III are future development plans.| 

 _*Ironman*_ consists of the following components. 

 | *Monitor* | The Nest-like control hub based on a Raspberry Pi 2/3 and the official 7" touchscreen display | 
 | *Sensors* | Arduino based devices, such as door alarms and cameras, running code based on a sensor and camera templates for pairing and secure communication with the Monitor | 
 | *Jarvis*    | A Java application that supports voice control of Monitor managed devices | 
 | *Controllers* | Network enabled control of Monitor managed devices | 

 h3. Security 

 _*Ironman*_ supports AES encrypted communication with IoT sensors and Jarvis interfaces. 

 h3. What it is 

 _*Ironman*_ is a do-it-yourself system, where you buy the parts and assemble them as described, modifying the provided code to suit your needs and handling flashing and maintenence.    _*Ironman*_ is designed to allow you to build your own home automation system where you specify the devices you want to control and how you want to control them.   

 h3. What it is not 

 _*Ironman*_ is not a product.    It is not intended for anyone other than Makers (aka DIY'ers) who like to tinker and see not just how to assemble things but why they actually work. 

 While the Users Guide is intended to bring up a currently working version of _*Ironman*_ with limited sensor and camera support, if you aren't prepared to deal with writing code or flashing devices and dealing with electrical circuits then _*Ironman*_ is not for you. 

 h2. The Ironman Monitor 

 The _*Ironman*_ Monitor runs on a Raspberry Pi 2 or 3 and provides a central hub for management of home automation devices.    It uses a 7" touch screen display and a mechanical switch to manage pairing with IoT devices and Jarvis interfaces. 

 h3. Installation Prerequisites 

 * A "Raspberry Pi 2 or 3":https://www.adafruit.com/product/3055 
 * The official "Raspberry Pi 7inch touchscreen display":https://www.sparkfun.com/products/13733 
 * The Pi 2/3 requires a "V / 2A power supply":https://www.adafruit.com/product/1994.    For best results, use a power supply rated to at least 5.25V to avoid under voltage conditions.    For ease of use the power supply cable should include an "on/off switch":https://www.adafruit.com/product/2379. 
 * The Pi 2/3 requires a microSD card that is at least 4GB.    A mechanism for using the SD card on your host system is needed, such as an SD card USB adapter or an SD port on your laptop. 
 * A mechanical switch, such as a "SPDT":https://www.electronicshub.org/switches/#Single_Pole_Double_Throw_Switch_SPDT, should be connected to the Pi GPIOs to allow for pairing the Monitor with IoT Sensors and Jarvis interfaces.    The ASCII diagram below describes the setup. The LED is off in normal mode, lit in Config Mode, and off in Pair Mode until something tries to pair with the Pi which then turns on the LED for 3 seconds. Config and Pair mode operations ared discussed in later sections. 

 <pre> 
                       ___ 
    Config/Pair Mode    |---|    Normal Mode 
                    ---------  
                   |           | 
                    ---------  
 connector pins -->    |    |    |   
                     |    |     ------ Not connected 
                     |    | 
                     |    ----330 Ohm R----- 
                     |    |                  | 
                     |    |    +-----LED------ 
                     |    |    | 
           RPi pin     7    9    13      
          RPi GPIO     4    G    27 
 </pre> 

 * You will need to have sudo access for your Linux user id. 

 h3. Generating the SD Card for the Pi 

 * Download the RPi 2 Development Platform  
 ** _wget <url>_ 
 ** Unpack the archive to a directory called *image*. 
 * Download the _*Ironman*_ Package Collection 
 ** _wget <url>_ 
 ** Unpack the archive to a directory called *package*. 
 * In a terminal window run: _dmesg -w_ 
 * Insert the microSD card and note the device name displayed for the newly added card as displayed in the _dmesg -w_ terminal window.    It should be something like /dev/sdb or /dev/sde. 
 * Kill the _dmesg -w_ command with Ctrl-C. 

 From the *image* directory 
 * Format the SD card 
 ** _sudo ./mksd.sh -d <device name>_ 
 ** where <device name> is the name you noted from the output of _dmesg -w_. 
 * Mount the boot partition from the sd card:  
 ** _sudo mkdir -p /mnt/boot_ 
 ** _sudo mount <device name>1 /mnt/boot_ 
 ** where <device name> is the name you noted from the output of _dmesg -w_. 
 * Install the Development Platform to the SD card 
 ** _sudo ./mkinstall.sh -b /mnt/boot -d <device name>2_  
 ** where <device name> is the name you noted from the output of _dmesg -w_. 

 From the *package* directory 
 * Mount the root partition from the sd card:  
 ** _sudo mkdir -p /mnt/root_ 
 ** _sudo mount <device name>1 /mnt/root_ 
 * Copy the _*Ironman*_ Package Collection files to /root of the root partition on the SD card 
 ** _sudo cp *.opk /mnt/root/root_ 

 Make sure all writes to the SD card have completed 
 * _sync;sync;sync_ 

 Unmount the SD card partitions 
 * _sudo umount /mnt/boot_ 
 * _sudo umount /mnt/root_ 

 Remove the SD card from the host system and insert it into the Raspberry Pi 2. 

 h3. First time boot 

 Power on the Monitor and wait for it to complete installation.    During this time the display may be upside down.   

 Once the display shows two xterm windows it is ready to complete installation.    Type the following command to install the _*Ironman*_ package collection. 

   opkg install *.opk 

 Wait for this command to complete, then reboot the system either by power it off and back on or by typing the command  

   reboot 

 The Monitor is now fully installed and ready for use. 

 h3. First time configuration 

 !>{width:300px}Ironman-PHP-Config-UI-480w.png(Ironman Config UI)! 

 Turn the power off and set the Mode switch to Config/Pair, then power the Monitor back on.    The LED should light indicating the Monitor is ready to be configured. 

 Use a smartphone or laptop with wifi to connect to the "ironman" SSID.    The default password is _ironman1_.    Then use a browser to connect to the Ironman web UI at  

   http://192.168.36.1:1337 

 The display should be as shown in the adjacent photo.    There are two network domains to configure, as described in the following table. 

 |_. Domain |_. Description | 
 | Internet Connection | This is how the Monitor will connect to your home network. | 
 | Sensors Network | This is how the Monitor will communicate with your IoT devices. | 

 h3. Network configuration 

 wlan0 

 * This interface is used for configuration of the Monitor. 
 * Configured on the 192.168.36.0 subnet. 
 ** See /etc/network/dhcpd.conf.aponly 

 uap0 

 * This interface is used as an access point for IoT devices. 
 * Configured on the 192.168.3.0 subnet. 
 ** See /etc/network/dhcpd.conf.uap and dhcpd.conf.uap.tmpl 
 ** The template is used to change the base subnet through the web interface. 
 ** The SSID is _ironman_. 

 <pre> 
 Pair/Config button is GPIO 4 (RPi pin 7) 
 Pair/Config LED is GPIO 7 (RPi pin 13) 
	 LED should only be lit on boot if button is enabled (in Config mode). 
		 In this case, we're in Config Mode to configure the networks. 
		 The web server (imwww) is on SSID _ironman_ at 192.168.36.1:1337. 
	 LED is off on boot if button is disabled (in Pair Mode). 
	 If in Pair Mode 
		 Start hostapd for aponly 
		 Start dhcpd for aponly on wlan0 
		 Start imrest web service on port 8165 for IoT devices and Jarvis interfaces. 
	 If in Config Mode 
		 Start wpa_supplicant on wlan0 
		 Create uap0 device as virtual device on wlan0 
		 Start dhcpd on uap0 
		 Start hostapd on uap0 
		 Start imwww for network configuration of the Monitor. 

 /etc/ironman/iot 		 Registration directory for IoT devices 
 /etc/ironman/jarvis 		 Registration directgory for Jarvis interfaces 

 Apps 
 imcore 					 Package that updates a PiBox Development Platform for use with Ironman. 
						 Includes network configuration updates and other config files. 
 imwww 					 Contains two web servers 
	 imwww 				 Provides network configuration interface for Monitor 
	 imrest 				 Provides IoT/Jarvis REST API.    Updates /etc/ironman directories with registrations. 
 imgpio 					 Command line tool for querying GPIO pins using syfs interface. 
 launcher 				 Ironman specific launcher that adds clock interface to front panel. 
 pisensors 				 Provides UI for managing sensors. 
						 Uses inotify to watch for changes to /etc/ironman/iot directory. 
 picam    				 Generic console camera interface (same as PiBox media systems) 
 appmgr, piboxd, omxplayer, pmsui, psplash, mjpg-streamer 
						 Same packages as in PiBox, unmodified 
 </pre> 

 h3. Pairing with IoT Sensors 

 h3. Pairing with Jarvis 

 h2. IoT Sensor 

 h3. Sensor Types 

 h4. Light Switch 

 h3. Flashing the firmware 

 h3. Power On 

 h3. Pairing with a Monitor 

 h2. Jarvis 

 h3. Prerequisites 

 h3. Pairing with a Monitor 

 h3. Supported Commands 

 h2. Addendums 

 h3. Source Code Repositories 

 * PiBox 
 ** Development Platform 
 ** appmgr 
 ** mjpg-streamer 
 ** omxplayer 
 ** piboxd 
 ** picam 
 ** pmsui 
 ** psplash 
 * Ironman 
 ** launcher 
 ** monitor 
 ** pisensor 
 ** www 
 * Arduino 
 ** Sensor Template (imlightsw) 

 h3. Fritzing Models 

 * ESP-01 Flasher 
 * Light Switch 
 ** Keyes_SRly 
 ** Hilink 
 * Monitor Switch