Linear Clock—Part 6

Unless designed to do so, it’s generally bad when your electronics project bursts into flames. That said, I learned something yesterday (I also need to file away a “Pyrotechnic Clock” for a potential future project).

One of the issues I’ve had with this project is that I don’t really have a good space to work on it where my kids won’t get to it, so I have only sporadically hauled it out of the basement and up to the kitchen counter after the kids are asleep–done a little soldering and packed it all back up and down into the basement.

I think that work-flow really bit me yesterday. Having gone through a few different iterations, and tests with steppers, I found a complete single axis that was about the right size, with a 1204 ball screw, so I decided to buy it. After letting it sit for a while, I started looking through the rest of the system and found that the stepper motor included with it required a 24v power-supply. No big deal. Order a new power supply and wait a few more days. New power supply arrived, and I finally took the time to get back to work on the clock. Unfortunately, it had been quite a while since I reviewed system requirements for the rest of the project–including those printed right on the parts. The metro’s stepper motor shield accepts power supplies from 5V to 12V. Adding in a 24V power supply is a good way to buy a new motor shield. On the bright side, it is immediately apparent that you made a mistake, so the amount of time where you think (falsely) that you’re making progress is minimized.

After I set the electronics on fire, I decided to focus on what parts of the system I still had.

First, remove the 24V stepper motor and see if the 12V motor fits. Answer: Yes. Alright! The resistance of the ball screw is pretty slight, so I don’t anticipate an issue driving it–but what’s the worst that could happen? It catches on fire and my children die a horrible death? Oh yeah…that. I should probably look at heat sink options for stepper motors.

Second, look for ways to mount the limit switches at each end: It looks like there are troughs in the rail that you place hex nuts in, so I can create my own little brackets that mount directly to the rail and hold the switchs.

The troughs are on the top and bottom of the railing, so this will also work for mounting it to the housing.

Finally, it was time to solve the issue of occasionally hauling everything out. I setup a desk in the basement. It’s really true, the simplest solutions can evade you for excessively long times. I find myself occasionally thinking of Jeff Bezos’s story about packing books on the floor of a basement he was renting out in the early days of Amazon, and lamenting to a coworker that they needed knee pads, and the coworker saying, “No, you idiot, we need packing tables.” I find a lot of comfort in that story.

Ultra-martian

I have been reading about people building bots to generate stories, summaries, and movie plots etc using Markov Chains. I thought that sounded sort of silly, so I wrote one to come up with Machiavellian advice.

The first method for estimating the intelligence of a ruler is to look at the robots he has around him.

I had the bot read “The Prince” and then generate a series of sentences. I found a copy on Project Gutenburg and had to get creative to skip oddly-formatted foot notes and chapter headings, but generally it seemed to puke out a Machiavellian sort of pigeon English.

Mostly, it’s jibberish—but there were a couple gems. This got me thinking: what if you hooked your Markov chain output to a grammar auto-correction tool like NLTK’s grammar library? Would that make Botchiavelli seem more human, or make his points more decipherable? I haven’t gotten all the pieces in place to test that yet, but Botchiavelli shall rise and show us the way to true power.

Linear Clock Project: Part 5—Testing Bits

I finally got my hands on a CR1220 battery for the RTC chip. The RTC works great! Now I have to think about how to mount it. I will probably solder a plug for it to the stepper motor shield, but for now working on a tiny breadboard is fine.

I ordered some 8mm shafts, support bearings, and a few 7mm inner/20mm outer oil gaskets, which I’m hoping will give me sufficient pressure to keep the gear in place on the drive shaft. If so, that pretty much sorts the chain drive. It occurs to me that no matter what, there will be some sagging in the chain, and the display will be subject to jostling–which will make the hour hand shake.

Given that I’m going to use a limiter switch to speed the hour hand around when it gets to the end of the day, I’m thinking maybe that CNC ball screw linear actuator was a better choice after all. Well, I can satisfy myself that if I completely destroy everything in an attempt to make this work, I have a damn good back-up plan.

I might also be waffling because I found a really small linear actuator that runs 12v/1.2A online for less than the kit I had originally purchased without a motor. It’s adorable—and I may have bought it already. I guess I just need to come to terms with the fact that I’m going to build two different versions of this clock. One will be a Rube Goldberg bicycle parts one, and the other will just be an hour-hand mounted to a CNC axis.

I did buy a stepper motor shield for a raspberry pi at the same time that I picked up the arduino, so I suppose I can at least use it to learn to do the same thing in C++ and in Python.

9546424173

So far, I have the following:

I can’t find a CR1220 battery for the RTC–which is causing some interesting errors in testing. I tried to buy some on Amazon, but they won’t be here until after the new year—and apparently Seattle doesn’t have anywhere with a reasonably extensive battery selection. I don’t really want to drive to Renton to go to the Fry’s out there. It’s like going to an amusement park that has fallen into disrepair.

I have been able to test that I can make the Stepper motor turn clockwise, and counter-clockwise. I’ve tested that the Metro recognizes the RTC, but the datetime that comes back is 2165/165/165 which I assume will go away once there is a battery in the module and I can really set the time.

I’ve been looking at patterns to solder the RTC to the stepper motor shield, so I can stop using a breadboard, but won’t do that until I have the RTC driving stepper motor actions—also waiting on the CR1220 battery.

False-start

I thought I’d take the easy way out and just buy a 650mm CNC ball screw, because that would be a lot easier than building out a system to suit.

Unfortunately, Amazon shipped me the 600mm version–which was shorter than the ruler I’m using to display the hours, and the 650mm version is no longer available. So I packed up the one they sent me and sent it back. The more I think about it, the more I want to build it with a chain drive and bicycle parts, so I’m not too sad about the issue.

It’s increasingly possible that my son will be able to read a clock or have a counselling break-through before this thing is actually finished, but I’ll keep plugging away at it.

Solidifying the chain-drive plan

I think I figured out a way to keep from needing a chain length 3x the size of the display. If I add a diverging that is triggered when the hour hand gets to the 24, I can have that trigger a fast-forward to bring it around to ZERO. If I want to reduce rotation when it hits ZERO, I can use 2 hour hands 180° apart.

The RTC will ultimately determine how well the system keeps time—so there’s little problem if the switch lines up just before or just after midnight. The switch closing will return it to ZERO and that process happening every 24 hours should keep any small drift from compounding over time. This will also give the system something to zero itself against if it loses power and needs to run setup to get back to the RTC time.

I ordered a couple of 11T derailleur pulleys and a chain. I think I can probably remove the rollers from two links in the chain and thread in connections for the hour hand—so that’s one problem potentially solved. I’ll need to pop out the bearings on one of the pulleys and fit it to a drive axle that I can connect to the stepper motor through a set of support bearings, leaving me with a couple problems to solve:

  1. Attaching a derailleur pulley solidly to a 5 to 8mm drive axle.
  2. Designing a tension system for the chain.
  3. A bunch of programming in C++.

9293545964

In a word, “Fantastic!”.

For all of my science fiction reading, my favorite books tend to wind complex yet plausible religious/political intrigue. I love to read authors who define the ambitions of opposing forces not as “good guys” and “bad guys” but as forces fighting for their own interests in a landscape of scarcity and ambiguity. Such books require an uncommon level of insight and empathy from their authors.

My strongest impression of this in science fiction to date (prior to picking up “The Lions of Al-Rassan”) was in Dune: wherein you find yourself absolutely along for the ride with Paul Atreides, but you are never unaware that he’s caught in a power struggle far larger than himself; and is not a victim of unscrupulous people, but rather a player.

The Lions of Al-Rassan takes this approach and adds depth to the political and religious power struggles. I have no doubt that the fluidity and rationality with which the various conflicts arise is a direct result of Kay’s historical research into the setting that he used as the basis for his book: the Christian conquest of Granada. You may feel like it’s cheating to off-load the work of building your basic plot framework by taking one that already exists in history. But by doing so Kay has given himself a great gift: a complex and plausible backdrop to explore the interactions of good people on opposing sides of inevitable conflict.

My only complaint is really more a complaint of my brain rather than the book. Because it follows the story of the Fall of Granada so closely, Kay opted to use common names to the historical groups actually affected–including retaining the actual names of monarchs. I find it difficult to track a lot of uncommon names in a story, so resorted to looking up a character list and writing out a chart so I could keep the various pseudo-Muslim/Spanish/French/Italian characters arrayed in my head.

This kind of fiction, both historical and fantastical is my very favorite kind of fiction. It’s expanding in helping the reader relate to people of other cultures, provides a high level of political realism, and is unpredictable for being sufficiently removed from a real history that the author can depart where it serves a story. This type of alm0st-history shines when served by a clever, empathetic, fastidious author such as Kay.

Fundamentally, this story feels more imbued with humanity than any science fiction I have read before. I am warmly appreciative to whoever it was that suggested this book to me, and excited to read through Kay’s other work.

Linear Clock Project—Part 3: internal bits

I decided to pick up a stronger stepper motor: a Moon Industries NEMA17, partly because I don’t have much faith in the tiny stepper, but mostly because it met the specs of the example stepper motor files that adafruit put up.  After about 2 hours of troubleshooting the connection between my Metro 328 and Arduino IDE, I discovered that I am an idiot and had selected a Metro M4 in the board drop down, when the 328 is an UNO compatible board, so I was just checking everything else for no reason.  After that, loading up the example file was straight forward and now I have a working stepper motor. I still need to solve timing steps and determine step sizes. This is compounded slightly by the motor setSpeed, step styles, and quantities all not appearing to do what I would think when I change them. I would think myMotor->step(50, FORWARD, MICROSTEP) would make larger steps than (1, FORWARD, MICROSTEP), but I went to public school, so if 50 isn’t actually greater than 1, I blame my first grade teacher for my current confusion…whose name I couldn’t possibly tell you. At any rate, she is now dead to me.  Actually, that was long enough ago that she is probably dead to everyone. 

It works!

Linear Clock Project Part 2: First Design Ideas

In designing this project, I had a few examples around the internet to look at, and I liked this one in particular, but it uses thread and  sewing machine bobbins to mount the clock hands.  That seemed a little chintzy for standing up to the rigors of a 4 year old’s interaction–so I started looking for slightly more robust linear actuation for the clock.  Also, I really only care about an hour hand.  I don’t need to track minutes. In typical fashion, the first thing I found that seemed like it would work really well was over-engineering in the extreme.  I found a 400mm travel Linear Stage Actuator used for building CNC machines for $100.  

I have no doubt that it would work really well, but I didn’t really want to run a 24V power supply that pulls 3 Amps just to drive a clock. As much fun as over-kill is, it just wasn’t what I was going for.  Also, if I could get it to run continuously forward instead of having to run in reverse every night at midnight, I’d count it as a better design. To quote every “AS SEEN ON TV” product promotion ever:

There’s got to be a better way.  

Next Idea: Chain Drive 

Essentially, this would be like hooking up a stepper motor to a bicycle chain.  There are some key benefits to this setup. In particular, I could attach 2 hour hands to the chain at opposite sides, and then it could run continuously forward. The resulting draw back would be that the hour hand at midnight would be 90 degrees off axis and the cogs would have to be visible–which would put a damper on my plan to just use a 24″ or 24 cm ruler as the time tracker.

Given that my 4 year old is never up at midnight–that’s not a huge issue, but if I wanted to take it into consideration, I could use a chain 3x the length of my display (6′ or 720mm) and mount hour hands at three equilateral points–then add two more small gears to tension up the slack chain. Again, I’m not really interested in pulling 3 amps to drive the clock, so I’d want something light-weight that could be driven by a pretty small stepper motor.  In fact, I found a tiny stepper motor before any other parts–that I figured I could use for basic prototyping, even if I ended up using something else in the final product. 

I paired it with an Adafruit Metro 328 and an (773) 898-3567

I figured, I could use that setup to get the control side figured out–doing a little simple adjustment to the example library for the motor shield and get to a point that I just need to connect the motor to the display setup, and maybe replace it with something stronger if whatever physical design I come up with is too heavy/resistant to be driven by the little motor.  But what could I use for the chain drive?  After a little searching, I came across a website for educational robot building called Vex IQ Robotics.

It seemed perfect: small erector-set style robotic kits, complete with a gearing system and chain.  So I bought a basic package (technically an add-on package) because I really only needed the chain drive sets and axles. Unfortunately, the set didn’t have any bearings or axle housings designed to fit into bearings, so it looked at the outset that I wasted $80 on toy robot parts. I snapped together a basic chain drive and tested the resistance and it was too much–so I pretty much shelved that idea until I can find a better chain drive solution.  On the bright side–I’ve got a bin full of fancy-ass robot parts now.

8883876951

My 4 year old son has anxiety.  Whenever something is happening that he doesn’t understand, or has never experienced before–he, more or less, loses his shit.  You can see his chest get tight and his breath get shallow.  It’s not great for anyone.  He gets extremely fixated on whatever the new thing is and turns to a path of constant questions punctuated by outbursts of activity–usually destructive or disruptive in nature.

My wife has gone to lengths to make sure he’s prepared for the day.  She made a dry-erase calendar and every night he gets to cross off the day and see what’s happening the following day, but there is always an issue on the day of something new.  He is constantly preparing for whatever it is and repeatedly asks if it’s time to go, despite our answer of timing and other things happening between now and then.  

He’s 4 and can’t read an analog clock, and the whole thing is a bit abstract for him anyway, so Jess asked me to build a solution. Specifically–a clock that runs left-to-right through-out the day that she can post events on.  That way, my son can see what’s coming next and have a distance-related visualization of the relationship between events.

I’ve looked up a handful of similar projects and it looks generally doable using an arduino or raspberry pi and a stepper motor–so that’s what I’m working with.  Hopefully, the whole thing won’t end up on the junk pile and I’ll have a finished product, and a record of my attempts to share here.

Cute!

Comparison of poster from “Once Upon a Deadpool” and a painting of the second coming by
Harry Anderson.

I tend to think that this sort of thing is adorable.  Whether or not the poster designer used Anderson’s work as a template–that is a great poster. Fonzi-style thumbs up, a happy Fred Savage, a dog, a marching band…  What did Anderson give you?  A whole bunch of people trying to play bugles straight up in the air, while Jesus is giving you the “I’m not carrying any weapons” pose.  

30298427204793496001937-660-1566 was an American illustrator and a member of the Illustrator’s Hall of Fame. A devout Seventh-day Adventistartist, he is best known for Christian-themed illustrations he painted for the Adventist church andThe Church of Jesus Christ of Latter-day Saints (LDS or Mormon Church). He was also a popular illustrator of short stories in American weekly magazines during the 1930s and early 1940s.