Raspberry Pi and Email

Email Checker Breadboard

Email Checker Breadboard

I’ve had a busy past couple of weeks, speaking at PechaKucha, teaching a class on Arduinos and Wireless Communications, and finding a new job. I’ve been so busy lately I have to schedule my fun, which is a little sad but apparently necessary! This week I dove back into the Raspberry Pi.

I got my RPi a few weeks ago from Adafruit, set it up, got it connected and installed some software but then forgot about it. I have a short term plan, which is:

I want a Raspberry Pi camcorder. What I envision is a system that is a RPi connected to a webcam. I flip a power switch and a red light comes on, indicating power and readiness. I then hit a candy-like button and the red light toggles to green, and the webcam starts recording. I hit the button again, and the green light toggles to red, and the Pi stops recording, as well as uploading the new video to a central repository (dropbox, fileserver, youtube, etc).

The first step in this project, aside from a little planning, is figuring out how the GPIO pins on the RPi work. As mentioned before, the RPi has a series of pins that allow you to logically control external devices, components, etc. I’ll need to connect these to components on my breadboard for the power switch, blinkenlights, etc.

Adafruit has a nice tutorial section for learning about the RPi, and one of the first tutorials for GPIO is an email checker. It connects to the ‘net, grabs a count of your emails from gmail, and then either lights a red LED (no mail), or a green LED (mail!). I thought this one was great because it includes some pieces of what I want to accomplish, namely LED and internet communcations. My learning process can take me to some interesting but unexpected places, so here’s the story of what happened!

The first section of the tutorial has you install some necessary libraries. I already had SSH set up on my RPi, because its a PITA to hook up an external keyboard and mouse to the Pi and move stuff around on my desk to make it work. VNC would work too, I guess, but I digress. I also had to make sure Python was installed and up to date, as well as the python RPi GPIO libraries. Everything progressed nicely and there were no problems.

The second part has you connect up the hardware. The Adafruit RPi starter pack comes with (almost) everything you need, including the Pi, a ribbon cable, a breadboard, and a breakout board so you can easily split out the GPIO pins onto your breadboard. I quickly connected everything up, but in fairness I have SOME small degree of electronics knowledge. Let me know if you need some pointers ;) One cool thing: I can now (sort of) read resistor codes without having to look them up! I needed 2 1kOhm resistors in series with the LEDs to limit the current.

The third section is the coding section. It suggest you copy / paste from the site, but you know… I like doing things the hard way, so I typed everything out myself. No problems here. The problem came when I tried to run my code! I am no python expert, and the errors can be … cryptic, to say the least. This is what I got when I ran my code:

root@raspberrypi:/home/pi/tutorials# ./rpi-gmail.py
./rpi-gmail.py:17: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(GREEN_LED, GPIO.OUT)
./rpi-gmail.py:18: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(RED_LED, GPIO.OUT)
Traceback (most recent call last):
File “./rpi-gmail.py”, line 21, in <module>
newmails = int(feedparser.parse(“https://” + USERNAME + “:” + PASSWORD + “@mail.google.com/gmail/feed/atom”)['feed']['fullcount'])
File “/usr/local/lib/python2.7/dist-packages/feedparser-5.1.3-py2.7.egg/feedparser.py”, line 375, in __getitem__
return dict.__getitem__(self, key)
KeyError: ‘fullcount’

I ask you, dear readers: What the hell does this mean? I surely did not know, so I had to go out and figure it out.

The warnings I wasn’t overly concerned about, warnings are usually just that, so I started looking towards the bottom. There was some indication of the error, KeyError ‘fullcount’. The offending line was trying to decode a URL, using ‘feed’ and ‘fullcount’. So I had to go off and learn about the feedparser code, and about the atom specification!

The feedparser code splits off the returned code into a dictionary, which is sort of like a key / value link in python (see here). Problem is, I’m no python wiz! And it looked to me like these were two dimensional arrays from C. Furthermore, I went off and looked at the Atom spec, which is a lovely IETF specification. None of these things told me what fullcount was, so I decided to do the usual boneheaded thing, and figure out myself what was going on.

I added a print statement in the python code to see what was being returned by the URL call. And what came back looked something like this:

{‘feed’: {‘summary’: u’<h1>Unauthorized</h1>\n<h2>Error 401</h2>’}, ‘status’: 301, ‘version’: u”, ‘encoding’: u’UTF-8′, ‘bozo’: 1, ‘headers’: {‘content-length’: ’147′, ‘x-xss-protection’: ’1; mode=block’, ‘x-content-type-options’: ‘nosniff’, ‘expires’: ‘Fri, 03 May 2013 13:36:04 GMT’, ‘server’: ‘GSE’, ‘connection’: ‘close’, ‘cache-control’: ‘private, max-age=0′, ‘date’: ‘Fri, 03 May 2013 13:36:04 GMT’, ‘x-frame-options’: ‘SAMEORIGIN’, ‘content-type’: ‘text/html; charset=UTF-8′, ‘www-authenticate’: ‘BASIC realm=”New mail feed”‘}, ‘href’: u’https://mail.google.com/mail/feed/atom’, ‘namespaces’: {}, ‘entries’: [], ‘bozo_exception’: NonXMLContentType(‘text/html; charset=UTF-8 is not an XML media type’,)}

I ask you again dear readers: what the hell is this? If you recognize it, you are a wizard and I am not worthy! But I am dumb, so I dug further. Strange, fullcount does not appear in the text above! Interesting. Hmm… what happens if I try this URL in a browser window? Ohhhh… it’s like an XML file! And the feedcount is a field in the feed description, so it’s just looking to pull the feedcount tag out and store it in a variable. But wait… 2 problems. One, the browser URL is asking me for my password again. And the returned fields do not match the ones that I’m getting returned in my print statement. Is it a cookie thing? What’s …

Oh, duh. I’m using the wrong password in my script file! I made a simple change, and voila! BLINKENLIGHTS!

No Mail

No Mail

Once it was debugged, I made one final modification, a simple loop that blinks the indicator light a number of times equal to your email count.

This debugging seems a lot easier in typing it up, than it took when I was messing with it. It took over an hour to set up, with about an hour of that in debugging. However, I learned a lot of neat stuff!

  • Package management for RPis
  • Atom specification, what it is and how it works
  • How gmail provides an API to pull your emails (useful!)
  • Python dictionaries
  • Python module storage and installation
You've got mail!

You’ve got mail!

“Well, after this I should think nothing of falling down stairs.” – Alice. In summary, when you fall down the rabbit hole, you never know exactly where you are going to end up, but it’s probably a strange and fantastic place!

 

Tracking Animals in Cades Cove

I wanted to share a beautiful and amazing experience I had last weekend, in the hopes that others might be inspired to step out and do the same. I saw a class offered by the Smoky Mountain Field School, specifically Wanda DeWaard’s Animal Tracking and Nature Observation class, and quickly signed up. What I saw and learned there with Wanda was so spectacularly awesome and inspiring, I had to share.

The weather report called for steady rain on Sunday, and I awoke before the dawn to the sound of heavy and constant raindrops falling outside my window. I was feeling admittedly grumpy, for while the class sounded fun, I do not relish being wet and cold for hours on end, and I had extremely pessimistic thoughts about what the day might hold. The thought of skipping the class did cross my mind… but two things prevented my going back to sleep. One, I had paid 50$ for this class, and they are taught rain or shine. Two, I had confirmed this with Wanda the day before, that she would be there, and I had committed to her to go. I told myself, maybe it wouldn’t be so bad, and I slowly rolled out of bed, creaking and cracking and coughing and grumbling.

Some coffee did wonders to prop me on my feet as it so often does, and with a frenetic burst of energy I prepared for my trip. Backpack, large bottle of water, turkey sandwich, two of my wife’s homemade granola bars, apple, and some walnuts. Polypropylene shirt and pants, fleece jacket, rain jacket, wool cap. Man… I need some rain pants, but instead pulled on a pair of poly shorts because that’s all I have. My legs will be cold… oh well.

I set off in the car, a few minutes late but that’s expected, and immediately start to feel my spirits lift. The rain has somewhat relented, and while it still falls the forecast says it is due to clear off around noon. Gospel is on WDVX radio, and while I am not a religious man, I do like to sing, and I do love bluegrass and gospel, and I add my keening off-pitch voice to the wailing songs. I speed along through mostly empty streets, taking back roads up through Townsend, bound for the Great Smoky Mountains National Park.

Misty Morning in Cades Cove

Misty Morning in Cades Cove

Cades Cove is smashingly, awestrikingly, absolutely gorgeous this morning. Mists and fogs rise from the ridges and low mountains around the cove. The rain has mostly stopped with the slightest of drizzles. There are huge numbers of wild turkeys strutting and calling, packs of deer flood through the lowlands and fields, and there are so few cars this early and wet, I  feel as if I have the Cove to myself.

As I so often do, I stop at one of the churches along the way. There is an old Methodist church, made completely of wood and balanced on columns of local rock, with high ceilings and a small podium, at which I often stop. Outside is an old graveyard, with the woods and fields surrounding. I step behind the pulpit… I used to feel guilty doing this, but I imagine that God, should he notice, probably appreciates my worship of his beautiful creations, and doesn’t mind too much I’m not ordained, or even particularly religious… this is how I worship, my voice booming around the empty, old, wooden room, echoing back to me as I imagine the people that have lived and died, born and breathed, here since the 1820′s. It… feels… amazing.

Cades Cove Missionary Church

I arrive at the trailhead for Abrams Creek, and pull up beside the only cars present. There is an older gentleman whom is a great and knowledgeable companion, a somewhat persnickety older woman, and our instructor. There are six or seven attendees on the roster, but only three show up, the rest no doubt subdued by the rain.

The instructor is Wanda DeWaard. She’s maybe in her 50s, fairly thin with long straight black hair going to gray. I’ll wager she was quite beautiful when she was young, but she maintains a vitality and passion that renders her somewhat ageless. Wanda has brought a canopy and we set it up to shed the rain, which is fortunate, for several other cloudbursts roll through in the next couple of hours. Wanda has taught and studied tracking around the US for more than thirty years, she is so passionate that her manner is infectious and I listen with rapt attention. I do dance around a bit at times, because I am cold, and sitting still is not easy for me.

Her lecture is short, or at the least time passes quickly. She tells us about tracking and what it means. Tracking is following the signs of passage of an animal. A track is not only a footprint, but also things left behind, physical evidence like feathers, fur, displaced patterns in the leaves or needles or mud, scratches or broken branches. Animal scat is one of the best identifiers of a creature. And wonder of wonders… she has brought twenty or more kinds of scat, carefully preserved, in specimen jars to show us! Bobcat, black bear (its huuuuuge), cricket (!), coyote, deer, mountain lion, boar, caterpillar, and so on. She also has a sense of humor, for some of the jars are filled with ‘snowman scat’, milk duds, and a creation of her own: raccoon scat! Raccoons, you see, sometimes have the eggs of a roundworm that are transmissible to humans, so she has made her own out of Godiva chocolate, corn kernels, various seeds, nuts, and berries. I don’t see any exoskeletons, but I do bravely eat two pieces of the candy and find it delicious. The rest of the scat we study to determine various taxonomies and identification techniques. I realize I have seen bobcat scat before, probably after it ate organ meat (smallish, twisted, black, in the center of a cross train on a ridge).

Wanda offers some laminated tracking sheets she has made, which show different categories of gaits for animals… diagonal walkers (dog, cat, deer, hoofed animals), pacers (marmot, muskrat, beaver, porcupine, skunk, raccoon, opossum, bear), bound walkers (weasels) and gallop walkers (rabbits, rodents). She notes that these are not 100% accurate and can vary depending on conditions of the terrain and the animal. She shows us what the prints look like. She shows us jars full of nibbled nuts, bones, and detritus and has us guess the creature by the bite pattern and size (mouse, squirrel, flying squirrel, rat). She shows us a jar with an owl pellet inside, hair and fur and tiny bones that we try to identify. Wanda does several animal impressions through the day, and she is quite good…. a black bear streeetching up on a tree and scraping, then rubbing his back. The bound of a rabbit, the walk of a bear and a raccoon, the hop of a squirrel.

Clear Print Tracking

Clear Print Tracking

Pattern Tracking

Pattern Tracking

We study feathers from various birds. She shows us how to tell where the feather came from (gentle curve with one side longer than the other? A wing, with the shorter side the leading edge. Fairly straight and flat tipped? Probably a tail feather). She points out you can guess what happened to the animal by the placement, condition, and number of feathers. Birds of prey will snip a feather so that it looks like it was cut by feathers, whereas a weasel or coyote or cat will often crush and bite them. A single feather, no marks? Dropped naturally. Several in a pile? Probably a naked bird in something’s stomach. We study the sound of feathers. I whip my wild turkey feather through the air, it is quite noisy… turkeys don’t need to be quiet when they fly because they find their food through sight and smell, and it doesn’t usually run away. Owls or hawks? They make no sound when you whip them through the air. We study wild turkeys, grouse, bluejays, woodpeckers, and others.

She shows a collection of books, some I have since bought. Two for my kids, Everyone Poops because Charlotte is potty training and loves animals, and Whose Tracks Are These, because she loves the outdoors as well as animals, and we often walk through the yard and woods looking for creatures. I also get two for me that Wanda (and Amazon!) recommend as among the best: Tracking and the Art of Seeing, and the Peterson Field Guide to Animal Tracks.

Soon we head into the woods. I am completely blind and see nothing, and must follow her like a lost puppy dog. I love the outdoors, and especially love the woods, and have spent a great deal of time there. However, I am often concerned with getting somewhere, with the journey, with speed and power, or looking over the trees and mountains and water. I have never really looked at the ground before, and it is at first remarkably difficult to see anything noteworthy. Wanda’s eyes are magic, she sees a world I have never experienced. We walk along Abrams creek and ramble through the woods for what feels like minutes but is actually hours. The rain has stopped but has washed away many of the old tracks, though it leaves behind wet ground that takes tracks quite well. She shows us how to press the ground and measure the substrate, how to tell the relative age and ground condition of a track. Some of the tracks are pocked with rain, meaning they were left either before or during the most recent showers. Some tracks are covered with other tracks… did you know deer most often place their back feet where their front feet have fallen? I did not, nor that the wider pelvises of the female deer will result in a slight offset to the outside.

Turkey Wing Feather

Turkey Wing Feather

We find quite a bit of scat, and Wanda points out that as an animal’s seasonal diet changes, so do their droppings… deer scat is typically more woody and solid during the winter, whereas in the spring when the fresh greens come out, it results in a wetter green plop. We find feathers from turkeys, with tiny piles of green matter mixed with white uric acid (you can tell the males because their scat is a J shape). Foxes and coyotes become largely fruitarian in the fall, eating lots of cherries, blueberries, and persimmons.

We feel the tracks to know how old or heavy it was, what kind of animal it was. How to see partials in the leaves and grass. How fast the animal was moving. Wanda knows the birds by their sounds. She notes a kingfisher just before she spots it, it flies back and forth over the creek looking for fish. A pileated woodpecker leaves a few shredded piles of bark for us to observe. We see signs of a yellow-bellied sapsucker, rings of small holes in the trees. Wanda points out they are actually inducing the sap to drip, which catches bugs, which the sapsucker leisurely eats.

I manage to track a human. There are several broken branches, some footprints, and a tiny tuft of blue fuzz hanging from a branch, snagged from the sweater or pullover of a domesticated primate.

Wanda points out some of the wild spring greens that are just starting to appear here in late March. That is Watercress or Nasturtium officinale, which grows in a spring pool that feeds the creek. That is Sochan or Sochani to the Cherokee, Rudbeckia laciniatum or green headed coneflower by others. That is Spicebush, used by pioneers and Cove dwellers to make spicy teas and flavor biscuits. While I cannot recommend you eat the wildlife in the Park, if you do get a chance you might find that all of the above are absolutely delicious.

Spicebush Blooms

Spicebush Blooms

We see numerous fungi, algae, mosses, lichens… the forest is wet and our fungal friends are everywhere, beautiful. Lungwort. Algae growing atop toadstools atop decaying wood. We see old beaver sign, fallen trees with gnaw marks of beaver size and cone-shaped stumps. I find an old, broken bone, perhaps 6 inches long, bleached white and mostly hollow. I find three fallen buckeyes, also known as chestnuts, said by the Cherokee to bring a year of good luck. I take three home to my family.

We see some of the first tiny, delicate wildflowers of the season. One a halberd-leaved yellow violet, the Viola hastata. Another a tiny, beautiful pale pink called a Spring Beauty, the Claytonia virginica. We see some Crows Foot greens, also known as woodland stonecrop or Sedum ternatum.

Viola Hastata

Viola Hastata

Claytonia Virginica

Claytonia Virginica

We find a few ponds filled with eggs… some are frog eggs (there is some discussion about whether or not they are frogs… they are bi-colored eggs, yellow and black, on the surface of the water) and many globes of salamander eggs, large pale white ghostly blobs about a foot below the surface, hard to see.

Salamander Eggs

Salamander Eggs

We walk out through the fields and see a large wild boar wallow, with many tracks surrounding (they look like pig feet, imagine that), including one large specimen whose dewclaws are clearly visible in one deep, clear track. We follow his sign for a few hundred yards until he disappears near the creek, presumably having crossed or moved onto rocks where we lose him.

Over the day, my eyes begin to awaken. It is a new way to appreciate the forest, a new layer of observation, a new way of seeing. Michael Pollen talks about opening his eyes for foraging in a similar manner in his excellent book The Omnivore’s Dilemma, where the secrets of the Morel mushroom are only visible to those with a practiced eye. It may be overbold to say that my walks through the forest will never be the same, but I feel I am more alive, more observant, more discerning, more capable. My eyes have been opened.

GO.

Introduction to Raspberry Pi

Two days ago I received my new Raspberry Pi, a tiny business card sized computer. It runs Linux, which is cool, but has all sorts of awesome things it can do… it has HDMI output for HD video, 2 USB ports, 10/100 ethernet, and a series of general purpose in-out (GPIO) pins that allow you to control all sorts of external electronics. Finally there is a component RCA video output, an S Video output, and a 1/4″ speaker jack.

Thinking Outside the Box

Thinking Outside the Box

I got it for a few different reasons. The absolute justification was because I want to have a way to record video in our hackerspace. The thought is, I can combine it with a USB webcam (graciously donated by my friend Rich… THANKS RICH) to record our presentations and workshops. Conceptually what I want is a shiny red button that, when pressed, will begin recording video, with a big GREEN light, and then when hit again, will stop recording video, with a big RED light.  Another thought was that there are ALL SORTS of things I could use an RPi for … media center, embedded computing, remote sensor networks, file servers… its a tool that unlocks the imagination, to assist in the creation of an Internet of Things, and in Making Things Talk.

The GPIO pins are essentially 3.3V logic pins that can be used to turn things on and off. There are also I2C pins, and serial Tx Rx pins. These pins, in combination with the regular outputs, allow a serious level of control and connectivity to external devices, breadboards, sensors, motors, and so forth.

The Raspberry Pi I purchased came from Adafruit, part of their Raspberry Pi starter pack, you can get one here. I acquired it as part of a group buy through our local hackerspace, Knox Makers, at a substantial discount, then eagerly awaited its arrival. In the spirit of full disclosure I must detail a minor SNAFU. The starter kit comes with a laser cut acrylic box, pretty sweet. One must self-assemble the box. Unfortunately, one of the sides that came with the box was noticeably thicker than the others, and thus would not fit in the tabs that had been cut for it! On the positive side, I contacted Adafruit, and they responded within an hour, and immediately sent me a replacement via first class mail.

All Wired Up

All Wired Up

I ran into a few other problems, mostly self-inflicted, that caused me to believe I might be cursed. Part of the install process requires imaging an operating system onto the micro SD card that comes with the kit. This micro SD comes with an adapter to regular USB, and behind that USB adapter is a little pull chain so you can remove it (the adapter is tiny).

When I tried to pull the wee pull chain, the adapter broke! I also don’t have an HDMI cable, they are quite expensive (the cheapest Walmart had was a 6′ generic China model for 12$), but I was able to scavenge a component RCA cable from my DVD player, and an adapter one of the hackerspace guys had given me that does component or SVideo to VGA. Later when I tried to set the machine up, I noticed (doh!) my keyboard requires a PS2 port, which the RPi does not have. And then when I was headed upstairs, I banged my forehead quite hard on the ceiling, which resulted in a lot of pain, some cursing, and a large knot. Some days it’s good to be a Murphy…

Yesterday I managed to work through most of these problems and get it running. I must say… it is very sweet to see such a tiny computer running a full desktop Linux! The process more or less mirrored the first few lessons from here, if you’re interested in reading up. I’ve a bit of Linux experience so there were no major obstacles, and the process was more or less smooth. I got the network up, I got the video up, I got SSH up, installed a few libraries for python development and to control the GPIO pins.

I Have That Knowledge

I Have That Knowledge

In the coming days I will be further detailing my learning and experiments with the RPi. For now, you can read up on some of the things that might be done here:

  • http://raspberrypihacks.com/
  • http://www.engadget.com/2012/09/04/raspberry-pi-getting-started-guide-how-to/
  • http://reviews.cnet.co.uk/desktops/25-fun-things-to-do-with-a-raspberry-pi-50009851/
  • http://arstechnica.com/information-technology/2012/12/10-raspberry-pi-creations-that-show-how-amazing-the-tiny-pc-can-be/

 

 

 

Arduino and XBee

Our hackerspace Knox Makers is hosting a 6 part series on Arduino microcontrollers, with 3 basic classes and 3 advanced classes. I volunteered to teach two of them, one of which is behind us, the beginning Arduino: Software class. The other is coming up, Arduino: Wireless Communications. And in true teach to learn fashion, until yesterday I had zero experience making radio doohickeys do their thing! Today, I know enough to share the basics, and my experiences.

Arduino Uno

Arduino Uno

In case you don’t know what Arduinos are for, they are a cheap open-source hardware microcontroller for prototyping and design. Arduinos allow you to glue physical and / or virtual objects together in any number of interesting ways. And did I mention Knox Makers is teaching a series? Or that the slides are available online for the general public?

Arduinos allow easy access to serial communication, which is just a way to send a stream of data one unit at a time, and receive it at the other end of the communication media. So for instance… USB is serial communication (Universal Serial Bus), so is MIDI, Ethernet, Firewire, PCI Express, etc etc. But for Arduinos, serial communication is an abstraction one or more steps removed from physical media… the Arduino doesn’t care if you’re using wires, or radio, or carrier pigeons.

ZigBee is a wireless communications protocol similar to Bluetooth or WiFi. ZigBee is intended for low power, short range, experimental (as in FCC regulations) communications. And XBee is a commercial implementation of the ZigBee protocol, sold by a company called Digi.

I had a business idea some months ago that required wireless communications, so I had a desire to learn more about it… and what better way than to commit to teaching a subject that you know nothing about, right? Actually, one great way to learn is to dive right in.

XBees are chips with a number of small pins used for various purposes like power supply, or signal strength indicator, or transmission or receiving data. You have to tie the XBee into your other electronics, using adapters, shields, or custom build components. Two of the members of Knox Makers gave me boxes filled with semi-random goodies: several XBee chips, some custom hardware (nice, Issac!), some shields, and miscellaneous cables, modules, and so forth.

I bought an XBee adapter from a company called Adafruit. This allows you to program your chips, and connect them to USB cables, and thence to computers. One reason you’d do something like this is to program the chip itself, like updating the firmware, changing the settings like radio channel or mode of operation, and so forth. Another reason to use this adapter, you can use XBees to transmit information to your computer, like say… temperature readings at a distant sensor, or car telemetry information, or chat clients between two computers on a private radio network, and so on.

Xbee Adapter (after soldering)

Xbee Adapter (after soldering)

Once your chips are programmed, you can also either connect them to Arduinos for additional logic (like my plans), or use them straight with other components for remote sensors or other communications purposes.

I found a great book called Building Wireless Sensor Networks that has quite a bit of interesting information. They suggested one product that was a remote wireless doorbell. The parts I’m using to accomplish this are:

The first step was soldering the XBee Adapter Kit. It had been a while since I brought out the iron, I had forgotten how fun it was. I managed to mess up the first one, twice… luckily I had bought 3 (they were cheap) and quickly soldered another one together. This part was really fun, but I stayed up waaaay too late… I have a tendency to get ‘in the zone’, and lose track of time… that’s how you know you’re having a good time!

Next, I wired up the button circuit. It’s pretty simple with an XBee shield, the shield sits right on top of the Arduino and handles the power and the data transmissions… all I had to do was wire power through a tactile switch and to an input pin. In software, I told the Arduino: if you see input on this pin, send the letter D across the serial link, which happens to be wired to the XBee. So when I hit the button, the letter D is broadcast via radio waves.

Doorbell Button

Doorbell Button

The receiver circuit was only a little more complicated. Since I’m using a Boarduino and I didn’t have another shield, I attached the XBee to a breakout board, which spaces the pins so you can use it on a breadboard. I then wired power and ground, and Tx and Rx, to the Boarduino. Then, I wanted some sort of bell. I ended up adding in a piezo element, and hacking one of the Arduino tutorials that plays ‘Twinkle Twinkle Little Star’, to instead play a slightly more ‘traditional’ doorbell chime.

Doorbell Chime

Doorbell Chime

This was a small project, but super exciting. I got to dust off my rusty soldering skills, become reacquainted with Arduinos, and hack a little hardware and software. I look forward to further experimentation!

Please let me know what you think, and if you need more information, I’d love to help you get started!

Voluntarily Unemployed

It is time for a new adventure. I have quit my corporate job.

The catalyst occured 18 months ago. I had been working crazy hours, switching back and forth between days and nights of work. Charlotte was about 6 months old. I went to bed one morning around 7AM after working all night, and then got called 2 hours later to tell me there was a critical severity problem and that I had to get on the phone immediately to fix it. Charlotte was crying, Melanie was misreable, everything came to a head and I punched a hole in the drywall of my foyer. Such an outburst is highly uncharacteristic of me, and was not my proudest moment. I decided I needed to find a new way to make a living.

I was very well paid at my old job, but it wasn’t a healthy environment, and I had to accept it was no longer the right job for me. In the past 18 months of soul searching and research, I have become enamored of the idea I owe it to myself and my family to do what I love and make a living doing it. I have a perception it is expected by our culture to work hard, put up with mind-numbing boredom for the sake of paying the bills, buying a large house to fill with unneeded material possessions. I don’t want this for myself.

The counterargument is this: the people I know whom are truly great at what they do, claim to love their work. It is said all jobs have ups and downs, but it is passion in what you do that carries you through the valleys to peak once again. I believe working at a job I hate is not right for me. The constant shifting of schedule, the boredom, the lack of passion has become too much to stay. My heart isn’t in it, my work is beginning to suffer, and it’s not fair to the company that has treated me so well, for so long, to do anything less than my best.

With foresight and research, I’ve made certain plans. I have 6 months of living expenses in cash. I have savings that would carry me through 2 years of unemployment that I’d rather not sell. I will take less money for greater happiness, but I’m going to put an absolute minimum number on my new job. $50,000. It’s approximately the median income for the US and for my area. It’s what I need to pay the bills, taxes, save a little, go on the occasional vacation, and have some small entertainment. But I am at the point in my life, it must be something I truly love to do.

One of the ways I have to describe my ideal career is a Venn diagram. Circle one is stuff that I love to do… playing video games, roleplaying, reading, writing, thinking, and so forth. These things change, but slowly over time… generally my limit on things I love to do is bounded by available free time. The second circle is stuff I am good at doing… I have a lot of computer skills (hardware, networking, programming, operating systems, etc). Skill can grow but slowly. The figure I’ve seen quoted is 10,000 hours to become an expert. Other considerations aside (like Pareto’s law), this is a very long time (five years of 40 hours / week). The last circle is, what people will pay you to do. This is based upon social contract and the value you can provide to others that they will pay for. The perfect job is the intersection of these three circles: what you like, what you are good at, and what people will pay you for.

These are surprisingly difficult questions for me to answer. Have you ever asked yourself, what are you good at? What do you like to do? How can you get people to pay you for these things?

I want to know!

 

Men’s Fashion

Business Casual

If you are at all scared of shopping, or don’t know where to start, I really hope this article is useful to you. If you don’t meet these characteristics, I hope you are amused and entertained by my experience in making a change.

Those of you whom know me, know that I have always been a terrible slob. Unshaven, dirty / faded / ripped jeans, ratty sweaters, old t-shirts, shoes held together with duct tape… and so on. My life has rapidly changed within the past few years. Married, homeowner, one child, another on the way, and the time for an image update had come. Most of these ideas came from my reading of the  Art of Manliness. The creator and maintainer is a man of many excellent habits and good advice for all men.

If you know me you know how poorly I dress, but what you probably don’t know is that very often I would open my closet, stare morosely at the contents within, complain that I had nothing to wear, and choose the same old ratty jeans and ill fitting polo shirts, or just wear another fleece and t-shirt to work. Nominally my occupation has no specific wardrobe, though a very loose business casual is most common. For years I have dressed below the standard. On more formal occasions (weddings, funerals) I had bought a couple of suits (for weddings), and I own a couple of dress shirts and a half dozen ties, but other than that, my wardrobe is composed of gifts culled from twenty years of Christmas presents from family or Walmart specials.

But finally, I had grown critically tired of the fear, the uncertainty, the … depression… of having a closet of useless, ratty, ill fitting clothes. So I decided to change it. My wife and I had talked about going shopping, and we finally decided to do it.

After a lot of reading and thinking, I spent an hour or so composing a wish list of things I wanted. They included: 2 pairs of dark jeans, 2 polo shirts (cotton), 2 polo sweaters (cotton), 2 v-neck sweaters (wool), 1 turtleneck sweater (wool).

Lesson Learned 1: Have a plan. It’s a lot easier to find what you want if you know what you are looking for ahead of time.

My first purchase was to be a couple of pairs of new jeans. We proceeded to the mall, and though I was scared at first (no, really), Melanie’s encouragement meant a lot… so take a solid friend with you when you go! We tried on maybe ten pairs of jeans before I found two that I liked. There is a lot of fit variation in cuts even within a single brand, and a lot of variation between brands.

Lesson Learned 2 – Proper fit is essential to a stylish look. A decent garment with a great fit, will usually look better than a great garment with a decent fit.

I was also looking for some polo shirts. I am a t-shirt man. I always have been. I am comfortable in soft cotton. I was surprised to find that soft, high quality polo shirts are CHEAP, and every bit as comfortable to wear as a t-shirt. In fact, I wear t-shirts under them, but polo shirts were designed for sport, so they are lightweight and breathable, two qualities I adore.

Lesson Learned 3 – Comfort comes not from the style of the garment, but how it fits and what it’s made of.

I ended up getting two polo shirts, two pairs of jeans, and two polo sweaters. Since I chose to go after Christmas at my wife’s urging (she knows a thing or two about shopping), I got what I consider to be incredible deals on clothing.

Lesson Learned 4 – If you shop at the right time of year and have an eye for a bargain, you can save more than 50% over retail price.

I was surprised to read, and later to find, that wool is an amazing fabric. I particularly liked the feel of the sweaters I found that were Merino wool, an extremely soft and lightweight variety. They were very reasonably priced, especially at the end of the year. Speak nicely to your retail staff, and you can sometimes find unadvertised deals, saving even more money.

Lesson Learned 5 – Become familiar with the properties and feel of various fabrics, such as their heat retention, hand feel, care instructions, and cost. It makes a huge difference in comfort and appearance.

As a retail beginner, it was surprisingly difficult to find the things I wanted. It seemed to me certain retail stores had more of the styles and fits I wanted, as compared to others where I couldn’t find things I liked, and when I did they didn’t fit. It took some time to find a few stores that carried clothing I wanted.

Lesson Learned 6 – Find stores you like, that carry clothes you admire, and fit you properly.

If you’re wearing business casual or dressier clothing, you’ll need some leather shoes. Many people recommend a pair of black leather oxfords for the dressiest occasions, and some brown leather shoes (bluchers, monk-straps, loafers) for casual occasions. I shined my shoes for the first time ever, and it made a big difference, even in my cheapest pair of slip-on shoes.

In conclusion, I had never cared for clothes. I believed fashionable clothing to be uncomfortable, and shopping to be a bother. I was surprised to find, both preconceptions were wrong. For a small expendature of money and time, my look has been refreshed, and people definitely notice. I’ve accepted that first impressions and a presentable appearance make a difference in the world. But more importantly, these clothes make me feel more professional, more attractive, and more confident, which increases the quality of my life. What better reason is there than that?

Next Phase of Exercise… 5/3/1

This is not me

A few weeks ago I moved into a new phase of exercise. I had started with a beginner program a few months ago, and progressed into a novice strength routine. I have recently started to plateau a little bit, the earliest gains and the easy progression behind me, particularly on squats. I’m older and get less rest than I should, but I’m also pigheaded and enjoy the stress reduction. Now I’m ready to move on a little further.

The new program was designed by a man called Jim Wendler, and is called 5/3/1. It’s designed around increasing strength on the 4 basic lifts: military press, deadlift, bench press, and squat. The short explanation is that you calculate or obtain your 1 rep max figure, take 90% of that as a starting point, and progress through a 4 week program, with the first week sets of 5, the second week of 3 reps, the third week a 5/3/1 up to your max established weight. One important point, is that the last set of each of these weeks, you are trying to exceed your stated goal by as many reps as you can possibly do to failure. So instead of doing 1 at my max rep of military press, I managed 6. The fourth week is a deload week lifting only 60% or so of your max, to give you time to rest and recuperate. The next 4 week cycle, you bump up your maxes by 10 lbs for lower body lifts, and 5 lbs for upper body lifts.

You also do some assistance exercises, designed for symmetry and increasing the base lifts. In my case I’m trying something called the triumvirate, which has dips and chins with the military press, decline situps and back extensions with the deadlifts, dumbbell presses and rows with the bench press, and leg press, curl, and lunges with the sqaut. The assistance exercises are multiple supersets, designed for increased strength and muscle mass, for instance a superset of dips and chins, 5 sets of 10 reps each.

I’m getting a lot stronger and maintaining progression. I’m in my third week right now, designed to lift my maxes, and generally kicking ass.

Sometimes I wonder, why am I doing this? 4 days a week is a huge commitment for my free time. I’m going to have to start doing it in the early mornings, like 6AM, to accomplish my other life goals (family, writing, personal development, etc). I received the answer last weekend. I recently had a dead oak tree cut down in my backyard, and for some dumb reason I decided I had to split it myself. I’m using an 8 pound splitting maul to accomplish the work, and it’s taking most of what I have to split the larger sections, ten or more maximum force swings to break the sections. But I feel good, I’m not overly sore when I’m done, and the sense of accomplishment as I stack cords of split wood is very satisfying. I also want to start taking some martial arts classes, particularly Silat, or Kickboxing and Jiu Jutsu. Increased strength and physical conditioning will help with any activity I choose to pursue.

I’d like to finish by posting some numbers, as a comparison to some of the old lifts I used to achieve. I will exceed these, this week.

Measurements:

  • Weight: 198 lbs (+5)
  • Biceps 14 (+1)
  • Chest 41 (+0)
  • Belly 37 (-2)
  • Waist 37 (+1)
  • Thighs 24.5 (+1.5)
  • Calves 15.25 (+2)

Surprised to find my chest is about the same (it looks a lot different), my belly smaller (yay), my waist bigger (boo), and calves… +2 to 2.5 inches? Wow. I still eat too dang much, something I need to work on. And CANDY has been my nemesis since Thanksgiving!

Lifts:

  • Military Press: 100 lbs, 6 times (+60)
  • Deadlift: 185 lbs, 7 times (not previously measured)
  • Bench (Dumbbell) Press: 130 lbs, 7 times (+40)
  • Squat: 180 lbs, 6 times (+55)

Definite improvement in just about everything. I hope these numbers steadily increase. Wow… it looks like, by the calendar, I’ve been training fairly regularly, with little exception, for about 5 months now!

December Updates

Reach For the Stars

Winter is upon us! I’ve been seriously slacking on updates. Have a lot going on in my life right now (baby, job, personal development, family… you know the drill), but that’s a poor excuse to stop writing! Actually, I’ve been writing more or less consistently in my personal journal, but that boring stuff would be no good for the likes of you, my dear audience of one… or two…

Anyway, I have three updates to offer: electronics, exercise, and venison!

Electronics: I have managed to come along a good way: I’ve a good beginner’s understanding of soldering and components. I’ve made my way through a few books; Make – Electronics, and Getting Started in Electronics are two of my favorites and are WELL worth your money and time. Right now I’m learning about integrated circuits, and am awaiting a new shipment for Christmas (are you reading this, Melanie?) so I can continue my experiments. I want to build a few alarm systems, and play with analog synthesizers. I want to construct some oscillator circuits and feed them into various modulators to make crazy sounds. I also attended a wonderful workshop at the local Hackerspace presented by Doug Laney about Proportional Integral Derivative controllers, or PIDs. PIDs are used for systems control in things like heating, cooling, keeping a tank filled with water, and so forth. Doug taught a great class about using Arduino libraries, and had some awesome props (literally) with him to show and tell. Thanks, Doug!

Exercise: I’ve stayed more or less on target with this! I think I’m hitting a plateau though, my easy beginner’s gains are starting to level off, and I believe it’s about time to branch out and try something new. I’ve been working off of Starting Strength, concentrating on squats, overhead press, bench press, and deadlifts, mixing in chinups and weighted decline situps. I’m up to 180lb squats (3 sets of 5), 95lb military press (3×5), 130lb dumbbell press (3×5), and 180lb deadlifts (1×5). My chins and weighted decline situps are coming along pretty well, too. I’ve gained about 5 lbs from where I started. I wish I could find my tape measure so I could check my measurements! Note: harass family to help me find tape measure. Anyhow, I think my next program will be something off of 5/3/1. It promises slower but more continuous progress. We’ll see. I really need to start running, too. I’ve been sticking with the elliptical machine, but need to start jogging, and / or hill sprinting. I take a moment here to review an old post… yep, I’ve been progressing pretty well! It’s hard to find the time to exercise, but it really does improve the quality of my daily life.

Venison: I harvested a young deer a few weeks back. It was important for me to do everything by myself the first time, so I butchered it myself in the garage. It ended up taking about 5 hours to cut up all the muscles. My wife and I have prepared it in a number of ways, and they have been absolutely delicious. Some of the awesome things we’ve tried: butterflied backstrap chops, breaded with sage and black pepper, and fried in butter, a wonderful venison roast with yellow potatoes, onions, and carrots, venison burgers (do you know the different kinds of fatback and salt pork available? I didn’t), and venison breakfast sausage (hot pepper and sage, my recipe needs work but still amazing). There’s a recipe I ran across the other day I want to try, compliments of the Girl’s Guide to Guns and Butter: Venison Stew. Yum! The take away here, is that any reservations I had about the possible gaminess or strangeness of venison has been eradicated. It truly is a delicious, nutritious meat, and I take supreme satisfaction at having taken part in this fascinating and rewarding human endeavor. Get out there and hunt!

 

The Hunt

Those That Came Before

I awake before dawn to the sound of Les’s voice “Time to get up, Shane”. I sit up, stretch, and think it would be nice to go back to sleep, it is too early to get up, that I can get a little more rest. But not today, for today is the day of my first deer hunt. I roll out of bed and start putting on clothes. Its about 40 degrees outside. A polypropylene undershirt. A long sleeved polyester shirt. Polypropylene pants. Camo pants and coat. Wool hat. Wool blend socks. Heavy insulated boots.

I eat a peanut butter sandwich, a banana, and a couple of caffeine pills because there is no coffee, and if there was I wouldn’t drink it because it would make me pee. A couple of sips of water, void bowels and bladder.

I take inventory at least three times: muzzleloading rifle, charged with powder and bullet, but no primer. Backpack containing: paracord, toilet paper, large knife, small knife, 2 apples, granola bar, 2 bottles water, 1 empty bottle for pee. Reloading kit: primers, bullets, sabots, powder, extractors, cleaning jag, patches. Safety harness, shooting glasses, cushion for sitting. I put on my orange vest and orange hat, and put my LED headlamp on. I’m ready.

I climb on the back of the ATV behind Les and we motor away. It’s a 5 minute ride to the path for the ridge I’ll be hunting. It is completely dark and the moon has set, though the stars are out. The cold wind blows in my face as he drives down the dirt road. We arrive at the dark path and Les asks me, Are you ready? I say I am. He leaves me there in the dark, among 60,000 acres of wilderness. It is DARK. There is low hanging fog. I take ten steps and stop, because I am afraid of getting lost. I look at the stars and try and make my bearings. Things that were clear in the daytime when we scouted are completely different in the pitch dark, wet woods. I take a few more steps down the crude path and it disappears. I find myself going downhill over a fallen tree and know I am going the wrong way. I backtrack, change direction, and soon after am headed uphill towards my tree stand. I almost pass it, my headlamp the only illumination, but I barely spot the ladder a few yards off the trail.

It is still completely dark when I carefully climb the wet rungs to sit on a flimsy metal platform 15 feet above the ground. The wind is blowing lightly and it is cold. I tie my safety harness on the tree, remove my backpack and tie it to the stand so it is out of the way, and sit, gripping my rifle tightly. I prime the muzzleloader with a percussion cap, and am ready. The sky in front of me is beginning to lighten very slightly. It is very quiet, and beautiful. I am not religious, but I begin to pray, should I take a shot and hit a deer, that the animal will die quickly, without pain.

Coming of the Dawn

The sky begins to lighten and the forest comes alive. The feeling of being on a hunt is singular and strange. I am happy and familiar with the woods, but not so much the dawn as the forest begins to awaken. The trees drip. Every sound is amplified. My mind is highly focused, and all thoughts leave me save the hunter instinct. Is that a deer? No. Is that a deer? No. Is that a deer? A woodpecker. A fox squirrel. A finch. Falling leaves. Dewdrops and mist fall from the trees. It is absolutely beautiful. Dawn slowly breaks, and my mind holds few thoughts, save the alertness of the hunt. I slowly turn my head from side to side, very slowly, looking for movement.

I turn my head to my right and spot movement. IT IS A DEER. IT IS ABOUT TO WALK BEHIND MY STAND. IT IS A BUCK. My heart rate instantly doubles and jumps into my throat. I slowly stand as it walks behind some cover, passing from my left to my right, behind the stand. I get tangled up in my safety harness, it’s only about 6 feet long and it’s now wrapped around me. I cant get a good shot so I turn around slowly to free the safety strap. The deer has stopped, I can only see the back half of the creature, but not where I want to hit it. I move to the other side of the tree, preparing a good shooting position for when it moves on. I’ve lost the deer. Did it hear me? Did it see me? I wait a minute, then another… no movement. I still don’t see it. I shift my left foot slightly, and the deer bounds away down the hill. I’ve lost it, I’m a little sad I didn’t take a quicker shot, but also happy that I didn’t take a bad one, and wound it.

Hours pass, quicker than I would have imagined. I am cold, but focused, and ready. My legs are stiff, I occasionally stretch them, slowly, very slowly. The sun rises and it remains cold, even colder because I haven’t moved in hours. It’s about 9:30 in the morning. I begin to get impatient, and second guess myself, that I wasn’t faster, more alert, more careful with the deer, and wonder if I will see another. I eat an apple, take out my empty bottle, and stand to carefully pee into it to avoid leaving scent around the stand.

As I’m closing the bottle and setting it down… I see another deer out of the corner of my eye, this one in front of me, walking from the left, and it will pass in front of the stand. I slowly sit and grab my rifle. The deer senses me, stops, and looks at me, and I freeze. It turns away and takes another two steps. I cock the hammer of the muzzleloader, and it turns again to look at me. I freeze again. It moves another two steps, looking away, and I bring the rifle to my shoulder, bracing against the rail of the stand. The deer is still walking and will soon move past me. It is directly below me, about twenty five yards away. I know I will not miss. I click my tongue, it stops and turns to look at me again, into my eyes. I fire.

The sound of my rifle is the last thing the creature hears. My shot hits several inches high, and severs the creature’s spine, just above its right shoulder. It drops instantly, twitches twice, and dies. The image of its passing will be burned in my mind, until I too pass on to my own death.

The Reaping

I burst into tears, and sob for about 5 minutes. I am ashamed to feel this way, a fully grown man, but I am very sad to have killed it. In writing this now, my eyes still mist over. It is the first creature larger than a wasp I have ever voluntarily killed. It was a beautiful forest animal, wild and free, and now it lays dead on the floor of its former home. I feel terrible, and think I will be a vegetarian. I am a compassionate man, and while I thought it would be powerful, I had no idea it would feel like this. I send a text message to my wife through tear-blurred eyes, and begin reloading my rifle as I wait to descend the stand.

Steve shows up, and as I’ve heard him approaching on his four wheeler, I have time to compose myself and dry my face so he won’t notice I’ve been crying. He whistles, I whistle in return, and start to feel a little better. I descend, and find it is a three point buck, perhaps 2 years old. We carry the animal out into a clear field, and gut it. This is strangely fascinating to me. That is the creature’s heart. That is its liver. That’s the lungs. That’s the stomach. I ask, apparently thats a spleen. The colon. I wish I was doing this part myself, but don’t. There is a great deal of blood.

Later I skin and butcher the animal myself, with a lot of direction and instruction from the others. This is the tenderloin. This is the backstrap. This is the fore and hindquarters. There is a lot of wasted meat on the carcass, I am told it is not edible… the neck, the ribs, scraps that I have missed in my inept butchery. I suppose it would depend on how hungry you are, but we throw much of it away, leaving it for the coyotes and buzzards that are plentiful around here.

That night we eat the tenderloin, marinated and grilled. It is among the most tender, most delicious meat I have ever eaten, as good as the finest most expensive and best cuts of grain-fed steak I have ever seen. I’m not absolutely certain it was worth killing to get it.

I was 37 when I killed and ate my first deer.

Electronics Introduction!

I used to play around some with electronics as a kid, generally to blow stuff up or light things on fire. In college I began to concentrate on software, and eventually picked up a Computer Science degree. Computer Science is more or less about abstraction, about algorithms, about the mathematical underpinnings that describe and transform information. I had very little formal instruction in physical circuits, only the basics of transistors and combining them into logic gates, then combining gates to build math functions like adders, shifters, and so forth.

Many children had electronics laboratories when they were growing up, wire terminals together with bells, lights, buzzers, etc to learn the basics of circuits. I never had any of this stuff, and when I was a kid the Internet was just beginning.

Some time ago I read an article on Reddit talking about electronics laboratory kits, and how many of the readers there had launched computer engineering careers through experimentation and hackery. I thought this sounded cool. I’ve also become more interested in synthesizers through my explorations in music, particularly analog circuits and their digital representations. Things like waveforms, filters, amplifiers, and the like. I also recently joined a local Hacker Space, to find others interested in this sort of geekery, and there are several nerds-in-residence there with considerable electronics experience.

Die Arduino Blinkenlights

Some weeks back I purchased an Arduino experimentation kit. An Arduino is kind of like a combination of old school electronics with microcontrollers and C code. Basically you can program electronic switching through the Arduino and do all sorts of cool stuff. I finished the basic experiments included with the kit, and decided to go a little further. I bought some components to try and wire up some custom circuits. I got a big breadboard, an adjustable power supply, and several resistors, capacitors, LEDs, switches, relays, potentiometers, etc etc etc, along with some soldering tools. This is a picture of what my newest hobby is doing to my workspace.

My Cluttered Workspace

Electronics experimentation usually requires a power source, which I didn’t have so I bought a universal regulated AC power adapter that switches between 3.5 and 12 volts at 1 amp. My first brilliant move with my brand new switching regulated power supply was to try and create some test leads by chopping the DC wires headed to the barrel connectors and splicing them into some test leads, so I could screw these down on my breadboard and have adjustable voltage for experiments. Unfortunately I spent 2 hours fiddling with it and basically failed due to the construction of the wires, so either I fried my 12$ power supply or I just haven’t figured it out yet.

Approximately 16 unregulated volts output

Plan B was to scavenge existing junk. I found an old ’12 volt’, 1 amp power supply in a box full of cruft at my house. Problem is, it was actually outputting 16 volts instead of 12 volts! So I created my very own custom circuit, my first design (a voltage divider, useful but trivial). As you can see, my cat Gus was very excited to help me.

I’m sure this process would be laughable to anyone who’s not a beginner, but it was basically 1: figure out desired current and voltage for my test LED (12 volts, 20 mA). 2: Design voltage divider. I knew I had to go from 16 volts to 12 volts, so thats a 25% drop. 3: choose resistors. I picked out a 220 ohm resistor and a 820 resistor to meet my design constraints.

Successful 12 volt divider

IT WORKED! I felt like a gosh darned genius. It’s good to have the occasional success among the failures!