Users Guide » History » Version 62
Hammel, 03 Oct 2019 18:32
1 | 10 | Hammel | h1. Ironman Users Guide |
---|---|---|---|
2 | 1 | Hammel | |
3 | 7 | Hammel | table{border-collapse;width:100%}. |
4 | 8 | Hammel | |={font-size:140%;margin-bottom:15px;background-color:#fdd}. This document is under development and is likely not accurate at this time. | |
5 | 7 | Hammel | |
6 | 2 | Hammel | {{>toc}} |
7 | |||
8 | 34 | Hammel | 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. |
9 | 1 | Hammel | |
10 | 10 | Hammel | h2. Overview |
11 | |||
12 | 17 | Hammel | _*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. |
13 | 1 | Hammel | |
14 | 43 | Hammel | table{align=center}. |
15 | 42 | Hammel | |!{width:640px}http://redmine.graphics-muse.org/attachments/download/114!| |
16 | 1 | Hammel | |={font-size:120%;margin-bottom:15px;background-color:#dff}. *Design Intent of the Ironman Project* | |
17 | 43 | Hammel | |=. Mark I release is in progress. Mark II and Mark III are future development plans. | |
18 | 1 | Hammel | |
19 | 17 | Hammel | _*Ironman*_ consists of the following components. |
20 | 12 | Hammel | |
21 | | *Monitor* | The Nest-like control hub based on a Raspberry Pi 2/3 and the official 7" touchscreen display | |
||
22 | | *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 | |
||
23 | | *Jarvis* | A Java application that supports voice control of Monitor managed devices | |
||
24 | | *Controllers* | Network enabled control of Monitor managed devices | |
||
25 | |||
26 | 1 | Hammel | h3. Security |
27 | |||
28 | 17 | Hammel | _*Ironman*_ supports AES encrypted communication with IoT sensors and Jarvis interfaces. |
29 | 12 | Hammel | |
30 | h3. What it is |
||
31 | |||
32 | 17 | Hammel | _*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. |
33 | 12 | Hammel | |
34 | h3. What it is not |
||
35 | |||
36 | 17 | Hammel | _*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. |
37 | 12 | Hammel | |
38 | 17 | Hammel | 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. |
39 | 10 | Hammel | |
40 | 1 | Hammel | h2. The Ironman Monitor |
41 | 3 | Hammel | |
42 | 17 | Hammel | 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. |
43 | 3 | Hammel | |
44 | h3. Installation Prerequisites |
||
45 | 1 | Hammel | |
46 | 11 | Hammel | * A "Raspberry Pi 2 or 3":https://www.adafruit.com/product/3055 |
47 | * The official "Raspberry Pi 7inch touchscreen display":https://www.sparkfun.com/products/13733 |
||
48 | * 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. |
||
49 | 27 | Hammel | * A keyboard is required for initial installation. A "wireless keyboard":https://www.adafruit.com/product/922 should work as will a wired keyboard. The keyboard will not be needed for normal operation but can be helpful in debugging. |
50 | 3 | Hammel | * 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. |
51 | 32 | Hammel | * 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. A Fritzing Diagram (attachment:IronmanMonitorSwitch.fzz) is available for this hardware component. |
52 | 30 | Hammel | !>{width:300px}IronmanMonitorSwitchBreadboard.png(Ironman Monitor Switch)! |
53 | 1 | Hammel | <pre> |
54 | 16 | Hammel | ___ |
55 | Config/Pair Mode |---| Normal Mode |
||
56 | --------- |
||
57 | | | |
||
58 | --------- |
||
59 | connector pins --> | | | |
||
60 | | | ------ Not connected |
||
61 | | | |
||
62 | | ----330 Ohm R----- |
||
63 | | | | |
||
64 | | | +-----LED------ |
||
65 | | | | |
||
66 | RPi pin 7 9 13 |
||
67 | RPi GPIO 4 G 27 |
||
68 | 6 | Hammel | </pre> |
69 | 5 | Hammel | |
70 | 27 | Hammel | * You will need to have sudo access for your Linux user id. |
71 | 16 | Hammel | |
72 | 1 | Hammel | h3. Generating the SD Card for the Pi |
73 | 3 | Hammel | |
74 | 1 | Hammel | * Download the RPi 2 Development Platform |
75 | 4 | Hammel | ** _wget <url>_ |
76 | ** Unpack the archive to a directory called *image*. |
||
77 | 17 | Hammel | * Download the _*Ironman*_ Package Collection |
78 | 4 | Hammel | ** _wget <url>_ |
79 | 1 | Hammel | ** Unpack the archive to a directory called *package*. |
80 | 18 | Hammel | * In a terminal window run: _dmesg -w_ |
81 | * 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. |
||
82 | * Kill the _dmesg -w_ command with Ctrl-C. |
||
83 | 4 | Hammel | |
84 | From the *image* directory |
||
85 | 1 | Hammel | * Format the SD card |
86 | ** _sudo ./mksd.sh -d <device name>_ |
||
87 | 18 | Hammel | ** where <device name> is the name you noted from the output of _dmesg -w_. |
88 | 3 | Hammel | * Mount the boot partition from the sd card: |
89 | 4 | Hammel | ** _sudo mkdir -p /mnt/boot_ |
90 | ** _sudo mount <device name>1 /mnt/boot_ |
||
91 | 18 | Hammel | ** where <device name> is the name you noted from the output of _dmesg -w_. |
92 | 4 | Hammel | * Install the Development Platform to the SD card |
93 | ** _sudo ./mkinstall.sh -b /mnt/boot -d <device name>2_ |
||
94 | 18 | Hammel | ** where <device name> is the name you noted from the output of _dmesg -w_. |
95 | 3 | Hammel | |
96 | 4 | Hammel | From the *package* directory |
97 | 3 | Hammel | * Mount the root partition from the sd card: |
98 | 4 | Hammel | ** _sudo mkdir -p /mnt/root_ |
99 | ** _sudo mount <device name>1 /mnt/root_ |
||
100 | 17 | Hammel | * Copy the _*Ironman*_ Package Collection files to /root of the root partition on the SD card |
101 | 4 | Hammel | ** _sudo cp *.opk /mnt/root/root_ |
102 | 3 | Hammel | |
103 | Make sure all writes to the SD card have completed |
||
104 | 4 | Hammel | * _sync;sync;sync_ |
105 | 3 | Hammel | |
106 | Unmount the SD card partitions |
||
107 | 4 | Hammel | * _sudo umount /mnt/boot_ |
108 | * _sudo umount /mnt/root_ |
||
109 | 3 | Hammel | |
110 | 4 | Hammel | Remove the SD card from the host system and insert it into the Raspberry Pi 2. |
111 | 1 | Hammel | |
112 | h3. First time boot |
||
113 | |||
114 | 26 | Hammel | Power on the Monitor and wait for it to complete installation. During this time the display may be upside down. Once initial installation is complete the display will be right side up. |
115 | 22 | Hammel | |
116 | Once the display shows two xterm windows it is ready to complete installation. Type the following command to install the _*Ironman*_ package collection. |
||
117 | |||
118 | opkg install *.opk |
||
119 | |||
120 | Wait for this command to complete, then reboot the system either by power it off and back on or by typing the command |
||
121 | |||
122 | reboot |
||
123 | |||
124 | 44 | Hammel | The Monitor is now fully installed and ready for use. At this point the keyboard can be removed though you may want to leave it connected for debugging purposes. |
125 | 22 | Hammel | |
126 | h3. First time configuration |
||
127 | |||
128 | 33 | Hammel | !>{width:300px}ironman-config-ui.png(Ironman Config UI)! |
129 | 24 | Hammel | |
130 | 22 | Hammel | 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. |
131 | |||
132 | 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 |
||
133 | |||
134 | http://192.168.36.1:1337 |
||
135 | |||
136 | 25 | Hammel | The display should be as shown in the adjacent photo. There are two network domains to configure, as described in the following table. |
137 | |||
138 | |_. Domain |_. Description | |
||
139 | | Internet Connection | This is how the Monitor will connect to your home network. | |
||
140 | | Sensors Network | This is how the Monitor will communicate with your IoT devices. | |
||
141 | 22 | Hammel | |
142 | 36 | Hammel | After both networks are configured, power off the Monitor and set the Mode switch to Normal, then power the Monitor on. The Monitor is now ready to use with IoT sensors, Jarvis and controllers. |
143 | |||
144 | 1 | Hammel | h3. Network configuration |
145 | |||
146 | 34 | Hammel | The Monitor's hardware supports WiFi B/G/N networks. However, in order to use the Monitor as both a WiFi client on the local |
147 | network and as an Access Point for IoT devices, only G networks are supported by the Ironman software. |
||
148 | |||
149 | h4. Internet Connection |
||
150 | |||
151 | The Internet Connection domain configures the Monitor to connect to your local network. |
||
152 | |||
153 | |_. Field |_. Description | |
||
154 | |Location |Unique name for this monitor, such as Bedroom or Office. This name is used to identify monitors by name via commands from Jarvis or other remote controllers| |
||
155 | |SSID |Network name configured on your router for your local WiFi network. | |
||
156 | |Security | Type of security used on your router. Only WPA2 Personal and WPA2 Enterprise are currently supported. | |
||
157 | |Password | Your router's password, specifically for the SSID entered previously. | |
||
158 | |||
159 | The *Show Password* button will display the password typed in the Password field. By default this button is not enabled, causing the Password field to be hidden using asterisks for each character. |
||
160 | |||
161 | h4. Sensor Network |
||
162 | |||
163 | The Sensor Network domain is used to configure the Monitor's private network used with IoT devices. Data on this network is not routed to the Internet Connection and data from the Internet Connection domain are not routed to the Sensor Network. |
||
164 | |||
165 | |_. Field |_. Description | |
||
166 | |SSID |Network name for this private WiFi network. This name will be hidden on Wifi scans.| |
||
167 | |Channel | Channel to use. Select a channel that has low use in your neighborhood. Only a subset of channels on G networks are available. This will be addressed in future releases. | |
||
168 | |Password | Password IoT devices should use to gain access to the specified SSID. | |
||
169 | |Static IP | An IP address to give the Monitor as it acts as an Access Point. This should be a Class C subnet for the network, which limits the number of IoT devices that can be managed by a single Monitor to 254. | |
||
170 | |||
171 | The *Show Password* button will display the password typed in the Password field. By default this button is not enabled, causing the Password field to be hidden using asterisks for each character. |
||
172 | |||
173 | 38 | Hammel | h2. IoT Sensor |
174 | 1 | Hammel | |
175 | 38 | Hammel | h3. Sensor Types |
176 | |||
177 | There is currently only one sensor type: imlightsw (light switch). |
||
178 | |||
179 | 46 | Hammel | The sensor template GIT repository, which is the imlightsw repo, is intended to be used to design additional sensor types, such as door and window alarms, window shade controllers, environment sensors and so forth. |
180 | 38 | Hammel | |
181 | h4. Light Switch |
||
182 | 47 | Hammel | !>{width:300px}imlightsw.png(Ironman Light Switch)! |
183 | 38 | Hammel | |
184 | 50 | Hammel | This prototype light switch (attachment:imlightsw-with-relay-2.fzz) uses a relay to power an LED on and off. The breadboard power supply can be replaced with an "HLK-PM01":http://www.hlktech.net/product_detail.php?ProId=54 and an "LM3671 5V to 3.3v buck converter":https://www.adafruit.com/product/2745 to power the board from mains (110v). |
185 | 38 | Hammel | |
186 | 1 | Hammel | The FTDI connection is used to connect and "FTDI Basic board":https://www.sparkfun.com/products/9873 so that a the output from the ESP-01 can be viewed in a terminal program. |
187 | 51 | Hammel | |
188 | The ESP-01 has a Blue LED that is used to provide visual information using blink patterns. |
||
189 | |||
190 | h5. Config Button |
||
191 | |||
192 | This button has multiple uses, depending on where it is used. |
||
193 | |||
194 | _AP Config Mode_ |
||
195 | |||
196 | 55 | Hammel | AP Config Mode means the device is running as an WiFi Access Point, allowing you to connect to it via a web browser to configure the device for use on a Monitor's Sensor network. |
197 | 51 | Hammel | |
198 | * AP Config mode is disabled by default, that is, when the Config Button is in the off position. |
||
199 | 55 | Hammel | * If Config Button is ON at boot, imlightsw enters AP config mode. In this mode the LED will blink twice and then stop. Once the device is connected to a Monitor's Sensor network it will blink 4 times. |
200 | 51 | Hammel | * After configuration is complete, button must be set OFF and device power cycled. |
201 | |||
202 | _Pair Mode_ |
||
203 | |||
204 | Pair Mode is used to pair the imlightsw device with an Ironman Monitor. Pairing involves the exchange of secret keys that will be used to encrypt messages between the Monitor and the imlightsw device. |
||
205 | |||
206 | * The Config Button is OFF at boot. |
||
207 | * Later the Config Button is turned on and imlightsw enters PAIR mode. In this mode the blue LED stays on. |
||
208 | 1 | Hammel | * After the device has paired with a Monitor the blue LED blinks. |
209 | 51 | Hammel | * The Config Button must be turned off for normal operation. |
210 | 55 | Hammel | |
211 | 51 | Hammel | |
212 | h5. Blue LED Blink Patterns |
||
213 | |||
214 | A _blink_ implies the LED turns on and then off. |
||
215 | |||
216 | |_. LED State |_. Blink Speed |_. Blink Count |_. Device Mode | |
||
217 | |Blink | 1/sec | 2 | Entered AP Config Mode | |
||
218 | |Blink | 1/sec | 4 | Device is connected to monitor | |
||
219 | |Blink | 1/.125 sec | 5 | Device failed to connect to monitor | |
||
220 | |Solid On | N/A | N/A | Entered Pair Mode | |
||
221 | |Blink | 2/.150 sec then 1/.200 sec | continuous | Waiting to Pair with Monitor| |
||
222 | |Blink | 1/.100 sec | 3 | Not currently paired with Monitor| |
||
223 | |||
224 | h5. Reset Button |
||
225 | |||
226 | The Reset Button is used to return the imlightsw to it's initial state, prior to configuration and pairing. If the device is reset it will need to be configured to use the network again as well as paired with an Ironman Monitor before it can be managed. |
||
227 | |||
228 | * The Reset Button is ON at boot. |
||
229 | * The device removes all configuration from itself. |
||
230 | * The Reset Button must be turned off, then the device can be rebooted and reconfigured. |
||
231 | |||
232 | table{border-collapse;width:100%}. |
||
233 | |={font-size:120%;margin-bottom:15px;background-color:#fdd}. The Reset Button is not connected in code currently due to the limit on GPIO pins in the ESP-01. To fully reset the ESP-01 you must compile the code with RESET=1, flash and run the code, then recompile with RESET=0 (or not specified on the command line) and flash again. | |
||
234 | 49 | Hammel | |
235 | 56 | Hammel | h3. Setting up to use the code |
236 | |||
237 | h4. Prerequisites |
||
238 | |||
239 | * ESP-01 connected to your serial port using an FTDI board |
||
240 | ** Try the one from "SparkFun":https://www.sparkfun.com/products/9873 |
||
241 | * You have proper power to the ESP-01 |
||
242 | ** You need 3.3V for the ESP-01. |
||
243 | ** You need 5V for the power relay. |
||
244 | ** Try this board from "Amazon":https://smile.amazon.com/gp/product/B010UJFVTU/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1. It can supply both 3.3V and 5V power on a half size breadboard like this one from "Adafruit":https://www.adafruit.com/product/64 |
||
245 | * Other parts you might want |
||
246 | ** ESP-01 "breadboard adapter":https://www.addicore.com/ProductDetails.asp?ProductCode=AD-BB-ADTR |
||
247 | ** "Logic Level Converter":https://www.sparkfun.com/products/12009 |
||
248 | ** "5V 1-Channel Relay":https://www.ebay.com/itm/5V-10A-one-1-Channel-Relay-Module-With-optocoupler-For-PIC-AVR-DSP-ARM-Arduino/310636242802?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649 board |
||
249 | |||
250 | h4. Arduino Setup |
||
251 | |||
252 | This build doesn't use the Arduino UI. It makes use of GNU Make to build the code without the UI. However, it still requires components provided via the Arduino UI distribution, along with extra libraries. |
||
253 | |||
254 | * Make a directory to hold required repository clones - call it _repos_. |
||
255 | * Change to _repos_ |
||
256 | * Clone the esp8266/Arduino repository |
||
257 | ** git clone https://github.com/esp8266/Arduino.git |
||
258 | ** cd Arduino |
||
259 | ** git checkout tags/2.1.0 |
||
260 | ** cd .. |
||
261 | * Clone the makeEspArduino repo |
||
262 | ** git clone https://github.com/plerup/makeEspArduino.git |
||
263 | ** cd makeEspArduino |
||
264 | ** If ESP_ROOT points to a symlink but doesn't use a trailing slash: _git checkout d13cf13602f2acc9be3baa3315911a4c037dc62d_ |
||
265 | ** Otherwise: _git checkout tags/4.13.0_ |
||
266 | ** cd .. |
||
267 | * Install libraries |
||
268 | ** cd Arduino/libraries |
||
269 | ** clone extra libraries (see Required Libraries below) |
||
270 | * If your USB/FTDI connector shows up as something other than /dev/USBFTDI then set SERIALDEV |
||
271 | ** export SERIALDEV=/dev/_your device_ |
||
272 | * aJson has a [bug with flush()](https://github.com/interactive-matter/aJson/issues/89) that prevents compilation. Apply the patch found in the lightsw repository's patch directory. |
||
273 | |||
274 | |_. Required Arduino libraries |_. URL | |
||
275 | |AES| https://github.com/spaniakos/AES/| |
||
276 | |Timer| https://github.com/JChristensen/Timer.git| |
||
277 | |WiFiManager| https://github.com/tzapu/WiFiManager.git |
||
278 | tag: 0.12 |
||
279 | commit: 04d47882a7d662b46bb1b1dbecfe786e5bc9efa4 | |
||
280 | |aJson| https://github.com/interactive-matter/aJson.git |
||
281 | Requires patch in patch/ directory. | |
||
282 | |aREST| https://github.com/marcoschwartz/aREST.git| |
||
283 | |arduino-base64| https://github.com/adamvr/arduino-base64 |
||
284 | Requires patch in patch/ directory. | |
||
285 | |||
286 | Notes on libraries |
||
287 | * cd esp8266/libraries, then clone the extra libraries there |
||
288 | * AES library: Remove the examples or the build will probably fail. |
||
289 | |||
290 | h4. The imlightsw Code |
||
291 | |||
292 | The code is required to do flash updates to the ESP-01. Before starting, be sure to install "cdtools":https://gitlab.com/cdtools/cdtools. |
||
293 | |||
294 | * Clone the software: _git clone https://gitlab.com/xarduino/lightsw.git_ |
||
295 | * Copy _lightsw/docs/arduino.sh_ to your cdtools directory (_~/bin/env_) and edit as appropriate. |
||
296 | ** Be sure to set ESPTOP as described in arduino.sh. |
||
297 | * Setup your environment for the build: |
||
298 | ** _. cdtools_ |
||
299 | ** _ard lightsw_ |
||
300 | ** _cd?_ (to see what you can do with cdtools in this repository) |
||
301 | * Change to this repos directory: _cdx_ |
||
302 | |||
303 | 38 | Hammel | h3. Flashing the firmware |
304 | 52 | Hammel | !>{width:300px}imlightsw-flasher.png(Ironman Light Switch Flasher)! |
305 | 38 | Hammel | |
306 | 53 | Hammel | This prototype light switch flasher (attachment:imlightsw-flasher.fzz) is used to program the ESP-01. A separate flasher circuit like this is required due to the limited number of GPIO pins on the ESP-01. |
307 | |||
308 | 1 | Hammel | The "FTDI Basic board":https://www.sparkfun.com/products/9873 is required to connect the ESP-01 to a computer over a USB port. On Linux, the port will show up as /dev/ttyUSB0 or similar. |
309 | |||
310 | 56 | Hammel | The code must be built before it can be flashed to the ESP-01. |
311 | |||
312 | * _make_ |
||
313 | ** Binary is in ../bld/*.bin |
||
314 | * _make RESET=1_ |
||
315 | ** This causes stored data in the ESP-01 to be erased on power up. After that, you need to reflash without this flag. |
||
316 | * _make SERIAL=1_ |
||
317 | ** This causes the code to use the TX line for serial output for debugging purposes. If this is not set then the blue LED is used instead and there is not serial console output. |
||
318 | |||
319 | Finally, to flash the updated image to the ESP-01 use the _upload_ target. |
||
320 | |||
321 | * _make upload_ |
||
322 | ** _upload_ target is in makeEspArduino.mk, not in local Makefile. |
||
323 | |||
324 | |||
325 | 58 | Hammel | An IoT sensors must be configured to operate on the same network as the Monitor's Sensor Network. Once this has been done the IoT sensor and the Monitor can be paired. An IoT device can only be paired with a single Monitor. |
326 | 1 | Hammel | |
327 | 58 | Hammel | h3. Connect Serial Terminal to IoT Device |
328 | 61 | Hammel | |
329 | !>{width:300px}minicom.png(Sample minicom session)! |
||
330 | 1 | Hammel | |
331 | 58 | Hammel | It helps, at this stage of development, to see what the ESP-01 thinks is happening while configuring it. This can be done by connecting the FTDI Basic connector to a USB connector on a laptop. |
332 | 1 | Hammel | |
333 | 58 | Hammel | * Connect the FTDI Basic to a USB port on the laptop. |
334 | * Check the laptop for a port such as /dev/ttyUSB0 (this may be different on different Linux distributions). |
||
335 | * Use _minicom_ or a similar serial communication program and connect it to /dev/ttyUSB0 |
||
336 | ** Baud: 115200 |
||
337 | ** No parity |
||
338 | ** 1 stop bit |
||
339 | ** Terminal type should be set to ANSI (you might get garbage characters otherwise) |
||
340 | |||
341 | You can now watch the progress of the ESP-01 as it processes hardware and software changes in the following sections. |
||
342 | |||
343 | h3. Configuring an IoT Device to the Sensor Network |
||
344 | 1 | Hammel | |
345 | 62 | Hammel | !>{width:300px}iotwebui.png(IoT Device Configuration)! |
346 | |||
347 | 57 | Hammel | The IoT device has it's own WiFi Access Point at 192.168.4.1 with no password. This is used to configure the device to connect to the Monitor's Sensor Network. |
348 | |||
349 | 1 | Hammel | * Set the Mode button to Config. |
350 | * Power on the IoT device. |
||
351 | 57 | Hammel | * Connect a laptop or smartphone to the _imiot_ SSID. An IP will be assigned automatically to the laptop or smartphone. |
352 | * If connecting to the _imiot_ SSID does not automatically open a browser page to the IoT device's WiFi configuration page, then manually open a browser to http://192.168.4.1. |
||
353 | |||
354 | The configuration page looks like the image to the right. This page has multiple options. Only the first is needed to configure to the Sensor Network. |
||
355 | |||
356 | * Click on ...tbd... |
||
357 | * A scan of local WiFi access points will be shown. |
||
358 | * Choose the SSID configured for the Monitor's Sensor Network. |
||
359 | * Type in the password configured for the Monitor's Sensor Network. |
||
360 | * Click on ...tbd... |
||
361 | |||
362 | At this point the device will attempt to connect to the Monitor and retrieve an IP address. Wait about 1 minute for this to complete. |
||
363 | |||
364 | * Turn the IoT device off. |
||
365 | * Turn the Mode button to Normal. |
||
366 | * Power on the IoT device. |
||
367 | |||
368 | The device is now ready for pairing with the Monitor. |
||
369 | 1 | Hammel | |
370 | 38 | Hammel | h3. Pairing with a Monitor |
371 | 14 | Hammel | |
372 | 38 | Hammel | * With the Monitor running, set the Monitor Mode switch to Pair. |
373 | 59 | Hammel | * Power on the IoT device. |
374 | * Turn the Mode button on the IoT device to Config. |
||
375 | * Wait for it to pair with the Monitor. When pairing is completed the Monitor's Mode Button LED will flash for 1 second and the Blue LED on the IoT sensor will light for 3 seconds. |
||
376 | ** The Monitor's Sensor app will show a new device that can now be managed from the Monitor. |
||
377 | * Turn the Mode switch to Normal on the Monitor. |
||
378 | * Turn the Iot device off. |
||
379 | * Turn the Mode button on the IoT device to Normal. |
||
380 | * Power on the Iot Device. |
||
381 | |||
382 | The Iot device can now be managed by the Monitor's Sensor App. |
||
383 | 14 | Hammel | |
384 | 9 | Hammel | table{border-collapse;width:100%}. |
385 | |={font-size:140%;margin-bottom:15px;background-color:#fdd}. *WARNING!* | |
||
386 | 1 | Hammel | |={font-size:120%;margin-bottom:15px;background-color:#fdd}. Leaving the Mode switch turned to Pair will allow random devices to attempt to pair with the Monitor. This is a security risk. The Mode switch should only be set to Pair long enough to pair with an IoT device. | |
387 | |||
388 | h2. Jarvis |
||
389 | |||
390 | h3. Prerequisites |
||
391 | |||
392 | h3. Pairing with a Monitor |
||
393 | 38 | Hammel | |
394 | * With the Monitor running, set the Monitor Mode switch to Pair. |
||
395 | * TBD |
||
396 | 1 | Hammel | |
397 | h3. Supported Commands |
||
398 | |||
399 | 35 | Hammel | h2. Addendums |
400 | |||
401 | 40 | Hammel | h3. Ironman Packages |
402 | 35 | Hammel | |
403 | 40 | Hammel | |_. Package |_. Repository |_.Contents |_. Description | |
404 | |imcore |monitor | |Package that updates a PiBox Development Platform for use with Ironman. Includes network configuration updates and other config files. | |
||
405 | |imwww |www | |Contains two web servers | |
||
406 | | ||imwww |Provides network configuration interface for Monitor | |
||
407 | | ||imrest |Provides IoT/Jarvis REST API. Updates /etc/ironman directories with registrations.| |
||
408 | |imgpio |gpio | |Command line tool for querying GPIO pins using syfs interface. | |
||
409 | |launcher |launcher | |Ironman specific launcher that adds clock interface to front panel. | |
||
410 | |pisensor |pisensor | |Provides UI for managing sensors. Uses inotify to watch for changes to /etc/ironman/iot directory. | |
||
411 | |picam |picam | |Generic console camera interface (same as PiBox media systems) | |
||
412 | |Misc |appmgr, piboxd, omxplayer, pmsui, psplash, mjpg-streamer| |Same packages as in PiBox media system, unmodified| |
||
413 | 1 | Hammel | |
414 | h3. Source Code Repositories |
||
415 | |||
416 | * PiBox |
||
417 | 39 | Hammel | ** "Development Platform":https://gitlab.com/pibox/pibox |
418 | ** "appmgr":https://gitlab.com/pibox/appmgr |
||
419 | ** "mjpg-streamer":https://gitlab.com/pibox/mjpg-streamer |
||
420 | ** "omxplayer":https://gitlab.com/pibox/omxplayer |
||
421 | ** "piboxd":https://gitlab.com/pibox/piboxd |
||
422 | ** "picam":https://gitlab.com/pibox/picam |
||
423 | ** "pmsui":https://gitlab.com/pibox/pmsui |
||
424 | ** "psplash":https://gitlab.com/pibox/psplash |
||
425 | 1 | Hammel | * Ironman |
426 | 39 | Hammel | ** "gpio":https://gitlab.com/xironman/gpio |
427 | ** "launcher":https://gitlab.com/xironman/launcher |
||
428 | ** "monitor":https://gitlab.com/xironman/monitor |
||
429 | ** "pisensor":https://gitlab.com/xironman/sensors |
||
430 | ** "www":https://gitlab.com/xironman/www |
||
431 | ** "meta build":https://gitlab.com/xironman/meta |
||
432 | 1 | Hammel | * Arduino |
433 | 39 | Hammel | ** "Sensor Template (imlightsw)":https://gitlab.com/xarduino/lightsw |
434 | |||
435 | 1 | Hammel | h3. Fritzing Models |
436 | |||
437 | 54 | Hammel | * ESP-01 Flasher: attachment:imlightsw-flasher.fzz |
438 | * Light Switch: attachment:imlightsw-with-relay-2.fzz |
||
439 | ** "ESP8266":https://github.com/ydonnelly/ESP8266_fritzing |
||
440 | ** "Keyes_SRly":https://github.com/rwaldron/fritzing-components |
||
441 | ** "Breadboard Power Supply":https://github.com/AchimPieters/Fritzing-Custom-Parts/blob/master/YwRobot%20Breadboard%20Power%20Supply.fzpz |
||
442 | ** "Hilink HLK-PM01":http://forum.fritzing.org/t/hlk-pm01-ac-dc-220v-to-5v/381 |
||
443 | 35 | Hammel | * Monitor Switch: attachment:IronmanMonitorSwitch.fzz |
444 | 54 | Hammel | |
445 | 35 | Hammel | |
446 | h3. Networking Internals |
||
447 | |||
448 | <pre> |
||
449 | wlan0 |
||
450 | |||
451 | * This interface is used for configuration of the Monitor. |
||
452 | * Configured on the 192.168.36.0 subnet. |
||
453 | ** See /etc/network/dhcpd.conf.aponly |
||
454 | |||
455 | uap0 |
||
456 | |||
457 | * This interface is used as an access point for IoT devices. |
||
458 | * Configured on the 192.168.3.0 subnet. |
||
459 | ** See /etc/network/dhcpd.conf.uap and dhcpd.conf.uap.tmpl |
||
460 | ** The template is used to change the base subnet through the web interface. |
||
461 | ** The SSID is _ironman_. |
||
462 | </pre> |
||
463 | |||
464 | h3. Pair Button Usage |
||
465 | |||
466 | <pre> |
||
467 | Pair/Config button is GPIO 4 (RPi pin 7) |
||
468 | Pair/Config LED is GPIO 7 (RPi pin 13) |
||
469 | LED should only be lit on boot if button is enabled (in Config mode). |
||
470 | In this case, we're in Config Mode to configure the networks. |
||
471 | The web server (imwww) is on SSID _ironman_ at 192.168.36.1:1337. |
||
472 | LED is off on boot if button is disabled (in Pair Mode). |
||
473 | If in Pair Mode |
||
474 | Start hostapd for aponly |
||
475 | Start dhcpd for aponly on wlan0 |
||
476 | Start imrest web service on port 8165 for IoT devices and Jarvis interfaces. |
||
477 | If in Config Mode |
||
478 | Start wpa_supplicant on wlan0 |
||
479 | Create uap0 device as virtual device on wlan0 |
||
480 | Start dhcpd on uap0 |
||
481 | Start hostapd on uap0 |
||
482 | Start imwww for network configuration of the Monitor. |
||
483 | </pre> |
||
484 | |||
485 | h3. Monitor IoT Directories |
||
486 | |||
487 | <pre> |
||
488 | /etc/ironman/iot Registration directory for IoT devices |
||
489 | 1 | Hammel | /etc/ironman/jarvis Registration directgory for Jarvis interfaces |
490 | </pre> |
||
491 | 41 | Hammel | |
492 | 45 | Hammel | h2. Privileged Apps |
493 | |||
494 | Some applications must be privileged in order to perform their functions, such as the camera. The terminal application is not privileged by default. It can be made privileged with the following steps. |
||
495 | |||
496 | # Power down the Monitor. |
||
497 | # Remove the SD card and mount it into your laptop or desktop computer. |
||
498 | # Edit this file on the SD card: /etc/appmgr.priv |
||
499 | # Add this line: /usr/bin/xterm |
||
500 | # Save the file and unmount the SD card. |
||
501 | # Remove the SD card from the laptop or desktop. |
||
502 | # Replace the SD card in the Monitor. |
||
503 | # Power up the Monitor. |
||
504 | |||
505 | The terminal application will now have privileged access on the monitor. |
||
506 | |||
507 | 41 | Hammel | h2. File Attachments |