Friday, December 6, 2013

Picture snapshot

Using my snaps program (mostly based on example from VideoCapture) and using as an inspiration, I wrote this.

Use it however you want. I have it snapping a photo of me every time I unlock my machine with Task Scheduler in Windows 7 to look back in a year or so at all the derpy faces I make.

Saturday, August 17, 2013

Sprinkler System

Kara and I will be installing a sprinkler system this fall. I am using this as an opportunity to actually do a useful programming, computer interface control project where I can use an Arduino/Raspberry Pi in a useful and productive manor. This project will contain the following elements. RainBird has some great education videos here:


The interface will be the only way in which the user will interact with the sprinkler system (other than the possible 'emergency shut off' which will be physical valves and/or a programmatic way to also replicate this behavior.

The interface will be web-based. This web functionality will run on a Raspberry Pi using Apache and be local-access only. That is, I will limit the ability to the LAN in order to impose some security on the system. Either password protected or MAC-address restricted.

I plan on including screen shots of various control sites as I develop them here.

Somewhere between the interface and the controller (though mostly interface) is the code needed to get the Arduino talking on the network. I found a little guide which talks about running a web server on the Arduino itself. This is must more simple than my original though of having the Arduino behave as a mindless drone that just takes commands over the network. As I develop this concept into more home automated things, it will likely be the better option as I can have everything centrally controlled and monitored on the Raspberry Pi and just have slave units that do the home automation over the network.


The controller will be how the user requests will be processed into the 24VAC signals needed by the sprinkler hardware in order to turn the water on and off. This will be comprised of an Arduino connected to a number of relays and an Ethernet controller. This will allow for the web access to the controller and for the signals to be processed and to fire the relays needed. I still have not decided if I will build a custom board containing the ATmega chip and other componants or just use three shields (would be more expensive but would require less building on my part).
The proposed pre-fabed parts are as follows:
Relay Shield -
Ethernet Shield -
Arduino Uno R3 (already have)-

An all-in-one unit like this would be nice too.

These components will be ideally contained in a housing located near the valve manifold (likely under the crawl space)

Relay Board:

Edit 5:
Did a mock up of the circuit for my relay board using the java circuit simulator from
Paul Falstad's page at

Based this on the arduino playground suggestion for relays and the posting at glacial wanderer.


 The valves will be 24VAC triggered. I will build a manifold using whatever ones are most convenient, including a back-flow (anti siphon?) mechanism or simply anti siphon valves. I will discuss these ideas with Chris. I plan on running these off of the existing water supply in the back yard to avoid the need of tapping into the main water supply for the house as the water in the back will only be needed for this purpose. If putting anti-siphon valves, it was suggested to paint them with outdoor paint to avoid having the plastic getting brittle due to UV exposure.


I have to build a manifold for the four Orbit valves I purchased. I will be hooking this up to the main water with a hose that connects to a second "manifold" which will allow access to a spigot at the house, a connector to the sprinkler system (which will have the anti-siphon), and a third connector to a valve located at the other end of the yard. I will secure this to the house

added a "fail-safe" off button. Basically, I will wire a button into the Arduino according to this site and I created an If statement which will turn all relays off if the button is pressed (I plan on wiring this into a big red easy-button or something and mounting it to the house)


The zones are supposed to all use the same type of sprinkler. It is recommended by Rain Bird to get the sprinklers to be able to reach each other for maximum coverage. The type of head will depend on the zone. Measurements of water pressure, flow rate must be determined to calculate maximum number of heads and other things. I plan on using the Vinyl tubing rather than PVC as it will not require digging a trench and destroying the yard.

Zone 1

This will be the front yard, normal sprinklers, trenched from the back.

Zone 2

Back yard, normal sprinklers

Zone 3

 Garden area, types of sprinklers will depend on what works best for a vegetable garden. Drip, or sprayers of various styles.

Zone 4

Drip zone. Since these are low flow systems, I assume we can use one system for the two beds on the front, the side and the small bed in the back.


 Since I do not want to let the world have control of my valves controlling my water, or my home theatre setup, I will create this in a secure way. Obviously I dont want it to be inconvenient for Kara to access but do not want it to be open to the outside world. There will need to be a happy middle ground between these two things. Obviously, local access only would be important. This will allow me to access it via an OpenVPN or SSH tunnel when away from the house. Perhaps a login page in order to secure it from visitors to the house. Another option (though obviously spoofable) is to restrict to specific IP addresses based on MAC address rules on the Router. This is simple, invisible to authorized users and the scope of the allowable IP addresses (on the right side of the firewall) is such that even if it were compromised, I would know who is doing it since I would have physically handed them access to my home network and realized they did something malicious.

Monday, July 29, 2013

DDD - Digital Dead Drop

I wrote this program a while back. In light of the recent NSA and Snowden news, I thought it interesting enough to put up here. I wanted to see what people thought of the concept and hopefully someone with better programming skills could clean up the concept and make it safer for general consumption.

The thought occurred to me while reading the Ender's Game series (namely the Shadow series) which involved a lot of covert communication on part of the characters. One of the methods used, the characters would send messaged to private dead drops for later retrieval. At the time I became very interested in secure communications and set up my own private OpenVPN server. Since I developed this, much of the communication was "taken care of" from a security standpoint. My user base was limited to myself, so I didn't concern myself with cleaning up the code to avoid injection attacks and the like. I submit this code with the hopes that people realize my perspective with developing it, just having fun with a concept.

The interface is exceptionally simple, as I wanted to use it mostly from my phone (which I connect to my vpn). This allowed me to quickly enter random thoughts on the bus or while out and about. without using commercially available options or something stored locally on my phone. This made the text safely tucked away on a secured and backed up server.

The submitted text provides a response showing the message and IP address submitted (this is not checked from the server side, as a lot of things in this, it was assumed)

My sshing into the server the messages can be watched in real time by following the file with tail.

To accomplish this, I used Python 2.7 and the Twisted library. I generated my own SSL certificates (which might have been unnecessary for the scope of the project as the traffic is already encrypted over the vpn but provided insight in the process)

This was my first project involving web/ssl and python together.

The source code for the project can be found at my github repo HERE.

I would appreciate any feedback with the knowledge that I never meant for this to see anyone's eyes but my own and have tried to remove any "sensitive" info I may have accidentally left in during testing.

Friday, July 5, 2013

Spokane Transit Authority

The south hill is a very nice place for Spokane. The houses up in the hill are well maintained and the general opinion is that the snobs live up here. Also those who do not wish to live in many of the more crime ridden portions of town. This is the reason my wife and I decided on this area
I have been riding the bus for a month now as a means to avoid the mass of traffic commuting down the hill. It has been very convenient as a bus stop exists five houses from our home. Due to the nature of this neighborhood, the clientele on the 6:55AM city loop from 29th Ave to the STA plaza is made up of commuters.
A man just got on the bus. He is carrying a green grocery bag from Super One Foods. It is obvious that he hasn't just woken up and is on his way home to consume his purchase. Based on the shape and silhouette of the bag, it would appear he has obtained a forty ounce beer.
The forty is a unique beverage choice for a number of reasons. Firstly it is seven in the morning in a Tuesday which carries its own set of issues. It also is a specific quantity of beer which ensures the goal of the drinker isn't just trying to enjoy a delicious malt beverage on a hot day (which the news promises to be over one hundred degrees). If one simply wanted a cold beer to quench their thirst, almost any beer is a better alternative and is likely of a reasonable quantity not to inebriate you. The goal of the forty beer is to get you drunk.
Alcoholism isn't something to laugh about but it gives an insight into some of the issues one might have on the bus. Riders who are drunk or on drugs can make the experience less than desirable. Even those just exposed to lifestyles connected with these issues seem to have less ability to cohabitate with their fellow human being. These people will undoubtedly end up at the bus plaza as a central "hang out" to loiter at.
The bus plaza is a bizarre place to me. When I am riding the bus, my goal is to arrive at my destination by minimizing my time spent on the bus. Even if I miss my transfer, the next bus is less than twenty minutes away (on a weekday). It seems I am of a minority of riders who actually use the plaza as a means to catch a bus or transfer buses. It always astounds me to see people to hanging out there. This issue of loitering is what makes it such a sketchy place to visit as people with no agenda often cause trouble for those of us that do. Getting bored and hassling people isn't fun for someone who just wants to be left alone. This is why I often leave my headphones on and ignore everyone I encounter on my commute.

To be fair, I have never had a negative experience riding the STA in Spokane. It is actually a rather convenient alternative to driving. Though its routes and frequency leave something to be desired as it typically takes three times as long to get anywhere, even if you plan your route meticulously. I hope to see it improve and plan on using it more in the future.

Hope this gave some insight into a brief thought I was having.

See you on the 33


Up until a few weeks  months ago I had a few misconceptions about the state of the financial world that is the United States. Some of those misconceptions have made me blind to very serious problems that have been growing for as long as I have been around and before. It has really come to bear this past decade but mostly since the financial crisis of 2007. Namely, the fact that the US Dollar is effectively worthless.

The purpose of money is to give a medium of exchange for people. This makes transactions more simple as people don't always need or want things at the same time nor should they be expected to. For example, a dairy farmer needs milking equipment to help milk his cows more effectively. The dairy farmer cannot pay the manufacturer of milking equipment in milk as he would likely be all set with milk from previous transactions (if he accepted milk in payment) but would prefer to have clothing for his children or theater tickets to take his wife out with. By having a common payment method, the milk farmer can pay in cash which the manufacturer of his dairy equipment can then exchange for the things he needs or wants. Cash makes this possible.

There are some elements that make a monetary system effective. The most important of these is the common acceptance of a currency. Since the US Dollar is the standard currency by law in the United States, it is "encouraged" for everyone to accept it. This has been the number one issue regarding the widespread acceptance of alternative currencies in the United States. People use money that people accept. Everyone accepts the money that people use. It is a cycle that has been perpetuated by the fact that our money has not been overprinted. This leads to the second thing a monetary system needs, finititude. For something to work as a currency, it cannot exist in excess. Imagine a world where people could pay for things in dirt. Everyone would go outside and dig up their yards. Eventually it would require dump trucks of dirt to pay for a roll of toilet paper as everyone would have access to a seemingly infinite supply of wealth and the only way to limit this wealth is by making the medium of transaction worth very little for a volume of it.

The solution is, of course, to have value associated with things that are rare in terms of volume and mass and cannot be brought into the monetary population easily. Colored stones, gems, and of course, precious metals. Gold has often been the medium of exchange in the world as it takes a good deal of effort to extract from the earth (which limits its rate of quantity increasing). Everything else about gold (its chemical properties and beauty) are secondary to this first property of finititude. A person walking up to your business with a sack of gold, you can reasonably expect that a massive quantity of gold didn't suddenly flood the market making the small amount you are about to accept is worthless. This is the reason many people invest in gold and silver today as well.

Gold isn't worth anything on its own. Think about the things you will need in the next week to survive. Oxygen, water, food, shelter. These are things that "cost money" and what we typically mean is that they do not simply exist within yourself, nor in such a way that they come to you without you "paying" for that. This payment can be that you have to forage the woods for these things (obviously we are fortunate to have oxygen in a relatively 'free' supply [of course I say relatively as an engineer because nothing last forever, damn you heat death of the universe]). We pay others to break down the process of creating all of the things we need and want. Gold isn't edible, it is simply a rare material in which things can be 'traded' (see: bought) for. There was a story I recall about the Spanish returning from the new world with large stores of gold expecting to be rich and be able to buy all they wanted. They in turn devalued gold and made things cost more as the quantity of gold increased but the production of things people actually used did not change. This was due to the fact that just because the quantity of gold went from x to (x+y) this didn't change that the entire value of the market was x = z where z is the products to be sold. The value of gold decreased by y due to the same quantity of z being spread out over more material.

The US dollar is worthless in the same regard as gold except for the detail that there isn't a single entity controlling the creation of gold like their is with the US dollar. Ultimately, money is what it is and it isn't the important part. The things that are important are the things we buy. Even if something did happen to our financial system like in the 1930s, there will always be a need for food, clean water, shelter, and clothing. As long as we maintain this belief, our currency system is an arbitrary means to and end.

Tuesday, July 2, 2013

Some food I cooked.

I uploaded this picture here about two years ago with the intention of talking about it. I am pretty sure it is stir fry I made with chicken. I don't have anything to say about it, but it is a draft and I wanted to make it not a draft. So here is a picture of food.