Wednesday, August 10, 2016

juggling squirrels? we can help!

Taking on a new role @ work, I'm responsible for many more moving pieces.  Last 5-6 years has been primarily individual-contributor work so I've been able to (mostly) stay focused on few enough deliverables that I could keep things in working memory.  But now it's (providing some direction to) multiple people with multiple tasks on multiple projects.

Years ago my good friend Dan Stratton introduced me to David Allen's Getting Things Done.  It was a godsend for my ADD riddled brain to have a logical but flexible framework for organizing and keeping track of so many squirrels.

I'm re-appreciating Dan's mentoring as I can dust off the lessons and get a handle on all the butterflies and cats I've got to juggle.  (just keeping the cats from eating the butterflies is an accomplishment)

 Not the end-all-be-all but a fantastic tool that naturally captures kids soccer schedules to vacation planning to cross environment network cutovers across multiple data centers.

 Highly recommended.

Monday, April 18, 2016

Noodlings/advice on 3d printers

Another "email to friend" post ... this time on getting starting 3d printing.

************************

Hey there!  Apologies for not getting back to you sooner but <insert excuse about being busy here>...

Anyway...on to the important stuff.  Make magazine does a yearly roundup/rating of many (if not most) of the current crop of 3d printers.  From $400 all the way up to $4000+, it's a pretty solid set of data.  And, it's free!  http://makezine.com/comparison/3dprinters/ has the latest..prices, recommendations, winners, etc.

Some personal recommendations and random notes:

***Lots of fun materials to print with.  The two main are PLA and ABS.  ABS stinks to high heaven.  PLA smells like waffles.  PLA also tends to warp less/is less finicky in general.

*** You need a printer with a heated bed.  Period.  You will read that if you print in PLA (which has a lower print temp) a heated bed is unnecessary.  That folks have no problem.  They either have low expectations or print very tiny things.  Otherwise this is flat out wrong.  PLA will and does warp on the corners...even with medium sized prints.  Despite hairspray, blue tape, and all the other tricks, I had warp.  Sometimes tiny, sometimes big ... but even a 2cm x 2cm cube had about .1 - .2mm turned up at each corner.  Drove me nuts.  Added a heated bed and BAM, all was right with the world.

*** I have an automatic-leveling probe to add to my printer ... but I haven't done it yet.  A friend has one and it makes setup a whole lot easier.  Without it, you have to level the bed manually to get it dead-parallel to the print head.  The probe will check several points and figure out if things are slightly off .. and automagically compensate.  I'd recommend one.

*** Using blue painter's tape to help things to stick to the print bed has worked exceptionally well for me.

*** Getting larger-footprint (3+ square inches) off the printer plate can be challenging.  A sharpened painters tool helps with this...but go slow.  There are other solutions (http://www.printinz.com/ ) but I haven't tried them. (yet)


There are no "plug and print" 3d printers.  Yet.  We're getting closer, but expect to spend a couple hours setting it up and calibrating it to where you can print a reasonably good yoda head.  Figure 2-4 weeks of tinkering to get it really dialed in.

3d printing is SLOW...especially when you want high detail.  The dino skulls I printed @ high res took ~16hrs each.  That said, lower detail (thicker layers) are often fine for fun kiddo stuff...there are a lot of things that'll come off in 30min - 2hrs.  AND .... even when it's slow, my kids (and I) have watched it for literally 15-20 minutes at a time.  Just watching the printhead.  It's hypnotizing.  (the wife doesn't understand this at *all* ...)  So set expectations accordingly.  It's no Star Trek replicator, but there is something satisfying about desiging something simple in SketchUp or TinkerCad (https://www.tinkercad.com/) and seeing it realized.

Check out https://www.thingiverse.com/ for loads and loads of fun/educational/kitchy free models.  They've got a friggin fully moving engine in there.  With an automatic AND A MANUAL transmission.  And more cats, dragons, gear boxes, and iphone stands than you can shake a (3d printed) stick at.

My printer is a heavily modified 2014 Printrbot Simple.  (they're not sold any more)  It's original 4"x4"x4" volume is now ~4" x 5.5" x 6".  It works well for *almost* everything. The aforementioned friend has a Printrbot Simple Metal with the heated bed option.  His 6x6x6" seems to be just enough more that he has little trouble fitting models.  The printer I'm building now, however, is an 8x8x8 volume...because I can.  ðŸ˜Š

Printrbot is the only company I have personal experience with, and they're pretty solid re: support.  I've had parts replaced by them under warranty and it was quick and painless.  Their forums are active as well, with a solid community of contributors.

Anyway ... it's still a bit of a wild and wooly world out there.  Reminds me a little bit of the 8086-80386 days ... when you bought systems out of ComputerShopper, had to research DIP switch settings for add-in cards, and oohed when VGA was first seen.  Good times.

Monday, March 28, 2016

Over The Air (OTA) esp8266 setup

Why OTA?

  1. it's faster than updating a sketch via USB/ftdi
  2. lets you update code when the module + sensor is wedged where the sun don't shine.
    1. under a dishwasher
    2. behind a fridge
    3. in an attic
    4. in a crawlspace
    5. up a tree
    6. surrounded by man eating racoons bent on world domination 


There's a *bunch* of info out there on getting over the air programming to work with an esp8266.  Much of it describes processes that are more difficult than necessary because...well, it's moved very, very fast.  As of the June 2015 timeframe, it still required quite a bit of handstanding on your head while juggling watermelons to work right.  We are lucky that an awful lot of the difficult bits are solved now.


After a bunch of futzing around, finally got the right combination of libraries, etc.

To wit:


  1. update to the latest arduino IDE (very important) - 1.6.8 as of this post
  2. use Examples=>ArduinoOTA=>BasicOTA as your base sketch
  3. Set the board to "generic esp8266 module" ... even if you're using something like the Adafruit Huzzah ... which I was.
  4. update the sketch with your wifi ssid and pw
  5. upload via normal USB/Serial method


Follow the rest of the steps here:
https://esp8266.github.io/Arduino/versions/2.0.0/doc/ota_updates/ota_updates.html

*POOF* magic happens.

You're welcome.

Saturday, March 26, 2016

Soldering irons and FTDI and bare modules (oh my!)

[question]
In my experience, Apple's default push notifications are fairly good about delivering things promptly and reliably, and email will be even better. I'm not terribly concerned about the reporting thing, I'm fairly comfortable writing dashboards and services for these. I do want to have it centralized so that I can get a notification if/when one of these looses power and stops pinging (or gets suddenly inundated with water or something). I can probably run that off a Pi or EC2 or whatever.

I'm planning to get two or three to start out with. We already have a soldering iron somewhere, so I think the only upfront things I need are the FTDI cable and a bunch of solder. After that, I think I can build these for less than $15/unit. If I'm doing them in bulk and get a little comfortable with soldering, I can shave a few dollars off that by getting https://www.adafruit.com/products/2491 instead of the breakout.



[answer]
Stick with the adafruit or sparkfun ftdi module.  While there are cheap $2 usb-to-serial converters out there, don't be too tempted.  Some use an "unlicensed" ftdi chip (which will give you no end of headaches with drivers...or worse).  Others are based on a different usb-to-serial chipset (CP-2102) that seems to work ok with windows, but is a royal PITA to use with a mac.  (I eventually did some sort of magic to get them to work on my mac ... but the 10.10-10.11 upgrade broke it)  Short answer: stick with the $20 genuine ftdi adapters from adafruit/sparkfun.  I've got experience with *all* the above problems.  And you know what they say ... "Good judgement comes from experience.  Experience comes from bad judgement."

Here's the thing with the bare esp-12E module from adafruit ... you'll still need to create your own method (board of some sort) to do the initial software load, *and* you'll need a minimal VRM to provide a clean 3.3v power source.   I originally intended to do just that with a small custom board, then I ran across these: http://www.electrodragon.com/product/esp8266-smd-adapter-board/  Even sourcing all the parts in bulk, I'm not sure I could build a board cheaper.  You get an easily soldered to/breadboarded breakout board *with* a vrm *and* the esp-12f already attached, all for $3.80!

You'll still need to do the initial flash with an ftdi module (they've got a picture of it hooked up on the page), but if you flash it with OTA (Over The Air) arduino code the first time, you can do subsequently loads via wifi*.   This, of course, also means you can update code easily when the thing is wedged *under* the dishwasher.  Or in the crawlspace.  Or behind the fridge.  :-)  Since you're already ordering from electrodragon for the water sensors, the additional shipping should be negligible.

I just ordered a handful of the above modules to experiment with.  If you're curious, I'll let you know the quality when they get here. (in...admittedly...about 2-3 weeks)

Re: soldering ... the adafruit iron will work fine...I've never seen them sell something they wouldn't use themselves.  A good iron makes soldering 10x easier.  If you can swing it, something like this ($40) http://www.amazon.com/Weller-WLC100-40-Watt-Soldering-Station/dp/B000AS28UC/ is even better and will last you until you're at *least* as old-n-busted as I am, if not longer.  ;-D

I've noodled the "how to know if the sensor has died" issue as well.  With the blynk app, when you add the notify widget there is a switch that says "notify is esp is down".  Which probably only works if the app is running on the individual phone.  It would be easy enough to write a service that runs on your home pc and regularly pings each of the registered sensor nodes.  Anything that doesn't respond over X amount of time triggers an email/sms alert.  Since you're using an a/c adapter, you won't necessarily need this now, but the esp8266 also has a built in incoming voltage monitoring function that makes it easy to keep tabs on battery charge levels.  See here: https://github.com/adafruit/ESP8266-Arduino and scroll down to/search for "ESP.getVCC()"

Ok ~ now get back to work!

*OTA info in a subsequent post ... stay tuned

Friday, March 25, 2016

3.3v (or: how to not fry your esp8266)

[question]
That all sounds great, makes a lot of sense. One more question - http://www.electrodragon.com/product/water-drop-rain-sensor/ says that it uses 5v, but the HUZZAH doesn't have a 5v pin and all the GPIO pins come with dire warnings on https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/pinouts about them not being 5v "compatible". I take this to mean something will melt, explode, or otherwise make me unhappy.

What happens if I just throw 3.3v at the water sensor board? Will give me 3.3v back, or will it not work or explode or something?

[answer]
Ok, took me a bit but I just checked the demo board I made, and I connected the water sensor to the +3v for it's vcc, and it works fine.  Some sensors (eg: the ultrasonic one I demoed) do require a 5v vcc* to work correctly.  Many, however, work fine on 3.3v.  Sometimes the sensor will outright state "5v only" or "3.3v only" or (in some cases) "3.3v and 5v".  Some will state "TTL Logic" <-- this almost always means: "will work with logic levels from 2.7v to 5v for the "on" state"

Yes, 5v isn't good for a microcontroller that uses a 3.3v logic signal to indicate a "high" (ON, or 1) state.  Thinking of voltage as pressure in a hose (a useful, if not entirely accurate, analogy).  A valve that's rated for 3.3v psi might burst/fail/leak if you hit it with 5psi.  Bit of a stretch for the real world, but you get the idea...tiny circuits that are spec'ed to deal with 3.3v may burn up @ 5v.

Using the above ultrasonic sensor, for example, I had to feed the sensor 5v for it to work right, but the signal pin also put 5v out.  That would have very likely damaged the input on the esp8266.  I wound up using a voltage divider to bring the 5v down to 3.3v.   (voltage divider quick tutorial: https://www.modmypi.com/blog/hc-sr04-ultrasonic-range-sensor-on-the-raspberry-pi )

Here's a bit of irony for you...my in-laws came by last night to borrow a pair of fans from us ... to dry out their garage floor ... where the water heater had been leaking.  I described the demo'ed water sensor and they immediately asked where they could buy one ...

OH...and before I forget...for *this* particular application, I'd recommend adding the email widget to your app and a call to Blynk.email in your arduino code.  (http://docs.blynk.cc/#widgets-notifications-email)  So instead of only having it notify an application (that may or may not be running) on your phone, you should wind up with a text message that will be sure to pop up and be noticed.

We do this by sending the email message to your cell carrier's "email to text" gateway. (list: http://www.digitaltrends.com/mobile/how-to-send-e-mail-to-sms-text)

Heck, have the huzzah send the email to *several* people just to be sure!

Cheers!

(*vcc == "this is where the positive supply voltage gets connected")

ESP8266 - powering it via AC

"In the beginning"

Been meaning to do this for a while now.  As in "for the last 10 years or so".  Anyway.   As I shot emails back and forth with a young man getting started in his making/tinkering journey it occured to me that:
1.) someone else might benefit from the knowledge
2.) the above is pretty well a self-serving bit of preening on my part
3.) the real reason is to give myself an easily accessible log for things I've learned and subsequently forgotten

With that bit of confession out of the way...let's go!

We were talking about how to get started with the ESP8266 modules.  A wonderful little doohickey, complete arduino microcontroller WITH wifi on a single (cheap!!) module.  I'd done a presentation at Boise Code Camp on getting started with the things (https://github.com/adbacker/bcc2016 for code and notes) that started the whole thing off ....



RE: getting the things powered by a/c for long term sensoring...

*****************
[question]
I'm looking at getting a bunch of those HUZZAH's from Adafruit. How did you power them? I'm probably an idiot, but I'm not seeing a good way to hook it up to wall (120v) power. All the examples I'm seeing have it powered through the console cable... which is all well and good until you want it to be not hooked up to a computer.

Do you know of any pointers to doing this?


[reply]
To power it via household current, you'll need an ac/dc converter.  (aka ac adapter, ac converter, etc)

I've used ac adapters from old cell phone chargers and other dead electronic devices with good success.  Anything from 5v to 12v will do. (the voltage should be printed on it somewhere).   You know what I'm talking about ~ they look something like this: https://www.ebay.com/ulk/itm/151620955695

If you don't have a 20 year collection to pull from (as I do), thrift stores are great sources for minimal $.

The Huzzah has an onboard VRM (voltage regulator module) that'll step the wall wart's DC to the 3.3v it needs.  But it'll only handle a max of 12v to step down, so keep that in mind.

You could cut/solder the ends of the ac adapter directly to the huzzah(make sure you get pos/neg right!), but I'd recommend soldering something like this, and then plugging your ac adapter into it. https://www.ebay.com/ulk/itm/262198002613

Note that the female connectors above are for a 2.1mm plug ... this size is pretty common to 12v ac/dc adapters, so make sure your adapter plugs match!

According to the huzzah docs, they recommend soldering the battery connector with the positive to +vbatt and negative to ground.  Those would be where you would want to connect your power.

You probably already have, but if not be sure to read through the adafruit learning tutorials ... good stuff in there.

https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/pinouts

Let me know if you hit any more bumps.