Tuesday, December 23, 2014

TIL: 3-way CFL bulb

I have a set of reading lamps, one everywhere we might sit and read, all with 3-way CFL bulbs. The lamp I use most often only had two settings: two clicks for OFF, two clicks for ON. Since I've had many 3-way incandescent bulbs before, I shrugged, and thought, "that's how it always goes: one filament burns out long before the other." I knew it was CFL, but I didn't put much thought into that because the "failure" mode was familiar. Tonight I decided to replace that bulb. And that's when I discovered it wasn't screwed in all the way. As soon as I screwed the original 3-way CFL bulb in all the way, it had four states again: HIGH, MEDIUM, LOW, and OFF. Now I wish I had checked sooner!

Friday, December 19, 2014

CLI to Google Calendar

After a few weeks of missing my old cli access to Google Calendar, and pushing the Try It! button with no success (yes, I customized it, but no, what I tried didn't work for me), I went looking (again) for another tool.

Hurrah! Look to gcalcli!

First I tried "pip install gcalcli; pip install vobject parsedatetime" but "which gcalcli" came up empty. I read the log file mentioned at the end of the pip install, ran a search on the most obvious error message, and re-ran it with sudo. Now it's working! I recommend "gcalcli list" to start.

The command I expect to use most often is

gcalcli --calendar 'Calendar' --title 'what is it' --where there --when '12/19/2014 10:00 PM' --duration 60 --description 'yay for description field finally!' add --details url
, and next
gcalcli --calendar 'Calendar' quick 'quick add text' --details url
(possibly). I have always wanted to be able to populate the description from the command line, but APIv2 only supported what's in Quick Add. Now that I've got another easy tool, I can forgive APIv3 for moving my cheese since it supports a feature I wanted.

Now if you'll excuse me, I need to pound on this new command line tool ...

Update: Oh, it works so well! I start at Spot the Station, I remove the irrelevant lines (too early, too short, or too low) with PrintWhatYouLike, and then I copy the remaining (relevant) lines.

That then becomes the starting point to fun with regular expressions! Although pbpaste is a Mac OS X tool hailing back to the NeXT days, Linux has tools like xsel and xclip that I hope are roughly equivalent.

clear; pbpaste | awk -F $'\t' '{ print "gcalcli --calendar \"Calendar Name\" --title \"ISS sighting\" --where \"Durham, NC\" --reminder 20 --when \""$1"\" --duration "$2" --description \""$3" max elevation, "$4" approach, "$5" depart\" add --details url" }' | sed 's/\ min\ /\ /g;s/\ above/°\ above/g'; echo

I like to glance at the commands before running them, just to be sure I haven't made some hideous formatting error about to be replicated at the speed of automation, and I like to check at least one of the resulting URIs to be sure the calendar entry survived the transfer. So far, so great!

Friday, December 5, 2014

TIL: Tube Wraps

I looked at these reindeer printable wraps for tp tubes for a minute before running to the bathroom to test my idea. (That's where I could find an empty tp tube, of course!) I measured it, then tested against another brand that of course had slightly different measurements so your mileage may vary.


You do need to be lucky on the intersection of paper sizes (US Letter in my case) and tube sizes, but today I learned you can get four tp tube wraps on a single sheet of paper! I'm thinking of printing some faces, and letting my young artist color to his heart's content! Then my young builder can assemble the village, and peace will reign while they are happily decorating.

Thursday, December 4, 2014

Bumps on the Arduino

So it hasn't been smooth sailing since I installed the Arduino libraries. This is why I was taking baby steps.

I followed the Adafruit directions for the HTU21D temperature and humidity sensor, and got ... nothing. Really nothing. One of my desperate ideas was to look for other libraries. I found SparkFun's HTU21D library, complete with a tutorial. The difference between the two libraries is that SparkFun has two error codes, 998 if sensor is not detected, and 999 if CRC is bad. I saw a whole lot of 998, and that was very helpful. No one likes to hit an error condition, but do you know what's worse? An error condition without an error message somewhere! I removed the Ethernet shield from the system. I ran Blink again just to be sure of my baseline. I ran a lot of continuity tests. (Tip: I always need at least one multimeter with the audible continuity feature.) I read the example code comment "use inline 330 ohm resistor if your board is 5V" and added resistors because my Nano is a 5V board. (Sadly, I didn't have any 330Ω resistors in my supplies. I did have a bag of 120Ω resistors from a long time ago, to use as signal terminators.) I ran even more continuity tests. I checked the 3V3 output voltage (3.28V) and the data line resistances (both about 360Ω). I think it's a dead sensor, possibly zotted before I added the inline resistors.

So, on to the ENC28J60 Ethernet shield for Nano. Again, the sample code didn't work. I tried EchoServer and TcpServer. I modified the example code to use a valid legacy IPv4 address (I decided the first test could be IPv4, even if my end goal is not to use legacy) on my home network, but I couldn't ping it, and I couldn't telnet to port 1000 on it. Additionally, my router didn't have a complete entry for it in its ARP table. Also, the link lights on the shield were off far more often than on. I ended up re-cabling everything in my computer room, both to simplify cables and connections, and to move the little unmanaged switch for extra ports to my desk so I could watch its blinking lights as well. Based on the indicators (no link lights on the ethernet shield, no link lights on the little switch, and no ARP entry on the router), I have to think this one is also dead. However, I also need to test this suggestion before giving up.

Yes, I think it's rather odd that two out of three components aren't working, and the two peripherals at that. It's possible that I need to work on some intermediate steps, to learn more about Arduino. Gee, more tinkering ...