fogbound.net




Sun, 14 Jul 2019

Sensor Problems

— SjG @ 9:28 am

I’m working on a circuit based on a 34685-MP chip bought at Marlin P Jones. The chip is supposed to be sensitive up to 7m away, but I’m not getting very reliable detection. My first thought was that, being next to a bunch of high-frequency stuff (a Teensy 3.2 with the audio shield), maybe it was interference.

The not-yet-functioning Annoy-o-Tron

I tried taking its output to the base of a transitor and lighting a LED to see if that was better. I got similar results.

I’m not sure what’s going on yet. If I do figure it out, I’ll post here.

Update: the Interwebs deliver! Following the recommendation I found in the comments on this article, I put the 34685-MP on a cable, and moved it away from the breadboard. Voilà! It now works as I had hoped!


Tue, 7 May 2019

The Maccabeam™

— SjG @ 5:43 pm

Back in 2017, I laser-cut a menorah out of poplar. When the family showed up for Hannukah, I mentioned my “laser menorah.” My nephew’s eyes lit up with excitement, but I could see his disappointment upon presentation of the actual product.

Subsequently, I’ve been building something closer to what he probably envisioned in the first place.

I’m slow at building things, and have lots of other commitments taking up time. I spend maybe an hour or two a week on the project, and tend to forget a lot of important details between sessions. There is a whole lot of learning and re-learning. However, I thought that documenting the various processes here would be good for me (my external memory), and may be of interest to others.

The first step of any project, of course, is to give it a good name and maybe a logo. Since it’s a laser menorah, I’m calling it the Maccabeam™, and my initial version of the logo looks like this:

The Official Maccabeam™ logo

So there are a lot of things to talk about here. I’ll post a lot of circuit design ideas, physical design ideas, and details on the software that drives it. I’ll also probably post some ambivalent thoughts on the whole holiday of Hannukah1. But for now, I’ll start with the list the requirements I’ve been using for the project:

  1. Instead of candles, I’ll be using lasers!
  2. The lasers will probably be illuminating vials of olive oil rather than shining on the ceiling.
  3. There will be more lights, too. Color LEDs! NeoPixels!
  4. The whole thing will be driven by an embedded controller I can program. Since I like the Teensy and Paul & Robin seem like the kind of people I want to support, I’ll go with a Teensy LC.
  5. Since I have a microcontroller, it should take advantage of the smarts, and not just rely on an on/off switch.
  6. Hey, if it’s gonna be smart, it should use a GPS receiver to figure out the location and date, and automatically run itself on Hannukah.
  7. It will need some kind of display so you can tell what it’s doing, what time it is, how long until Hannukah, etc.
  8. It’ll be cool if it could play some music too.
  9. OK, maybe I don’t want an on/off switch, but I do need a switch to trigger a simulation mode. That way, I can to show it off to people at any time of year.
  10. [update 13 May 2019] Oh, I forgot an important one. The Maccabeam™ wants to be stand-alone. It doesn’t want any dependencies on the Interet, wireless networks, or the like. It should only depend on a source of electricity and a constellation of 20-some-odd highly sophisticated satellites and their groumd support network.

So with that set of requirements, I got started. I hope to write something here about each of those requirements as I complete the build.

1 I mean, it’s celebrating the victory of a family of intolerant religious fanatics over both their foreign imperial enemies and their more moderate coreligionists. Their victory established the shaky Hasmonean dynasty whose infighting and collapse resulted in Herod’s rise to power in the region, etc.


Wed, 13 Mar 2019

Replacing the battery in a mid-2012 Retina MBP

— SjG @ 8:17 pm

I bought my MBP back in September of 2012, and it’s been the best machine I’ve ever owned. Named Apotheosis, it’s quiet, powerful, good battery life, and all that. It’s been through four or five iterations of MacOS, and still runs fast. It’s got old-school USB 3 ports, an SD card reader, and the mag-safe connector. In short, the only thing I could hope to improve it would be more storage.

Of late, however, it’s been exhibiting power issues. It will log itself out, or spontaneously go to sleep and not wake up without external power. I reset the System Management Controller (SMC) by the arcane ritual of holding down Shift, Control, and Option on the left side of the keyboard, then holding down the power button for 10 seconds. No luck.

Then, there’s some minor issues with the screen; small areas that look almost like fungus in the display. From what I’ve read, this has affected a lot of older Retina displays, but in my case it’s more an annoyance than a serious problem. Still, given these two issues, I thought perhaps it’s time to upgrade. After all, the machine’s over six years old.

Looking at the new MacBooks and MacBook Pros, though, I can’t find anything that would be satisfactory. Certainly nothing at a price-point that I feel like paying. I’m not a big fan of the new keyboards, and if you want to put a lot of storage (i.e., 2TB) in a machine, Apple really makes you pay. Resolved, then, try to get more years out of Apotheosis. Apple no longer services this model, and the indy/Authorized dealers wanted $500 to replace the battery. That seemed high to me.

Other World Computing has a replacement battery kit for $85. I ordered it, and it arrived overnight! In big red letters, they warn that “Professional Installation Highly Recommended” but people like me don’t pay any attention to such things.

Back cover removed

The kit comes complete with Torx screwdrivers specifically for the MBP, including the (in)famous “pentalobe” driver.

They also supply a step-by-step video for the process. This is a really outstanding instructional video. It shows everything in perfect detail. Things which sound simple in words (e.g., “unclip the connector”) are often not so clear when staring at the physical object. But watching each step makes it very simple.

That being said, they estimated two hours to do the process, and it took me more like three. Part of that was my obsessive disassembly process which I’ve perfected over the years. It involves lots of post-it notes, with little drawings and sticky tape that I use to make sure I can reassemble things correctly. In this case, the video would have been sufficient, but old habits die hard. And, frankly, this is a good habit.

Even thought OWC makes this a straightforward process, Apple certainly didn’t intend it to be. You have to remove the speakers to really get at the battery. To get the speakers out, you basically have to remove all the guts:

Ready for battery removal
All The Innards… haruspices take note

The kit includes a gnarly solvent that helps dissove the adhesive holding the battery in place. This is the worst part of the process, although they provide gloves and eye protection to make it a safer process.

Once the machine was back together, I went through a full charge/discharge cycle, and it’s seemed quite stable. There are some weird minor discrepancies. For example, while writing this post and doing some other odd chores, I’ve been unplugged. The menu bar battery gauge tells me I’m at 81%, while CoconutBattery tells me I’m at 77.6%.

With any luck, this repair will help me keep Apotheosis up and running for a few more years!


Wed, 2 Jan 2019

Using Makefiles for Teensy Development on Mac OS

— SjG @ 9:24 am

Even if you don’t want to use the Arduino IDE for building your application, or want to do fancy things that only the evil, convoluted syntax of Makefiles can provide, you can do Teensy development on the Mac from the command line. While there are a lot of guides out there on how to do it, I hadn’t seen a complete step-by-step set of instructions.

So with no further ado, here are the steps for building Teensy applications on Mac OS using the Makefiles and the mighty command line.

  1. Download the Arduino IDE from https://www.arduino.cc/en/main/software and install it.
  2. Download Teensyduino from https://www.pjrc.com/teensy/td_download.html and install it.
  3. Download a “basic project template” for Teensy. The original is at https://github.com/apmorton/teensy-template but I’ve been using the fork at https://github.com/a-j-f/teensy-template which has been updated more recently and uses the Teensy CLI Loader for uploading to the device.
  4. Update the Makefile to set your Teensy model
  5. Type make to build, or make upload to install on your Teensy

If you’re wanting to monitor the serial console of your Teensy over USB, install a terminal program like CoolTerm. Alternatively, if you use Homebrew or MacPorts you can use a console-based terminal program like minicom. Once the USB connector is plugged in, your Teensy will show up as something like /dev/cu.usbmodem45504901. The communications settings will be 115200 baud, 8 bit, no parity, 1 stop bit.



Mon, 17 Sep 2012

Cambot’s First Campaign

— SjG @ 10:30 pm

Cambot is a project based on the Teensy development board. Cambot creates an infra-red “trip beam” that triggers a pre-focused Nikon D90.

To create an IR beam and detector that work in direct sunlight, Cambot pulses the IR source every 10ms, and compares detected signal between the on and off states. If it’s greater than a threshold, it’s considered a valid signal. The sensor also has a vary small aperture which is additionally shielded with a filter to reduce the ambient IR. When powered on, Cambot goes into calibration mode, which lights up an LED when it detects a good signal. This is critical for lining up the IR sources and detector — once a good signal is sustained for 3 seconds, Cambot goes into “armed” mode. When armed, breaking the beam will turn off the IR source, half-press the camera’s shutter for 10ms so the camera can compute exposure, and then fires off a burst of pictures before re-arming itself.

While there’s nothing in Cambot that couldn’t have been implemented with, say, 555 timers, counters, and gates, having the ability to drive digital logic with C code makes things much more flexible. When trying to determine the proper threshold values for arming and triggering, the ability to output hex data over the USB connector to a host computer was invaluable.

Here’s Cambot’s first run, when the trip-beam was positioned over a tempting milkweed blossom in the back yard.

If there’s any interest, I’ll post a circuit diagram and source code.