Showing posts with label Wireless. Show all posts
Showing posts with label Wireless. Show all posts

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%.

Yeeeee-OWCH.

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...

Monday, September 29, 2014

Shellshock, herd immunity, and the implications for the "Internet of Things"

Sometimes the analogies used for computer stuff can be a bit off-the-mark.  For instance, cordless computer "mice" aren't called "hamsters."  Computer "viruses," on the other hand, are a spot-on description.  Some are transmitted through a physical vector (historically, through a storage device such as a floppy drive or USB stick).  In other cases, transmission is seemingly airborne (such as via unencrypted wifi).

Continuing the analogy, UNIX-based systems such as Linux and Mac OSX have enjoyed the luxury of a certain "herd immunity."  In part because UNIX-based (a.k.a. "*nix") operating systems were designed to be networked, which meant that defences were baked in from the get-go.  Also, in the past, most everyone was running Windows.  And Windows users--typically but certainly not always--tend not to be the most tech-savvy.  Which, for anyone in the market for notoriety, put the virus-writing bulls-eye on Windows.

Which gave rise to a certain smugness among *nix users that ranged from a sighroll (When will you people learn?") to outright pointing-and-laughing whenever the latest Windows virus was making the rounds. 

Last week's "Shellshock" vulnerability may well have brought that smugness to an end...at least blunted it for the foreseeable future.   Mainly because the free ride of (perceived) "herd immunity" has come to an end.  Apple's OSX has definitely spread from the Graphics Department to other areas of business.  Also, the overwhelming majority of web servers are based on some flavour of Linux.  Additionally, embedded devices are increasingly based on Linux.

For programmers like myself who do the bulk of their work on Linux laptops or desktops, most of the distributions (e.g. Ubuntu, Red Hat) make it stupid-easy to install security updates.  Ubuntu, for one, definitely gets up in your grill about them.  (Plus, we generally know better than to ignore them for any longer than absolutely necessary.)  By contrast, an Android tablet (which is Linux-based) like my Nexus 7, can be more obsequious, like the velvet-footed, quasi-invisible Victorian butler.  (That tiny notification icon in the northwest corner of the screen murmurs, "Would Milady graciously condescend to update her tablet now, or after tea?  Very good, marm."  But no more than that.)  Which is dangerous from the standpoint that updates are easy to ignore, but it's the tablet that's more likely to connect to that coffee-shop wi-fi.

And the proverbial web-enabled toaster?  Fugeddabouddit.   Its manufacturer was too busy trying to squeeze half a cent off the unit cost (to appease Walmart's accounting goons) to worry about releasing software patches.  And that's precisely the problem with the Internet of Things.

And while I don't necessarily like to call for yet more regulation, I think any government that waits until after a catastrophic network attack to require patching is a reckless government.  The two major barriers to such a catastrophe are well on their way to becoming null and void.  Clearly, the industry cannot be trusted to police itself.

Cost was the first barrier.   Unlike Windows or OSX, Linux is free to use.  It is--just as importantly--also free to hack up and modify to suit your particular hardware.  Either factor is enough to make Linux a no-brainer for electronics manufacturers.  Which is fine for standalone gadgets.  But when they're exposed to a network (and by extension other devices), an evolving immune system is a non-negotiable.

There's another dimension to the cost factor, and that's in hardware.  Previously, only full-size PCs or laptops had the processing power and memory to support a full-blown operating system.  Not anymore, when the $40 Raspberry Pi runs off an SD card like the one you probably already have in your camera.  Eventually, the only limits on size will be imposed by the need to connect it to monitors and standard ports or peripherals (these days that means USB devices; who knows what hotness tomorrow will bring?).

All that, for a manufacturer, means that they don't have to spend the money and time to develop a custom operating system; they can go with a no-cost off-the-shelf platform.

The second roadblock, scarcity of always-on connectivity, is now disappearing, as public libraries and city buses and in some cases entire cities offer free wi-fi. 

The upshot is that we'll have an ubiquitous operating system that is less than likely to be immunised against the latest viruses.  And it will be living in the (metaphorical) Grand Central Station of the internet, exposed to any and all comers.  Pandemic is not a risk; it's a certainty.

I know that most people could care less if their cyber-toaster tells a black-hat hacker or the NSA or the CSEC that this morning's raisin bagel was (gasp!) not gluten-free.  But that's soooo emphatically not the point here.  Why?  Because hackers do not always want your data.  In many cases, they want to siphon your processing power and your bandwidth so they can use it to attack those who do have juicy credit card numbers or email addresses or passwords. or naked celebrity selfies or whatever.  Which ultimately means that when anyone's too lazy to keep up with patches, they're aiding and abetting the enemy.  And complacence, as we know from politics, is complicity.

Naturally, my Gentle Reader is too savvy and hip to be slovenly about such things.  They fully appreciate that even their Fitbit has orders of magnitude of computing and communications power beyond what put people on the moon.  And they, beyond question, have the instinctive class and sense of noblesse oblige to know that with great power comes great responsibility.

Of course they do.

Monday, December 6, 2010

Rebooting the Android strategy/tactics

I thought that Google's decision to take a lower-key approach with the Nexus S Android phone was interesting in its potential to under-promise and over-deliver. Not enough to drive your faithful blogger over to T-Mobile, of course--their "bundling" of voice, text & data is the lame joke it was when I crunched the numbers months ago and decided to stay with pre-paid. In the meantime, I'm holding out for better luck with the next incarnation.

At least Google seems to have learned from their very public spill, and that's encouraging. But the real question (to my mind, anyway), is how much a more Googly-flavored Android phone can push consumers to push their carriers to open up their offerings to less "customized" (a.k.a. "locked down") handsets.

Personally, I'm leaning toward a pessimistic view, given how willfully ignorant most Americans seem to be about the true cost of anything that involves monthly payments. Then again, cool is cool--and that's the game just now.

Wednesday, September 15, 2010

Government snooping - a programer's view

In debugging computer code, I can't think of a situation where no data doesn't trump bad data. Why? Because when you expect data and don't see it, you know something's wrong. Bad data, by contrast, can lull you into the proverbial false sense of security--thus, making it more expensive to backtrack and fix the error that no data would have made glaringly obvious.

Best friend H. posted Time's "What Your Cell Phone Could Be Telling the Government" on her Facebook page. H. is--and will always be--a far more experienced and competent programmer than I, so I can only assume that posting it from her phone was an act of supreme irony.

I suppose on the Civics level, geo-tracking and wire-tracking are equally repugnant. But from a Computer Science level, there's a difference. And the reason I consider geo-tracking worse than good old-fashioned wire-tapping is that the data can be so much more easily hosed by those who have an interest in hosing it.

The difference boils down to this: If you're snooped while conspiring to do something baaaad, you're pretty much dead to rights. The data's there or it's not--it's just that binary. But...need an alibi to inject that bit of "reasonable doubt" into your trial? Send your phone elsewhere with an accomplice. Enter ambiguity. Which is something I like to do when organizations who haven't earned my trust are a little too interested in my...demographics. (That's how Microsoft has 110 year old programmer on file at MSDN thanks to their nosiness--and the fact that their drop-down list goes back to 1900.)

Now. Were I independently wealthy enough to become a professional mischief-maker, it might even be amusing to pick up a second (or third or fourth...) do something like the whole Amelie garden gnome schtick. Just for the sheer pyromanaical joy of watching another data point go kablooey.

In the meantime, however, I despair at the lack of brains involved, It's a simple signal-to-noise proposition, and there's no way around that. Jack Bauer codswallop aside, you don't catch the information that will stop the ticking bomb by floating a hundred driftnet. Just like you don't thwart another 9/11 by shaking down Medal of Honor recipients. Bad data, folks: It just makes the errors that much more expensive. Because doubling the powder when the gun's aimed at your own foot is not what I consider smart.

Saturday, August 28, 2010

Historical perspective

I probably appreciate the self-congratulatory peeks at retro technology as much as the average 21st century geek. Although, in this case, I can't be too smug at something like this, because my first computer (an 8088 powered by two 5.25" floppy drives and no hard disk) boasted zero on-board storage.

Fortunately, there's a great deal of perspective waiting behind the instinct to revel in the great, good fortune of living & working in the PC/smartphone era. A pair of such moments were waiting for me a week ago at the Army Museum located in the Citadel of Halifax, Nova Scotia.


The first is was an example of headphones. Not exactly the padded featherweight of Bose, these. But that probably wasn't high on the priority list of the folks using them to locate mines in World War II. My maternal grandfather, a mine-sweeper of 54-F Pioneer Company in the First World War, would have rejoiced to have such technology at hand. Preferably before his best friend (also a mine-sweeper) missed a trip-wire and was blown apart while Grandpa could only watch (and/or dive for cover).

The second artifact is what WWII called a mobile phone. Transmission of radio waves (which, in military terms, replaced a terribly vulnerable--wired--telegraph technology) predated even Grandpa, and had already seen use by the British during the Boer Wars, and developed a highly complex system for sending messages to its fleets after war broke out again in 1914. Doughboy Signal Corps units relied on "portable wireless outfits" (i.e. wireless telegraphs that could be comfortably carried by four men or truck-mounted for field use) with antenae ranging between three and four feet tall.

In addition to adding full-fledged telephony, WWII's mobile communications (as shown above) saw great advances in compactness. But, alas, our perennial complaint of losing all bars has a long and dishonorable history: Significantly, it was a contributing factor in the ill-conceived debacle known as Operation Market Garden. Needless to write, the cost was paid in blood and treasure--and dearly.

Which, IMLTHO, may be something to keep in mind when the next iGadget is unveiled to the sound of the trade press hyperventilating over how it "revolutionizes," well, everything. In reality, that particular revolution's been here and gone. Sure, another may come along, but spending all attention on whether or not something has a a built-in camera pretty much guarantees that the next (real) revolution will come out of left field.

Wednesday, June 30, 2010

Don't send a Samurai to do a Ninja's job

My eyebrows were raised a bit by the rumor-news that the Kin, Microsoft's mobile phone based on Windows 7 was being yanked from the market. At first, I thought that I had just missed Kin's release b/c targeted at a much younger demographic. But it turns out that it's been a mere six weeks since launch.

In the trade press, the usual suspects have been blamed: Low on features, high on monthly plan, disjointed marketing, etc. But to be contrary, I'm going to declare myself a temporary marketing expert (on the strength of having once been a tween-then-teen-then-twenty-something) and let you in on the secret behind the failure.

Simply put, the target demographic was too darned obvious. More importantly, Angst doesn't take well to obvious pandering. If you want Angst to buy something, you do one of two things:

A.) Tell Angst to grow up and leave that sort of thing in the toybox with its old Barbies & GI Joes. (See also, Hello, Kitty)
B.) Tell Angst that it can have it when it grows up. (See also, everything else.)

Personally, I thought that the round version of the Kin was kind of cute, suggestive of a hyper-evolved Tamagotchi. (Which sentiment, by the bye, should pretty much be the Kiss of Death for its prospects with Angst.) So I hope that Microsoft & Verizon's lost millions will at least benefit the B-school textbooks of the next decade. Namely as an example of the difference--purely in marketing terms, of course--between Ninjutsu and Bushido.

Sunday, June 27, 2010

Haven't we been here before?

In recent months, I think that I've caught one or two references to using the iPhone to deliver mobile ads. Whatever--didn't plan on drinking the Apple-flavored Kool-Aid in the first place. But I should have known to look for the "me-too" from other folks. And here it is from Microsoft.

If the advertisers subsidized part of your phone bill or chipped in to discount the original cost to the device--and you had a choice about it--I wouldn't be so disgusted. But I very much doubt that happening. At least in the scenario described, the customer has to take the step of installing an application from the advertiser. If the relationship is abused thereafter, s/he presumably has the choice of severing the connection by uninstalling the app. Fair enough.

What bugs me, though, is how the lessons of the internet age were clearly not absorbed. Because you can already see the marketing wagons fitted out to march to the next boom-bust cycle. It's in the use of phrases like "advertising platform"--as if spammers, scammers and B-school boorishness have an actual right to bogart bandwidth for which you, the consumer, are footing the entire bill. You know, the reason that spam filters and image-blocking have to be baked into email software, and popup blockers are in their own arms race against JavaScript-gone-bad. The reason why people have to make an all-or-nothing decision about whether or not to block Flash on web pages.

In other words, welcome back to the 1990s, just on a smaller screen, at tastier download speeds, and higher costs to the "customer."

Saturday, June 12, 2010

It's the creators, stupid.

If you're in the mood for (mostly) content-free hyperbole today, look no further than The Atlantic's Closing the Digital Frontier. If you're not, allow me to summarize:

  1. Traditional media/entertainment (nearly) brought about its own demise by buying into the early hype about information "freedom."
  2. The web browser is dead.
  3. "Curated" internet access--i.e. controlled by Apple, Netflix, Big Media, etc. is the future.
  4. The near-monoculture in the U.S. of wireless carriers, smartphone OSes, will leave consumers with no choice but to shut up and pay up for the "best" stuff.
  5. Curated apps and paid media will kill Google and search/aggregation in general.

Rebutting point by point:

1.) I call "Historical revisionism." The RIAA and MPAA hardly bought into the "information is free" mantra. Moreover, I recall paywalls throughout my experience with the web. I remember a fully "curated" World Wide Web. (It was called AOL.) I remember Disney buying InfoSeek and basing search results' "relevance" on who was willing to pay. That and the "portalization" of search was--IMLTHO--what drove us into the clean interface and impartial rankings of Google. And so I would even make the case that what is still killing big media and big entertainment is not pirated content, but rather the reduced barrier to entry for so-called "amateurs" who are equally or more talented than the "professionals." Thus, the demise is much more a matter of competition. That and the consumer figuring out how much they'd been fleeced for mediocrity--if not outright suckage.

2.) The browser is the fastest, easiest and most generic way to get information online, period. And that even with the royal pain that is cross-browser support. Also, smartphone disk space is limited, and expecting someone to give up drive space for a single-function app is pretty darned arrogant unless it's impossible to deliver the same functionality in a web browser. Is there any way Twitter can improve your experience with accelerometer (meaning Wii-like controls)? Don't think so. Ditto for Facebook, looking up phone numbers, finding a restaurant, GPS, etc. A bootstrapped software company is not about to invest months of coding in Objective-C and praying for Apple's laying-on-of-hands to replicate the same functionality that web forms could provide in two days with Dreamweaver and an upload to GoDaddy. If MySpace, Facebook, Twitter, etc. had gone the "application" route, we never would have heard of them, much less their mobile versions.

3.) Curated, paywall access works for content that's expensive to produce. For everything else, there's YouTube and long tail marketing. Getting the consumer to pay for streamed content is hobbled by data capping and attempts to control what's routed through The Tubes. In essence, Apple's set itself up in the business equivalent of a love triangle. On one hand, it's in bed with AT&T until 2012. On the other, it's wooing the content providers (Netflix as well as more traditional publishers and media). The interests of Apple's two paramours are diametrically opposed: One makes money pushing as much data to the consumer as possible, the other by limiting it. The consumer pays three times--for data, delivery and device. Which I personally don't have a problem with, but when each member of this love triangle is pushing what the market will bear, independently of the others...that's an oligopoly ripe for disruption. Particularly when, with three hands held out for each byte streamed to every device, the consumer is still expected to put up with advertising for the privilege.

4.) (And speaking of disruption...) Why Michael Hirschorn assumes that the boundaries of the various markets stop at the US border I can't fathom. I'm not knocking good ol' Yankee ingenuity--not in the least. But devices that sip battery life, add bulletproofing for spotty connections, are solar-chargeable, use freerer platforms (e.g. Android, Linux) and otherwise make virtues of scarcity are more likely to come from overseas. You know all those people who are manufacturing our gadgets or writing the code for them? After all these years, a few of them just might...just maybe...have figured out how to create stuff without Western input. If we're lucky, the usurious attitude of the Western titans even provided a little extra incentive to stick it to The Man. (Then we can sit back and enjoy the spectacle of watching Bollywood try to figure out what Hollywood hasn't. I'll pop the popcorn.)

5.) The amount of information stored on servers is not static, much less decreasing. Someone has to make it findable; someone needs to tie it together in relevant ways--with "relevant" being a highly subjective term. Individual applications are, by nature, too partisan, too one-size-fits-all. Certainly there will be niches focused and valuable enough to justify installing a new app. on a mobile device. But a niche isn't valuable until you are already aware of it...and know enough to assess the value of the information. And where would you find that online? Oh yeah...that would be through search and Wikipedia and blogs and maybe Stack Overflow-type sites. You know, all that stuff whose wake is being planned.

But I guess what chaps my hide--even more Hirschorn's smug assumption of the native superiority of brand-name content and distribution systems--is the collective view of the world as passive consumers dropping quarters into an internet that resembles nothing so much as a vending machine or pinball game.

Bottom line: The proverbial "killer app" is rarely created in a management retreat; still less often is it created when Joe Consumer somehow connects to Jane CEO and says, "Make me x." No, a "killer app" happens when its creator thinks of a unique way to solve a problem--even if the "problem" is mere boredom--and gets off her/his (figurative) backside long enough to solve it. Preferably in the most convenient, efficient, and perhaps even creatively satisfying manner possible. Any pipe-dreams on the part of the Big Boys of setting up more toll booths on the internet are not integral to the design. Unless the telco, entertainment, and hardware giants collude (and, less likely, cooperate) to create the One Web To Rule Them All, creators will win.

Sunday, June 6, 2010

Another new "race" in technology

Another riff brought to you by last night's trip into Barnes & Noble. Not so much about books, though, because--for once--the in-your-face front display did not contain books. No, the pride of place normally given to J.K. Rowling and Stephanie Meyer was instead devoted to the Nook eReader. No great shocker there, just elementary retailing in action. In fact, I think it was just last week I'd read that both Amazon and B&N are more aggressively marketing their gadgets.

But the poster-blurb about wi-fi & 3G did catch my attention, along with some mention--I thought--about web browsing. It turns out that the web browsing thing wasn't just the mudslide pie sugar-rush talking after all. Amazon's next-gen Kindle will (allegedly) also have built-in wi-fi--presumably in conjunction with, or in place of WhisperNet.

Together, they only make me (again) wonder how long it will be before accessing an unfettered internet will be a "given" in the same sense as electricity and hot & cold running water. Which is interesting timing, considering how AT&T and Verizon and Comcast and a number of their ilk are dusting off the notion of data-capping and/or actively fighting net neutrality.

In a sense, it's a race to see whether always-on and unmetered access will become either a quasi-right or a privilege in the American mindset. Granted, utilities are typically metered, but phone/data companies try to have it both ways by combining use-it-or-lose-it with overage charges. I mean, seriously, who talks exactly 500/1000/whatever minutes a month? Yeah, didn't think so--which makes it a lose-lose proposition all the way.

Personally, I'm betting on quasi-right. And the driving reason is the explosion in the number of gadgets that come with web browser as a standard feature. Gadgets that are live in a handful of seconds, rather than the time it takes a PC or laptop to go through the operating system equivalent of waking, showering, brushing teeth and reading the paper over coffee. In a phrase, instant gratification. Standing between the American consumer and instant gratification generally isn't smart business. And, having recently rolled my eyes half-dizzy shopping the talk/text/data Happy Meals the brand-name mobile giants offer, I can't say as I'll feel sorry for them when they lose the race.