Thursday, April 18, 2019

May I have a word?

I suppose the multi-week gap between project completion and project installation was a chance to check for "drift" on the two DS-3231 real-time clocks (RTCs) that went into "Mark II" of the Office Finches' overhead lighting.  Small mercies 'n all...

For those folks just tuning in, I added a shelf to the corner of their corner of the office a couple summers ago.  The overhang blocks the already-not-abundant natural lighting of a NE-facing window.  The "Mark I" was extremely prototype-y.  Like, 5mm-LEDs-in-breadboards prototype-y.  I wish I were making that up.  (Moral of the story:  Never underestimate the longevity of V1.0.)  The "Mark II"'s design supercedes that at the cost of some duplication, yet with fewer components overall.  What's shown above is mirrored by a twin just 30cm or so to the right.

Anyhoo, Adafruit -- the Great-Grand-Godmother of every winky-blinky cosplay project on the planet, or so it seems -- batched their NeoPixels into a handy ring.  And, to their credit, each of these 12 itty-bitty-winky-blinkies punches well above its weight @18mA a pop.  The office walls are mostly a darker green, so I was initially disappointed in the lighting levels.  But after the (white) table, (white) cages, and (mostly-white) cover-cloth were all back in place, I had nothing to complain about.  And that's just with 24 pixels.

They also massively streamline the design overall:  Base (white) lighting, rotating RGB (to vary the light-spectrum), motion-activated night-lighting, and a top-of-the-hour "disco" light-show to keep an eye on the RTC drift is now handled with just six wires instead of a couple dozen.  So, good job, Adafruit:  I'm sorry I didn't realise that the PixelRings I bought were knock-offs.  I'll know to check next time.

Importantly, this project cemented my affection for the "Boarduino" form-factor -- by which I mean an Arduino project running from an Atmega328P-PU chip plugged into a full- or half-size breadboard.  (You can do the same with smaller chips like the ATTiny 24/25/44/45/84/85 chips, if you're willing to make certain trade-offs in computing power and features.)  The flexibility (from a wiring standpoint) is pretty much unbeatable.

But there's another kind of flexibility I've lost my heart to, and that's just the pure freedom from a particular MCU form-factor.

Don't get me wrong:  For the initial coding/debugging, the full-size UNO is my trusty go-to.  Mainly because, even with ZIF sockets, toggling between the "programmer" breadboard and the actual project breadboard is a PITA.  Also, plugging a Trinket into a baby-breadboard and wiring it up to all the other widgets has the satisfying feel of solving a puzzle. 

That being said, I kind of live in Perpetual Prototype mode with these projects.  (Off the top of my head, I can already think of at least three things I'm smacking myself upside the head for not doing differently -- most notably, using bigger screw-sizes.)  And, when all's said and done, I can.  Everything about this project is generic and re-usable.  Even the PLA 3D-printed offsets used to mount stuff onto the underside of the shelf can be recycled by melting and re-extruding.

Part of me cringes at condemning the waste I see in the name of hands-on technical education.  Yes, learners should feel free to make mistakes, up to and including the dreaded "magic smoke" that is a rite of passage in electronics.  But trashing a new toothbrush to make a bristle-bot that will end up in the ocean as soon as the coin-cell battery wears out (or it ceases to be amusing -- whichever comes first) also makes me grind my heckin' teeth.  Because the unintended lesson taught is obsolescence.  Any child will inevitably pick up that lesson many times over in modern society without any lesson-plan, spank you very much. :~/

The DIY folks I follow seem to delight in passing around upcycling hacks.  E.g. the boy who repurposed a computer fan to charge his phone while bicycling to school.  Or the girl who hacked together a foot-powered washing machine to power through that chore in less time.  Or even the junkyard/repair-shop trade in salvaged parts...the kind of place where you bring your own box and pay in cash (and/or beer).  Love 'em all.  Really, I do.

But I'm talking about something slightly different, something that we in the First World(TM) are typically privileged to do, and that's make stuff with brand-new (or gently used) parts.  Maybe it would help if we had a more generic term than "Boarduino,"  something that encapsulates the ethic of intentional re-use. For now, I'm going to have to roll as a soi-dissant "perpetual prototyper" (in lieu of "maker" or "hacker"), but I'm definitely in the market for something better.  And the nanosecond I find a better badge, I will wear it proudly.  Heck, if it's on-fleek enough, I might even get the tattoo.

Saturday, November 24, 2018

Silly Saturday, 2018.11.24, the Kenny Rogers edition

On a late Sunday evenin',
At a start-up out of runway,
I sat next to The Greybeard,
We were both too tired to weep.
So we took turns a-sighin'
As the errors rolled from Jenkins,
'Til ennui overtook him
And he began to speak.

He said, "Grrl, I've made a life
Out of savin' founders' bacon,
Smellin' trouble brewin'
'Fore the pinks slips start to fly.
By the green hue of your skin-tone,
I can see you called your options
If you'll walk me down the hall-way,
I'll give you some advice."

So we headed to the break-room
And he kicked my butt at foos-ball,
Then opened up the drink-'fridge
And slammed a Mountain Dew.
Then the place got almost quiet
Once we set our phones to "vibrate."
He said, "If you wanna make the rent, grrl,
This is what you got to do."

"You got to know when to ship it,
Know when to slip it,
Know when to refactor,
When to let things stand.
You never work ev'ry weekend
If the CEO's not there, too.
There'll be time enough for workin'
When the Round A lands."

"Now, ev'ry Greybeard knows,
That the secret to the pay-off
Is knowin' that ideas mean jack
When your team can't see them through.
'Cause every app. is Facebook
And every app. is Friendster,
And the best that you can hope for
Is your VCs know it, too."

And when he'd finished speakin'
He ordered up an Uber,
Buffed his LinkedIn resume,
Tossed his work-badge in the trash.
And once at his next start-up,
The Greybeard hit the jackpot.
But in his parting words I'd found
Advice that I could cash.

[Repeat chorus three times]

Saturday, April 21, 2018

How to go from Dunning-Krueger* to Imposter Syndrome in 3 weeks or less

This past February, the (ahem!) "illuminati" of the Moncton User Group had a problem:  No speaker lined up for March.  Now, I had already started a spiel on basic AVR microcontroller programming.  Problem was, it was intended for more of a Makerspace crowd.  Alas, the local Makerspace has been in a lull for awhile now, which left a half-finished outline languishing in a folder alongside a bunch of transition slide images.  But I figured that if I tossed out the hardware-oriented "What is a Circuit?" bits and amped up the code samples, it could be made to a "niche" sort of way.

It's been roughly a year and a half since I stood up in front of my MUG colleagues to bang on about my latest nerdery.  So I knew that I was basically out of shape as a presenter.  Still, I had a bit over three weeks to finish the outline and turn it into slides, but no big deal because it's really only the bare-bones basics, plus I totally know where I'm going with it and, anyway, the Arduino presentation was so long ago that nobody will realise that I'm poaching half the image files and honestly it's not like anyone here will be starting out from scratch with a C-like programming language anyway, right???

Boy howdy, did that beastie hand ever me my head -- more than any other presentation I've given.  It was pretty humbling, even before I was regaling my shower-door with the soundtrack for the slide-deck.  :~/   I half-expected at least one of my coaches/mentors from UWEC Forensics to show up and administer a well-deserved smack upside the head.  A sampling of mistakes:
  • Not verbalising sections as I finished them.  (The first few run-throughs always sound absolutely dreadful; better to break that much dreadful into smaller chunks.)
  • Trying to cram too much into single slides/sections.  The last-minute right-sizing set me back to square one for the most difficult (and crucial) part of the whole thing.
  • The demo. part should have been chucked overboard.  The idea was to pull everything together and mop up the important nitty-gritties that weren't covered by the basic examples.  But even contrived and oversimplified, it was too much for a fatigued group of people, smart as they are.
  • Procrastinating until almost too late on wiring up an actual breadboard with the demo. project and trying to upload my sample code.  Rookie mistakes that egregious on the Friday before a Tuesday presentation is nothing short of speaker malpractice, IMLTHO.
  • Procrastinating until too late for actually timing the whole presentation.  It ran close to 90 minutes end-to-end,  I figure that 75 minutes was pushing the limits of people's patience.  My last minute cuts never actually made it all the way out the door b/c of nerves.  Bad, BAD me.
  • Overconfidence in how quickly I could translate my extremely n00b understanding of a subject into something that could be understood by someone coming into the subject fresh.  (Arduino has made huge inroads into the AVR space for a reason, fam!)
  • And the great-grand-matriarch of all the other mistakes:  Having precisely zero practical experience before volunteering.  Don't get me wrong:  I'm a huge fan of learning by teaching, but this skirted dangerously close to the proverb about the blind leading the lame.
From the standpoints of sound and flow, it wasn't horrible -- that much, at least, can be said without relying on charity.  I learned decades ago how to fake confidence.  Despite the nerves (or maybe because of them), my ex-coaches would certainly have approved of both the volume and variety of hand-gestures and body language.  With, by the bye, no reading directly off slides (the cardinal sin of any presentation).  There were a couple of small stumbles, one slide-transition hiccup -- nothing that fazed me, even in front of my peers (a.k.a. my betters).

But there was a ominous lack of response when I ended every section/subsection with "Any questions about that?"  Uh-oh.  Which tells me that, at best, I bored just over 20 very talented people who have better things to do on a Tuesday night.  At worst, I made them lose whatever interest they might have had in AVR programming.

Cold comfort, I suppose, that I don't crawl out of the rubble entirely empty-handed.  Quite apart part from the obvious perks of thoroughly understanding the material and having a sweet set of references all in one place, nat'cherly.  And an even greater appreciation for everything that the Arduino ecosystem has accomplished. No, my personal takeaway from this three weeks of scrambling is where I need to turn my attention next.  And next.  And next.  And so on.  (Respectively, those "nexts" are Serial I/O, timers, pulse-width modulation, I2C and SPI communication, and then whatever I don't recognise while I'm tripping through all that.)

It goes (almost) without saying that I will certainly leave room in my brain for the lessons (and humility) acquired after  ear-bashing my I/T colleagues.  In another year or two, I'll be back up in front of the room.  And it's not so much a matter of living down this talk as it is living up to the standards set by the other presenters who generously share their time and knowledge (and war-stories) with us. 

- - - - - -

* The Dunning-Krueger Effect is the inability of a newbie to correctly assess her/his abilities in a new area of competence.

Wednesday, February 28, 2018

Revenge of the script-kiddies

This week, I was happy to discover that Digikey has a blog (  Which -- even as an aggregator -- is still a good place to visit every night before I put the tablet to bed.  Except for the rare occasion when the content is engrossing but still kinda nightmare-fuel.  Like the gas pump credit card skimmer "autopsies" cross-posted from Sparkfun's website.

Don't get me wrong:  All hacking post-mortems -- and boy howdy, is this a hack -- are like candy to me.  (For good or ill, I tend to think more like a builder than a breaker.  It's one of those "see how the other half lives" things.)  And a few of fascinating, albeit disturbing, things jumped out at me:
  1. Credit card reading software transmits in clear-text...WHYYYYYY????
  2. The circuit board is being mass-produced.  Granted, etching your own circuit onto a board is fairly low-tech.  (For grinsies, I intend to give that a go myself, 'smatter'a'fact.)  But this is not a homebrew board.  Someone had access to professional production facilities.  Multiple times.
  3. The software was widely available, even before Sparkfun published the .HEX file.  That's evident from the fact that three different PCBs were using the same bytecode.
  4. Based on the small footprint of the compiled code, it's probably safe to assume that the software was written by a seasoned professional...possibly in possession of optimiser software.  (Newbie/Hobby programmers tend to write inefficient code.  And they don't pony up for optimiser add-ons to their IDEs.) 
  5. The head-scratcher is why skinny code was installed on a (comparatively) fat chip.  Did someone port legacy code?  Was someone planning for forward-compatibility?  There are other possible explanations of course, but those I mentioned don't bode well either way.
  6. The person who assembled the final product couldn't be arsed to change the default settings on the Bluetooth module.  Which means that anyone with the inclination (and the software) could roll up to the pump and download your credit card info.  Swell.
  7. At least one of these digital yobs is a crap solderer too ignorant and/or lazy to learn elementary circuitry.
Sadly (though doubtless unsurprising to my Gentle Reader), it's that last part that brasses me off like nothing else.  And that despite having my credit card info. stolen in the last fortnight.  Grrrrrrr.  (Not via a gas pump -- of that I'm certain.  Cold comfort, that.)  Why?  Because these lamers are the hardware equivalent of script kiddies.  [spits]  For tinkerers with enough savvy to know the difference between an HC-05 and and HC-06*, it's frankly embarrassing to know that these hacks (in more than one sense of the term) are running amok. 

Normally I try to be grateful for the incompetent criminals.  But in the case the same lack of will/skill to configure the Bluetooth module for stealth mode allows data to be stolen multiple times.  Senator Warren (D-MA) excepted, the political will to hold even the most egregious negligence to account just doesn't exist in Washington.  The fact that fewer than half of American adults have checked their credit reports in the wake of the Equifax breach demonstrates why.  (Not unlike the folks who won't patch their software, amirite?)

And given the knuckle-dragging, lead-paint-chip-eating, mouth-breathing stupidity to come out of the GOP "leadership" after every mass-murder, you can darned well bet that the completely obvious, logical solution -- a.k.a. mandatory encryption in gas pump credit card readers -- is beyond hope.  Why, that's the kind of red tape that will kill jobs; let the free market sort it out; government shouldn't be picking winners and losers; something-something-something, freedom, apple pie, USA! USA!  [eyeroll]

The worst part is, what with the #cybergrandpas (@Viss's delicious term) currently running the show, I almost hope that there's no interest in the problem.  Because like as not, the "solution" would be to ban the Bluetooth modules.  Seriously, I would not be at all surprised.  See, #cybergrandpas think they understand guns.  They might have even held one at a sportsmans' club photo-op once!  But they know they don't understand electronics.  Which makes geeks who can tell Schottky from Shinola infinitely more terrifying than angry white men mowing down someone else's children by the dozen.

- - - - -

* The Sparkfun article at one point talks about the skimmers using the (older) HC-05, but then talks about the HC-06 (and, at one point, the HC-01, which I'm not convinced is even a real thing).  Psssst!  Hey, Sparkfun:  If you're looking to hire a technical editor who works remotely, call me.  I know a gal.  More than one gal, in fact.  What I'm saying is, you have options here.

Wednesday, January 17, 2018

Do the tools make the maker? Sometimes I wonder...

One of the electronics/computer repair shops in Moncton has been branching out into selling Raspberry Pis, Arduinos, and a whole whack of, ahem!, "accessories" for them.  Business is apparently brisk:  One wall became two, then three.  I alternate between referring to them as "Candyland" and "The Widget-pushers."

So I emailed the Alpha-Widget-Pusher last week to see whether he had a source for the ATMega328P DIP chip I've been having a difficult time tracking least from Canadian suppliers.  And since I'm probably going to be spending some time moving these from breadboard to breadboard, it's a good excuse to find a better chip-puller than the twist-prone cheapie that I picked up from Princess Auto.  So I tacked a request for recommendation onto the email.

The reply was that their Alpha Chip-Puller is mostly using tools made in the 1930s.  For which, mad respect.  Plus a small side of jealousy.  Take care of the tools and the tools will take care of you -- that's one of my tenets, and not just in electronics.

I griped to Dennis about how, after decades of Kanban, TQM, ISO-9001, and every other flavour-of-the-month underfunded QA push, they still "don't make 'em like they used to."  That's something you shouldn't gripe about to a Recovering Manufacturing Engineer(TM).  At least not unless you want an earful about how ISO-9001 only guarantees that your processes are executed as documented.

But he's right.  A CNC machine capable of of 0.001% tolerances can't stop the cheap steel it just milled from warping or cracking in use.  Consistency is not quality...or at least is only a part of it.  In fairness, in some cases consistency is a Very Big Deal(TM).  (Remember Intel's division-error and the resulting freak-out?  Even the one-in-nine-billion odds were too much for everyone.)  But consistency is a hard, easily-measurable metric.  Thus its overweighted role as a surrogate for quality.

True quality, of course, is squishier, less easily shoe-horned into a database or aggregated into a colour-coded chart/graph.  Let's face it; no one picks a tool off the wall at the big-box hardware store or out of a mail-order box and thinks, "My great-grandchild will maybe use this to build __x__ one day."   So I very much doubt that, unless they were hand-made, the manufacturer of those antique tools gave much thought to their whereabouts in 2018.

That's not to say that no one cared about quality.  In the Great Depression, people were more apt to look on non-daily expenditures as "investments," especially tools that would better allow them to mend and "make do" vs. having to buy new.  Double that for the craftsperson putting food on the table.  Print advertisements and radio jingles, doubtless, headlined "quality"* as a major selling-point.

But tracking down product made decades ago and measuring its longevity?  Even scraping and comparing offerings on eBay is nothing any MBA could consider a "metric."  No, the value is solely in the eye of the beholder--specifically, the craftsperson who imagines the spirit of previous generations of craftspeople echoing in their work with the tool in question.

I suppose that some savvy marketer could pitch tools as "future heirlooms."  'S'matter'a'fact, I'm kind of surprised they already haven't.  (And if they already haven't, for the noodley love of the Flying Spaghetti Monster, shhhhhhhhhhh...)  Mind you, any such campaign will be waged by some giga-conglomerate offs-horing its manufacturing while writhing its last in the strangling grip of a Wall Street vampire squid.  But maybe--just maybe--its last gasp will blow on whatever embers remain of the crafts(wo)man ethic.

Melodramatic?  Eh, probably.  But even for someone whose tool-belt can be so very ephemeral--wherever you are, PC-Write, know that I still love you!--it does matter.  Particularly post-Christmas as I stare at a brass-rimmed steel thimble perched on my monitor-stand.  Mom doesn't expect to have the fine motor control necessary for hand-sewing ever again.  So I'm the heiress of a *whack* of embroidery floss and her thimble.  Which turns out to be her Mom's thimble.  It's clearly been stepped-on, and there's a patina of rust on the inside.  Alas, my bone-structure takes after my other, more petite, Grandmother.  But that's nothing a little padding and a skinny rare-earth magnet can't deal with.  And it will be dealt with, and shortly.  Enshrining tools on a shelf is the same as burying them.  I'd like a bit of Grandma to live on, even if only in my crazy projects.

- - - - -

* A sound captured by Mark Knopfler in his dangerously catchy throwback tune "Quality Shoe."  (You, Gentle Reader, have been warned.)

Thursday, December 7, 2017

The limits of affordances

Just because I'm mostly a back-end (read database and business logic) developer doesn't mean that I don't care about UI or UX.  Mom drilled the ethic of putting myself in another person's proverbial shoes into me pretty early-on.

For what I usually do, that plays out in well-organised data-sets, scads and scads of validation code, and fighting tooth-and-nail for the absolute rock-bottom minimum of data passing back and forth between client and server.  Mostly do-able...assuming you aren't double-teamed by Marketing and Legal.  (Pro Tip:  Know your bandwith/hosting costs cold, have your calculator handy, and put the onus squarely on those noseyparker byte-hoovering data-slobs to quantify the ROI.  Preferably in front of upper management.  Chances are, they can't and won't.  And they'll think twice before doing it again.  Alas, twice isn't always enough times.  Lather, rinse, repeat.)

While my world is largely ruled by, well, rules, front-end designers and developers wrestle with the container-of-fuzzy-spaghetti-from-the-back-of-the-fridge otherwise known as the modern human psyche.  More power to them.  I've wrestled heisenbugs a-plenty (losing more than a few rounds, mind you), and still would rather re-fight every single one of those battles than allow a random user to type a DateTime value as plain text.  Seriously. 

Thus I'm a starry-eyed fan of design folks like Don Norman, Mike Monteiro, Erica Hall, and Luke Wroblewski.  (Viktor Papanek's magnum opus has been on my wish-list for years, but it's been out of print for so long.  Some day...)  Also behavioural psychologists like Daniel Ariely and Daniel Kahneman.  Likewise Clay Shirky when it comes to pointing out the differences in how humans act individually vs. in groups (absolutely critical in this connected age).

The single most important take-away from all this reading is:  Thou shalt make it easy for thy user to do The Right Thing(TM).  (In an ideal world, thou shalt make it statistically impossible for thy user to do the wrong thing, but -- Mike Monteiro excepted -- nobody in this crowd is rocking anything like Charlton Heston's beard from The Ten Commandments, so...).

And yet, for all that reading--in most cases multiple readings because it's all crazy-good--I find its limits no farther away than the local co-op grocery store.

Several years ago, I had both the keep-you-on-your-toes challenge and the genuine pleasure (because they shouldn't be mutually-exclusive) of holding down the account for a household-name client.  The kind of client that was flush enough to send holiday gifts to their vendors.  As a matter of corporate policy, I donated gifts like the cheese-knives and cutting-board to the office kitchen.  (Being the Patron Sinner of the office's "liquid potlucks," what else would I do with that kind of thing, I ask you.)

The two shopping bags were another story.  Lovely things, those.  Two sets of handles, for shoulder or hand.  Constructed from the recycled (PET) plastic equivalent of Grade-A Wakandan vibranium, IMLTHO.  (Or adamantium -- take your pick, Marvel fans.)  Crossed with a Tardis to boot.  They're awesome.  Especially when compared to the branded "resusable" bags hawked by the local grocery stores.  Two of which (in our household, at least) have been known to blow their seams in less than a on the very next use.

So I, being a back-end developer aspiring to minimise my UI/UX sins, attempt to do the right thing by making it easy for my user (a.k.a. the cashier) to do the right thing.  Which means the double-decker short cart rather than the monolithic monstrosities with the turning-radius of a battleship.  Heavy stuff on the bottom (because Physics, nat'cherly) and little and/or smooshable stuff on top.

At the checkout line, the first thing dropped onto the conveyor-belt is the bags.  With the awesomer ones unmistakably on top of the not-so-awesome ones.  Then the groceries, carefully graded (front to back on the belt) from heaviest to lightest.  The affordance couldn't be plainer:  Put the stuff closest to you in these-here bags up-top.

Yet, well over 90% of the time (in my observations), the cashier dumps the awesome bags off to the side and loads the flour, the shortening, the canned goods, etc. into the el-cheapo bags and resorts to the industrial-strength bags only when the others have run out.

Why?  Because when it's the difference between the known and the unknown, afforances don't mean jack.  As far as the average customer and cashier are concerned, all branded "reusable" (in my case, the quotation-marks are there for good reason) bags are churned out by the same no-name offshore factory.  (And, for all I know, they are.  Booyah, race-to-the-bottom globalism, yo.)  The default option -- i.e. the ultimate affordance -- is the known quantity.  It's the same reason that the "Save" button still looks like a 3.5" floppy disk and not a USB flash drive or an SD card.  The exact same reason.

Which, while it's frustrating as all get-out, is deeply humbling.  It's why I consider darned near every UI/UX developer on the planet grossly underpaid.  As much as non-programmers puzzle (perhaps shudder) at the inner workings of computers, I embrace them as fundamentally logical -- ultimately knowable.  In contrast, stepping into the world of human-computer interaction means trading the near-certainties of Boolean logic for the fuzzier approximations of statistical norms...clouded by the occasional chaos of lizard-brained mob-thought.  [shudder]

Alas, my patron-client must have custom-ordered the awesome bags, because they have no manufacturer's tag.  (They're a dark olive green, slightly beveled bottoms, two sets of handles -- can ya do a girl a solid here, Intertubes???  Halp.) Or I'd cheerfully solve my weekly problem by ordering a few more.  ("Thou shalt make it impossible for thy user to do the wrong thing," remember???)

The other, cheaper, solution, of course, would be to just tell the cashier to use the weirdo bags.  Except that cashiers are basically just trying to optimise for ringing up as many sales as possible without getting yelled at.  At the risk of sounding ancient, I'm old enough to remember when ringing up sales (and making small-talk about the weather) was all cashiers had to do.  Another person not only bagged your groceries, but also loaded them into numbered tubs so that a third person could help load them into your car (if you so chose).  Contrast that with the utter faceless dickishness of Home Depot, et. al., and their self-checkouts, and you'll understand why I refuse to participate in any further dehumanisation.

Ultimately, computer programming, like any discipline, has to push the boundaries to stay relevant.  In the 1990s, we had the waggish adage of "Intel giveth and Microsoft taketh away."  And while I sometimes wonder whether an on-demand "serverless" world of ginormous anything-goes NoSQL databases and spaghetti-nets of asynchronous-microservices-du-jour will trash back-end coding as a legit. discipline, I have no such worries about UI/UX developers.  Those boundaries, however mystifying to a left-brainer like myself, are vast, but relatively immutable.  But certainly no less challenging for all that. 

Wednesday, November 8, 2017

"Experience is what you get when you were expecting something else."

That was the little bio. tag-line for someone on the Arduino forums.  (I didn't make a note of their handle.  Apologies!)  Granted, if you're trolling through the Arduino forums, you're already feeling that.  But boy howdy, that hit a little too close to home for me.

Backstory:  The chicken coop is almost finished from a structural standpoint.  For monitoring temperature, humidity, and ammonia (NH3) levels, I decided to take the cue from my neighbour and roll with a wifi-based interface vs. Bluetooth/Android. 

The wifi breakout board that I'm holding up below is the ESP8266:  Version 1.0 form-factor with the Version 12 firmware.  Go figure.

I've known for well over a year what a difficult little beastie it is.  
  • The above form-factor's pinout is downright breadboard-hostile. (Two rows of pins?  Just...whyyyyyyyyyy????) 
  • It runs on 3.3 volts (vs. 5 volts for most other things).
  • Like all electronics that transmit a signal, it's a PIG for current (~300mA peak).
  • Constructing and sending an HTTP GET request is super-fussy about syntax (including carriage returns) and timing.  At the time of writing, HTTP POST is above my pay-grade.
And as the proverbial cherry on top of all that lamesauce, my (Ubuntu 12.04) workstation has this nasty, sneaky tendency to quietly drop USB -> Serial connections.  When you're in the middle of debugging and already inclined to blame your code, this can waste scads of time.

But this, in addition to being my first full Internet of Things project (well, first non-proof-of-concept project, anyway) was only my second rodeo with a smaller microprocessor.  I've already gone a few rounds with the Atmega328 chip running on a breadboard.  It's the same chip used in the Arduino UNOs, which streamlines development (as much as development can be streamlined).

The squee little ATtiny85 is the baby of the Arduino family.  Its surface-mount form-factor is the brains of Adafruit's Trinket, so I'm already familiar with some of its...errrrr..."quirks."  (So, yeah, the "baby" can sometimes swing to more of the "Stewie Griffin" than the "Maggie Simpson" end of the spectrum.)

The biggest quirk is that peeking inside the head of the ATtiny chips is almost impossible.  (I've done it with another full Arduino and an FTDI/UART programmer, but the wiring alone would make Rube Goldberg shake his head.)  All the usual protocols you'd use with a full-size Arduino chip (I2C, SPI, full Serial) are not supported.  The best that the ATtinys can manage is the SoftwareSerial library.  Which looks all fancy-schmancy on the surface, but under the hood does something known as "bit-banging."

Now, without wading into the intricacies of two- and three-wire communication, let's just compare bit-banging to an intersection where the drivers only sorta-kinda follow the protocol of taking turns and where the cars don't always arrive at neat intervals.

The bigger Atmega328 chips require you to supply an external "clock" (a crystal oscillator plus a couple of capacitors) to time the exchange of ones and zeros.  And while you have that option with the ATtinys, you do it at the cost of two pins -- of which there are only five on the ATtiny85.  The remaining (and default) option is to rely on the chip's 8 MHz internal clock.

As it turns out, that clock doesn't exactly run with the tightest tolerances.  According to one reply on the Arduino forums, the slop can be as high as +/- 10%.


The upshot was that the hit-to-miss ratio of the HTTP GET request even making it to the router intact was absolutely abysmal.  By contrast, when I ported the code to a full Arduino UNO, the ratio flipped.  Still not perfect, but more than acceptable.  When I wired up an Atmega328 on a breadboard and uploaded the self-same code to it, the results were the same as the UNO.  The relative reliability of the external clock made all the difference in the world.

Pity.  I had high hopes for that little cutie-pie of a chip.  I still plan on wiring up and coding a Bluetooth-based proof-of-concept with it.  Mainly to get a handle on its reliability..  As I mentioned, HTTP GET is hella-finicky.  The AT-commands used with Bluetooth are simpler, so there is some hope there.

In the meantime, I'm going into production with a slightly over-engineered "Mark I."  I still need to pick up a replacement NH3 sensor from BJW in Moncton (because guess who hosed up soldering headers and then nearly ripped off a couple of pads trying to de-solder them?), burn it in, and kick its tires.  And, finally, knock together a screened enclosure to proof the whole contraption against, ahem, "re-wiring" by a trio of curious -- and probably bored -- chickens.  (I've seen the movie Chicken Run, y'all, and I would not put it past any of them.  Related:  Remind me never to let them watch Iron Man either.)

For the longer-term, I have a couple more sketches for the "library" of Arduino code accumulating in a Mercurial repository.  For this project I imported the temperature and humidity code lock, stock and barrel and it worked right out of the box.  Which is the whole point of a well-organised code-library.  And with a tenacious sinus infection knocking me flat in the middle of this project, don't think that I don't appreciate my past self for that!

And, most important, this radically expanded my notes.  Most especially the "Gotcha" section of an Arduino-on-a-breadboard ("Boarduino") presentation that I might give sometime in the next few months.  Because while I consider this latest round of butt-kicking just another installment of paying my dues, I benefited hugely from the forums, etc.  And so I'm paying that forward.  Mind you, I don't worry about the next generation becoming soft and spoiled.  Because even if I spare someone this particular butt-kicking, there are plenty more lurking out there with each new project. Oh yes, yes there are...