tag:blogger.com,1999:blog-99513902024-03-13T01:22:52.900-04:00Tales of an Indie DeveloperHow a random developer tries to pursue dream jobs.DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.comBlogger294125tag:blogger.com,1999:blog-9951390.post-14707237200303776332018-02-24T16:23:00.000-05:002018-02-24T16:23:37.929-05:00Building a Reclaimed Kubernetes Cluster<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0a-zS36iuKtKgwpxwg1ysPFPuDeiOeuKQze4ejuzxkkB_O0-2dwVtszmLfS_mlotQvcWGvi-wDYrEQvYRotc01TJNyuPPRaRWPViqugKaksYy56mGhf-RWZXv22J9vpXkSbTgGw/s1600/Kubernetes+Cluster.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 0em; margin-right: 2em;"><img border="0" data-original-height="994" data-original-width="1024" height="388" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0a-zS36iuKtKgwpxwg1ysPFPuDeiOeuKQze4ejuzxkkB_O0-2dwVtszmLfS_mlotQvcWGvi-wDYrEQvYRotc01TJNyuPPRaRWPViqugKaksYy56mGhf-RWZXv22J9vpXkSbTgGw/s400/Kubernetes+Cluster.jpg" width="400" /></a></div>Thanks to family hand-me-downs, over the passing years I have become a repository of unwanted laptops. Some of them barely boot anymore, but three-quarters of them have two cores and 2 GB of RAM or more. One actually had four cores and 8 GB of RAM... making it a veritable workhorse. I could make them disposable workstations, but instead I wove them together and created a personal Kubernetes cluster.<br />
<br />
The base OS for the nodes is <a href="https://www.ubuntu.com/download/server">Ubuntu's latest LTS release</a>. Rather than using <a href="https://tutorials.ubuntu.com/tutorial/install-kubernetes-with-conjure-up">Conjure on MaaS</a> to set up the cluster (which required an isolated network for bootp and DNS and meh), I leveraged <a href="https://github.com/kubernetes-incubator/kubespray.git">Kubespray's flurry of Ansible scripts</a> to prep an inventory of machines over SSH. This ended up being surprisingly low impact and worked perfectly for the use case of building a test lab with piecemeal hardware.<br />
<br />
Laptops work just fine as server nodes with a few tweaks:<br />
<ul><li>Even if you use the server distribution of Ubuntu, laptop events such as closing the lid will still result in a suspend/hibernate/resume action. Edit /etc/systemd/logind.conf to make sure the laptop keeps running when closed:<br />
<code>sudo vi /etc/systemd/logind.conf<br />
HandleLidSwitch=ignore<br />
sudo service systemd-logind restart<br />
</code></li>
<li>The display will remain on once you start ignoring LidSwitch events - <a href="https://gist.github.com/deckerego/76893e43e177ac3b7286fe94e4ecf9c2">run a script at startup</a> to turn the display off and save energy.</li>
<li>Even if you are running in console mode, <a href="https://askubuntu.com/questions/247033/why-is-my-laptop-running-so-hot-with-ubuntu">NVIDIA Optimus laptops will go nuts</a> and seemingly run the discrete and on-chip GPUs nonstop, overheating the machine. Install Ubuntu's Bumblebee packages to prevent this:<br />
<code>sudo apt-get install bumblebee bumblebee-nvidia primus linux-headers-generic</code></li>
<li>As with all Kubernetes nodes, disable swap by commenting out the partition in /etc/fstab. Since you will no longer need to resume from hibernate mode on the laptop, it can be safely disabled</li></ul><br />
Once you have the laptops prepped and the latest updates applied, you will need to make sure each node has a copy of python-netaddr installed: sudo apt-get install python-netaddr <a href="https://www.ansible.com/">Ansible</a> issues its commands over SSH, so ensure you have keyfile-based authentication set up from the machine you will be running Kubespray on to each of the nodes. If you don't already have an SSH key generated (for example, if you will run Kubespray on the master node), then you can generate a passwordless one via ssh-keygen. After that, copy the public key to each node with:<br />
<code><br />
ssh-copy-id node1 <br />
ssh-copy-id node2 <br />
...<br />
</code><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxxlVhUd3AERM_APW3qv-jkqtA_wF7iuMJJGG06MMqM_LFWNURugNlRzQpLtpQun3MROsWJt0y9rbAnysZVFUjSdo5NQV8SvPCBUL3b0xhleOmmyj7V3n3Z3HxuhQHEoyHuPFH8Q/s1600/Installing+Ubuntu.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" data-original-height="768" data-original-width="1024" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxxlVhUd3AERM_APW3qv-jkqtA_wF7iuMJJGG06MMqM_LFWNURugNlRzQpLtpQun3MROsWJt0y9rbAnysZVFUjSdo5NQV8SvPCBUL3b0xhleOmmyj7V3n3Z3HxuhQHEoyHuPFH8Q/s400/Installing+Ubuntu.jpg" width="400" /></a></div>After that, the machine you are running Kubespray on will need Ansible installed. I ran Kubespray on the master node to keep things simple - so on that Ubuntu box I issued: <br />
<code><br />
sudo apt-add-repository ppa:ansible/ansible <br />
sudo apt-get update <br />
sudo apt-get install ansible <br />
git clone https://github.com/kubernetes-incubator/kubespray.git <br />
cp -rfp inventory/sample inventory/mycluster<br />
</code><br />
This will: <br />
<ol><li>Install Ansible on the box</li>
<li>Download the Ansible scripts from Kubespray</li>
<li>Creates a new Ansible inventory called "mycluster" that is a clone of the Kubespray sample</li>
</ol>An important thing to remember is that you address nodes by straight IP address - not by hostname. This is especially important with Ansible scripts because the node's hostname may well change as part of the installation process. If your nodes are fetching their IP address via a DHCP server, ensure the DHCP server has static IP allocations for your nodes.<br />
<br />
Once you have all the IP addresses for your nodes, set them in your inventory file. An easy way to do this at the command line is:<br />
<code><br />
declare -a IPS=(192.168.1.32 192.168.1.36 192.168.1.40) <br />
CONFIG_FILE=inventory/mycluster/hosts.ini python3 contrib/inventory_builder/inventory.py ${IPS[@]}<br />
</code><br />
<br />
Verify the inventory is correct by cracking open inventory/mycluster/hosts.ini - if you want to change hostnames, now is the time.<br />
<br />
I would recommend having Kubespray build a kubectl configuration file automagically for you. To have this generated as an artifact, change inventory/mycluster/group_vars/k8s-cluster.yml to have the following entry set: <code>kubeconfig_localhost: true</code> After these tweaks you should be ready to launch Kubespray's Ansible playbook. Note that Ubuntu's convention is to have you operate as a normal user and sudo all of your commands, so you will need to use Ansible's --become parameter:<br />
<code><br />
ansible-playbook -i inventory/mycluster/hosts.ini cluster.yml --ask-become-pass --become<br />
</code><br />
<br />
At this point Kubespray will try its best to get a cluster up and running on the nodes specified in your inventory file. At the very end Kubespray will provide you with a kubectl configuration file in artifacts/admin.conf, which you can then copy or merge into another workstation's ~/.kube/config file. <br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbAif2MOpQxFiZ2yM8dG1eLyW2NTeihbpA7PVMaeaK-T0u16QTAhy4ckNRBCB9k6M_33rAqdyvAuh7qjccyXbZDuQl776w7f6zw8kUIipaLx5SjYbZyXJojqVK5hFMglasma-Pdw/s1600/Kubernetes+Dashboard.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="830" data-original-width="1211" height="274" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbAif2MOpQxFiZ2yM8dG1eLyW2NTeihbpA7PVMaeaK-T0u16QTAhy4ckNRBCB9k6M_33rAqdyvAuh7qjccyXbZDuQl776w7f6zw8kUIipaLx5SjYbZyXJojqVK5hFMglasma-Pdw/s400/Kubernetes+Dashboard.png" width="400" /></a></div>Once you have the Kubernets configuration file set on your workstation, you can use it to fetch an authtoken to get into the Kubernetes Dashboard. The proper way to do this is to generate a new system secret that has the appropriate permissions to interrogate the running cluster... but the lazy way is to just steal the token used by Kubernetes' namespace controller. <br />
<br />
I'm lazy, so first I list all the secretes in the kube-system namespace:<br />
<code><br />
kubectl -n kube-system get secrets<br />
</code><br />
And then fetch the token for the namespace controller:<br />
<code><br />
kubectl -n kube-system describe secret namespace-controller-token-???<br />
</code><br />
So that I can use it to login to the web dashboard:<br />
<code><br />
kubectl proxy &<br />
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/login<br />
</code><br />
Now you should have a working cluster you can mess with!<br />
<br />
So that the laptops were properly ventilated, I placed each vertically into a metal document sorter from an office supply store. This gives me a nifty vertical rack for the laptops that has plenty of air circulation and allows me to route cables out of the way.<br />
<br />
I've constructed one weird frakencluster - but it works!DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-35982753653250513702018-01-23T22:56:00.000-05:002018-01-23T22:56:56.157-05:00Your Documents Under the Magnifying GlassA few years ago I moved my household administrivia to a paperless system. Instead of stacking file folders deep with bills and statements, everything would be scanned & shredded. This greatly helped with storage space - but in a couple of years I ended up with a network drive filled with over 3,000 PDFs, images and documents. Bear in mind the majority of these are scanned documents - so the contents are images instead of machine-readable text. Everything was dumped into a single directory and files were named based on the timestamp of when they were scanned, taking hours to organize documents into folders and sub-folders.<br />
<br />
Instead of burning hours sorting documents I started burning hours building a simple set of applications that would read document metadata, attempt to convert the images to text, group documents by common letterhead and then provide a simple search interface over all of it. Since optical character recognition is hit-and-miss, any full-text search should permit proximate indexing and searching to allow for fuzzy matches.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPp0Qh8gGf0f-qGym4nkBkkw4i51ORKFOkg-SfPamhJHbydj1yuIDt666uwDS1yDCUYrsrKmNVAN-Imnkp8FjcErevUiWDg3kSD7Iq76V-WinUHy-NiTgaEzEa7iacstzsVrmF4A/s1600/docmag.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPp0Qh8gGf0f-qGym4nkBkkw4i51ORKFOkg-SfPamhJHbydj1yuIDt666uwDS1yDCUYrsrKmNVAN-Imnkp8FjcErevUiWDg3kSD7Iq76V-WinUHy-NiTgaEzEa7iacstzsVrmF4A/s400/docmag.jpg" width="400" height="215" data-original-width="1129" data-original-height="607" /></a></div>In the end I created two apps: <a href="http://github.com/deckerego/docmag">DocMag</a> and <a href="http://github.com/deckerego/docidx">DocIndex</a>. DocMag serves as the search front-end and allows users to perform full-text searches on scanned documents, label them with tags and automagically group other documents with the same letterhead or logo. The interface is pretty spartan and uses Spring Boot to build a straightforward integration into Elasticsearch. DocIndex is the batch process that crawls a filesystem and parses the documents using OCR, generates thumbnails, tags similar documents using computer vision-based template matching, and stores document metadata within Elasticsearch.<br />
<br />
DocMag was created in Groovy using Spring Boot (Spring Web, Spring Data, etc). I did this mainly to understand how Spring Boot's conventions translated over to the Groovy world... it had been quite a while since I had worked with Grails. It turns out that Groovy, Spring Boot and Thymeleaf complemented each other quite well and make for fairly simple web development.<br />
<br />
DocIndex was created with Spring Boot and Java 9 initially. <a href="/2017/12/java-jigsaw-puzzles-devops.html">I griped in an earlier post</a> about my problems with Java 9's dependency management, so instead I fell back to the lambda expressions and work queue management within Java 8. This permits multithreaded parsing of discovered files, which then allows for vertically scaling document indexing by adding cores. Horizontal scaling should be possible by replacing the in-memory work queue with a proper shared message broker. There is <a href="https://github.com/deckerego/docidx/issues/12">a "reminder" issue I've already filed</a> to migrate to a proper broker so this can be done sometime in the future.<br />
<br />
Both DocMag and DocIndex are <a href="https://hub.docker.com/u/deckerego/">deployed as containers within DockerHub</a>. This was especially necessary with DocIndex, as it relied heavily on native libraries for <a href="https://github.com/tesseract-ocr/tesseract/wiki">Tesseract OCR</a> and <a href="http://opencv.org">OpenCV</a>. OpenCV was the most contentious - each Linux distribution has a different version of OpenCV, and the version changes quite rapidly. Building containers for distribution allowed me to ensure users got the correct version of native libraries that worked well with their Java bindings.<br />
<br />
Another nice feature of the containerized deployment model was composition - I was able to pair the correct revision of Elasticsearch, conditionally include Kibana, and provide a simple web application firewall by placing DocMag behind <a href="https://github.com/SpiderLabs/owasp-modsecurity-crs">modsecurity and Apache</a>. Network connections could be maintained between Elasticsearch, modsecurity, and DocMag without any of these interconnects leaking to the "outside" world, allowing me to do things such as only expose modsecurity to outside traffic and only permitting DocMag to receive requests through modsecurity. Elasticsearch could be hidden as well, only available on the internal network managed by <a href="https://docs.docker.com/compose/overview/">Docker Compose</a>.<br />
<br />
Deployment can be relatively straightforward; since everything is deployed to Docker Hub as a container, one should just need to download the <a href="https://github.com/deckerego/docmag/blob/master/docker-compose.yml">docker-compose.yml</a> file and issue <code>export DOCUMENT_HOST_DIR=/mnt/documents && docker-compose up -d</code>. This should provision a single-node Elasticsearch instance, start DocMag behind modsecurity, and begin indexing with DocIndex.<br />
<br />
If you are stuck digging through mountains of scanned documents, give DocMag a try. Ease of installation is one of its primary goals - so let me know if you find any issues getting it running!<br />
DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-19256270092152055482017-12-20T12:31:00.000-05:002017-12-20T12:34:11.521-05:00Java Jigsaw Puzzles DevOps<a href="https://commons.wikimedia.org/wiki/File:Whimsy.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGrzc5Sp5-sd8OLIaGxNnWiGgi-Pfmmj6FZsm6k3MYs8vynzstOu9fSgwpbOoxAH-I7uOP_ZNrAoWA8Up1tDHK_SQwvzSMx07p_1ra1Jjpf5EWaN-aWI12eQP-yxKBzWSplfSgiw/s1600/jigsaw_puzzle.jpg" data-original-width="200" data-original-height="150" /></a>Oh man that's a catchy blog title.<br />
<br />
For the past couple o' weeks, my after-hours project has been trying out <a href="https://github.com/deckerego/docmag">building webapps</a> and <a href="https://github.com/deckerego/docidx">batch jobs</a> using the combo of Java 9, Spring Boot 2 milestone releases, Elasticsearch 6.1 and Docker Edge with Docker Compose. Just because I was in a WAF frame of mind I added <a href="https://www.modsecurity.org/">modsecurity</a> as a web application firewall in front of the app so I could learn a bit more about building WAF rules with Apache 2.<br />
<br />
It was a fun lil' exercise, but in the end I found that all the cutting edge releases simply wouldn't play nicely with each other.<br />
<br />
One painful exercise was trying to get Java 9 distributions to work within a Docker container just as it would within my desktop environment. <a href="http://openjdk.java.net/projects/jigsaw/">Project Jigsaw</a> is an oft-cited future feature of Java that build engineers have been asking for to end the myriad of JavaEE / Java ME / Java Desktop / Java Server distributions. It <i>should</i> help containerization by allowing svelte JRE installations to bootstrap within a minimal OS. However... this new way of distributing JREs with modular components creates <b>yet another</b> dependency management headache for builds. Once you begin writing manifest elements for Jigsaw + Java 9, every library and its mother now needs to be managed by your manifest as well. Its enough to drive you nuts. <br />
<br />
Let's say you don't want to jump into building modular JARs yet and just build traditional JARs that don't use Jigsaw dependency management. Well... Ubuntu's OpenJRE 9 distribution doesn't automatically inject some Java 9 foundation libraries (such as javax.image), while Oracle's JDK does. If you use an Oracle JDK locally to develop things may appear just fine, but then you need to perform some command-line overrides for things to work on an OpenJRE 9 build. To make things more hairy, it seems that OpenJDK and Oracle have built implementations that might be runtime compatible but are NOT compatible from a build & deployment standpoint. Command-line arguments are vastly different, even though manifest formats are the same. That makes building standard build & deployment scripts a pain, as well as local testing. Distributing Oracle's JRE within a container is just to fraught for me to attempt - so I stick to distribution with OpenJDK instead.<br />
<br />
I ended up burning too much time trying to get a consistent build between my streamlined Ubuntu-powered Docker container and my local MacOS development environment, so I punted back to Java 8. While Java 9 had some nice memory management features and some syntactic sugar, what I really needed was Lambda and Stream support. Java 8 was sufficient for this in both Oracle and OpenJDK-land.<br />
<br />
The combo of Spring Boot 2 (milestone 7) and Elasticsearch 6.1.0 was another mix that simply didn't pan out. The Java libraries for Elasticsearch 6 had a few signature changes across the API which were entirely incompatible with Spring Data Elasticsearch, and the protocol between ES 5 and 6 did not appear to be compatible. I'm sure this will get patched up in short order within the Spring project, however until then I had to fall back to Elasticsearch 5.6.4. I wanted to stick with Spring Boot conventions as closely as possible, so I did not go native just for ES 6 support.<br />
<br />
In the end... I do have a fully containerized solution using Spring Boot 2, Java 8, Elasticsearch 5.6.4, and modsecurity. Getting WAF protection, a single-node ES cluster, a web front-end and a indexing batch process running in the background all happens with:<br />
<br />
<code>export DOCUMENT_HOST_DIR=/mnt/documents && docker-compose up -d</code><br />
<br />
...and that's it! Containers are also available at <a href="https://hub.docker.com/u/deckerego/">Docker Hub</a> and require thankfully LITTLE dependency management.DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-46419029441756519322017-05-15T21:01:00.000-04:002017-05-15T21:01:50.396-04:00Climate Change By The DollarOne of my lil' neurosis is ensuring that I reduce my energy usage year over year. To make sure I'm following a downward trend, I've been trending the dollar cost for energy and water bills. Assuming that cost per unit does not go down year over year (which so far has been true), this should be a reflection of overall energy use.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaDKIWAN5HKSkMt67L7UvU-yyrUe2v-gt7j9geN7DNnAEZtapK0wGRuQ3W_mdutcFn_Lu8dNkBG7qkz5NMYe1wieIbODBQAMo3cYV5WcYMHa60ob2G1rYD_TryDWK9fr2upQ73Lg/s1600/Screen+Shot+2017-05-15+at+20.43.20.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaDKIWAN5HKSkMt67L7UvU-yyrUe2v-gt7j9geN7DNnAEZtapK0wGRuQ3W_mdutcFn_Lu8dNkBG7qkz5NMYe1wieIbODBQAMo3cYV5WcYMHa60ob2G1rYD_TryDWK9fr2upQ73Lg/s1600/Screen+Shot+2017-05-15+at+20.43.20.png" /></a></div><div class="separator" style="clear: both; text-align: center;"></div><br />
Note that the large hills on the graph spurred on by heating bills (both water and central air) are shrinking each year. Air conditioning during the summer months is showing small increases. Over the past three years I have also replaced all light fixtures with LED lighting - which does help drop the constant spend month over month.<br />
<br />
It is interesting that while both winters and summers are getting warmer, heating the house expends much more energy than cooling the house, providing an overall downward trend. Water use is also beginning to spike due to the lawn irrigation system, which is why I created the <a href="https://hackaday.io/project/7566-sprinkler-switch">Sprinkler Switch</a> project to only water when no rain has occurred recently or is forecast to occur that day.<br />
<br />
This is an indirect measure of how our climate is changing, and only represents a four year sample size. The trends are still quite visible - and demonstrate how evolutions in home heating could significantly reduce energy consumption.DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-60925244975260550582017-02-04T21:12:00.002-05:002017-02-04T21:15:40.647-05:00Alarm Clock Hacking by Blocks<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyTz56GMf4JI-jfXBx4quJ5yAbs9RppWpA0cG2uiUPTns3sKOKx2ntktPrsB6xQ44QjC4s2hIHEDhWy5GvDJFFrJzN7Dfj6y08hhzEVYH46SzdNq4QF0sTOl-RbFT8y9OollSIEQ/s1600/clock_dresser.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyTz56GMf4JI-jfXBx4quJ5yAbs9RppWpA0cG2uiUPTns3sKOKx2ntktPrsB6xQ44QjC4s2hIHEDhWy5GvDJFFrJzN7Dfj6y08hhzEVYH46SzdNq4QF0sTOl-RbFT8y9OollSIEQ/s400/clock_dresser.jpg" width="400" height="225" /></a>A little over <a href="/2014/12/hack-your-alarm-clock.html">two years ago</a> I built an alarm clock intended for hacking by kids, using a web-based Python IDE. When I tested the lessons, I found that kids didn't like messing with Python and only learned enough to get things barely working. Yet, when it came to <a href="https://itunes.apple.com/us/app/scratchjr/id895485086">Scratch Jr</a> or the desktop version of <a href="https://scratch.mit.edu/">Scratch</a>, they would spend hours at a time. I needed to find a more approachable way to code.<br />
<br />
Recently I discovered <a href="https://developers.google.com/blockly/">Blockly</a>, a product from <a href="https://developers.google.com/edu/">Google for Education</a>. With that framework you can code by blocks and use its transcoder to output JavaScript, Python, Lua, Dart or (ugh) PHP. The transcoder runs entirely client-side, and the output is human-readable - well indented and even commented.<br />
<br />
Writing custom blocks turned out to be an easy thing, so I created blocks to modify the LED display, send audio out to a speaker, or react to button presses. Now you can use blocks to program the clock, while retaining all the functionality present in the older Python interface.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP_a7nasb7FhK-vosHfS7l7LZlBoNFpocEKFDK7yasL21XCaJRZ95IFSADLGw6vCgitRrkhVj425b0sXuDNiEd0oVW5LBDIX_P64GeN7DFL4UfDRq3_QCYkAY7ZY_ncZnEkNhKhA/s1600/block+programming.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP_a7nasb7FhK-vosHfS7l7LZlBoNFpocEKFDK7yasL21XCaJRZ95IFSADLGw6vCgitRrkhVj425b0sXuDNiEd0oVW5LBDIX_P64GeN7DFL4UfDRq3_QCYkAY7ZY_ncZnEkNhKhA/s400/block+programming.jpg" width="400" height="276" /></a>If I was going to redo the Hack Clock, this time I wanted to have a presentable site with full hardware and software lessons, for both Python and Blockly. I revamped <a href="http://hackclock.deckerego.net/">the Hack Clock website</a>, completed the <a href="http://hackclock.deckerego.net/lessons/python/">Python lessons</a> that I left incomplete last time, wrote new <a href="http://hackclock.deckerego.net/lessons/blocks/">Blockly lessons</a> for the new IDE, and completely re-did the <a href="http://hackclock.deckerego.net/hardware/">hardware how-tos</a>. Lesson writing took up the lion's share of time, since they all needed new images and better testing.<br />
<br />
Another bit o' feedback I had received was that installing the <a href="https://github.com/deckerego/hack-clock">Hack Clock software</a> was too much of a pain. I tried to make this a bit easier this time by offering releases <a href="https://github.com/deckerego/hack-clock/releases/latest">within a Debian pkg</a>, although you still needed to use apt to install dependencies. Still, this cuts down installation from over an hour to about ten minutes... and most of those ten minutes is spent twiddling your thumbs while you want for packages to download and install.<br />
<br />
The hardware needed tweaking as well. It turns out the Raspberry Pi headphone jack is just <a href="https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/pi-zero-pwm-audio">a PWM pin hack</a> and it seemed that GStreamer sometimes just couldn't grok it. The headphone jack was never a complete solution either - it required a discrete amplifier to power speakers, and soldering wires onto a 1/8" jack is a GIGANTIC pain. To make the audio hardware easier to cope with, I moved away from the headphone jack to <a href="https://www.adafruit.com/products/3006">Adafruit's I2S decoder and amplifier</a>. It provided better audio and cleaner installation without increasing my part count or price. It has proven out to be easier for everyone so far.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg67o-wElZ-qUDHFzai2rv4Mvsvxseg9YpeQACnDaSEX_0axcwtITsQzbnYgbiXof7qfAy9fpJ-xAjQuwMf9brNA8VY_ronHgenXy_R5LIjUtawu9lJDArJQWHsbVi42uJmk9uuTA/s1600/hackclock_bare.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg67o-wElZ-qUDHFzai2rv4Mvsvxseg9YpeQACnDaSEX_0axcwtITsQzbnYgbiXof7qfAy9fpJ-xAjQuwMf9brNA8VY_ronHgenXy_R5LIjUtawu9lJDArJQWHsbVi42uJmk9uuTA/s400/hackclock_bare.jpg" width="400" height="263" /></a>The old Hack Clock had another embarrassing flaw: it could only handle one button input and couldn't manage output at all. That drove me nuts and was probably the second biggest thing I wanted to fix. With the latest release the Hack Clock can handle as many buttons as you have GPIO pins, and you can also drive output pins as "switches" in code. The code-by-blocks IDE could deal with buttons and switches as simple function blocks - which meant reacting to user input became much easier to code.<br />
<br />
Once things were ready, I installed the Hack Clock software in a mission-critical environment: kids' rooms. So far things have gone well; audio has been more reliable than with the headphone jack, and they have been able to tweak the software more easily than with Python. One bit I noticed this round however: kids don't like looking down to read something, then looking back to code it. The next generation Hack Clock should have an interactive demo to guide through the lessons so they never have to glance away from the IDE.<br />
<br />
I'd love to hear what other people experience when they try to get the Hack Clock running as well. A <a href="https://hackaday.io/project/3413-hack-ready-alarm-clock">hardware list</a> is posted on Hackaday, and all the instructions are at <a href="http://hackclock.deckerego.net/">http://hackclock.deckerego.net/</a>. Let me know what you think!DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-60400586955292245532016-12-15T22:52:00.000-05:002016-12-15T22:52:10.479-05:00Arcade Addiction<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9J0QyVjqgvAQenqUnHkZa8pXrESzSFsN3ui4U4jQYjbDXtSiOBp5abJFnYh82JGt_5CICrDy3MFA1fAOKSWBjficN19HG9MIUkVQHERjkSqycWRpv_glRlh_GVOyXSUjVvDAyvg/s1600/20160923_194238.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9J0QyVjqgvAQenqUnHkZa8pXrESzSFsN3ui4U4jQYjbDXtSiOBp5abJFnYh82JGt_5CICrDy3MFA1fAOKSWBjficN19HG9MIUkVQHERjkSqycWRpv_glRlh_GVOyXSUjVvDAyvg/s400/20160923_194238.jpg" width="400" height="225" /></a>Ah, who can forget playing Pac-Man at the Pizza Hut. Or Joust waiting for a pizza at Noble Roman's. Or DigDug at Pizza King. Come to think of it... I ate a lot of pizza as a kid.<br />
<br />
Fast forward to Christmas of 2014 - I purchased a <a href="http://www.recroommasters.com/Xtension_Classic_Arcade_Cocktail_Cabinet_p/rm-xt-tab.htm">arcade cocktail cabinet</a> from Rec Room Masters. After it was assembled in Ikea-like fashion I mounted an old monitor, discarded 2.1 speakers and an Raspberry Pi 3 inside of the chassis. Nifty.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-22reh15U38PC0qN9hB_TRKoIzEob0DGzoIUZQb5Cy6JdakeDlUXBwEaqppVgjjbVXcxkNWN9BUPb9NOtIn85ZnvDr1_HGHriXqns84Sw5eAm2Pa4nZHO17xtHWVJcw_rgzPNkQ/s1600/20161009_145814.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-22reh15U38PC0qN9hB_TRKoIzEob0DGzoIUZQb5Cy6JdakeDlUXBwEaqppVgjjbVXcxkNWN9BUPb9NOtIn85ZnvDr1_HGHriXqns84Sw5eAm2Pa4nZHO17xtHWVJcw_rgzPNkQ/s400/20161009_145814.jpg" width="225" height="400" /></a></div>One oddity was that I didn't want to shell out all the cash for every single button in a panel... so I needed a cap for each remaining hole. Luckily I had access to a 3D printer, so was able to <a href="http://www.thingiverse.com/thing:1786827">remix a hole cap</a> on Thingiverse and print black caps to fill the gaps.<br />
<br />
I wanted the Raspberry Pi to sit a bit out of the way, so I screwed it into the VESA mount that the monitor rested on. After sawing an <a href="https://www.adafruit.com/products/1609">Adafruit perma-protoboard</a> in half I was able to <a href="https://plus.google.com/106224289181527993344/posts/RzCQB7YH21k">craft some custom headers</a> that allow ribbon cables to connect from the Raspberry Pi and join with header posts for the joystick pins and buttons. This allowed for much better cable management and room for the subwoofer & speakers underneath.<br />
<br />
I wasn't interested in installing a coin door on one side - so I kept it wide open and instead had the cabinet door facing the center of the room. Little had I expected that cats would LOVE climbing in the open gap of the cabinet... and ripping cables off my Pi. I shoved the open side against the wall - allowing the extension cord to conveniently poke through - and now the only access is through the swinging door on the opposite side.<br />
<br />
On the software side, joysticks and buttons are mapped through <a href="https://github.com/recalbox/mk_arcade_joystick_rpi">mk_arcade_joystick_rpi</a>, an archaically named but amazingly useful module that allows GPIO pins to become joystick inputs recognized by Linux. It took some work in order to have <a href="https://github.com/retropie/retropie-setup/wiki/retroarch-configuration">libretro recognize these buttons</a>; many of them had to be remapped. However, libretro quickly became my go-to MAME emulator and now supports controls on both sides of the cocktail cabinet.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsCNo8JlNX5sIORjE-5Ql81_8KL5JVeXQVKyE3OTXvNOo2XXdHhyphenhyphenEL1nuwSpd21EPHexgq9e3YJsrR8y67j7OZFvx-UJpTSuEqqd65unXu376QqtLeQUX0XLpXe_VAVJtiVGNflw/s1600/20160914_224846.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsCNo8JlNX5sIORjE-5Ql81_8KL5JVeXQVKyE3OTXvNOo2XXdHhyphenhyphenEL1nuwSpd21EPHexgq9e3YJsrR8y67j7OZFvx-UJpTSuEqqd65unXu376QqtLeQUX0XLpXe_VAVJtiVGNflw/s400/20160914_224846.jpg" width="400" height="225" /></a></div>I had to perform some slight modifications to the <a href="https://retropie.org.uk/">RetroPie</a> display setup to rotate the screen 90˚, but luckily so many cocktail cabinet titles were programmed for this 4:3 aspect ratio. Titles are working flawlessly now, and I can host two-player action by flipping a few emulated dip switches.<br />
<br />
One thing I found interesting was how MAME distributions were entirely <a href="https://docs.google.com/spreadsheets/d/1LP1MELCvcxu7TfiowF_0ZuvRVEMqlfQyTVetnOJvuJc">dependent on the exact name of your zip file</a>. In addition, each ZIP was a true manifestation of the on-board arcade ROMs - in that sometimes a US distribution or second edition game actually piggybacked on top of a previous ROM. In this same way, two ZIPs were sometimes required to run a single title: one for the older ROM, one for the later version. I ended up combining the two ZIP archives into a single one - in this way older ROM images were still injected as a dependency, while the ZIP name was that of the older title and was still executed correctly. <br />
<br />
Pizza night at the household now takes on an entirely new meeting. A few slices and a frosty beverage helps me appreciate Ms. Pac-Man in a whole new light.<br />
DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-80538339387556759612015-10-07T23:25:00.000-04:002015-10-08T06:11:30.880-04:00Raspberry Pi Finally Conquers Userland<a href="https://commons.wikimedia.org/wiki/Category:BIOS_POST_cards#/media/File:BIOS_POST_card.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1KFeN27HvKQ0CciC-mh_ApHcl8Ci4CqiY3SJTuk_PWaKSwy_s7ClGi6OjmPdtCt2R4TATTrbYAKnXlmla6jwB_gvpNt3A1ca_JP3XBV-eiFxwaXBokhA7hZWfkWOrPeDPcLMrng/s1600/BIOS_POST_card.jpg" /></a><a href="raspberrypi.org/">Raspberry Pi</a> developers have had quite a coup on their hands this past few weeks. The "official" Raspberry Pi Linux distribution <a href="https://www.raspberrypi.org/blog/raspbian-jessie-is-here/">Raspian was just upgraded to Debian 8, or "Jessie."</a> This provides a <b>huge</b> number of wins - the 4.1 release of the Linux kernel, latest glibc and build chain updates, more native packages (like Node.JS and wiringPi), and device trees. Oh, sweet device trees.<br />
<br />
While the current Raspian distribution still relies on wiringPi 2.24, the most recent 2.29 version <a href="http://wiringpi.com/wiringpi-update-to-2-29/">has a much nicer way of addressing GPIO in userspace</a> by exposing the GPIO ports in /dev/gpiomem. All too often Raspberry Pi developers run GPIO apps as root to access the array of general purpose I/O pins, however this leads to all the lovely <a href="/2013/10/your-barn-door-is-off-its-hinges.html">security holes and vulnerabilities that privileged access brings</a>. You never want Apache or Python or any user-created apps running as root - so instead you must find a way to export these ports and allow unprivileged users to access them. Traditionally this has been done using wiringPi's export utility, however the latest gpiomem exposure seems to be much cleaner.<br />
<br />
With Jessie I've been able to significantly cut the complexity of installing <a href="https://github.com/deckerego/GarageSecurity/">Garage Security</a> and <a href="https://github.com/deckerego/SprinklerSwitch/">Sprinkler Switch</a>. I don't need to manually install wiringPi, Node.JS, Video4Linux and a number of other packages. Things seem to largely "just work" as one might expect of a modern distro. One example is that <a href="http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome">Motion</a> has been updated and appears to be pre-packaged on Raspian, and the necessary Video4Linux bcm2835-v4l2 kernel module properly creates a /dev/video0 device. CPU utilization appears to be much lower with the current stack, and it appears that I can just tweak Motion's configs to save videos in an HTML 5-friendly way rather than transcoding them with a script.<br />
<br />
Garage Security and Sprinker Switch are being updated now for Jessie and testing is underway... the new Jessie builds are looking very promising so far.DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-73694511595333717242015-09-25T19:35:00.002-04:002015-09-25T19:35:59.915-04:00XMPP (Jabber) as a Message Broker<p><a href="https://commons.wikimedia.org/wiki/File:Seiyu.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0vusjqoXxq_RdrhPzZcd-PU6LjNpGyCZuPBkOw4I5j0H59R1mftP0Oa0NxqiveK3KxWSY-kyfKid09rY79PhvODgE2IxdKUMYtlXB3CZ0PXNJGKlE0Vmj4UAq4uL4Fl6prjgA_w/s1600/240px-Seiyu.png" /></a>For a long while I’ve relied on Jabber/XMPP support within Google Talk to communicate with back-end systems like my <a href="https://hackaday.io/project/2049-garage-security">Garage Security</a> monitor. Garage Security could push notifications to me when motion was detected, and I could reply back to ask for camera snapshots or current temperatures. It’s almost as if I was using XMPP and Google’s Talk servers as a message bus; everything was a request/response pair that I could receive as notifications in a nice lil’ mobile interface. This was a superior approach to having a peer-to-peer communication channel over the Internet at large - I could keep my firewall completely closed and instead publish events to a trusted broker over at Google HQ. I essentially treated Google Talk like a hosted RabbitMQ instance.<br />
</p><p>This "XMPP broker” approach continued to work after Google moved from Google Talk to Hangouts and <a href="http://xmpp.org/2015/03/no-its-not-the-end-of-xmpp-for-google-talk/">dropped full XMPP support</a> (notably for <a href="https://www.eff.org/deeplinks/2013/05/google-abandons-open-standards-instant-messaging">federation</a>), however things appear to have become a bit more difficult when two different systems (like Garage Security and my new <a href="https://hackaday.io/project/7566-sprinkler-switch">Sprinkler Switch</a>) want to share the same Hangouts user ID. Previously <i>both</i> systems would receive an inbound message, so I would filter by a token in the message body. If I asked for “garage status,” Garage Security would catch the “garage” keyword and respond while Sprinkler Switch would just ignore it. As Hangouts has turned the XMPP support decidedly more text-message-ish, it seems now the last system to authenticate will starve out the previous system, and only one system will actually receive the messages.<br />
</p><p>This is not outside of the XMPP spec it seems, and the <a href="https://www.safaribooksonline.com/library/view/xmpp-the-definitive/9780596157524/ch03s06.html">protocol itself</a> specifies two ways for the systems themselves to deal with the issue:<br />
<ol><li>When connecting to the XMPP server set the <b>priority</b> for your connection. A higher priority is more likely to get inbound messages.<br />
<li>Specify a <b>resource</b> name within your XMPP user identifier. This allows a system to be uniquely addressable with the same username.<br />
</ol></p><p>The first option doesn’t necessarily help my situation - I want both systems to receive inbound messages. The second option is possible using XMPP’s definition of user IDs… where a user identifier is actually the composite of:
<ul><li>The username that is used for authentication<br />
<li>The domain that the user resides within<br />
<li>The resource that uniquely identifies who is signing in<br />
</ul>Using this schema, I could provide <a href="http://sleekxmpp.com/api/xmlstream/jid.html">SleekXMPP a JabberID</a> (its native user identifier) of <code>chuckleface@gmail.com/garage</code> and have it uniquely identify Garage Security, while <code>chuckleface@gmail.com/sprinkler</code> uniquely identifies Sprinkler Switch. It’s not entirely unlike the routing key in AMQP or a topic name in JMS… <code>chuckleface</code> could be considered your message type, <code>gmail.com</code> could be considered your exchange, and <code>garage</code> could be considered your ID. Or something like that. It makes sense in my head at least.
</p><p>Hangouts, however, just cares about chat messages. It could give two craps about my resource name. There’s no way to specify that in a contact either… with Hangouts you specify an e-mail address which in turn becomes a username and a domain. That’s fine for chat… but when I want to address an individual system I’m kinda outta luck. Hangouts will just reply back to the last resource that <i>sent</i> it a message - no way to specify a specific resource.
</p><p>I've posted a <a href="https://gist.github.com/deckerego/be1abbc079b206b793cf">demo using Python on GitHub</a> which lets you build a quick XMPP client. An example might be:
<pre>>>> from jabtest import Jabber
>>> jab1 = Jabber('test@gmail.com', 'apikeyh4x0r5', 'testone')
Opened XMPP Connection
>>> jab2 = Jabber('test@gmail.com', 'apikeyh4x0r5', 'testone')
Opened XMPP Connection
>>> jab1.send_msg('deckerego@gmail.com', 'Testing One')
Sending message: <message to="test@gmail.com" type="chat" xml:lang="en"><body>Testing One</body></message>
</pre></p><p>I don't have a fantastic solution for now... so in the interim I've disabled Jabber support for Sprinkler Switch.
</p>DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-22181484197161437032015-01-05T07:00:00.000-05:002015-01-22T20:40:38.374-05:00Telling a Tale for Ten Years<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxRbqE14EWRbsIhIG_sAuv9iVc2Fed_9-rwFrgok7GsyNmYyOBP9fnUmLFSDNAyG0jRYXarGfJBWtBPs0ObVrei289VUYJBkNhZlOE6TZucyMhXRMO-HU_TIMOqS1d8-3Jhh9bHQ/s1600/me.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxRbqE14EWRbsIhIG_sAuv9iVc2Fed_9-rwFrgok7GsyNmYyOBP9fnUmLFSDNAyG0jRYXarGfJBWtBPs0ObVrei289VUYJBkNhZlOE6TZucyMhXRMO-HU_TIMOqS1d8-3Jhh9bHQ/s1600/me.png" /></a>Exactly ten years ago I started this ridiculous blog as a way to collaborate with other game developers. At the time I thought I would dig deep and push out at least one title. This eventually led to the "Desktop Distractions" studio concept, and the nascent title <a href="http://deskblocks.deckerego.net/">Deskblocks</a>. I also worked within the <a href="http://www.crystalspace3d.org/main/Main_Page">CrystalSpace</a> engine as an entrant to the <a href="http://www.planeshift.it/">PlaneShift</a> team. I just couldn't give these projects traction however, so I gave it up and moved on to tinkering.<br />
<br />
Even though the driving force behind the blog had faded away, and even though no one else reads this blog (aside from the <a href="/2012/09/the-state-of-net-integration-frameworks.html">State of .NET Integration Frameworks</a> post), I kept updating it. Writing - even if it exists only for your own edification - really does help with communication and critical thinking regardless of what you write about. Even though my day job has nothing to do with garage door openers, my posts on my <a href="/search/label/garage%20door">garage door security system</a> helped me organize the build in a way that informed the <a href="http://hackclock.deckerego.net/">Hack Clock</a> project. Back in 2006 I began investigating <a href="/search/label/vector%20processing">vector processing</a>, and the resulting frameworks have helped me think about and design microservice architectures. Of course, there was plenty of venting as well with <a href="/2010/12/candyland-gets-paved-again-repeatedly.html">my favorite software companies being dissolved</a> or <a href="/search/label/opensuse">SuSE Linux</a> winning and failing and winning and failing again. All of this writing helped me when performing comparative analysis at work, or designing parallel architectures, or watching trends in software development.<br />
<br />
It is hard to believe a decade has slipped by. It doesn't even seem real. I don't think I've evolved much since that one cram session in <a href="/2007/09/crystal-chair.html">a crystal chair</a>, but I'm glad to have my collected ramblings to reflect back on.DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-37892640305871318602015-01-04T22:29:00.001-05:002015-01-04T22:29:46.063-05:00Your Garage as a Gas Station<a href="http://commons.wikimedia.org/wiki/File:Arvin,_Kern_County,_California._Co-op_store_and_gas_station_established_December_1939_in_the_Arvin_F_._._._-_NARA_-_521769.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1lTxWWD_kl_MW6FE8Nd6yvlSHOEUu-5zD812J-vr1xVtd1nrz2T2za0gEHGORQ5A53kdKnW5t-SgnYJZ9ad_TE12rIbzRy5DjedWTJ6fiB3Rr2SekbAZpVy1o61evXdyjOzacfQ/s1600/Arvin,_Kern_County,_California._Co-op_store_and_gas_station_established_December_1939_in_the_Arvin_F_._._._-_NARA_-_521769.jpg" /></a><a href="http://blog.deckerego.net/2014/11/are-electric-vehicles-really-better.html">I had evaluated electric vehicles</a> previously to determine if they actually were more efficient than cars with internal combustion engines, and found that (at the time) they did have a lower carbon footprint and would save me considerable amounts on fuel costs. Of course, that was before gas prices dropped nearly 33% in a single week - however I knew the prices were being artificially deflated and would eventually push back up. An added bonus remained that I would no longer be late to work because I had to navigate out of my way and fill the tank.<br />
<br />
I was able to <a href="http://blog.deckerego.net/2014/12/i-took-nissan-leaf-for-extended-test.html">take a Leaf out for an extended test drive</a> and make sure it fit my commute - which it did. I couldn't find another auto manufacturer that actually had an EV on the lot aside from Tesla, so the Leaf was the only auto at my price point. Luckily there are many Nissan dealerships in my general area and I ended up picking a Model S Leaf that I have been driving for a few weeks now.<br />
<br />
One great thing about an all-electric auto is that your garage is transformed into a "gas station," and you never need to leave your house to refuel. Bear in mind this does <i>not</i> necessarily mean you can use your normal 120V outlets to charge the car (using a Level 1 plugin-in charger) - you will at the very least need a dedicated circuit for charging, lest you blow a fuse from too much load. On my 24-hour test drive I quickly found out that the 120V outlet in the garage was on the same circuit as the master bathroom; when the car's 120V charger was powering up the battery it was consuming 11.3A of power, and a typical hairdryer will eat 12.5A. The combined 24A of load will trip your typical 15A circuit breaker quickly.<br />
<br />
Ultimately a 6 kW, 240V/30A (Level 2) charger is necessary for home charging since even a dedicated 120V outlet will require 21-ish hours to go from empty to 100% charge. Normal usage often requires a 10.5 hour charge with 120V, which can easily be done in 4 hours with a Level-2 charger. The good news is that while the chargers offered through the dealership appear to be fairly expensive, Home Depot and Amazon will sell Level-2 30A chargers for under $500. If you add in the cost of an electrician adding a 40A 240V dedicated circuit, you can have a 6 kW charging station for under a thousand bucks. The daily cost per kilowatt will be the same, and while there are some who worry about peak/off-peak charging hours most residential agreements seem to bill based on volume, not based on time of day. 6 kWh at 2 AM is billed the same as 6 kWh at 2 PM.<br />
<br />
The technology is changing rapidly. Level 2 chargers are rapidly eating from 20 amps to 30 amps to 40 amps, and Tesla is building a nationwide Level 3 charging network based on renewable energy. It's hard to say how all of this will play out... in 5 years we may have <a href="http://www.teslamotors.com/blog/driving-range-model-s-family">sedans with a 400 mile range</a>... in 10 years we may have self-driving cars in metro areas... in 20 years 25% of new car sales may be EVs. Ari Jay's <a href="http://arijaycomet.com/2014/12/30/comparison-our-2012-nissan-leaf-vs-our-new-2014-tesla-model-s85/">comparison between the Leaf and the Tesla S85</a> is a great example of the current state of the market - in the end both cars are great, to serve two different purposes and two different drivers. We're getting past early adoption, sliding past the <a href="http://en.wikipedia.org/wiki/Hype_cycle">peak of inflated expectations</a> and heading towards the <a href="http://en.wikipedia.org/wiki/Hype_cycle">trough of disillusionment</a>. Sure people are getting a bit anxious on range and worried about cost... but on the other side is mainstream adoption, and the widespread infrastructure to support electric vehicles and cross-country road trips.DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-76755058116745498102014-12-31T16:17:00.000-05:002014-12-31T16:53:36.982-05:00The Gear-Headed Mentality<a href="http://commons.wikimedia.org/wiki/File:Students_at_work_in_auto_repair_shop_-_NARA_-_285366.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg5j1cxs1ZO0nAwjv9F8uCdqlSZNgHzk67iJbj0VOLDToPn809TxiK0A1qs8Z13VYzMwzz5fwMsBO60YtqLz3w_3oWA1ef0imdMgmENzT1JAIURE8U9XqCZzrT1VwRQ5hGsv2-vA/s1600/Students_at_work_in_auto_repair_shop_-_NARA_-_285366.jpg" /></a>The old Saturn Ion that I had been driving is nearly ready to give up the ghost. After nearly a decade on the road, it is time for it to be put to pasture. Even now the car is getting 30 miles per gallon, a completely respectable rate. Still, so much of my traveling is just limited to the daily commute and running errands -<br />
and it is time to look at something more efficient than a controlled explosion eighteen inches from my knees.<br />
<br />
The first issue I encountered <a href="https://www.blogger.com/blogger.g?blogID=9951390">when shopping for an EV</a> was that dealerships still seem to be getting accustomed to selling all-electric cars. Several salespeople outright refused to speak to me about the Leaf, and instead passed me off to other sales reps. I couldn't find a single salesperson who would let me drive a Ford Focus. After I pried a bit further, it seems like the more "senior" sales staff believe that EV <u>buyers</u> are too high maintenance - the buyers don't understand the range issues, they fear higher return rates, they get cold feet and back out of the deal. Even the sales staff that would talk to me pressed very hard for a commitment, wanting faux signatures and asking for money down prior to delivery. I spoke to lot managers about the Leaf turnover rates, since I felt they had a more accurate sense of how inventory was moving, and they seemed to think the actual return rates were much lower than the rates the sales guys were assuming. For one lot, out of 15 Leaf sales only 1 had been returned.<br />
<br />
If you troll the EV forums you find that there is some hint of truth to the conception that potential all-electric owners are a high-maintenance bunch. Several complain that they had to wait a whole 5 minutes in a maintenance bay, others are incensed at the 87-mile range, and many aren't quite ready for the anxiety of finding a charger when they need one. If you are planning on using an EV as a secondary commuter car the stress can be much less, however an all-electric primary car can definitely give you an ulcer. Electric vehicles definitely require a cultural fit right now, which may be why there is such friction between buyers and sales people.<br />
<br />
As odd as it might seem, Focus/Leaf/i-MiEV/Soul/i3 owners are more akin to Corvette than to Corolla owners. <a href="http://www.mynissanleaf.com/">A happy Leaf owner</a> frets over charging temperatures, battery chemistry, wind resistance, regen strength, residential electrical codes, LED vs. halogen amperage - and enjoys doing so. Just as a Corvette owner is worried about properly gap'ing spark plugs, an EV owner is worried about electrolyte conductivity. If you wouldn't enjoy obsessing over the winter tires of a 'Vette, you likely wouldn't like obsessing over the optimum tire pressure for maximum EV range.<br />
<br />
In all honesty, I've never been a car guy. I know that the engine belts form a mobius strip to allow for even wear... and... there are cables? And various and sundry liquids? Not sure. However, the mechanics of an EV are much simpler to understand, which lets dullards like me <i>become</i> car guys because there is<br />
so much less to know. As is entirely too apparent, I'm more than happy to obsess needlessly about the baubles of technology... and so I think I can make the shift from the mainstream "it just works" mentality to the gear-headed "how does it work" mentality. Mainstream adoption may not be there for EVs just yet, but wannabe car guys have the perfect inroad now.DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-50903056325631203102014-12-17T08:00:00.000-05:002014-12-17T08:00:06.452-05:00Hack Your Alarm Clock<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjevlYecoqnD8WaE77cFtiw7lfnuNqsdGeAgnDN2FCjMuieeMqp-HvxfvsRvYGUhnx-PYP2NkngH0v3zcSBKfE6NUrKfxmRXXKGthDafVQ5bKSqQQiiZWeMO4TMeYV6A7kelcIaFQ/s1600/mark_1.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjevlYecoqnD8WaE77cFtiw7lfnuNqsdGeAgnDN2FCjMuieeMqp-HvxfvsRvYGUhnx-PYP2NkngH0v3zcSBKfE6NUrKfxmRXXKGthDafVQ5bKSqQQiiZWeMO4TMeYV6A7kelcIaFQ/s1600/mark_1.jpg" /></a>Kids, teens and adults are more inspired to tinker after they learn the basic framework of what they are tinkering with. Electronics and circuit sets are great, but it really helps to jump-start learning with demos or projects that are heavily documented in the box. After you get your bearings on what works and what breaks, you are more free to experiment and add your own ideas.<br />
<br />
To that effort I'm working on a hackable alarm clock based on the Raspberry Pi platform along with several Adafruit/Sparkfun components. The idea is that we can build a customized, tricked-out bedroom alarm clock with some general off-the-shelf components to see how hardware and software work in concert to create something useful. After the project is done, I'm hoping its creators will feel inspired to rip it apart or build new features using the pieces.<br />
<br />
I've already run these lessons with a few kids between the ages of 5 and 11, and it was pretty interesting to see what they found interesting. They all wanted to start playing music, but they celebrated being able to have <b>whatever number they wished</b> show up on the LED display. To simply type "77," hit "Save" and refresh the display was enough to send them clapping. They also spent a ton of time building their own enclosures out of Lego, designing the perfect case for their clock.<br />
<br />
Right now we have made it to Lesson 6 (the AM/PM indicator), however I have only published up to Lesson 4. More are to come, and I have already found some refinements that need to be made in the previous lessons. The lessons are available at <a href="http://hackclock.deckerego.net/">http://hackclock.deckerego.net/</a>, the hardware project is documented on HackADay at <a href="http://hackaday.io/hacker/5116-deckerego">http://hackaday.io/hacker/5116-deckerego</a>, and the Python source code for the clock driver is posted on GitHub via <a href="https://github.com/deckerego/hack-clock">https://github.com/deckerego/hack-clock</a>. I will keep these sites updated as the project grows.<br />
<br />
Let me know if you try out the project yourself. We are already making some fun hacks, such as using the LED display to show the answers to math problems. I'd love to hear what other people devise!DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-7482015161405698452014-12-16T22:52:00.001-05:002014-12-16T22:53:20.340-05:00Out of Gas<a href="http://commons.wikimedia.org/wiki/File:SOME_MOTORISTS_RAN_OUT_OF_GAS_SUCH_AS_THIS_MAN_IN_PORTLAND_AND_HAD_TO_STAND_IN_LINE_WITH_A_GAS_CAN_DURING_THE_FUEL..._-_NARA_-_555460.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjR-BWzWZ0GasiP5eHCBvqDysOesclH64eGz3LOQAr9slT-0bO_4Zi7OE43s50D753I3lIylPMmLEV2r3NSDtr-hwPa7f92IRIYlJl0cIGkmvkbp3IMcayUt3ouZry7ZjAedwjaQ/s1600/SOME_MOTORISTS_RAN_OUT_OF_GAS_SUCH_AS_THIS_MAN_IN_PORTLAND_AND_HAD_TO_STAND_IN_LINE_WITH_A_GAS_CAN_DURING_THE_FUEL..._-_NARA_-_555460.jpg" /></a>I took a <a href="nissanusa.com/electric-cars/leaf">Nissan Leaf</a> for an extended test drive today - I borrowed it last night and will return it tomorrow morning. It was definitely good to take an all-day test drive... there were a few things I didn't expect to encounter but are helpful to know.<br />
<br />
First off: the range. I drive approximately 53 miles a day just to work and back, and I'm driving in a midwest winter. The temp wasn't terribly cold - it was above freezing - but I needed to run the defogger for most of my trek. I drove in "Eco" mode the entire time as well, and made sure to take advantage of the regenerative braking. While Nissan quotes the driving range <a href="http://en.wikipedia.org/wiki/Nissan_Leaf#Range">between 75 and 84 miles</a>, a single 26.5 mile trek ate 40% of my battery. This places my winter driving range closer to 66.25 miles, assuming a linear discharge of the battery. That ain't good, and is a full 12% <i>less</i> than the advertised range.<br />
<br />
I am pretty fortunate to have EV charging stations at work, otherwise I'd be sunk within a year. Right now the plan is to use the regular 240V charger at work, and trickle-charge the battery at 120V at home. This means I need to charge for 4 hours once I arrive at work, and charge for 10.5 hours at home. Not terribly convenient, but doable. If I wasn't able to recharge at work I would definitely be sweating it on the trip back.<br />
<br />
For a while I weighed the difference between the S and SL models (the low and high end), but I didn't find a compelling reason to move to the SL. True, the SV/SL models offer <a href="http://www.nissanusa.com/innovations/carwings.article.html">CARWINGS</a>, however it uses an old AT&T 2G network that is scheduled to go dark by the end of 2016. There is also the navigation console and full Bluetooth support which is nice... but... meh. Overall I didn't find a compelling reason to upgrade from the base S model, other than adding the quick charge package.<br />
<br />
The Leaf is tempting. I will definitely need to change my driving habits and will have to always be mindful of the nearest charging station; already I've petitioned work for additional EV spots. However, if I am willing to bend over backwards I believe I could make a switch to all-electric.DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-85968620303684402832014-11-18T08:00:00.000-05:002015-01-14T00:50:43.634-05:00Are Electric Vehicles Really Better than Combustion for Commuters?<a href="http://commons.wikimedia.org/wiki/File:Detroit_Electric_car_charging.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbPlbmqs-XGFqVUyFwiG-6oSplk2x_q7j9fyZeIkcB5tEYf1ODfVwysKzN6kL316itm3nolavoNOL2fpje0if8pd4N-JbOP5iWvRjn6QwYUqaSxBbaHeLdUaJ6dtC8RpzVvanVRQ/s320/Detroit_Electric_car_charging.png" /></a>I have a pretty regular commute of about 50 miles a day. The wheels are about to fall off my ten year old auto, which still manages around 30 MPG given my highway driving. I'd like to swap out cars prior to abandoning it on the side of the road, so I started to wonder if now was the time to go with an all-electric car.<br />
<br />
I've never liked the idea of hybrids. I'd rather mess with a combustion engine <i>or</i> an electric motor, not <i>both</i>. Electrical systems are crazy enough as-is without a gas-powered mobile generator strapped to it. Luckily electric vehicle prices have also come down significantly, with a base-level <a href="http://www.nissanusa.com/electric-cars/leaf/">Nissan's Leaf</a> going for under $22k. With that kind of price tag, I started to wonder how much better an all-electric car might be compared to a hybrid or an efficient combustion engine.<br />
<br />
I started to measure my gas consumption and prices at the pump, and keep a running total in a <a href="https://docs.google.com/spreadsheets/d/1YX52JjZLCmRfThk52dOF8SIe58RnoJVQz2W-tSt8c8I">Google Doc Sheet</a> which I'm happy to share. After a month of driving, I started to calculate what the cost and the CO<sub>2</sub> savings might be. I took current fuel costs and compared them to what an efficient combustion or hybrid car might be, then found some analogous kilowatt-hour data to draw comparisons to an electric vehicle. Here's what I found for a four-week period:<br />
<br />
<table style="width: 800px;"><tbody>
<tr> <th></th> <th>Current Car</th> <th>Efficient Car</th> <th>Electric Vehicle</th> </tr>
<tr> <th>Total Fuel Cost</th> <td>$119.52</td> <td>$95.43</td> <td>$40.81</td> </tr>
<tr> <th>Avg. Miles per Gallon</th> <td>29.52</td> <td>37</td> <td></td> </tr>
<tr> <th>CO<sub>2</sub> Created</th> <td>802.59 lbs</td> <td>640.65 lbs</td> <td>511.62 lbs</td> </tr>
<tr> <th>Monthly Savings</th> <td> </td> <td>$26.25</td> <td>$85.74</td> </tr>
</tbody></table><br />
So an EV would reduce your fuel costs by 66%, however it would only reduce your carbon footprint by 36%. By comparison the "efficient car" reduces both fuel costs and carbon footprint by 20%. One would think that an electric vehicle would trounce a moderately efficient car in carbon dioxide production, but that doesn't appear to be the case.<br />
<br />
Now, this is all based on an assumption that my data is sound... and maybe it should be reviewed by some more objective eyes. I'm effectively ignoring fuel transport and refinement costs (including battery production) - that's a rabbit hole I don't want to go down. I determined the CO<sub>2</sub> output of gasoline engines using stats from <a href="http://www.eia.gov/tools/faqs/faq.cfm?id=307&t=11">U.S. Energy Information Administration</a> and carbon output per kilowatt hour from the <a href="http://www.epa.gov/cleanenergy/energy-resources/refs.html">Environmental Protection Agency</a>. Based on that info, I was able to determine the impact of either EV or combustion cars. This makes a few assumptions and generalizations for the different types of fuels being burned, such as ethanol mix and coal/natural gas combustion of power plants. Nissan's own <a href="https://play.google.com/store/apps/details?id=com.nissanleaf.feelectricUS">"Feel Electric" Android app</a> makes slightly different calculations than my own, using an "EPA formula" that equates one gallon of gasoline to 33.7 kilowatts per hour. It also does not add CO<sub>2</sub> emissions from power plants into its equation. Using Nissan's formula, the savings for a week's worth of driving was slightly different than mine:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjK-upeVrNfK-62oCKK0dGujBgh2OT-83QOzkmcNPkwNj_zMUjm10FX3wTTcUegfi2ARWlaliLayyARX2ZiQJfXA28Yi1_RVozB0Hl3Qn0kBEnt8JSH5rBDhEjpqFDINbomvO495A/s1600/Screenshot_2014-11-17-07-47-16.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjK-upeVrNfK-62oCKK0dGujBgh2OT-83QOzkmcNPkwNj_zMUjm10FX3wTTcUegfi2ARWlaliLayyARX2ZiQJfXA28Yi1_RVozB0Hl3Qn0kBEnt8JSH5rBDhEjpqFDINbomvO495A/s320/Screenshot_2014-11-17-07-47-16.png" /></a> <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQ3lzK5jAqCfV2d2oIP69jvyNQCJB0Gp32q27QxNADbgdn_vYAZBqY8TPqw33EdTRnS-eJkHdLkEwy8UiBCmJ2FQFQkzN2LbnHgZ-QH2byrSny4NrQ-5cvfPHuOm9BxfA9LCEmJQ/s1600/Screenshot_2014-11-17-18-29-35.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQ3lzK5jAqCfV2d2oIP69jvyNQCJB0Gp32q27QxNADbgdn_vYAZBqY8TPqw33EdTRnS-eJkHdLkEwy8UiBCmJ2FQFQkzN2LbnHgZ-QH2byrSny4NrQ-5cvfPHuOm9BxfA9LCEmJQ/s320/Screenshot_2014-11-17-18-29-35.png" /></a></div><br />
If we assume my cost calculations are correct and we <i>add</i> the additional engine fuel costs to a 36 month lease, how would monthly car costs compare? Let's take a look assuming $2,399 due at signing, adjusting if more is due by prorating the amount across the term of the lease:<br />
<br />
<table style="width: 900px;"><tbody>
<tr> <th></th> <th>Ford Focus</th> <th>Ford Focus Electric</th> <th>Nissan Leaf S</th> <th>Tesla Model S</th> <th>Chevy Spark</th> <th>Mitsubishi i-MiEV</th> <th>Kia Soul EV</th> </tr>
<tr> <th>3yr Lease</th> <td>$256.74</td> <td>$202.00</td> <td>$199.00</td> <td>$890.28</td> <td>No Lease Listed</td> <td>$216.47</td> <td>?</td> </tr>
</tbody></table><br />
Note this makes a combustion car about $50 more a month than a comparable electric vehicle. The Kia is an interesting EV, unfortunately no Kia dealerships in my entire state carry one. From here we can narrow down affordable leasing options to the Focus, the Leaf S and the i-MiEV. Let's compare these three across the features I consider mandatory:<br />
<br />
<table style="width: 800px;"><tbody>
<tr> <th></th> <th>Ford Focus</th> <th>Nissan Leaf S</th> <th>Mitsubishi i-MiEV</th> <th>Kia Soul EV</th></tr>
<tr> <th>Price</th> <td>$202.00</td> <td>$199.00</td> <td>$216.47</td> <td>?</td> </tr>
<tr> <th>AC Power (kW)</th> <td>107</td> <td>80</td> <td>49</td> <td>81.4</td> </tr>
<tr> <th>Horsepower</th> <td>143.38</td> <td>107.2</td> <td>65.66</td> <td>109.076</td> </tr>
<tr> <th>Battery Capacity (kWh)</th> <td>23</td> <td>24</td> <td>16</td> <td>27</td> </tr>
<tr> <th>Average Range (mi)</th> <td>76</td> <td>84</td> <td>62</td> <td>93</td> </tr>
<tr> <th>ABS</th> <td>Yes</td> <td>Yes</td> <td>Yes</td> <td>Yes</td> </tr>
<tr> <th>Traction Control</th> <td>Yes</td> <td>Yes</td> <td>Yes</td> <td>Yes</td> </tr>
<tr> <th>Bluetooth</th> <td>Yes</td> <td>Yes</td> <td>No</td> <td>Yes</td> </tr>
<tr> <th>Quick Charge</th> <td>Optional</td> <td>Optional</td> <td>Standard</td> <td>Standard</td> </tr>
</tbody></table><br />
The i-MiEV seems a little underpowered and overpriced by comparison, however it did have several other amenities that the others lacked including more charging options. The Focus did offer considerably more power than the Leaf at a comparable price point, at the cost of average driving range. Another big difference is that the Focus has a water-cooled battery enclosure, while the Leaf's batteries are currently air cooled. This may extend the overall life of the Focus batteries, however this may not be a big issue for a 36 month lease. <br />
<br />
The Kia Soul appears to be the stand-out performer, however it is off the list due scarce availability. I attempted to give the Focus a test drive, but after searching I found that I would need to travel 8 hours and cross three states to find one. That means the Leaf is the only one I can test drive, even though it ranked a close third by comparison.<br />
<br />
The take away message is that the cost savings may be enough to trump a comparable combustion car by significantly lowering fuel and maintenance expenses for commuters with a predictable travel schedule. The environmental impact isn't as huge as I expected... however I'm just measuring greenhouse gasses and not contributors to smog, runoff or noise pollution. We may not have to weigh that impact however - the economics now seem to carry the day for EV's.DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-35113067304425461382014-08-24T15:53:00.000-04:002014-08-24T15:53:19.939-04:00DNS - The Internet's Phone Book<a href="http://commons.wikimedia.org/wiki/File:X-office-address-book.svg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFjf8XW-jFwARxFg8MaEqQ_RuiNOF-YIwldOLo6VDBbwe7HcAJsCqzDkF244V0y8RFFKSAJpWazkAeW42nBe-Rrj39b24jxlOeTveyRJ5xHy9Ow8a9YbNPyopOXeVsG-kWTvMPeQ/s1600/X-office-address-book.jpg" /></a>My earlier post about <a href="/2014/08/web-filtering-at-home.html">filtering Internet content for kids bringing home their school iPads</a> may have created more questions than answers for some parents. The big confusion seems to step from what a Domain Name System (DNS) server is, and how it helps filter out objectionable content.<br />
<br />
Let's go waaaaay back in time, back to the birth of the initial global network called ARPANET. Back in the day - and even now - you could reach a remote computer by using its numeric address. To connect to a remote computer, your machine may connect to "192.168.129.34" and send along some pretty data. Those numeric addresses could be a pain to remember however - so shortcuts were created that mapped a human-recognizable name (like "BubbaComp") to the numeric address (like "192.168.129.34"). Solutions were eventually engineered that let people share these lists... that way everyone could have this helpful list of shortcuts. This convention kept evolving as users continued to join the global network, up to today. Now when you type in "amazon.com" your computer is smart enough to look up this shortcut name and find out the numeric address is 176.32.98.166. Your computer always talks to 176.32.98.166, however you talk to your browser using https://amazon.com.<br />
<br />
This operates just like a phone book. No one remembers people's phone numbers anymore... or at least I don't. Instead you look up a person's name in your personal address book or the big dead-tree phone book on your front stoop, then communicate using the phone number in the book. Connecting to sites over the Internet works in the very same way.<br />
<br />
What if you didn't want your kids visiting certain sites? You could employ the same trick as you might to stop them from calling certain people over the phone - edit the phone book. If your kids can't look up a person's name and find their phone number, they can't call the person. If you edit the Internet's phone book and remove objectionable sites, your kids can't visit the objectionable site on their device of choice. That's exactly what OpenDNS allows you to do - use a phone book that only has acceptable web sites within it.<br />
<br />
What if a kid memorizes a phone number tho? Your plan falls apart a bit in that case. DNS filtering has the same limitation - if your kids memorize the IP address of a site (or share an underground DNS server), then they can go directly to the site and bypass your sanctioned "phone book." <br />
<br />
If your kids go to a site that has a wide variety of content (like YouTube), you can't filter out specific types of content within the site. Just like calling a party line on the phone... if you allow access to the party line, you can't control anything past the initial dial.<br />
<br />
Hopefully that helps explain why OpenDNS is only your first line of filtering. Lemme know in the comments if I can clarify further!DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-88290951683709628792014-08-23T22:14:00.001-04:002014-08-24T15:26:52.762-04:00Web Filtering at Home<a href="http://commons.wikimedia.org/wiki/File:Brueckner-Schile-Mischief.jpeg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 2em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiahzMxPotK0AAPup2qGMvsdKhCPcxNddpiw3M1ch7yelnZwbcnYsPyYiwE4BIBbBqHwkBuiCbBXSnDuD-bCJWvJVyAMZo6xlLo66e7tTO7M-Jd9p0CS9aRKfL6Kx0VtdDEICdxGQ/s1600/466px-Brueckner-Schile-Mischief.jpeg" /></a><b>[Updated to include an OpenDNS how-to]</b><br />
<br />
Now that iPads are standard issue for a lot of schools, a few parents have asked me how they can block inappropriate material at home. While the schools themselves filter at the network level, as soon as the student comes home the network is wide open.<br />
<br />
In all honesty, you can't filter out 100% of all objectionable content. It's hard to have software determine if a YouTube stream is showing questionable video. However, you can audit, track and block some obviously adult sites. The traditional options to perform web filtering include:<br />
<ul><li>Software applications or parental controls on the device itself</li>
<li>Filtering devices on the router or wireless access point</li>
<li>External Internet services that block DNS requests</li>
</ul><br />
Software applications give you the most control on a per-device level and can block errant applications as well (like anti-virus software), however you have to install them on each and every device. They also have the benefit of blocking things no matter what network they are attached to. They usually require a medium-level effort to circumvent, and it is sometimes hard to get a report on what the actual activity has been or if any sites had to be blocked.<br />
<br />
Filtering devices provide filtering for the entire network and do not rely on software to be installed on the device, which is nice. This solution is the hardest to circumvent, so long as you properly lock down your wireless access point. This solution cares less about applications however, and can’t really tell how appropriate actual content on a site is. It also only controls those devices on your network, and often doesn’t have fine-grained controls.<br />
<br />
External Internet services filter your entire network, just like a filtering device would, however it is hosted out on the Internet rather than being something installed or managed inside your house. This option often doesn’t give you much (if any) per-device controls, however they often do a great job of letting you pick what and how many sites to filter out. These solutions often provide reporting as well, letting you see what was viewed by devices on the network. This solution also can’t tell you about the actual content on the site, but just the URL that was visited. This solution is the easiest to circumvent, although this can be mitigated by locking users out of the administrative settings of a device (e.g. not letting users change network settings on an iPad).<br />
<br />
What I chose for the house was an external Internet service via <a href="http://www.opendns.com/">OpenDNS</a>. This was easy to set up since I just had to create an account and make a few minor tweaks to our wireless access point, and it gives me some nice reporting on what was blocked. For example, lately I saw a lot of adult sites being blocked and found an iOS application was loading them in the background.<br />
<br />
OpenDNS has a <a href="https://support.opendns.com/entries/26272175-Introduction-to-Configuring-OpenDNS">Getting Started Guide</a> on their site, but here's an abbreviated version of the steps for setting up OpenDNS on your home network:<br />
<ol><li>First, load up the settings console for your wireless router. Check your user guide for how to do this - usually it involves loading up a web page at http://192.168.1.1 and entering a username and password.</li>
<li>Next, find the "Internet" or "WAN" settings page within your wireless router. This is in your router's user guide as well. It may look something like: <div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjE-oPY6QQYLoVOA78AuzIVDV-EHLepDN5StaXBI9QLgm7BETFWgAfHQMkqGN7f5o9kiOc6kAg1qetLRLNqw1FEQ1hm3Bqee1YJKZ-P9lFthrUK5rWVjmSwU80P5eOWrWbK8Tn0wg/s1600/Screen+Shot+2014-08-24+at+15.14.55.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjE-oPY6QQYLoVOA78AuzIVDV-EHLepDN5StaXBI9QLgm7BETFWgAfHQMkqGN7f5o9kiOc6kAg1qetLRLNqw1FEQ1hm3Bqee1YJKZ-P9lFthrUK5rWVjmSwU80P5eOWrWbK8Tn0wg/s400/Screen+Shot+2014-08-24+at+15.14.55.png" /></a></div></li>
<li>Change the DNS Servers from the automatic settings to the values "208.67.222.222" and "208.67.220.220"</li>
<li>Click on "Apply" or "Save" or whatever floats your router's boat.</li>
<li>Create a new account at <a href="http://www.opendns.com/">http://www.opendns.com/</a></li>
<li>Part of your account creation process will be linking your local network to your OpenDNS account. Once your local network joins OpenDNS, it will begin monitoring what sites are requested.</li>
<li>After you create your account, you will be taken to the OpenDNS dashboard. At that point you can decide how much filtering you want to apply to your network - from sites that are obviously adult-only to sites that are adult in theme (fashion magazines, for example).</li>
</ol><br />
I'll post a subsequent entry on what OpenDNS actually <i>does</i> in hopes of helping explain why this kind of filtering is useful and its limitations. While this might seem like rocket surgery at first, hopefully this helps you learn how to be a steward of your Internet connection... just like you have to monitor & maintain your sump pump before the basement floods.DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com1tag:blogger.com,1999:blog-9951390.post-54034550906121684342014-06-22T23:10:00.000-04:002014-06-22T23:10:18.372-04:00A Drift Into Failure<a href="http://commons.wikimedia.org/wiki/File:Project_error.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQJ6ZlUZn65eUDLjvdlw_AMBOn4DhtOKN8jyJDspL-6NUvnTditOhN3WxaORot-prTApKEnVU3Ev_BlOq6KAZhxYp5cR6SxtzxoYmLy8t4mTMpGeJJl1Jlw4wft6BXznhhKAOeNw/s1600/Project_error.jpg" /></a>I'm still working towards catching up on my Christmas ready. I already wrote my missives on <a href="/2014/02/thinking-in-patterns.html">Thinking in Systems</a> and <a href="/2014/03/a-systems-language.html">A Pattern Language</a>; next up is the DevOps favorite <a href="http://sidneydekker.com/books/">Drift into Failure</a>.<br />
<br />
The basic premise of <u>Drift</u> is that failures, even massive ones, don't (usually) happen because of a vast conspiracy or from the deeds of evil people. Massive failures occur from behavior that is considered completely normal, even accepted, as part of a daily routine. These routines give our perspectives tunnel vision and often don't allow us to see the underlying issue. Production goals, scarce resources and pressure on performance causes drift in these routines that slowly erode safe practices.<br />
<br />
Fatal aircraft crashes and space shuttle disasters are often quoted in the book, however every operations or software engineer in IT has seen this play out a gazillion times before. The site goes down on a regular basis... and no one knows quite why. After digging and pushing new code and re-pushing bug fixes for many sleepless nights, one often finds out that the outage was due to a routine maintenance task gone awry. Maybe a query optimization cache was manually flushed within the production RDBMS, causing the entire cluster to freak out and create a bad query plan. It seemed perfectly sane at the time and even if every single person knew this was going to happen the day before, it likely wouldn't have been caught.<br />
<br />
<u>Drift</u> points out how remediation and "root cause" reporting is often fruitless. The concept of high-reliability organizations was pushed in the 1980's as an entire school of thought, focused on errors and incidents as the basic units of failure. Dekker demonstrates that "the past is no good basis for sustaining a belief in future safety," and such a focus on root-cause analysis often does not prevent future incidents. The traditional "Swiss Cheese Model" for determining cause has attempted to see where all of the holes within established safety procedures line up, so as to create a long gap through which problems can drive themselves through. This type of reductionist thinking where atomic failures create linear consequences has turned out not to be predictive after all - instead we need to look at things through the lens of probability.<br />
<br />
One of the best practices that anyone, including those supporting enterprise software, can encourage to avoid failure is to be skeptical during the quiet times and always invite in a wide range of viewpoints and opinions. Overconfidence can be your downfall, and dissent is always a healthy way to get new perspective. Dekker quotes <a href="http://books.google.com/books/about/Managing_the_Unexpected.html?id=GU55MJOp1OcC">Managing the Unexpected</a> to point out that "success... breeds overconfidence in the adequacy of current practices and reduces the acceptance of opposing points of view." Those that were not technically qualified to make decisions often were the ones that made them, or outside pressures (event subtle ones) caused trade-offs in accepted practices. Redundancies that were supposed to make things highly available often make systems more complicated and, in turn, actually make them more likely to fail.<br />
<br />
The best way to avoid a drift into failure is to invite outside opinion, even bring in disparate practice groups. Take minority opinions seriously. Don't distill everything to a slideshow. Be wary of adding redundancies and failsafes - often the most simple solution will be the most reliable. The recent re-invigoration in <a href="http://martinfowler.com/articles/microservices.html">microservices</a> is a great example of this - by simplifying the pieces of a complex system, we can allow each component to work in isolation and ignore the remainder of the system. This allows the system to grow, adapt and evolve without support systems usually provided for monolithic software stacks.<br />
<br />
Drifting into failure occurs when an organization can't adapt to an increasingly complex environment. Never settle, always embrace diversity and keep exploring new ways to evolve. A great quote from Dekker is "if you stop exploring, however, and just keep exploiting [by only taking advantage of what you already know], you might miss out on something much better, and your system may become brittle, or less adaptive."DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-39974719853726920852014-03-23T21:33:00.000-04:002014-03-23T21:33:18.517-04:00An Expensive Failure of JudgementSo remember when I precariously perched a moderately <a href="/2014/03/its-basement-not-swimming-pool.html">encased rangefinder</a> above my sump pump well? It was kinda wedged in between the cover and the well wall, and I <i>thought</i> there wasn't enough play in the line leading to the rangefinder as to let it drop in. Well... all my hackery finally caught up to me and a very expensive sensor ended up taking a swim. Current remained running through it the entire time so for several hours it swam in well water, slowly accreting minerals. No amount of drying out would save it.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj_JGQlv2QGyZgnx54CRQP6NBrDMvCcT7vr8ZQRGm6KVg8p0LFcL9zaLbgq4LYHDYOGpUWQB06Hq6wIJ4zU5jOIhNnl2GZ2sgduB82GuB62NkxDpWtxxw9e-58HRohLQa0rEsqSw/s1600/20140316_220558_LLS.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj_JGQlv2QGyZgnx54CRQP6NBrDMvCcT7vr8ZQRGm6KVg8p0LFcL9zaLbgq4LYHDYOGpUWQB06Hq6wIJ4zU5jOIhNnl2GZ2sgduB82GuB62NkxDpWtxxw9e-58HRohLQa0rEsqSw/s200/20140316_220558_LLS.jpg" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_EVO-6w5Mx0xfOxAeY44nhpgtJ5G_6WLyucGT-Mmz07niZVIPNbPQ2Hf4MOFYWbJ0v3Y_GNMbkvz8ACMXK8O_aS6NeeeahTGvZ3UNKSh2krVCpGAyuGI_nHKS1PXU7f-x8LGTbw/s1600/20140316_221833_LLS.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_EVO-6w5Mx0xfOxAeY44nhpgtJ5G_6WLyucGT-Mmz07niZVIPNbPQ2Hf4MOFYWbJ0v3Y_GNMbkvz8ACMXK8O_aS6NeeeahTGvZ3UNKSh2krVCpGAyuGI_nHKS1PXU7f-x8LGTbw/s200/20140316_221833_LLS.jpg" /></a>I wasn't going to replace it with another expensive sensor... so I went the completely opposite direction and built an unbelievably primitive water detector. Here two plates of aluminum foil were hot-glued to construction paper and the bare end of my infamous telephone wire, then isolated in electrical tape. If water bridged the two aluminum plates, a connection would be made - at least enough of a connection to be considered a "high" signal.<br />
<br />
The other end of the two wires were sent to the NPN transistor that was originally intended to work as a UART logic inverter. Now it was a simple logic gate; once the water closed the circuit the NPN shut off the current headed to a GPIO pin. If the pin was live, no water was detected. If the pin was dead, you had a problem.<br />
<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4jETTMaeJ7oKmZKe1blt0aQYqk0MHX67v8duHLdtwa3UsH6V232sZzT2kMEzOxp7B6WZJhK98JdDXz0dmLdFhXiyjTQL3FWybi9RsI2QbMFB20qAfcBhW5IgzE0XVioPx4tkbgw/s1600/20140316_222749_LLS.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4jETTMaeJ7oKmZKe1blt0aQYqk0MHX67v8duHLdtwa3UsH6V232sZzT2kMEzOxp7B6WZJhK98JdDXz0dmLdFhXiyjTQL3FWybi9RsI2QbMFB20qAfcBhW5IgzE0XVioPx4tkbgw/s200/20140316_222749_LLS.jpg" /></a>The web front-end that I created for this whole rigamarole <a href="https://github.com/deckerego/BasementMonitor">was updated to reflect this hack</a>, and now just reports the binary status of the water detector. I'm not thrilled with the setup, but I also wasn't too keen on the idea of plopping any more money down on a solution.<br />
<br />
So... lesson learned. Don't dangle water sensitive components over a well of water.<br />
<br />
I do have a need for another security camera, so this whole setup may just be ditched in favor of another <a href="http://www.lavrsen.dk/foswiki/bin/view/Motion">Motion</a> rig. I really dig the <a href="https://www.sparkfun.com/products/11295">I2C temperature and humidity breakout board</a> however, and I'd like to keep using it. Maybe I'll save up my allowance and get a <a href="http://www.adafruit.com/products/1469">CC3000</a> WiFi board and pair it up with the temp/humidity board... that would be a pretty nifty & tiny package.DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-78103882227714215302014-03-11T22:32:00.000-04:002014-03-11T22:32:10.526-04:00It's a Basement, not a Swimming PoolSecond up on my <a href="/2013/11/retrospective-raspberry-pi-garage-door.html">paranoia list</a> is my basement slowly filling with water. My paranoia is founded in a rich history of failed sump pumps, broken water mains and power outages. I can mitigate some of my worries by installing a backup, non-electric Venturi aspirator and a die-cast primary sump pump - however anything mechanical can break. I believe in nothing anymore.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglboAJEucENc0p026x0pDMlo0GHOJGeUjHS4Ecp2VZBiVOZKjE-yZAp2VUIgdDtIEYA6YpfFELrv-U5mRw4TonfumSFvrouseHJzezs_JIm-LVI0QsCwzWzXGwlFHYubWc-nc09g/s1600/20140308_174546_LLS.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglboAJEucENc0p026x0pDMlo0GHOJGeUjHS4Ecp2VZBiVOZKjE-yZAp2VUIgdDtIEYA6YpfFELrv-U5mRw4TonfumSFvrouseHJzezs_JIm-LVI0QsCwzWzXGwlFHYubWc-nc09g/s400/20140308_174546_LLS.jpg" /></a>A Raspberry Pi can help satiate most of my neurosis, including this one. Using a <a href="https://www.sparkfun.com/products/11295">Honeywell HumidIcon Digital Humidity/Temperature Sensor</a> and a <a href="https://www.sparkfun.com/products/8504">Maxbotix Ultrasonic Range Finder</a> I can monitor basement humidity, temperature and sump well levels.<br />
<br />
My first component to integrate was the range finder. The Maxbotix LV-EZ4 can operate in one of two modes - either providing an ASCII representation of the range using RS232 serial communication or using an analog voltage. I dorked around with two possible ways of using this - feeding an analog signal through an <a href="http://learn.adafruit.com/introducing-trinket/introduction">Adafruit Trinket</a> and have the values <a href="http://www.raspberrypi.org/forum/viewtopic.php?f=44&t=67158">translated into an I2C signal</a>. However - I had a 5v Trinket - and even with constructing voltage dividers I couldn't quite coordinate the right voltages to negotiate with the Pi. I punted and <a href="http://www.raspberrypi.org/forum/viewtopic.php?f=45&t=67035">used the serial port</a> from the LV-EZ4, however the Pi uses UART and so I had to create a <a href="http://www.technoburst.net/2010/07/not-gate-using-transistor.html">logic inverter</a> using a recycled NPN transistor. Once I inverted the signals from the range finder, the Pi was able to read the inbound ASCII representation of the range.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZW5d4MT99U9c0UnSKwuhs2De_fDH0DlGUJdlWItVfGYhZuaBNuTu4SpphKJCcnbImcVY1f2CXJAutSpwyzFrZ0TY5yl4VNeNsl0PhWW9C8njXoe4uuk2_dlERP2MdH3KAW0Q3ZQ/s1600/20140310_203040_LLS.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZW5d4MT99U9c0UnSKwuhs2De_fDH0DlGUJdlWItVfGYhZuaBNuTu4SpphKJCcnbImcVY1f2CXJAutSpwyzFrZ0TY5yl4VNeNsl0PhWW9C8njXoe4uuk2_dlERP2MdH3KAW0Q3ZQ/s200/20140310_203040_LLS.jpg" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi77ROHe_DSxJ61kS9zYsGlDPgZz2inwch8QabLUFJATEzonUOUsQ-XoeBeFwB77dp2Goxvo2_GTWfkh-X1_q3-VRY1LVCqb8K5gw7zYZSjSK32-AzK3dfMAVWfrqWQ-dQ_LBp9zg/s1600/20140310_204208_LLS.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi77ROHe_DSxJ61kS9zYsGlDPgZz2inwch8QabLUFJATEzonUOUsQ-XoeBeFwB77dp2Goxvo2_GTWfkh-X1_q3-VRY1LVCqb8K5gw7zYZSjSK32-AzK3dfMAVWfrqWQ-dQ_LBp9zg/s200/20140310_204208_LLS.jpg" /></a>After I had the range finder working, I used Sparkfun's Honeywell breakout board via I2C to communicate temperature and humidity to the Pi. Both the range finder and the breakout board fit nicely on a mini breadboard, sharing voltage and ground while splitting out I2C data, clock and RS232 data feeds. Once permissions were correctly set and kernel modules loaded, things appeared to be working nicely.<br />
<br />
I wanted to save the range finder from water splashes, or at least slow its eventual decay. I re-used the case from the SD card I purchased for the Raspberry Pi, cutting out holes for the extrusions in the range finder board. Corners were then covered in electrical tape, and the seams were covered in hot glue. No, it's not pretty. No, it may not add to the LV-EZ4's lifespan. It was at least worth a shot however, and I've added a bit of crush/drop protection.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNjtkAYxkH0Pk_rzIhsOWwyO3wtGLiHf1JFrKu98nSX966X7ZdPe_mJzaz6MwxoxRXMe-Fj4Li-AqyXxZ_7Swo79aSnrW1CY-SpPa6FLPk6hHeNtenNqfFz4DLpi07C0DICZodNA/s1600/20140308_174620_LLS.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNjtkAYxkH0Pk_rzIhsOWwyO3wtGLiHf1JFrKu98nSX966X7ZdPe_mJzaz6MwxoxRXMe-Fj4Li-AqyXxZ_7Swo79aSnrW1CY-SpPa6FLPk6hHeNtenNqfFz4DLpi07C0DICZodNA/s200/20140308_174620_LLS.jpg" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-Z_WqMohSUFInnZP21ZPY0fb_RMqMfcmYyWjcnq3jFinDaw1s9LAwUWoHZcGwpoU7A4bS_P5flXcjOB84sZq0Dn07PrfIzU2IN_ug09E4CcBiq8XwOSAQk4Bc03lsCd-xte3G3w/s1600/20140308_174627_LLS.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-Z_WqMohSUFInnZP21ZPY0fb_RMqMfcmYyWjcnq3jFinDaw1s9LAwUWoHZcGwpoU7A4bS_P5flXcjOB84sZq0Dn07PrfIzU2IN_ug09E4CcBiq8XwOSAQk4Bc03lsCd-xte3G3w/s200/20140308_174627_LLS.jpg" /></a>Everything is hooked into a <a href="http://www.element14.com/community/docs/DOC-51668?ICID=raspi-group">Raspberry Pi Model A</a>, just to save a few bucks. For an enclosure I ripped apart an old Netgear wireless access point, which easily housed the mini breadboard and the Pi. I decided to try things out but stumbled upon an unsettling fact... there are no power outlets near the sump pump well. Undeterred, I went looking for any long length of wire and found twenty feet of RJ11 telephone cable. It had four total wires - which would be more than enough to carry voltage, ground and signal wires. I sloppily spliced the wire, soldered it onto three jumpers, attached one side to the breadboard and another to the range finder. To my surprise - it actually worked. I was able to string the range finder all the way across the room, which also made ambient humidity readings more accurate.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNp38zqFAVu4XFuzsvt-67WowEAQHf2MIPMLJuQHV8pRMfIo5pLnmnNFnpH-ziMS2ZmT8P5oDDQQkSImh2JcgxD0lhwb8rRBwlj_TntcFdtJXTK7g9zm1qnkH6VyxCQ6-WV3JnJg/s1600/20140310_211632_LLS.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNp38zqFAVu4XFuzsvt-67WowEAQHf2MIPMLJuQHV8pRMfIo5pLnmnNFnpH-ziMS2ZmT8P5oDDQQkSImh2JcgxD0lhwb8rRBwlj_TntcFdtJXTK7g9zm1qnkH6VyxCQ6-WV3JnJg/s320/20140310_211632_LLS.jpg" /></a>In much the same way as I created the <a href="http://bottlepy.org/">Bottle</a> application for the <a href="https://github.com/deckerego/GarageSecurity">garage door security monitor</a>, I created a <a href="https://github.com/deckerego/BasementMonitor">Bottle app to host REST APIs and display the well depth, temperature and humidity</a> as well as allow Jabber (e.g. Google Talk) clients to request the status of the well and the climate. It all is working well so far, however I still need to tweak the Honeywell I2C code to make sure the component re-samples conditions at every request. Right now it is just fetching the currently stored values.<br />
<br />
Right now the range finder is resting atop the sump pump well and is just waiting for the upcoming rains. My eventual goal is to create a <a href="https://github.com/deckerego/HomeDashboard">home dashboard</a> that aggregates all sensor data from around the house: sump pump well depth, basement temperature and humidity from the Basement Monitor APIs, ground-level temperature and humidity from a <a href="https://nest.com/thermostat/life-with-nest-thermostat/">Nest thermostat</a>, garage door state and camera feeds from the Garage Security APIs and maybe even power data from an attached <a href="http://www.apc.com/">APC UPS</a>. The Bottle apps would then work to expose sensor data as REST APIs, and a more powerful <a href="http://www.playframework.com/">Play application</a> would serve the user interface, archive historical data, provide alerts and indicate trends.DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com1tag:blogger.com,1999:blog-9951390.post-26110430584189192362014-03-01T21:13:00.001-05:002014-03-01T21:13:35.662-05:00A Systems Language<a href="http://commons.wikimedia.org/wiki/File:Paisley_pattern.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcQvLH-ckCLmpqDHReOR45vZsK7cJ4KIOnfia5qA22RxctbiYSOI-Exf-n7M26LTCntJ27UJbFlr5RNPTyjWsIuvEuQ_DZIo8YNv6_UFQzJJvTmL5eKR1nIdSrJaKojqVhtebuQA/s1600/Paisley_pattern.jpg" /></a><u>A Pattern Language</u> is an interesting book to pick up, and that's not just a joke about the size of the volume. <a href="http://www.patternlanguage.com/">Its web site</a> betrays how old the book actually is; it was published in 1977 based on research that had been ongoing for several years. It's scope is pretty large and covers everything from the layout of an office building to the composition of an entire town. Much attention is focused on how to build <i>communities</i> within these spaces, and a lot of research provides evidence on optimal ways of building and tearing down boundaries.<br />
<br />
Of particular interest to me were chapters concerning self-governing workshops and offices. The book stresses that no one enjoys their work if they are a cog in a machine. Instead, "work is a form of living, with its own intrinsic rewards; any way of organizing work which is at odds with this idea, which treats work instrumentally, as a means only to other ends, is inhuman." This is a fairly strongly worded assertion that means that employees must feel empowered in order to construct meaningful product.<br />
<br />
Just as <a href="/2014/02/thinking-in-patterns.html">Thinking in Patterns</a> postulated that groups should autonomously self-organize in order to realize their greatest efficiency, A Pattern Language encourages the formation of self-governing workshops and offices of 5 to 20 workers. A chapter is dedicated to the federation of these workgroups to produce complex artifacts - such as several independent workshops working in concert to build much larger things.<br />
<br />
<u>A Pattern Language</u> also encourages keeping service departments small (less than 12 members) and ensuring that they can work without having to fight red tape. This applies to many shared services departments in both government as well as public sector organizations; departments and public services don't work if they are too large as the human qualities vanish. One must fight the urge to make an "idiot-proof system," since this can cause the system to devolve to the point that only idiots will run it.<br />
<br />
The book is largely about physical space of course, so it has many recommendations on how offices should be connected. The authors specifically studied what isolated groups within a company, and even what we might consider small physical distances amounted to big interruptions in communication. If two parts of an office are too far apart, people will not move between them as often as they need to. If they are a floor apart, they sometimes will not speak at all.<br />
<br />
Ultimately <u>A Pattern Language</u> has a lot of common sense to offer up about how to build a work community, backed by a fair amount of research that bucked many trends in the 70's. It had points that should not be glossed over even now, including:<br />
<li> You spend 8 hours at work - there is no reason it should be any less of a community<br />
<li> Workplaces must not be too scattered, nor too agglomerated, but clustered in groups of 15<br />
<li> Workplaces should be decentralized, not reliant on a central hub<br />
<li> Mix manual jobs, desk jobs, craft jobs, selling, etc. within a community<br />
<li> There should always be a common piece of land (or a courtyard) within the work community which ties offices together<br />
<li> The work community is interlaced with the larger community they operate within<br />
<br />
Workspace efficiency and community engagement is definitely not a new practice, however we always tend to think it is. If we can remember the lessons learned thirty-seven years ago, we may be in a better place to make a better workplace today.DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-12666413101868284272014-02-12T21:47:00.000-05:002014-02-12T21:47:21.800-05:00Thinking in Patterns<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://commons.wikimedia.org/wiki/File:Cognitive_Hazard_by_Arenamontanus.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSVyz2PKz8JzGiJfCfja35dwTqzhFTbzi3Hz5FC4FSvFwxPPqG03GmBQnyhza6UzY50zrOHAltgIsjdIf7NhyphenhyphenpXQElJzOtPeeKoVyPFXOFUScNywM295XLiYGmDUoupX84u-Dllg/s1600/Cognitive_Hazard_by_Arenamontanus.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="background-color: #f9f9f9; font-family: sans-serif; font-size: 12px; line-height: 19.200000762939453px; text-align: start;">Cognitive Hazard by Arenamontanus</span></td></tr>
</tbody></table>I've finally started to look at some recommended reading that has been on my wish list for going on two years now. Two of the books, <a href="http://www.chelseagreen.com/bookstore/item/thinking_in_systems:paperback">Thinking in Systems</a> and <a href="http://www.patternlanguage.com/">A Pattern Language</a>, have particularly resonated with me since they spoke directly to the practice of software engineering without mentioning it once.<br />
<br />
<a href="http://www.donellameadows.org/">Donella Meadows</a> has left behind quite a legacy, and has great observations on how people work within overarching systems. Systems are everywhere and are often composed of yet other systems - just as it is with how people manage their workload every day. In particular, Donella notes the traps that systems can cause which cause things to go completely awry. Let's see if we can identify any of these traps within the context of enterprise software development:<br />
<ul><li>Policy Resistance (think of "The War on Drugs," where two sides are trying to leverage the same system)</li>
<li>Tragedy of the Commons (exhausting a shared resource)</li>
<li>Drift to Low Performance (goals are eroded because negative feedback has more resonance than positive feedback)</li>
<li>Escalation (one side is attempting to out-produce the other, without a balance in between the two sides)</li>
<li>Competitive Exclusion (success to the successful)</li>
<li>Shifting the Burden to the Intervenor (an addiction has removed a system's ability to shoulder its own burdens)</li>
<li>Rule Beating (finding loopholes)</li>
<li>Seeking the Wrong Goal</li>
</ul><br />
Any of those sound familiar in your current software engineering practice? No matter if this is exhibited between the business and the engineers, or PM's and engineers, or between engineers - these are universal pratfalls.<br />
<br />
There are ways to influence systems and avoid the traps we often fall into. These leverage points within the system can allow you to alter behavior and encourage positive results. A tricky point remains that some of the leverage points that are easiest to alter have the smallest impact, and some of the largest impact leverage points are very difficult to manipulate. If we look at an Agile software scrum, you might identify least impactful to most these leverage points as:<br />
<ol reversed=""><li>Numbers, Constants and Parameters. It often feels like you're changing things because you have the most control over these knobs and dials... but all too often reactions are delayed and are cushioned by buffers within the system. Sure, you can change your sprint velocity or begin estimating bugs, but those are just different views on the same result.</li>
<li>Buffers, or the sizes of stabilizing stocks that act as reservoirs of results. A buffer may delay or even out the consequence of a change within the system. Changing buffers would be like changing from a two to a four week development sprint in Agile - you may give yourself more time to recover, but more than likely you're just delaying an inevitable fail.</li>
<li>Failing that, you might try to alter the real, physical parts of the system and how they interact. This can happen, but they are often difficult to change and result in a game of whack-a-mole. This is more fondly called "re-arranging the chairs on the Titanic," and often is exhibited by swapping out team members but keeping the system the same.</li>
<li>The next leverage point might be to try and change how quickly you respond to changes by reducing delays, which in turn alters how quickly the system changes. However, Donella does demonstrate that shorter reaction time can very easily result in greater volatility, and things can become so volatile that they crash. This is what Agile is meant to guard <i>against</i> by locking down a sprint and ensuring priorities aren't changed on a day-by-day basis.</li>
<li>In order to get a grasp on things one may also overlook the balancing feedback loops - or safety measures - that safeguard the system in times of emergency. The excuse is generally that "the worst is unlikely to happen," however this drastically reduces one's survival range. Adaptability is important, and if you take away the ability to adapt you can crash even harder.</li>
<li>Monitoring for reinforcing feedback loops <i>is</i> something that becomes crucially important. This tasks requires one to watch for runaway chain reactions, which can cause a meltdown if not kept in check. Here bad decisions and bad reactions begat even more bad decisions and bad reactions, causing a runaway system. Look for balance instead of infinite feedback loops; if you can keep pushing your tasks to the next sprint, you're only encouraging a runaway backlog of tasks.</li>
<li>Information flows can save a system. If information is in your face and always available, it influences even small decisions. Look at the Nest thermostat or smoke detector - here are devices whose primary purpose is to give you a nonstop flow of info wherever you are. The more info you have (such as how many hours heat was pumped into your house), the more you make small alterations to find balance. This is another part of the Agile process in the form of burndowns/burnups/velocity graphs. This info is meant to be viewed and reflected upon often.</li>
<li>Rules (incentives, punishments, constraints) often have to take place to enforce all the above points. In order to kill feedback loops, ensure emergency systems are maintained and information is shared some rules of the game have to be put into place.</li>
<li>Self-organization, which is an odd juxtaposition of the above rule about rules, is something that Donella prizes most about not only the human condition but systems in general. Usually if you let the component pieces of a system find their role, they will find a way to work with other components in harmony. This is the proof against micro-management; the more you manage, the more you can threaten a system's success. Let developers go free within the confines of the sprint, and don't hover over them (aside from a daily standup).</li>
<li>Find the right goals to change a system. If you focus on GDP, you will focus on gross domestic product at the exclusion of other things. Picking the right goal is tougher than it sounds - you need to know what you want first. However if you can clearly identify and communicate a measurable goal, you can have a huge amount of control over the system. Define what the business actually wants to see - and involve them in the decision making process.</li>
<li>Change your mindset. This is effectively what EVERY project management methodology attempts to do - make you think about the same problem in a different way. If it gives you a renewed perspective, this can be helpful. However...</li>
<li>...ultimately you should transcend paradigms and realize no paradigms are true. This is what supposed "anti-patterns" are meant to exhibit, and it can be helpful to realize that Agile, just like Waterfall, will ultimately come and go. Just ship early, and ship often.</li>
</ol><br />
Just as we have "Gang of Four" or "Enterprise Integration" patterns, the above are system patterns that can help us decompose and deal with a system. Look for the common traps that always happen - and then evaluate your leverage points to counteract them.DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-28776497398355147772013-12-02T23:07:00.000-05:002013-12-02T23:07:09.558-05:00Massively Parallel Compute as a Service<a href="http://commons.wikimedia.org/wiki/File:Vectores.PNG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2Yv3IL8075pvLgmJoCgjCmPDLLCRiIi1hCGdMvGbk9ZL8cwTvGRTPpEmzQlP5rmp0CAcc0FITHjkawi7aTX1gZZ9L5tnezSRTum3nnbUXEpKqXnOb0-9kmE63ASuJN4O8S33JMg/s1600/Vectores.PNG" /></a>Back in the Spring of 2012, <a href="/2012/03/my-past-few-work-engagements-have-been.html">I asked several panelists at VMWorld to weigh in on vector processing with GPUs as a big data/big compute solution</a>. The response was a resounding "not yet," as the infrastructure has not yet reached commodity level and GPU processing was greatly constrained by memory paging. It now seems like both obstacles are being removed.<br />
<br />
Amazon Web Services is now offering <a href="http://www.theregister.co.uk/2013/11/05/aws_gpu_grid_service/">EC2 instances that offer up virtualized instances of NVIDIA's Kepler GPUs</a> as "G2" instances. This supports H.264 encoding, OpenCL, CUDA and OpenGL toolsets which allows for more mature toolsets to build apps targeted to these vector processing instances. This kind of support allows for commodity toolchains <i>and</i> commodity infrastructure to allow for massively parallel processing on demand.<br />
<br />
Memory paging should soon be <a href="http://www.theregister.co.uk/2013/11/16/nvidia_reveals_cuda_6_joins_cpugpu_shared_memory_party/">addressed by NVIDIA via CUDA 6</a>, and should also be addressed by <a href="http://www.pcworld.com/article/2062430/amds-next-gen-kaveri-chip-due-in-january.html">AMD with its upcoming Kaveri architecture</a>. Once memory addressing is unified, the swapping of memory regions should become unnecessary and allow for memory to be addressed locally without pagination. This simplifies application development, virtualization and hardware architectures considerably.<br />
<br />
I believe that very soon we will see vector processing at scale garner as much attention as map/reduce clusters currently do. Massive data parsing has been commoditized, and now we have an opportunity to commoditize massive algorithmic crunching.DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0tag:blogger.com,1999:blog-9951390.post-31369840745362868752013-11-03T17:29:00.000-05:002013-11-03T17:29:00.812-05:00Retrospective: The Raspberry Pi Garage Door Remote + Security System<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-JTiEFf7QaScVjjgx6R6UckC_k3ecJjp7JO4mG74JcBAkTHpooqhg7vg47muYlA6srJIyDQqSHb4Zs7Bs7GXUSNi9CVSpsj29pywvmvuD1dEUViMokrgepq9sy0AAUD4alyARxw/s1600/20131101_223758_LLS.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-JTiEFf7QaScVjjgx6R6UckC_k3ecJjp7JO4mG74JcBAkTHpooqhg7vg47muYlA6srJIyDQqSHb4Zs7Bs7GXUSNi9CVSpsj29pywvmvuD1dEUViMokrgepq9sy0AAUD4alyARxw/s320/20131101_223758_LLS.jpg" /></a></div>My rinky-dinky garage security system is now online and in operational use. I still have more tweaks to do - for example, I got rid of the metal backplane within the My Book casing that now serves as my <a href="http://www.blogger.com/2013/11/shutting-door-finishing-up-raspberry-pi.html">board enclosure</a> because it shielded my WiFi signal, killing the network connection. I'm sure I will continue to tweak the <a href="http://www.lavrsen.dk/foswiki/bin/view/Motion">Motion</a> configs to increase framerates and decrease sensitivity. Now that e-mail notifications are working, hopefully I can limit the spurious notifications and just notify on the bigger changes of motion over two seconds in length.<br />
<br />
Another measure of success is cost; if I could have purchased a ready-made setup for a marginal increase in cost, it may be better to go with a commercial platform. If the build is overkill and I could have built it with cheaper components, I should scrap this and re-build. Looking at commercial options I couldn't find anything that had <i>both</i> the garage door functionality <i>and</i> the security camera... just one or the other. Chamberlain does sell the <a href="http://www.chamberlain.com/smartphone-control-products/myq-garage/model-myq-g0201">MyQ Garage</a>, a pretty nifty home automation product that contains a universal garage door opener and a tilt sensor that is WiFi-enabled and can be paired with a smartphone app. They also sell the <a href="http://www.chamberlain.com/smartphone-control-products/smartphone-connectivity/myq-internet-connectivity-kit">MyQ Internet Connectivity Kit</a>, which is more of an Internet-enabled garage door master controller. Neither have a security camera paired with it, but you could easily install a wireless camera separately for around $40. The MyQ solutions are $140 and $120 respectively, giving you a total build cost of $160-$180. Not bad, really.<br />
<br />
If you bought every part new, the build list for my lil' setup is:<br />
<table width="300"> <tr>
<td>Raspberry Pi B</td>
<td>$40</td>
</tr>
<tr>
<td>USB Micro-B cable</td>
<td>$2</td>
</tr>
<tr>
<td>USB AC Adapter</td>
<td>$5</td>
</tr>
<tr>
<td>8GB Class10 SD Card</td>
<td>$8</td>
</tr>
<tr>
<td>802.11n USB dongle</td>
<td>$9</td>
</tr>
<tr>
<td>Parts for MOSFET switch</td>
<td>$5</td>
</tr>
<tr>
<td>Universal garage door opener</td>
<td>$25</td>
</tr>
<tr>
<td>HP HD-3100 webcam</td>
<td>$14</td>
</tr>
<tr>
<td>Enclosure made of random stuff</td>
<td>$0</td>
</tr>
<tr>
<td style="border-top: 1px solid gray;">Total</td>
<td style="border-top: 1px solid gray;">$108</td>
</tr>
</table><br />
I had most of these parts on-hand, so my actual cost was closer to $70. That means a savings of $90 over a commercial solution. I don't know of a cheaper solution than the Raspberry Pi that could handle a 1280x720 webcam feed and perform motion detection, and a $14 webcam is cheaper than Raspberry Pi's own camera expansion card.<br />
<br />
Of course, your time isn't free. The hours spent in construction count - so I tried to estimate how long each step took me:<br />
<table width="500"> <tr>
<td><a href="/2013/10/your-barn-door-is-open.html">Tearing down & wiring up garage remote</a></td>
<td>1 hour</td>
</tr>
<tr>
<td><a href="/2013/10/your-barn-door-is-closed.html">Setting up webcam and Motion</a></td>
<td>2 hours</td>
</tr>
<tr>
<td><a href="/2013/10/your-barn-door-is-off-its-hinges.html">Configuring OS & system administration</a></td>
<td>4 hours</td>
</tr>
<tr>
<td><a href="/2013/10/your-barn-door-is-on-display.html">Building web interface</a></td>
<td>3 hours</td>
</tr>
<tr>
<td><a href="/2013/11/shutting-door-finishing-up-raspberry-pi.html">Building enclosure</a></td>
<td>2 hours</td>
</tr>
</table><br />
All told maybe 12 hours of work, a quarter of which was me figuring out how to render an MJPEG stream on an HTML5 canvas. The web interface can be re-used, as are the system administration steps, so I could probably do another in four hours or so. Four hours and $70 isn't too bad for peace of mind.<br />
<br />
Speaking of ease of mind, I'll leave this thread with an ad for Chamberlain's MyQ Garage. I thought I was bad... but these actors have turned garage door anxiety into an existential crisis. <br />
<br />
<iframe width="420" height="315" src="//www.youtube.com/embed/jCB988Snkpk" frameborder="0" allowfullscreen></iframe>DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com5tag:blogger.com,1999:blog-9951390.post-2262137018879315122013-11-01T23:27:00.000-04:002013-11-01T23:27:58.369-04:00Shutting the Door; Finishing Up the Raspberry Pi Security Camera + Garage Opener Remote<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqSNRC77_Q-xZ3PQ0NN9xgL4Gzy0GjGMulSFwNB8NgzFt17E3NNR42_XU4vNPLZF527f_DFTLChWFYxW6jNd2NL9R2pXt9MCB7Lpk9HZ3ZB0dbf0NmessTor9Sm7mLyz4QMFQenw/s1600/20131101_221651_LLS.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqSNRC77_Q-xZ3PQ0NN9xgL4Gzy0GjGMulSFwNB8NgzFt17E3NNR42_XU4vNPLZF527f_DFTLChWFYxW6jNd2NL9R2pXt9MCB7Lpk9HZ3ZB0dbf0NmessTor9Sm7mLyz4QMFQenw/s320/20131101_221651_LLS.jpg" /></a></div>I'm going to be tinkering with this new security camera / Internet-enabled garage door opener for some time... I imagine I'll add environmental monitoring and perhaps even hook it up to the sprinkler system. Even with future expansion in mind, I needed to shield the Raspberry Pi and the remote control board from dust and stray water. The mini protoboard I would likely keep as opposed to soldering a more permanent board, since I wanted the ability to dork around with the <a href="http://wiringpi.com/pins/special-pin-functions/">GPIO pins that have pull-down resistors built in</a> and possibly add additional controls.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnNugisJK2rttKz2MiCbELx677gUofBJ_-BCYnT-g5gEM9gvtvh0IJpICHZeVsYY6OoU9IDpvg4aaZv8nC0muPnI2ER0DF2DLFCvoeHbVT1r0yKxWz4m-3Fle9Ln0jYBmXyTvtjA/s1600/20131031_075134_LLS.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnNugisJK2rttKz2MiCbELx677gUofBJ_-BCYnT-g5gEM9gvtvh0IJpICHZeVsYY6OoU9IDpvg4aaZv8nC0muPnI2ER0DF2DLFCvoeHbVT1r0yKxWz4m-3Fle9Ln0jYBmXyTvtjA/s320/20131031_075134_LLS.jpg" /></a></div>I had an old Western Digital My Book sitting around with a defunct hard drive, and it appeared to be nearly the right size to house the Raspberry Pi, the garage remote board and a mini breadboard. I decided to gut it and use the housing as an enclosure. I found a few motherboard standoffs in my toolbox, and uses those to keep both boards a few centimeters off of the metal backplate. The drive and controller itself I shelved.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCpNwyCef8jKTotPR_gr7amIBFp_s9OKJQ1YppLXoNvVmxQk6Ego3JNSOPLLqR3TCZV7WgZCuzoy85zAjl8B2dKwqdBbDWlLrxQgDtQXZmtNyIIxrOY-at-SYGCKawqEcAb1mAAQ/s1600/20131101_221704_LLS.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCpNwyCef8jKTotPR_gr7amIBFp_s9OKJQ1YppLXoNvVmxQk6Ego3JNSOPLLqR3TCZV7WgZCuzoy85zAjl8B2dKwqdBbDWlLrxQgDtQXZmtNyIIxrOY-at-SYGCKawqEcAb1mAAQ/s320/20131101_221704_LLS.jpg" /></a></div>Once I had everything stripped apart, the garage remote was mounted on one side of the board and the Raspberry Pi was mounted on the other. It was a tight fit, but I was able to get the webcam plugged in, the mini breadboard slid in and all the wiring completed within the confines of an old My Book chassis. Using a very technical device I call a "hacksaw," I removed some of the side wall of the enclosure so I could pull out the micro-usb cable for power and bring the webcam so it can be positioned independently.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaa_kGR205D7WdpdkRqsRPk6dqHGEXKR9BHwAu_a_Z5lUeDKUAwQRgFDKAAgMw7QUPn5kRP-ZhInfGTvZgCCzDQEqk9LRiVKs8VjABx5QgoB55zJBDYVWqqTKkbS8G2LEkIOqNtg/s1600/20131101_223333_LLS.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaa_kGR205D7WdpdkRqsRPk6dqHGEXKR9BHwAu_a_Z5lUeDKUAwQRgFDKAAgMw7QUPn5kRP-ZhInfGTvZgCCzDQEqk9LRiVKs8VjABx5QgoB55zJBDYVWqqTKkbS8G2LEkIOqNtg/s320/20131101_223333_LLS.jpg" /></a></div>In the end everything didn't <i>quite</i> fit... the garage remote is bursting out of its seam. However the general look of the device is far better than it was before. The unit is now back sitting on a shelf in the garage, quite content.<br />
<br />
I still have some continued tweaks to do, but I think I've now addressed the root question: "is the garage door up?"DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com1tag:blogger.com,1999:blog-9951390.post-37132293593248510472013-10-31T07:00:00.000-04:002013-10-31T07:00:01.032-04:00Who Moved My Barn Door?I really need to stop it with the "Barn Door" titles.<br />
<br />
So I now have <a href="/2013/10/your-barn-door-is-open.html">wired a Raspberry Pi to a garage door remote</a>, created <a href="/2013/10/your-barn-door-is-on-display.html">a primitive web interface</a> for it, and attempted some <a href="/2013/10/your-barn-door-is-off-its-hinges.html">security and stabilization</a> for the supporting applications. Now I am moving on to sending an e-mail with photo attachments of security events that have occurred.<br />
<br />
Setting up the mail server within the Ubuntu distribution was a bit of a pain. The Pi can't act as an MTA all on its own thanks to all the relay rules in place across the Interwebs, so instead I had the default <a href="https://wiki.debian.org/GmailAndExim4">exim4 installation route through GMail</a>. I wasn't interested in installing yet another outbound mail system; I would rather leverage what comes packaged by default. I ensured I deployed an application-specific password for exim4, then followed the very helpful instructions from Debian on how to hook it all up with GMail as the outbound SMTP relay.<br />
<br />
The default mailutils <a href="http://www.simplehelp.net/2008/12/01/how-to-send-email-from-the-linux-command-line/">will not send attachments</a> over e-mail, so instead I installed mutt for a command-line mail client. I can issue e-mails via:<br />
<code>echo "Motion was detected" | mutt -s "Garage Security System" -a /srv/motion/23-20131030184606-00.avi -- somedude@gmail.egg</code><br />
<br />
Once combined with <a href="http://www.lavrsen.dk/foswiki/bin/view/Motion/ExternalCommands">Motion's External Commands</a>, I can <a href="https://github.com/deckerego/GarageSecurity/tree/master/admin/usr/local/motion">build scripts</a> that e-mail off movie files as soon as they end. The mpeg4 format appears to work natively within Android, so video snippets are easy to view once they are e-mailed out.<br />
<br />
Now for some polish; I need to construct/find an enclosure and finish the front-end user interface.DeckerEgohttp://www.blogger.com/profile/06234538763600679177noreply@blogger.com0