Plexitube Owl Clock

owlTickAnimationSmallFor Christmas I designed and built six steam-punk owl clocks that have a novel faux Nixie Tube display. Nixie tubes are wonderful with their glass tube bodies and brightly glowing numerals, but think how wonderful a solid-state low-power any color “Nixie Tube” would be!

The basic idea is that you position an LED at the edge of a piece of acrylic that has a pattern laser-etched into its surface, and the LED lights up the pattern. Long ago I’d realized that a stack of 10 laser-etched digits with an LED to light up each digit might have the same visual charm as a Nixie Tube, and the Plexitube was born.

I’m pleased with the way the project turned out.  I’ve put the software, circuit designs, and illustrator files up on github. I even made a short video of one of the clocks in action.  The project has even gotten some attention from Hackaday and won this Reddit unconventional clock competition.  Thanks a lot guys!

owlEyeElementsBackAndForthSmall

At the time it was unclear if light bleed between the layers would make the digits hard to read, so I sat on the Plexitube idea for a long time waiting for a project that could use that kind of display.

Then I went to work at a new company, and I had to spend an entire day listening to benefits summaries and corporate on-boarding. To pass the time, I started to do some sketches of an owl made from only two pieces of wood. I used my Swiss army knife to cut my co-workers’ name tags into owl prototypes. I really liked the design, and I thought it would be perfect for an owl-shaped clock with Plexitube eyes. Would this be this year’s Christmas Project?

I can’t really start a Christmas Project until after the Halloween Costume builds are done, but this project couldn’t really take shape until I’d at least tested the viability of the Plexitube. I figured if I just spent one evening laser-etching a digit stack and holding it over an LED, I could figure out if the displays were going to be an unreadable mess. If it failed, I could pull the plug on the owl idea before they got out of the paper prototype stage. So I spent one of my Wednesday nights making a prototype stack.

VeryFirstTestOfPlexitubeThe prototype stack had a lot of issues. The back digits where hard to read, there was a lot of inter-digit light bleed. I really couldn’t say for sure whether this was going to work. That’s pretty much the worst-case scenario for a make-or-break prototype. Really, I should have just stopped then, but I couldn’t stop thinking about the nice owl shapes.

The Impossible Project

Halloween came and went and I needed to decide. I even went so far as to do some prototypes of an alternative project that was much simpler, but I could tell that the owls were the ones that wanted to be made. I’m usually pretty careful planning one of these projects, and never before had I taken on one that had so many BIG unknowns. I’d never worked with surface mount electronics, never bent wood to such small radii, never designed a PCB with a lot of exact physical layout constraints, and never used an in-circuit programmer. I decided to go for it, but I knew I’d have to get first-time-success-lucky on a number of things, and I told my coworkers that I did not expect to succeed.

Two months and counting

realTimeClocksTime to make a lot of quick choices and order stuff from China. I chose the popular Neopixel surface mount LED as my light source. They could be any color and all 40 of them could be controlled using just one pin from my controller. I decided to go with the ATMEGA328p, which is the same chip in an Arduino UNO. I was building 6 clocks, so I’d need 240 LEDs. I ordered a reel of 500 from China, along with some surface mount capacitor and resistor assortments, photo resistors, and some DS3231 real-time clock modules with battery backup. Ordering things from China is very cheap, but it can take a few weeks for the stuff to show up, so I had to get that moving quickly.

Now ordering printed circuit boards from OSH Park takes something like 10 days, so I really needed to get that in the pipe. If the first set of boards were a complete blowout, I could still get a second order in, but I had to hurry.

lightGuidesCloseupThe LEDs I was using are much fatter than that 1/16″ acrylic layers I was using, so each layer needed to have a sort of integrated light guide leg that would stick out and sit directly above the 3 tiny color chips inside the LED. The alignment had to be exact. So I measured an 10-layer alternating stack of acrylic and black card stock to get the exact spacing, and then I had enough info to begin laying out the PCB.

 

 

OwlClockPCBTopI used Eagle CAD and finally had to spring for the non-free version so I could work with more than one page of circuit. I had to use some tricks with the Grid to get all the LEDs laid out in the exact right locations. After a full weekend of fighting with Eagle, I had something I could send off to OSH Park. I also quickly ripped one eye segment out into another file and ordered 3 small “test boards,” so I wouldn’t have to do my first attempt at reflowing a surface mount board with one of my giant and owl boards.

Then it was back to working in Illustrator on the design for the acrylic digit layers, black card stock separators, etc. I customized the digits of a font to make them slimmer. All the digits obstruct one another, so I wanted something that was lovely, but was mostly empty space so other digits could shine though. I also did some tricks like make the zero (which is in the back) a bit bigger/bolder so it would still read well though all the other digits.

Secret Symbols

Now on a clock there are 4 digits, but not every digit needs all 10 numerals. Heck, the tens of hours digit only really needs a 1. That leaves 9 layers for other special non-digit things. I could, in theory, have put some extra digits in the back of the tens of minute digit since it only goes 0-5, but I decided if I was going to be showing other info in those lower digits, it would be better to have all the digits there. I also decided to keep the 2 in the hour-tens digit so I could support 24-hour time in the future, and show a full year like 2016, etc.

I wanted to show the phases of the moon, sunrise and sunset times, moon rise and moon set times, etc. I used 6 of my 8 free digits doing the arcs of the moon. Because all the layers are at different depths, I staggered them so the arcs actually make a 3D sphere shape with the middle most arcs at the front. That left me with 2 layers. I used one for a sun outline that could be used along with the arcs to show things like the equinoxes/solstices.

The Magic Eye

That left me with only one free layer, which I used to add the outline of an eye. I realized that the arcs could be used to animate a slit-pupil eye looking back and forth. Of course I needed that! My owls eyes have eyes?! Yes … yes they do.

Plexitube Assembly

eyeElementBeingStackedEach eye element can display two digits, and they are laboriously assembled by stacking 20 digit layers and 20 paper masks on 4 brass pins in careful sequence. Thankfully, the digit layers were fairly easy to keep track of because they already had digits etched into them! Each acrylic layer has to have its protective plastic peeled away, and its etching scraped and dusted. Because the pins are press-fit, I had to carefully push them down on the pins without cracking the 1/16″ acrylic. The first stack took me 2 hours to assemble. My finger nails were frayed from all the plastic peeling and I had 11 more elements to make. What had I gotten myself into?!

eyeElementBack

First Reflow

solderPasteStencilingFinally the owl boards came! I had also ordered a solder stencil from OSH Stencils. When making a board like this, the basic process is a bit like silk screen printing. You position the PCB under a stencil and squeegee solder paste though the stencil holes onto the board. Then you place all the itty-bitty components onto the board with tweezers. Finally you oh-so-carefully put the board in an oven and heat it up until the solder paste melts and the parts all snuggle down exactly into place via surface tension. A while ago, I had built a special computer-controlled toaster oven in order to do just this process, but I had never used it!

intoTheToasterI kept waiting for my test boards to show up, but eventually I gave up and decided to do my first reflow on one of my giant and indispensable owl boards. I populated the board, put it in the oven, and pushed the button. Then I held my breath as the oven went though its 3-minute cycle. Success! The board came out looking perfect! It looked like something totally commercial, not something I’d made with tweezers and a toaster oven. MAGIC! Surface mount is awesome. I’m never going back!

fiveOfSixBoardsForOwlsOk, so the board looked like it was all soldered up, but would it work? I hooked the LED chain on the board up to an Arduino UNO (remember how those NeoPixels can be driven by just 1 LED?) and some quick code showed that all the LEDs were working! I blinked each one red-green-blue to test and they passed with flying colors! *phew*

owlClockDigitTest54Now for the real question: would the digit display actually look good or was the whole thing going be two months of work for an unreadable mess? I wrote some code to cycle though the numbers and positioned the eye module over the LEDs. It sort of worked, but it wasn’t great.There was quite a bit of cross lighting between digits, especially between digits 1 and 2.

I was extra sad I’d left that 2 in the hour tens digit. No one wants to look at a clock and not be able to tell if it’s 11:14 or 22:14. Something really needed to be changed. But what? I did, however, decide to get my second round of PCBs made. OSH Park sends out 3x boards, so if I wanted 6 by Christmas, I’d have to order the second round pronto.

OwlLogoI spent an evening designing a nice owl icon to put on the second round of boards, added two regulator bypass pins, and then sent the thing off. No time for anything fancy. It turns out the icon was a fail.  Even though I followed OSH Park’s guide lines it did not render properly.

 

Eerie Is Good

plexitubeCloseupOne thing I did notice while I was running that test is that although the digits were not yet crystal clear, the whole thing had a very eerie feel to it. It was almost as if I couldn’t quite tell what the heck kind of technology I was looking at. It sure didn’t look like LEDs. The layers of acrylic have a wonder full “hall of mirrors” effect on the lit segments.  I also noticed that the light bleeding off the tops/sides of the eye element were kind of hypnotic to watch go through their sequence. I had originally planned to cover the elements with a ridged copper cylinder segment, which would have looked steam punk, but not as strange/cool as that bleeding light. I decided to leave them uncovered.

Back To Body Work

Now that the boards and the eye element design were mostly settled, I had to get back to figuring out how to design the bent body of the owl. I did a second pass of designing the body in cardboard. I knew that trying to bend 1/8 plywood into a loop maybe 3 inches in diameter was going to be tricky and might be impossible. In a recent build, I’d used laser “kerf bending” to make it easier to bend curves in thicker plywood. Could I take that to an extreme? MicroKerf Bending™? I tried spacing the kerf cuts .1″ apart, cutting almost all the way though the plywood. The results where a satisfyingly bendy piece of wood. Still the owl has some very wide sections at the top of his eye arches and those were still quite stiff. Too much variation to be able to bend into a loop.It would have been nice to write some sort of script that would space the kerfs closer/wider based on the overall width of the piece, but I had to settle for just doing a few different spacings by hand.

owlBrowClampThe brows above the eye were delaminating when I’d apply the bend. That was bad. I fixed it by pre-sanding the upper layer thin in those areas and by putting a few little spring clamps on those edges during the bend. That solved the problem, but all these iterations on the body design were burning up time at a crazy rate. Would I make the Christmas deadline!? Here I’d been thinking I was saving time by having most of the owl form come from just one piece. So wrong.

Steaming and Clamping

owlInClampingJigI built a clamping jig out of a big board and carved away clearance for the owl feet. I’d steam an owl body in a pot on the stove and then bend it with my gloved hands whilst racing out to the garage to clamp the body around the face in my special jig. The first time I did this the face of the owl split in two! Yes, when the body is looped back on itself and clipped tail to feet the forces on the face are nice and balanced, but while you’re bending that around the forces on the face are actually pretty big. So I changed my clamping jig so it would support the face during the bend. Finally, it worked!

boardInOwlTestI had a lot of other little issues. I had to add some “foot prop” pieces so I could have a way of evening out feet after the main clamping was done. I thought I’d be able to adjust the owls stance by adjusting the tail angle, but a sort of scissoring action made it so any amount I pushed up the tail also pushed up the feet, canceling out the adjustment. So the owls look down a little bit more then I’d like. That’s okay though because they like to nest up high.

owlsOnTheClockFaceI wish I could have used 1/8″ mahogany plywood. Then I wouldn’t have had to deal with staining the outer body. However, that’s not something I can get locally so I was stuck with stain. I hate stain. I tired pre-staining, which gave nice crisp edges at the stain boundaries, but that made the gluing a lot weaker. I tried post staining with with pre-clear coating areas to try to reduce bleeding over, but it still bled some and required lots of awkward sanding to fix. If I had it to do again, I’d try to get hardwood ply. I did eventually get them all glued and stained.

The Secret Sauce

secritSauceUnderSideOfEyeI’d been thinking about my eye element problems. How could I improve the contrast? I already had black card stock all over the place blocking as much light as I could. I realized that as tight as the fit was around the card stock, there were still micro gaps, and the light leaks I was seeing were probably coming right up from the LEDs and into the clear bottoms of the other segments. I decided to use a small brush to paint some black acrylic into those areas! EUREKA! That fixed the problem entirely and now the displays looked great.

Christmas Eve

owlClockInFrontOfTreeIt was Christmas Eve, and I was still clear-coating owl bodies. Applying wood finish on Christmas Eve is par for the course for me. The big issue was that I was still driving the displays from a separate Arduino and hadn’t fired up the on-board computer at all. I spent a while reading about fuse bits and fighting with boot loaders, and fiddling with Arduino IDE config files. Had I made some mistake with as-yet-untested parts of the PCB? Could I get lucky one last time on this “impossible” project? Yes! At last, I was able to program the chip on the clock board, get the real time clock synced with Greenwich Mean Time, and put enough code in the clock that it could actually display the time! The clock could go under the tree.

Software in the New Year

Early on I had decided to punt on all but the most basic software until after Christmas. I had pages of ideas on fancy software features, and I knew I’d have enough trouble just getting the things physically built by Christmas. This was going to be a Christmas gift with an eventual “firmware upgrade” gift chaser.

owlSimulatorExplodedViewI knew there was going to be a lot of software, so I wrote a iPhone owl clock simulator to give me an easier platform to develop some of the code. I had been reading Jean Meesus’ Astronomical Algorithms, and I wanted to have the clock not only show the phases of the moon, but be able to display sunrise/set times and moon rise/set times.

I had included a light sensor on top of the clock so the clock could dim a bit when it was in the dark, but it could also tell if your hand waved over the clock and maybe then it would cycle though showing the sun going though sunrise colors while showing the sunrise time and the show the sunset time while cycle though the sunset colors.

Color Picking the Old Fashioned Way

colorPickerWithThreePotsAndUnoI really wanted to use nice colors in the clock, but just choosing 3 numbers for Red/Green/Blue doesn’t tell you what those are going to look like in the final display.  I needed a way to search for good colors.  So I made a super simple color picker by hot gluing three potentiometers to a board. I used an Arduino UNO to read the three RGB values and display the color on  a jury rigged LED + acrylic digit. Go Go gadget gaffer’s tape! The program would print the values out to the serial monitor.  That way I could find just the right pink by fiddling with the knobs and then write down that RGB triple from the screen.   I used that to make a whole pallet of colors I liked.

The Trouble With Doubles

The big problem was that most of the Astronomical Algorithms need double precision math. The solar system is big and you need the precision, but the Arduino tool chain doesn’t have real double precision math. I spent a while (stupidly) writing a math lib that did approximate double precision math using two single precision float values based on this paper targeted at GPU computation with floats. I did get the math working, but to my horror, I discovered that the code it produced to compute the equinoxes/solstices was so huge that it didn’t fit into the 32k of memory on the ATMeg328p. That was a huge waste of time. I did, however, use the code to generate the next 100 years of solstices and equinoxes and compress them down into just 100 bytes of Progmem, but the sunset/sunrise times were doomed. I went back to some still usable moon calculation code so the clock can show the current phase of the moon.

Then I wrote a lot of silly features. On the clock recipient’s birthday, it displays in their favorite colors. (And on their kids’ birthdays, their kid’s favorite color, etc)

I wrote all the code to set the time/date/gmt offset with nice auto repeat ramp ups and useful icons. (When you’re setting the month a sliver of moon shows, when you’re setting the day there’s a sun icon, etc) I even used the right arc of the circle to show AM and the left arc for PM like they were the first and second parts of a 24 hour clock face. Not that I expect people have to set the time/date much, but a clock needs to do that.

The clock counts down to midnight on New Year’s Eve and shows fireworks and a spinning golden globe at midnight. On JRR Tolkien’s birthday, the the eye of Sauron looks around and sometimes a golden ring spins and the digits are red and fade up and down like like a breathing beast.  etc.  I don’t want to give to many surprises away.

Needless to say, there are a year’s worth of Easter Eggs in the clock code, even on Easter.

Two Words “Optical Theremin”

photoresistorsWhen I was working on the auto-dimming feature, I wanted to have a direct readout of the light sensor, so I could fine tune a mass/spring system for the dimming rates. When I first hooked it up, I realized that with a much stiffer spring it was pretty neat to play with. You’d wave your hand over the clock and the digits would smoothly go up and down. It was kind of mesmerizing.

I was showing it to a friend, and when I started waving my hand around he said, “Wait, it has a Theremin too!?” and the Optical Theremin was born. I hooked that code up to the hue of an hsv conversion and now when you press the down button, you get one minute of “Optical Theremin” where waving your hands around changes the colors and numbers in a soothing and lovely display of Plexitube awesomeness.

It’s hard to stop writing code for the clock, but after the “Optical Theremin” feature, I started getting close to the memory limits and I decided to call it quits. It was time to give out festive springtime firmware upgrades! I had been trying super hard to have the code all done before the spring Daylight Savings Time change because people had clocks they couldn’t set! I only missed that deadline by a week. I blame double precision!

owlTrustBuidingExercise

Clarence was starting to think that perhaps this hazing ritual was going a bit too far…

Make Time Lapse Candle Videos

Timing a Birthday CandleWhile waiting for my project’s Printed Circuit Boards to arrive, I decided I should try shooting some more time lapses.  I won’t be able to design the iPhone software until I get some more experience.  I wanted to figure out some sort of time lapse that wasn’t crazy long.  That way I wouldn’t have to worry as much about ambient light changes, and I could try out different things quickly. I picked up a pack of birthday candles at the super market.  How long does it take one of those puppies to burn down?

I timed one, and it came in around 15 minutes.  Perfect.  Now all I needed was a better background.  As nice as peg board and cobwebs are, they weren’t the best back drop for my first time lapse, so this time I went that extra mile. I put a rusty steel plate behind the scene, but I still had to cover the base of a lamp. I decided to use a lovely wooden cutting board that my uncle had made for us. Alright, the stage is set. I completed my first candle time lapse.  That one went ok.  I was pleased by how the spirals on the candle sides make them look a bit like the tops are spinning down.

Blue Candle Lost SequenceThe one downside to shooting time lapses involving fire is that you must have a fire extinguisher handy and keep an eye on them the whole time.  None of this “set it off and go to bed” crystal growing luxury. One mistake I made was that I lit the candle with a match and accidentally clonked the candle while I was doing it.  For my next shot, I wanted to set up a bunch of candles and light them incrementally.  I rushed to the corner store and bought one of those butane BBQ lighters.  Now I was ready.  My first shot had been a bit short because the candle didn’t burn all the way down before the preprogrammed time lapse ended.  I guess my 15 minute test included a little bit of me blowing on the candle, which really shortens the burning time because it melts extra wax.  Also, this time I was going to be lighting them incrementally.  Best not to have it run too short, so I switched to a 28-minute duration.  I used the stopwatch on my phone so I could light the candles in 30-second increments.

I really like the idea of performance time lapse.  It’s kind of fun dodging in and out of scene between camera shots.  After 28 minutes of watching the candles burn, I rushed inside to squeeze all those stills into a movie.  OH NO!  This time there were no frames on the SD card. I’d wasted the entire shoot. What happened?  I still don’t really know. I’m using CHDK so my camera now has about 8 zillion tiny menu options, and eventually I just reset everything and re-enabled the USB remote feature.  Then it worked again.  It was so weird because during the entire shoot it was acting as if it were taking pictures.  Now I know to really watch the “remaining frames” number and make sure it’s actually going down.

Red Candle Disaster Waiting to UnfoldI did two more shots: a green one and a red one.   For the last shot, I  propped the camera rig up with some clothes pins on top of an empty cardboard box so I could have a shot looking down on the candles.

The Mystical Garden Poltergeist Wreaks Havoc

I sat with the camera until all the candles were out, and then I left.  When I came back, I found that the camera had flopped forward and done a face plant on the rocks!  In a panic, I tested the camera, but it seemed to be working.  While looking at the time lapse frames, I noticed that at the frame where everything went wrong the words “Mystical Garden” were eerily smeared across the rock.  Was the ghost of my previous time lapse jealously haunting the set?  No, but almost as miraculously, the camera shutter had been open during the exact moment of  collapse and had taken a smeary photo of the nearby box my crystal growing set had come in!

fallingCameraPhoto

 

I hear by swear off the Cardboard Box and Clothes Pin Mounting System.  Time to build a tripod mount and lay this Mystical Garden to rest. You can see all the candle time lapses here.

Building an Arduino based Motorized Camera Rig

I’ve always wanted to make a time lapse video. It’s like building a machine to catapult forward in time.  What could be more fun?  I really feel like the best time lapse videos integrate camera motion to give the scene an additional compelling dimension. I spent a couple of evenings building a quick and dirty motorized camera slide from a dead inkjet printer. It was a failure.  It was unable to produce the slow steady motion needed for video, much less the kind of control needed for time lapse.  I started to think about what a serious system with substantial time investment would have.  It could be bigger and have at least two-axis camera motion.  It would need a bunch of software with some way of key-framing the camera motion, maybe an LCD display, maybe a pendant control for stepping/snapping frames without jiggling the camera.  What else?  A way to power and auto-trigger the camera for time lapse.  All in all a much, MUCH bigger project.  OK, if that’s the end goal, what’s a good first step? I’m always wary of  physically big projects. As the size goes up, costs go up. Big projects are harder to get into/out of the car, take up more workbench space, and ultimately collect dust in a bigger way.   If I can fit a project into a single project box, life is simpler.

Bigger Motor ControllerSo instead of embarking on a large two- or three-axis rig, I decided to build a very small one-axis rig.  Heck, I already had a small one-axis slide.  This way I could get my feet wet with the software, LCD, motor controllers, and all the other fun stuff, but without as much schlepping. A friend of mine pointed out that a little motorized stage like that could also be used for focus stacking, and he’d been wanting to build a focus stacking rig.   He sent me little linear slide with a stepper motor drive and a tiny ball screw.  I’d never seen a ball screw that small!   It was sweet!  I poked around on Amazon and ordered a A4988-based stepper motor driver the size of a postage stamp.  They were cheap, small, and the data sheet made them sound like they were doing a decent job with the microstepping, which might be useful for very precise focus stacking.  I used to build stepper motor drivers out of discrete components, but it’s unbelievable what you can get these days for not much money. I’ve been itching to try some of the pre-made ones out, so I ordered the stepper motor and a much bigger driver board based on the TB6560, mostly because I was having trouble convincing myself that a driver without a heat sink was really going to be able to do the job. And even the big one was cheap.  It was less than $17,  including two-day shipping to my door. I’d also been wanting to play with some of these cheap LCD displays I see around, so I ordered a 4-line 20-character blue one that Amazon Primed its way to my house for $16. I ordered the blue one because a green-and-black LCD was going to make the project look like it was from the early 90’s.  I ordered one that had an I2C daughter board because I wasn’t sure how many IO pins this project was going to need, and I didn’t really want to burn half of them driving the display. When the display came, I was bummed that they’d shipped me the green and black version, not the blue one!   I set my time machine for the early 90’s and kept moving.  I wired up the display to an Arduino Uno.  I downloaded the Arduino IDE and a library to drive the display.  I wired it up like this:

Screen Shot 2014-04-23 at 8.44.48 PM

Then I ran this exciting bit of code.

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

//Addr: 0x3F, 20 chars & 4 lines
LiquidCrystal_I2C lcd(0x3F,20,4);

void setup()
{
 lcd.init(); 
 lcd.backlight();
 lcd.setCursor(0, 0);
 lcd.print("Hello World");
}

void loop()
{
}

Two DisplaysThankfully, it just worked.  The text was super crisp and readable.

I was still a bit bummed about the color, so I decided to roll the dice and try ordering the blue display again.  I’d be able to compare the two colors side-by-side and see which one I liked best. This time I did get the blue one. It worked and was crisp and clear.  Our eyes don’t like focusing on dark blue things though, and if I had to be brutally honest I’d have to say that the green display was more readable.  I decided to switch to the blue one anyway.

Special CharactersI wrote a little program to page through all 256 characters that could be sent to the display to see what sorts of special characters might be available.  There were a few useful ones like left and right arrows, the deg symbol, and a solid block character which I might actually use in my interface.

The next step was to put the various parts I was thinking about using together to visualize how things were going to fit.

Component Layout And Sizing

I was originally going to mount everything to the side of the motorized stage so I could cut down on external wiring.  I could even put the end-of-travel sensors inside the project box.  But it was starting to look 10 pounds of project in a 5-lb bag.

The project box was big, and it was going to have to be right under the camera or using it would be uncomfortable and trying to manipulating it would jiggle the camera.  Those issues seemed like deal breakers.  The next plan was to put the control box at some distance from the motor and make a separate control pendant that could plug in.  I’d need OK and Cancel buttons and some sort of spring-loaded pot for jog control.

Remote Jog WheelI went poking around at the local surplus store and scored a VCR remote with a nice spring-loaded jog wheel.  It even had two buttons inside the wheel, so I thought my control pendant problems where over.  I’d wire up the jog wheel/buttons through a phone connector to the main control box, and I’d be all set.  However, when I dissected the remote, I found that the jog wheel was not a pot.  It had 3 digital pins providing gray code position info.  That meant only a few jog speeds in each direction, and it meant I’d need more lines than a standard phone cord.  Back to square one.

Spring Return PotI decided to take a stab at adding my own spring to a pot to make a “return to center” jog controller.  I drilled a hole through the pot’s shaft and bent up a spring.  It worked. After some fiddling, I was able to make it control the motion of the slide.  It had a really sloppy feel to it. The center was always just kind of approximate, and it was harder to turn in one direction than the other.  Kind of a cruddy experience compared to the feel of the remote’s nice jog wheel.  I decided to punt for a while and work on other parts of the project.

End of Travel SensorsI wired up the end-of-travel sensors.  I was using IR gap sensors for a no-contact way of measuring the travel.  Now that the sensors couldn’t be mounted inside the project box, I decided to make them fit inside a bit of metal wiremold that I had lying around.  I used some Bondo to hold the sensors at the correct height and support a phone jack at the end so the sensors could be easily connected up.

This was by far the most annoying part of the entire build.  The phone jacks turned out to be back-stabbing fiends.  Fitting everything in the wiremold was annoying, and I had a wire tear out when I was closing it up.  Then the sensors weren’t working, so I ripped everything apart trying to figure out why. I had accidentally grabbed a two-conductor phone cord even though I’d  purchased a 4-conductor one. Then when I finally figured that out, I failed to realize that when using phone connectors, the wires get flipped from left to right so red on one end becomes green on the other, and black becomes yellow.  *Smack Forehead*  After I figured that out, I thought I was home free, but it still didn’t work.  I finally traced the problem to a poorly designed jack where the connector could clip in, but was still not fully seated and wasn’t making contact.  After that got resolved, everything was fine. But I’d burned an entire afternoon trying to run 4 wires a few feet.

Quick Release Plate MountedI got a super cheap quick-release plate.  When I was taking it out of the packaging, a spring and pin fell right out of the bottom.  I deemed them to be unnecessary and threw them out.  Then I noticed that  the cam lock tends to slowly unscrew and the screw can’t actually be tightened properly without making the cam hard to turn.   A dab of Loctite could solve that.  Hey, it was cheap!  My only regret is that I wasn’t able to mount it so the cam stuck out the same side as the wiremold.  This would have made the whole thing more compact left to right, but that might have required tapping some blind holes, and this way around it was simple to mount.  Just a 1/4-20 though an already existing hole in the carriage.

LCD Rig Wire MessI had all this wired up to an Arduino Nano.  It could jog the motor when I twisted the pot, and it could read the end-of-travel sensors.  Next was to start designing some UI for the LCD.  I played around with being able to highlight various menu options by quickly toggling the solid block character behind them, etc.  It all seemed doable, but it was kind of tedious Arduino development. I kept thinking “How is this going to scale up for multi-axis key frame animation craziness?”

 Massive Feature Creep Occurs

It was then that I noticed Bluetooth LE boards for the Arduino.  Could I control my whole rig from an iPhone app? I could ditch the LCD, buttons, pendants, and all the associated wires and connectors.  I could make the project box smaller.  I could write an iPhone app to do the interface heavy lifting, and I’d only have to do a moderate amount of stuff on the Arduino end of things.  No more planning out of awkward LCD interfaces.  Plus, it just sounded fun!

Blue Tooth ConnectedSo I ordered one of the boards, and I was off to the races. Adafruit’s page about wiring up the board is very clear, and I hooked up an Arduino UNO just to try it out.  I was able to get their UART echo communication going right away.  Simple, Pimple.

The next test would be to write my own program to establish the Bluetooth communications and see if I could use a slider to jog the motor.  I wanted to test the latency and to see if stepper motor switching noise would affect the communications.

The great thing about Bluetooth LE is that you don’t need any special licensing.  I spent one of my precious Wednesday nights ripping the com parts out of the Adafruit example and sticking them into my own simple app.  The app just had a connect/disconnect button, a connection status indicator, and two end-of-travel indicators. The communication is only 9600 baud, so I made a special jog loop the Arduino could go into where the phone would keep sending single bytes of  jog slider info, and a 0 would indicate that the jog portion was done and go back to the main loop.

The very first version wasn’t wired to anything. It would just indicate end-of-travel limits having been reached if you slid the slider close to the end of its travel path.  After tracking down an issue with a rough signed char, I got it working. The latency was quite low.

Jog Actually WorkingNext up: rewire the Nano to remove the LCD/knob and wire in the Bluetooth LE board.  Then I’d be able to jog an actual motor. I powered it up and could hear the motor making some ticking sounds, but jogging wasn’t working.  I went to hook up the scope and bumped the alligator clip that was providing motor power.  It touched something on the board, and the Arduino’s LED’s went out.  Yup, I’d fried the Nano.  Ouch. Oh dear. Had I fried the USB port on my computer?  Apparently not. *phew* No need to panic.   I did not, however, have a spare Nano on hand.  Trying out the jogging was going to have to wait until next week.

Jog On OscilloscopeIn the mean time, I rewired some parts of the protoboard to make it a bit less hairy.  I don’t want accidental short circuits killing things, but I also don’t like clipping the leads on resistors and caps.  When the replacement Nano came, I decided to only connect motor power after I was reasonably sure the other things were working.  I  used the oscilloscope to see if the Nano was producing the expected step pulse trains.

Yup, that seemed to be working.  With some trepidation, I decided to try and hook up motor power again.   Nothing burned out, and it worked!  Next I needed to see if the limit switches worked. I jogged the stage all the way down to the end, and one of my limit indicators on the iPhone started flickering like crazy. But it was the wrong indicator. I swapped near/far sensors and added some software switch debouncing.  The slow linear ramp of the limit sensor was producing a lot of noise when it got close to the logic level boundary.  I’d love to run it into a nice Schmitt Triggered gate.  That would keep the software nice and clean, but if I was going to have PCBs made, it would add area and expense.

I could have made them go-to-analog inputs and just used two thresholds.  That’s probably what I should have done, but  stepping at 1/16 of a step was putting me at 54400 steps per inch, which was really taxing the powers of the accellStepper library and I didn’t want to add much to my inner loop.  That’s probably silly of me and adding two analog reads to my loop wouldn’t matter. Instead, I did digital reads and required a large number of matching consecutive answers before alerting the iPhone. Probably over complicating the code since the real bottleneck in accellStepper is probably its use of millis() not a couple of  analog reads.
Camera On RigNext up was to install CHDK on my camera and see if I could manage to use a USB cable to act as a remote shutter switch.  CHDK runs on various Canon cameras and lets them do things they normally couldn’t.  My camera (a Canon S100) didn’t have a way of remote triggering, so I had to hack it with CHDK  to do that.  You have to make a special bootable SD card.  I used a tool called STICK to analyze a photo taken by my camera, determine the exact firmware in the camera, and download and format a bootable SD card.   This made setting it up simple.  Then I went through a maze of  menus to turn on remote shuttering. I wired one of the Nano’s output pins to my camera’s USB port and wrote a snippet of code to take a picture. It worked! Right now I hold a line high for 1 second, and then it takes a photo when the line goes low. I haven’t tried running a shorter cycle.  Maybe with manual focus/metering it could take photos more quickly.  I haven’t tried.

timeLapseStagetimeLapseSetup

I had motion, I had photo taking. It was time to try and do a time lapse with this rig. I took it over to my son’s Lego studio area and set up a magic crystal garden I’d purchased online.  I used fun-tack and clothespins to aim the rig, plunked an old calendar photo of clouds in the background, and we were almost ready to go.  I set all the camera settings to manual. Then I set the code to move though the system’s full range of motion over 10 hours, taking one frame every 2 minutes for a total film length of 10 seconds.

I waited until it was dark, and I fired off the time lapse.  It felt like Christmas Eve,  and I didn’t know if Santa was going to leave me a time-travel movie or a lump of coal. I told the kids we couldn’t go into the garage for 10 hours. In the morning, I went out to see what had happened.   The first thing I noticed was that one of the big chunks of foam I’d taped up over the garage windows had fallen down during the night.   Oh, oh.  Still, the crystals were fully grown and there were 300 photos on the camera, so it was time to try and play them as a movie.   Unfortunately, iMovie only lets you specify still frames down to 0.1 seconds in length, so you can’t really make a 1/30 of a second one-frame-per-image movie.  Argh!  Photoshop can do it, but that requires loading all the frames into layers. On my machine, loading in 300 big 3000×4000 pixel images was taking for-ev-er.   Finally, I just downloaded some freeware frame encoding tool and used that to build my time lapse.  Then I could use iMovie to add title, fiddle with the sound, etc.  By 11am, I’d finally managed to unwrap My First Time Lapse.  It was over-exposed and didn’t have great focus, but the kids thought it was cool.  Success!

 

crystalsFinalState