Wednesday, May 30, 2012

TwitterMatrixTicker Dot Matrix Tweet Printer

 At the beginning of this month, at the Silicon Valley Flea Market, I managed to pick up an old Star NP-10 dot matrix printer in relatively good shape for $5.  Due to other circumstances, I've also found myself in possession of just shy of two cases of tractor feed paper.  I figured I would need to find a reasonable application for these two wonderful events.
Demo Video:
 I present... the TwitterMatrixTicker!  I currently have it configured to watch for any tweets mentioning me (@KWF), and then having it print each tweet line by line on this great piece of printer history, so feel free to send me tweets and enjoy the thought of them interrupting my evening as they print out on this ridiculous loud monstrosity.
The hardware is relatively straight forward; a BeagleBone (Thanks to TI for giving me one for free!) uses Twitter's API to search for @KWF tweets, then parses out the usernames and text and sends it to the Star NP-10 over a USB-to-Centronics adapter.  I would love to have set up a webcam live-streaming the twitter stream streaming onto my floor, but I'm afraid that local bandwidth limitations make that prohibitive.

I currently have it just printing flat ASCII, but these printers can usually do quick a bit of formatting on their own.  I haven't been able to find a manual for this specific printer, but the Epson FX-80 manual should give you a good idea of the method; while printing text, send "ESCape,command-code" sequences in-line to place the printer into different modes (bold, wide font, underline, higher resolution).  The higher resolution, or "Near Letter Quality" mode is a good one to know, because dot matrix printers literally print via an array of metal pins striking a ribbon to the paper.  After a single pass, the font is... "dotty," and doesn't look very good.  By putting the printer into NLQ mode, it takes a second printing pass slightly off-set from the first, to try and smooth out the final result.
This was all printed in NLQ mode.  Considering that this printer is decades old, and that I didn't have to replace the ink cartridge in it (other than rolling out the next foot of ribbon), I have to say I'm quite impressed with this printer.  Modern printers really are terrible...

Like always, I give you the source code for the shell script I wrote for this:

Just change the user name on the first line, the output file to your printer device, and the timing limits if you want to pound Twitter more often than every 15 minutes, which I have it set up for.  This would probably lend itself well as a cron script, but I felt like writing it as a busy loop to make the dynamic API request intervals easier.

An Amazing Deal on 1000bSX Gigabit NICs

When most people think of Ethernet, they automatically think of the four twisted pair Cat5E or Cat6 cords that have become the ubiquitous solution to hard-wire networking.  For consumers, this is perfectly fine; baseT Ethernet cable is cheap, flexible, and at an effective length of 100m easily serves any of your modern household networking needs.
Of course, there are other variants of Ethernet.  One of these is Gigabit baseSX fiber Ethernet.  Yeah, fiber, like fiber optic cables.  SX Ethernet is a half-duplex optical protocol, meaning you need two optical fibers, but those fibers let you make a single Ethernet run on the order of 200-550 meters (which of course you can push even farther in a pinch, with luck), which make it a useful physical layer to link larger multi-building Ethernet deployments.  Of course, like all high-end computer equipment not bought by the consumer, fiber kit is typically put well outside the price range of an individual, let alone a college student such as myself.  This is where living in the South Bay and having access to surplus electronics stores like Weird Stuff is awesome.  I was recently spending a leisurely Friday afternoon digging through their $3 NIC box (as an engineer does in the Silicon Valley), when I happened upon this:
Kind of a screwy NIC... It took some deep puzzling before I finally figured it out; a fiber optic NIC, and a 64 bit PCI bus.  Most PCI cards that you see only have the first three banks of contacts you see on the left.  I had never seen the fourth bank of contacts before, but realized that I had finally managed to find an example of 64 bit PCI in the wild.  64 bit PCI was a short-lived extension to the typical 32 bit PCI before PCIe finally arrived and solved the peripheral bandwidth issues felt by PCI.  (PCIe did this, instead of widening the 32 bit parallel data bus of PCI to 64 bits, by replacing the single (slow) 32 bit bus with one or more very fast serial buses; this is why PCIe cards are so much smaller than PCI, and come in 1x, 4x, 8x, 16x variants. It refers to how many serial lanes are running, ironically, in parallel to that card).

 Of course, like all several-hundred-dollar pieces of equipment to be had at Weird Stuff for $3 "as-is," these did have some minor electrical issues.  One of the boards had some rather unhappy looking QFP pins, and the second was missing an isolation capacitor running from the transceiver back to the chip set.  A little tender love and care with a soldering iron and a sharp blade puts these back to right, and a $5 25' SC fiber cable put me in the exclusive "my LAN has a fiber link in it" club.

Granted, none of my computers have 64 bit PCI, so these great Gigabit NICs only get something more like 250Mb, but, should the day ever come that I need to for some reason have a decent-speed Ethernet link spanning more than 100 meters, I'm ready to go.  Are you?

While digging around for a few of these NICs in good shape, I found something on the order of nine of them.  If you're in the south bay area, and badly want or need to have a heterogeneous physical network layer, you stand a good chance of going in there and finding the rest, that I left in a neat little stack in one of the NIC boxes.

Sunday, May 27, 2012

Don't Panic - A Panic Button Light Switch

As is usual after a south bay salvage crawl, I've been cranking out the projects this week.  This one was a find at Halted; 600V panic buttons on sale for $4.95. I didn't need much deliberation on the matter of buying one...
Panic buttons are typically used in industrial shop settings for when you see an immediate safety hazard.  Slamming the button turns off power, and to reset it simply requires twisting it per the helpful arrows. 
Of course, I lack a shop of my own (yet), but this seemed like a perfectly reasonable replacement for my current bedroom light switch.  In case you're wondering, yes, that is in fact glow-in-the-dark tape outlining my light switch. I actually tactically placed several pieces of it about the house back in my tape days.
So, $4 and change for a panic button, and $2 for a metal blank gang plate.  Getting a metal one is important because, as I've painfully learned before, the plastic ones are surprisingly brittle.
On the back of the plate, I scribed from corner to corner to find the center, and center punched it.
Drilling the hole for the button does take a couple steps.  The shank of the button measures to be 0.8400", in case you manage to snag the same one.
Cruel fate would have it that our 20 year old no-name metal drill set happens to have a mis-pull in it; no 13/16" drill (which is the ONE size I needed) and two 3/4".
As the old machinist's parable goes, "it's easier to take more off later than to try and put some back on."  I under-drilled the hole, then spent some quality time with the face plate, a cylindrical file, the button's shank, and the burning desire for the end result it takes to spend that much time carefully filing sheet metal to size.

Dis-assembly Video:


Getting the button apart isn't what I would call particularly tricky, but is actually simpler than I expected, which got me in quite a bit of trouble.
 So for an hour of puttering around the house and a few bucks, I now have what is possibly the most satisfying light switch on the block.  I probably should also take this moment to crack some joke about the advantages here, considering my tendency to panic when I have girls over, but we should all know by now that I am suaver than that.

Demo video:


There has been some concern about this doing damage to the wall.  I certainly would only want to install this in a "new-construction" gang box, and not one of the floating "old-work" ones that aren't nailed directly to a stud.  I'd also tend not to get overzealous about using it, but that's true for most things in life.

MSP430G2 Value Series Third Generation

This is a little embarrassing since I do so much with Texas Instrument's kit, and even more so because I've been *using* these chips for some time now, but I just realized today that TI had finally released their third generation of their MSP430G2 value series.

The MSP430G2 series is TI's lowest cost line of MSP430 microcontrollers, which make them particularly attractive when both cost and power are important to you.  Two years ago when they first announced the value series (and the $4.30 Launchpad to go with them), they only had the MSP430G2xx1 chips available, which topped out at a paltry 128 bytes RAM / 2kB Flash / 14 pin DIP, but those came with the promise of three more generations of MSP430G2 chips with progressively more horsepower and hardware peripherals.  A year later, the MSP430G2xx2 line came out, raising the high water mark to the more comfortable 256B/8kB/DIP20 package that meant you could start doing projects more involved that simple thermostats or desk clocks out of it.

The third generation (MSP430G2xx3) has apparently been out for some time now, and I either happened to be under a rock that week, or the MSP430 community didn't get nearly as breathlessly excited about it as they did the MSP430G2xx2 line.  This pushes the G2 value series up to 512B/16kB of program space, and you can get three complete eight bit I/O ports if you're willing to finally admit the inevitability of surface mount ICs.  16kB of flash memory opens a LOT of doors for this nice little chip.  I've been cooking some projects targeting the MSP430F series, but I might be able to stick to these little bad boys now.

Just wanted to give y'all a heads up that these are available-ish.  As of right now, Digikey seems to be in their typical mediocre form as far as having new MSP430s in stock, but they'll catch up eventually, and TI of course has an outstanding sampling program.

Friday, May 25, 2012

First Experiments with Pulse Reconditioning

During my south bay salvage crawl on Friday before Maker Faire, I managed to score a good deal on D cell sealed lead acid batteries. These are interesting because the only way that you usually see lead acid batteries is the "flooded" ones in your car, where the cells have caps on the top and you can actually open them and interact with each cell's internal chemistry.  Flooded cells are great for installations such as cars, UPSes, etc, but are useless for more dynamic projects for lack of my interest in dumping sulfuric acid all over myself (fun fact: I've actually done this before).
Seriously; a REALLY good deal.  I got 100 cells for literally nothing more than a song and having to haul them away. These came as 48V packs originally used in telecom UPS for phone systems; these are why you always want a wired phone on your phone line (for what few of us even have those any more), since phones don't fail when your power goes out.  But, like most good deals to be had on salvage crawls, this one came with a little hitch; these batteries are dead.  Dead-dead.  Not the 10.5V won't start your car dead, but 30mV per cell, cold-death, sitting on a shelf for decades, chemically inert dead.

The party line when you run into lead acid batteries in this state is "they're dead; put them down and walk away,"  Of course, being a college student, I find myself time-rich and cash-poor, so trying to bring these cells back to life and identifying which ones are beyond saving is nothing more than a challenge.  I've previously participated in trying to restore much larger flooded lead acid batteries (each cell larger than a breadbox), but I figured these D cells may be more apt for personal exploration in the subject, since they lack the ability to be used to arc weld with.  I've got a line on a set of standard traction batteries in about the same shape as well, so if this project seems successful, I will eventually be able to move up in scale.




Now let's take a moment to talk about lead-acid battery chemistry.  Wikipedia does a wonderful job of explaining the whole process, but it primarily comes down to this: given two plates of lead (one of elemental lead, the other of lead dioxide PbO2) in a bath of sulfuric acid (H2SO4), the sulfate ion bonds with the elemental lead, releasing electrons into the metal plate and protons into the acid bath in exchange for becoming PbSO4.  Wandering over to the other plate, PbO2 pulls electrons from inside the plate, and trades another sulfate ion from the acid bath for its oxygens.  This forms even more PbSO4 on this second plate, and generates water between the oxygen and loose protons.  The fact that this chemical reaction punts electrons from plate to plate is why we find it so useful, in exchange for converting both plates into lead sulfate and the sulfuric acid into plain water, which also provides an easy way to measure the charge state of the cell via the state of sulfuric acid to water transition (about a 20% density change).

In the ideal world, recharging the battery is the complete opposite; drive electrons backwards from plate to plate, cause sulfate to migrate back into the water, and break apart water back into acidic protons and PbO2.  Hopefully by this point in your life, me pointing out that the world is far from an ideal place isn't a particularly contentious issue.  This concept works well as long as the battery is only kind-of discharged, but starts to fall apart as soon as you're talking about very dead cells.  Let the battery go too dead, and the lead plates will consume all of the sulfuric acid, and the PbSO4 will become very strongly bonded.  Come back too late with your offer to trade the sulfate a lousy proton for his lead, and he might actually turn down the offer.  Suddenly, you've got players not willing to participate in the game anymore, and your battery starts to look like it's a hockey team with some anger issues and half the team sitting in the box.

Not only does the total battery capacity go down, but the internal resistance of the cell goes up.  Typical lead acid cells have internal resistances measured in the milliohms.  Let them discharge too far and that figure will start creeping up into the ohms range.  Taking one string of these D cells at random, I measured an internal resistance in the hundreds of ohms, so these are irrefutably dead.



Than again, just because this lead sulfate doesn't want to participate doesn't mean I can't try and use some force to try and coerce them.  Higher charging voltages applied to the cells will more forcefully drive sulfate back into the electrolyte, making them available again for storing energy.  The problem is that apply a higher voltage means applying more power to the cell.  Apply too much power to a flooded cell, and you'll start to electrically break down water into gaseous hydrogen and oxygen, causing an explosion hazard (which is why you need to make your fourth connection away from the battery when jumping your car; sparks + H2 + O2 make for an exciting evening).  Apply too much power to a sealed cell like these, and being unable to vent the gas, they build up in pressure, before first rupturing, then likely also exploding, causing death, destruction, etc etc.

In any case, applying this excessive power doesn't seem to be the way to go.  If only there was some way to apply a higher voltage without apply more power to the lead acid cell...
Well now would you look at that... Scale settings are 0.5us per horizontal division, and 5V per vertical division, so you can see the cell sitting at ~11V, drop down to ~0V, then get kicked back with ~40V for a very short (~100ns) time.  Suddenly, we've got the much higher voltage we need to break apart very comfortable PbSO4, without the excruciating explosion and death problem caused by excessive power.  Clever trick, but I'm not as quick as I used to be, so trying to manually apply 100ns pulses to these batteries would be error prone, and frankly, incredibly boring.
Enter the timeless 555 oscillator and an inductive charge pump, found online here. The 555 quickly switches on and off a high power MOSFET, which causes current to flow through the large inductors before turning them off so fast that the current turns into a large voltage spike, which is fed back into the battery through a high current diode.
Granted, I built mine from what I happened to have on hand, so some of the component values aren't particularly optimal, but for a first trial it's showing some promising results.
Running a string of six of these D cells over night with this pulse conditioner, the internal resistance of the string went from about 500 ohms down to ~15, and the current drawn from a 12V source went from 50mA to 0.3A.  Granted, some of those results are from simply charging the cells at all, but initial qualitative observation has me thinking this helps, and once I finish purchasing a real lab power supply this coming week,  I'll be able to make more quantitative comparison between sets of strings, since I have 14 more 12V sets I haven't even touched yet.

In all honesty, pulse conditioning sealed lead acid cells isn't entirely kosher, so don't take my experiments here as much prudent.  I spent a very long time considering exactly how hard I was abusing these cells before I was willing to run it unsupervised, and unsupervised they will need to run; pulse reconditioning is a process measured in a timespan of weeks for typical cells.

Thursday, May 24, 2012

More Maker Faire Post-Op

As you could probably tell, I didn't even try and capture the scope of what goes on at Maker Faire, but Dangerous Prototypes has been doing an amazing job of capturing it for those of you not fortunate enough to make it.

Maker Faire How-To Video:

I even made it in their How-To video.  My segment starts around 3:00, and I gave them all the MSP430 kit at the end in the hopes that they finally building something not using a PIC. :-P

Tuesday, May 22, 2012

Maker Faire Bay Area 2012

I just spent a simply unbelievable weekend gallivanting around the peninsula with a multitude of my Internet friends, for Maker Faire and the pleasure of being surrounded by incredibly smart and creative individuals.

I didn't even bother trying to take good pictures of the whole affair, because pictures and video just never seem to capture the tremendous scale and energy of the entire place.  I did snap some quick iPod photos, but simply because by the end of four days (!) I knew I wasn't going to remember half the places I went or saw, or people I met.



 Maker Faire for me started Thursday afternoon, when I caught a ride to San Fransisco with Jaren Havell.  He, Chris Gammell, and Jeff Keyzer rented a house in Berlingame, so I came as their fourth. Saving me from the 30 minute drive from the south bay was surprisingly helpful by the end of the weekend; I'm not sure I would have been able to get myself out of bed Sunday morning without my ride having to be there on time.
Jaren and I drove into San Fransisco for Dangerous Prototype's San Fran taco crawl.  Ian had us all meet in the Mission district, and we promptly made our way from taco stand to taco stand.  The tacos were amazing.
The first of the two priceless moments this weekend was Ian over-hearing me introduce myself to someone else in the group, make a double-take, and exclaim "Wait, are you THE Kenneth Finnegan?!?" He was very excited to finally meet one of his "premier free PCB builders," and we had a good time talking about the challenges of SMT kits and about off-loading a few product ideas I've had onto DP's fulfillment chain.



Friday started out with my salvage crawl, where everyone met at Halted at 10:30AM and we made the rounds of the south bay electronics stores.  Attendance wasn't nearly as impressive as Ian's crawl, but we ended up with a reasonably-sized group.

I didn't take any particularly interesting pictures, since I can guarantee you that you can walk into Halted, Weird Stuff, or HRO any time you like and they'll still look pretty much the same.  I came back from the trip with a few connectors and fuses I need, a pair of databooks I'll find useful, a $25 kiosk computer (with decent legs; P4 3.4GHz Cedar Mill with 1GB of DDR2 RAM), and ~100 D cell sealed lead-acid batteries.
We of course had lunch at St John's.  My burger was just as satisfying as I hoped, for the end of an outstanding day buying e-waste.
 After the salvage crawl, it was off to the San Mateo fair grounds for everyone else to set up their booths.  I wasn't officially signed up for any booths this year, but managed to sneak in long enough to find some people I knew at Texas Instruments.  They were having some mechanical issues with their booth, so I ran to the nearest phone booth, changed into my "Mechancial Engineering Man" cap, horse-traded with Radio Shack for a toolbox, and managed to get all of TI's defective booth props put back together in time for Saturday morning.



Saturday morning found us at the fair grounds bright and early.  Even an hour before the 10AM gates opening, at 9AM there was already cars and people lined up around the block to get in.  I checked in at TI's booth and helped them artistically stack Launchpads, but found myself with a spare 30 minutes before 10AM.  All of the makers were mulling around checking out each others booths, since this was going to be the only respite they'd have before two full days of desperately trying to keep their booths running.
I used this chance to sneak into the Exploratorium booth, and had a once in a lifetime chance to play with the spinning table exhibit for a glorious 20 minutes of spinning harmonics without any small children forging paths of disc destruction through my experiments.  Priceless experience number two.  Once the gates opened, the crowds started to become difficult to navigate almost immediately.  It's amazing how much of Maker Faire you can cover from 9:40AM-10AM when you can move between booths at a dead sprint.

I ran into Thomas Wilson, one of my friends from the UCD MechE dept, pretty early on in the day, so being able to spend the morning with a second person to pivot the crowds off of made the day much more enjoyable.  This was his first MF, so to have someone there to drag him around until 2PM to give him a birds-eye view of what to go back and spend more time at was hopefully helpful for him.
I ran into my best friend's parents Saturday during lunch, in addition to countless other people I knew either locally or from online.  I can't express how much I enjoyed meeting all of you in person who came by and said hello.
By 2PM, the crowds were getting even nuttier than before, and I had finished a satisfying first-pass through the Faire, so I decided to go back and drop by the TI booths and see how they were doing.
 They were very happy to see another face willing to help them go toe-to-toe with an endless swarm of people wanting to hear about Texas Instrument's microcontroller platforms.  Since they had been nice enough to get me a sponsor's badge, it was the least I could do.
Larissa from TI and I have been emailing back and forth for some time now, so it was nice to finally put a face to one of my industry contacts.  Adrian (of Launchpad unboxing video fame) and Gerard from 43oh were also there.



Sunday was more of the same.  I took advantage of the first few hours of thin crowds to cover some more of MF, including a needle felting booth making some very adorable felt dolls.
Needle felting is where you take a barbed needle and colored wool, and use the needle to tangle the fibers to make the more solid felt texture you typically only see in flat sheets from the craft store.  I thought it was very clever that they used soft brushes as a work surface for the felting.
 
 I ran into countless makers I knew personally throughout the weekend, both those local to the bay area and those from all over the world; for how wide spread we are, makers really are an incredibly tight-knit community.  Evil Mad Scientist Labs was there again with their amazing Digi-Comp pool ball ALU.  Watching kids get excited about adding two numbers together was pretty precious.
I won't even try and list either everyone I met or everyone I tried to find and missed; both lists are tremendous.  I did think it particularly unfortunate than I spent more than half of MF working the TI booth, and STILL didn't manage to meet Matt Richardson, of Beaglebone-powered Descriptive Camera fame, in person.  I even tried to describe pictures before the MF network went into total congestive collapse (Internet inside the fair lasted all of about 45 minutes Saturday morning before going down for the rest of the weekend).

While packing up the TI booth Sunday night before Jeri's Hacker Meetup, there was the entertaining distraction of the solar eclipse, so Larissa and I went outside to watch it.  The Exploratorium was handing out shaded glasses, and several people had brought viewers, but for the sake of avoiding the crowds we managed to jury-rig a surprisingly effective viewer using a business card and my Leatherman Micra. Thanks to her for the picture.



To wrap up this very long weekend, Jeri had us all take over Harry's Hofbrau, which was pretty entertaining.  You put 100 makers in pretty much any public institution and silliness will commence.  Sylvia and Ben's meta photo repeating last year was but one of the multitude of stunts being pulled that evening.
Jaren and I finally woke up Monday around 11AM, and after enjoying breakfast at an adorable cafe in downtown Burlingame, we decided to finally actually spend some time in the BnB that we rented for the weekend, so we spent the afternoon writing an Arduino library for the TMP421 chip.

Over-all, this weekend was AWESOME.  Many other blogs actually made an effort of trying to capture the sheer volume of creativity flying around (example), so I urge you to go read them as well, but if you're not already penciling out the weekends for May, 2013, you better get on it!  Maker Faire is amazing, and easily worth the trip from WHEREVER you happen to be in the world.



A few post-op pointers in no particular order:
  • If you show up on time, you're late.  With how fast the crowds grow at MF, being there 30 minute early to be towards the front of the line lets you get done in the first hour what would take all afternoon.
  • Bring business cards.  Ian made of point of telling booths to bring hundreds of cards.  I didn't appreciate that the same is true even when you're not in a booth.  I grabbed an inch of business cards on my way out the door, and effectively ran out half way through Sunday.  Get a whole box printed just for MF.
  • Take breaks.  MF is an overwhelming experience, and if you don't pace yourself, come 1:30PM you won't be having a good time.  Bring water and fruit, and don't wait until you're starving to eat or exhausted to sit down.  
  • If it's your first time, you can easily spend all of both days working your way through booths, and you'll still miss stuff.  MF isn't your average conference.  The coolest and most interesting stuff will be squirreled away in the least expected places.  Don't even limit yourself to the booths; attendees probably bring as much stuff to show off as the booths, so don't ignore the giant swarm of people as you wade your way through it.

Thursday, May 17, 2012

My Summer Internship at Above The Play

Remember how, two months ago, I was champing at the bit to be done with school and planned to spend the spring and summer giving all of you my undivided attention cranking out projects and blog posts to go with them?  You may be wondering why that only lasted all of three weeks before I fell off the face of the Earth again.  Turns out, having a blog is a remarkably powerful way to get yourself employed (see: Valve hiring half of the EE blogosphere this year).  I didn't land myself a job at Valve like all the cool people, but instead have been hired by a company based in San Carlos called Above The Play.

I'm looking forward to an interesting summer. Above The Play is a fresh-out-of-the-starting-gates start-up (seriously; I'm employee #2) hoping to develop intelligent video solutions for ice hockey.  We think it's going to be possible to leverage the contemporary explosion in availability of computing power and networked video equipment to build a powerful computer vision system to track ice hockey players as they move about an ice rink.  Being able to track players throughout an entire hockey game will likely open some interesting doors as to what you could do with this information.
But of course, before we can start building applications using all of this information, we need to build a framework to actually collect the information in the first place.  This is where I come in, terrifyingly enough.  I was set down in front of a MacBook Air with a C compiler and an empty source code repository last week and told "go build a computer vision system." 

GULP.

So we'll see how that goes.  We're managed to get incredible access to an ice rink in Redwood City to develop our prototype in, so if you're in the area, feel free to drop by and wave at the ceiling-mounted cameras as you become part of my training data while you skate.  At this point, I'm only at the ice rink from midnight to 5am, which is the only time we can go out on the ice to run network cables, but once we have the hardware installed and basic software working, that will probably change, and it's likely my boss will make a concerted effort this summer to get me into ice hockey.

Strangely enough, the fact that I worked at another computer vision company last year didn't have anything to do with precipitating this; goes to show how little my career plans amount to.  I also find it entertainingly fitting that the first thing I'm doing with a BS in mechanical engineering is spending a summer coding in C.  I do get to build some mounts for the cameras, but trust me, the feeling you get when applying a college degree to 4" PVC drain pipe with a sawzall is... priceless.

Here's the bright side: my boss understands that I planned to spend the summer teaching all of you... something... so he wants me to try and write about as much of this project as is practical for a company to release online.  We're pushing some interesting limits on this project, so here's to hoping I can find the time and energy to not only write about it, but convince my boss to let me publish it (it's a little sticky writing a contract where both he and the Internet get the IP, when only one of them is giving me money for it).  I'm not too worried; he seems like a pretty cool guy.

Here's the down side: I didn't get this job until after I had already registered for Maker Faire, HOPE, SEMICON, a tour of the Titan Missile Museum, etc., so my summer is ironically now OVER-subscribed.  This job will undoubtedly make for some very interesting blog fodder, but the start-up life may not lend itself well to me juggling other projects much.  They sadly return to their rightful place on the back burner.

So that's what's going on. You may find my twitter feed more entertaining, since I use it to break up the rest of my days spent writing C daemon code, and it's a lot less work than blog posts.  If you're going to any of the same conferences as me this summer, feel free to track me down and say hello; I'd love to meet as many of you in person as I can before school starts again.

Bonus video of Ice Oasis' Zamboni:

And yes, that is in fact four o'clock in the MORNING.  My sleep schedule is already pretty much hosed, and it isn't even June yet.  We're trying to find a good compromise between operating on Pacific time and Hong Kong time.

Thursday, May 3, 2012

Positive Uses for QR Codes

I have been a little busy with my new job this week, so in lieu of any gritty technical content, I want to take the time to give you some food for thought and petition your to really chew on it for awhile.

QR Codes are two dimensional bar codes that allow you to quickly capture significant amounts of data only using the camera on your phone or MP3 player.  Unlike traditional linear bar codes, which usually only have a single checksum digit to verify a good read, QR codes have a significant level (20-70%) of error-correction-coding.  This means it is surprisingly easy to "read" a QR code given most people's expectations based on UPCs.

Once you learn the distinctive three large and one or more small bulls-eyes of QR codes, you will start noticing them everywhere.  They're one of those little things that have crept into modern life without most people even knowing what they are.

Now notice where you see them.  Exclusively on advertisements.  Seriously?  There are a ton of interesting ways that you could apply these, and the best we can come up with is an easier way for advertisers to push stuff on us?

I am the only person I know of who uses QR codes in a meaningful, constructive manner; Wifi.  Every time you show up at a friend's house for the first time, you have to sit them down and start interrogating them about how to get onto the Internet (I don't have an addition, honest).  In my apartment, I have a piece of paper that very clearly says "WIFI - SSID: Finnegan" and has a QR code of the wifi key, so newcomers just need to point their phone at the wall, and Internet.  Super easy, super simple, everyone who has come over and asked what it is thinks it's really clever, and it is totally useless.* 

No one installs QR readers, because no one really wants to take the time to decode advertisements.

Think about how else you could use these.  What games could you build that used these to quickly transfer data between people's phones?  What systems could you make more convenient with these?

How do we use these things in an awesome way that actually makes people want to even know what they are?  Advertisements aren't it.

Food for thought.  Think about it. 

* - I argue that it is still perfectly secure as long as you post these Wifi QR codes deliberately.  I wouldn't post them facing out on my windows, but put someplace discrete, physical access is a prerequisite, and by then your WiFi key really doesn't matter.  And yes, I appreciate the irony that I just said I wouldn't post these facing out my window, but just posted a picture of one on the Internet. Consider why that is.

SSR Switchbox with IEC Powercord

I've written about these in the past, but this is probably the switch box that I am the most happy with.  This is a simple plastic electrical gang box, with a solid state relay inside of it, such that a lowly microcontroller can switch relatively high current 120VAC loads.  I've used these to control all of my apartment's lights, as well as to control a 600W hot plate.  After making a few, I did get kind of tired of each one having a power cord permanently attached, which gets annoying when your storing these between projects.
I decided to convert all my switch boxes to have IEC connectors, which are more commonly known as "Computer cords."  Almost all computers use IEC power cords, but also most benchtop measurement equipment, and a few other random devices.  Using an IEC power cord is nice because it allows you to separate the cord from the device for storage or replacement of either the cord or piece of equipment.
I got some panel mount IEC connectors from Halted with 0.25" spade lugs on them.  These originally have three tongues which are meant to snap in when it is pressed through a properly sized hole, but the gangbox plastic happened to be too thick for them to engage.  Since they couldn't engage, they kept the female IEC connector on the cord from fitting, so I snapped off the tongues, which is why there are three odd windows in the side of the connector.  I used some hot-melt glue as strain relief instead.
Precutting and bending the wires to connect the IEC connector, outlet, and SSR is somewhat of an art form, since trying to adjust anything inside the gang box gets cramped very quickly.
Of course, you should use properly colored and gauged wire when wiring 120VAC equipment, but I somehow ended up with 500' of 16 gauge wire, so I'm using it anywhere I can get away with it.
Hella cramped.  I connected the hot and neutral using the punch-through connectors on the bottom of the outlet gang, but you are free to use the traditional screw terminals on the sides.
And there you have it.  A real quick and easy box to drop into any project where you want to control Christmas lights, a lamp, or a small heater.  The SSR takes about 10mA at anything from 3-32V to switch on.  Although the SSR is rated for 25A, you really don't get to use that much.  Considering the other components I used, I wouldn't push it much above 10A, and as Phil in the comments reminds us, SSRs do dissipate quite a bit of power.  If you go as high as 10A, you only get to pulse the load (like I've done before), so don't hook this up to your space heater and then act shocked (hahaaa) when your junction box literally melts.  If you need to handle more power, find yourself a good heat sink for this bad boy.

Surprisingly cheap, as well:
  • SSR - $6 on eBay
  • IEC connector - $0.90 at Halted
  • Screw terminal (2) - $1 at swap meet.
  • Gang box - $0.60 at Home Depot
  • Outlet gang and face plate - $2 at Home Depot
Repeat after me: "I will not kill myself with 120VAC, and if I do, it isn't Kenneth's fault."