Friday, November 6, 2015

26: A More Secure Breadboard Setup for Particle Photon or Arduino Nano
-- revised: Nov 25, 2015 --

I hate loose wires, also not fond of soldering. So, browsing Aliexpress I found 2 possibly useful devices: 8-wire screw terminal strips (I got 4) and a bunch of 2-wire spring clips.

Terminal Strip, Photon, Spring Clips

Anyway, I like both connectors. The screw strip is a tad over-kill. I probably won't run 220v through it. I particularly like the spring clips -- they are pretty strong. And flexible in number. And cheap: $1.30 for 10 pair. REVISED: I tried getting more than 1 wire clamped in a spring clip -- Sorry, not reliable (and not very useful, otherwise)!

I'll probably mount the whole setup on an about 8" square of 1/2" plywood, screwing the breadboard and connectors to the board. There should be room left for a 4-switch relay.

Monday, November 2, 2015

25: Particle Cloud vs. Daylight Savings Time

Clock time is important to my "live" Photon system (see posts 20, 23). Imagine my surprise in finding the time off by an hour on Nov. 1. Sloppy me. Particle Docs is explicit that the Time.zone() function does not adjust for Daylight Savings.

Lucky for me, I have a Linux/Raspberry Pi to back me up. Here's a little shell script that can correct the time in my Photon program:

thisF=your-function-name
photon=1234... # your Photon's ID
accessT=5678... # your access_token
a=`date | sed -n 's/.* .\([DS]T\).*/\1/p'`
if [ "$a" != "ST" ] ; # previous WAS "DT"
then
  v=-5  # Standard Time (value less than GMT)
 else
  v=-4  # Daylight Time
fi
# This can tell the Photon
curl https://api.particle.io/v1/devices/$photon/$thisF \
 -d access_token=$accessT -d "args=$v"

Unix/Linux have a scheduling program called cron. And each user can have a personal set of scheduled programs accessed by the crontab app.. If the above shell code is in a file called "set-tz" then this crontab entry will execute it every Sunday in October, November and March:

# min hr dom mo dow command
...
0 3 * 3,10,11 0 sh set-tz

Read it as: 
"at zero minutes after the hour, 
3am, 
any day-of-month, 
March, October, November, 
Sunday
Then execute set-tz."

Ugly, but looks isn't everything.