Saturday, April 23, 2016

38: Search for the Perfect Connector

Here's some recent purchases:

The white spring clips are cheap, easy to use, fairly secure, not waterproof. I've had some of the 2-wire type for a year. They are useful while you are messing around. Generally better than alligator clips.

The lower set are pretty much the opposite: secure, waterproof and not cheap. And once you snap one of these suckers together it's work getting them apart. But really waterproof. Also, they could use a screw-down hole like the white clips.

The search goes on...

Monday, April 18, 2016

37: Raising an "Exception" in a Particle Photon or Electron

Let's say that that you have a remote Photon that is monitoring a temperature sensor and it reads a value that is out of range (too hot, too cold, whatever). I have a Raspberry Pi Linux system (could be any other Unix or Linux computer) that needs to be notified. One way would be for the Linux system to "ask" (i.e., "poll") the Photon every few minutes for the current temperature value and then to test for out of range for itself. A plausible action would be to send a text message to a (hopefully) responsible human.

A better procedure would be for the Photon to decide what is out of range and to send an alert message directly to the Linux on its own. The Particle programming interface offers a neat way to do this between that Photon and another Particle device. The sending device "publishes" a uniquely named message (up to the "cloud") and the receiving device can "subscribe" to it. Note that Particle has gone and gotten metaphorical on us: overloading the words "publish" and "subscribe" with new specialized meanings.

This is good for Particle Photons or Electrons but the interface to a Linux doesn't seem so straightforward. Linux/Unix systems like to receive this kind of message by reading a named device. So, until Particle provides such an interface, the simple solution is to publish/subscribe between 2 Particle devices and have the receiving computer pass the data on through the USB cable. In Linux shell this statement could record the message;

$ my-pgm </dev/ttyACM0 # program "hangs" waiting for data

Note that the single subscribing device could be used to receive messages from several publishing devices. And these could be either Photons or Electrons. The Photon receiver would cost a negligible $20.

Wednesday, April 6, 2016

36: Early Experiences with the Particle Electron
-- Revised 4/16/2016 --

See for a full description. But, briefly, the Electron communicates with the cloud via cell service instead of wifi & your Internet connection. Also, it's costs more than the $19 Photon ($80 for the developer setup). In addition, you need to have cell service -- starting at $2.99/mo (initial 1MB).

I hadn't bought in to the Kickstarter campaign so I waited a while for my first unit. See post 32. In a single day I managed to break it twice: first I mangled the tiny brass antenna socket (but I repaired it with the help of a strong magnifying glass). Next, I broke the USB plug off the board -- I was moving the Electron around trying to get it to connect to cell service & pulled too hard on the cord (Warning: not very hard). BTW: Particle did not give me a replacement.

Irksome. But I thought I still needed the cell-connection feature. So I ordered another one. Quick delivery. I'd learned a couple lessons (you can, too): I was patient and got the antenna connected at the cost of only 15 minutes of teeth-gnashing. Then I taped the whole setup to a board and used a USB extension cord so I never have to plug/unplug directly to the Electron's socket.

Programming is nearly the same as the Photon (there are some Electron-only cell service functions). But here's a few differences: I have pretty reliable AT&T cell service (2 or 3 of 5 bars on my phone). But while a Photon connects to my wifi in a couple seconds the Electron can take 1 to 5 minutes (thats what led me to break my unit #1). Also, it appears to me that orientation of the provided antenna matters. When the antenna is lying flat (edge on to the signal) connection is less reliable than if the upright (flat on to the signal). I've written a C++ program to test this & I'll post the results.

I haven't had a lot of joy with the Electron. The place I was going to install a few appears to have good FreedomPop cell modem service. Current price is: Modem $0, 1 GB LTE data/month $15. Particle Photons are $19 (plus cell modem), Electrons $69.

My test program was no fun. I wasted most of my month's data just trying to download versions of the code (download often failed but data was used, anyway). Downloading via USB seldom worked.

Also: I sometimes get the blinking red light "hard fault" signal. Hard fault is not explained. Lately I've had a LED signal not described in the online Docs. The usual sequence when you power up a Particle device is--

1. blinking green (looking for signal)
2. blinking blue (signal found, working on logging in, etc. -- this reminds me of dogs sniffing each other's butts)
3. breathing cyan (you are in!)

-- but in my case it's solid cyan (not useable).

Tuesday, April 5, 2016

35: My Arduino Nanos

I currently have 4 fully working Nanos. I recently installed one in a real-life situation for one of my granddaughter-farmers. At the time this left me with only one that I could download new code to. So I ordered 2 more cheap ones ($7 and change each). When they arrived they seemed to be working but the Coolterm app on my Mac couldn't detect their USB ports. I tried downloading a new driver and when that didn't work I send them back (too much trouble for the price). Unfortunately, I'd done the cheap Nano bit before ($3 each that time). Those 2 also didn't play nice. When will I learn? I now have a price point that maybe helps. I replaced the latest non-working pair with 2 from Sainsmart (via Amazon) for $12-ish each. They work fine.

I also have a Nano that Coolterm "sees" but which fails half way through downloading code from the Arduino app. So, essentially broken. And, I have literally burned 2 out through wiring mistakes. Best not to reverse connecting to VIN and GND (right next to each other, 2.5mm apart).

So, I bought 10 Nanos & have 3 working. You could probably do better.