AutoScope : Part 2 : Gears

The original design for the microscope’s gears were nicely done. They had set screws and mounted securely to the knobs (from what we can tell from the video). Unfortunately, our microscope used different control knobs, so we couldn’t use the original 3D models.

So, Dan and I started from scratch. The most important item that Dan discovered, with the help of the Australian pathologist, was that the gears were designed in part in OpenSCAD using Parametric software.

OpenSCAD is an open source program which allows you to program 3D models. You write code instead of drawing objects. This is very handy when it comes to creating repeating objects — like gears. Let the math and the computer figure out the shapes needed for a given pitch/size.

I spent some time using the Parametric Pully program written by droftarts. It allows for a lot of nice things, like different gear profiles, retainers, set screws, and whatnot. In the end, I decided to go with a simple “idler” style.


Why an idler? Because it’s simple — just a ring of gears. At this stage I’m testing fit and the general idea — so I wanted something simple that would print quickly.

Since these gears will slide onto existing knobs — not motor shafts — the inside diameter is much larger than normal. For example, a NEMA17 Stepper Motor has a 5 mm shaft. I needed 26 and 30 mm!

OpenSCAD needed the ID — which I knew. But is also needed the number of teeth, which I didn’t want to guess at.

To help me figure out the problem, I put together a simple Excel sheet which calculates the Diameter and Number of Teeth given a tooth pitch (we’re using 2mm 2GT / GT2 belts) and tooth height (found on belt spec sheet — 0.75 mm).

It’s a simple calculation, where I had the number of teeth as a variable in the calculation. The idea was to get a ballpark idea of the gear size. Since I know that the OD needed to be at least 35mm, I could scan down the list and see how many teeth this would be.


Scanning down the list, I saw that anywhere from 50 to 70 teeth would work fine. I went with 60 because it’s a nice even number (60 minutes in an hour) and it was about the right size.

After plugging the numbers into OpenSCAD I was able to get two nice 3D models of my gears. There was a LOT of trial and error — my measurements of the knobs were exact, but 3D printers aren’t. And the knobs are slightly tapered, and I’m going for a friction fit. We’re talking 1/4 mm changes here — very small.

You’ll notice that I didn’t put a flange or retainer on the gears. (The retainer keeps the belt from slipping off.) Why? Because I printed one with a flange and the 3D printer created a bunch of supports. These support just get broken away when you clean up the part — BUT, they resulted in poorer quality gears. Instead, I’m printing the gears as one part and the retainers as the other parts. I can then glue them together. A little more work to assemble, but MUCH cleaner teeth on the gears.

Another important design decision I made was to make the gears a little oversized. Remember how my knobs are different sizes? Well, I didn’t want my gears to be. Why? Because then they’d have different ratios, making coding a bit trickier. And I already have enough to deal with. So, I sized everything to the larger knob. This resulted in two gears with exactly the same number of teeth (60), the same OD (about 38mm), but different IDs (about 26mm and 29mm).

The result is a pretty clean look.


Next up, controlling the steppers.



AutoScope : Part 1 : Overview

Dr. Dan Kott, a member of our local maker community, came to us with a problem. He had come across a microscope automation project created by a pathologist in Australia. Because of other commitments, the Australian doctor was unable to complete the project, and Dan wanted to complete it.

The idea is this: automate an inexpensive, but good quality, microscope. In other words, motorize the stage. Instead of manually moving knobs, motors and a microcontroller would take the place of your hands.

Why do this?

  1. You can make the microscope joystick controlled. This means you can remotely move around a slide. Very handy in a teaching situation where a video camera is connected to the microscope and the teacher is pointing at an overhead projection.
  2. Samples can be “marked up” for reference. An automated scope knows exactly where X/Y are on the sample slide. Therefore, a physician can find an element of interest, say a cancer, note it’s location, then give the slide and location to a student for review. (“See position 1456, 2345 — that’s an abnormal cell wall.”)
  3. Slides can be automatically scanned. The automated microscope setup means that an entire slide can be photographed in very high resolution. Those photos can be “stitched” together to make a single high resolution image.

While Dan had some videos of the rig, and copies of the 3D models for holding the motors, there were a number of challenges. These included:

  • Creating gears which would fit onto the existing knobs of a common series of microscope.
  • Determining which stepper motor controllers and software to use.
  • Choosing a microcontroller and writing code for it.
  • Getting the basic setup to work, so that additional functionality can be added.

First stop: the gears.

Useful Utilities

Here’s an assortment of Windows utilities  that I’ve found very useful.

fre:ac – free audio converter

I use fre:ac to rip CDs to MP3s. But, more importantly, to combine multiple MP3s into one file. This is especially useful for CD audiobooks with multiple discs. Also helpful for multipart audiobook MP3 downloads. Game of Thrones in 28 parts? No problem. Combines them all into one giant GoT file.

WinSCP – File Transfer Utility

When I want to transfer files (ex. game ROMs) from my PC to my Raspberry Pi, I use WinSCP. It can use the FTP protocol, but I run it under SCP. Wonderful to use. Don’t let all the toolbars and icons get you confused. Just hide 99% of them like I did. Makes transferring files to and from different OSs a breeze.

Floola – iTunes Replacement

I have a selection of older iPods which we use for audiobooks and assorted portable music. I’m not a fan of iTunes (memory issues, bloat, constant update reminders, fucked-up syncing, and general hatred of being locked into an ecosystem). This is a simple problem that will read, write, and update your iPod. I’ve been using it to manage audiobooks on a 3rd gen Shuffle. Works great. And, again — unlike iTunes — you can pull your music OFF of the iPod, too.

Handbrake – Video Converter

A long while ago we ripped a bunch of DVDs (to VOB format). I’ve been using handbrake to convert them to MPEGS for our PlayOn / MyMedia server. Works like a charm. Unlike some other / older converters, I’ve not had problems with audio sync and whatnot. Great piece of software.

Calibre – eBook Management

If you have a Kindle, you need to have Calibre. I read a lot of books from my public library, but don’t want to be hassled with return/due dates. Download in epub format, run through Calibre, have Calibre load right to the Kindle. Easy as pie.

Honorable Mentions

7Zip — My primary ZIP tool.
Audacity — Audio file editor.
Bulk Rename Utility — Absurdly complicated, but handy to have.
Win32DiskImager — Reads and writes images. Use it for backing up SD cards. Also handy for loading images onto SD cards (ex. when creating a Raspberry Pi card).
Paint.Net — Powerful image editor/creator.
Primo PDF — Print to PDFs for free.
WinDirStat — Helps me hunt down big files for disk space cleanup.
WinMerge — Helpful dev tool. Compares two files (text is best).


RetroPie Showing Only “CHOOSE”

After building my Pi2 (for the living room), I decided that I’d use my old Pi1 for the bedroom. Just another image install and a new SD card and I’d be set.

Or so I thought. Last night I batch loaded a bunch of ROMs and find that RetroPie is either showing a black screen, a scrambled screen, or just the “CHOOSE” option. You can F4 to exit and restart, but same problem.

After deleting ROMs, paring down ROMs, etc I finally uncovered the issue.

At first it seemed that the quantity of ROMs was the problem (it is running on an older Raspberry Pi, after all). Was it the Master System? SNES? It was weird.

So I slowly re-loaded my ROMs. And the second I added ANY GBA ROMs it started acting up. Here’s why:

I was stupid. I forgot to double-check the install instructions for GBA games. You need to have a BIOS file for that emulator. I had done this on my Pi2, but forgot to do it on my Pi1.

What’s happening is this: Emulation Station attempts to generate screen backgrounds for each of the emulators. To do this, it needs to run the emulator (I’m guessing). It hit the GBA, didn’t find the BIOS, and failed in an unfriendly way.

Putting the GBA BIOS in the proper directory, like I should have done, has fixed the problem. Horray!

Summer Reading List

I’ve never quite understood why there’s a focus on “summer reading” ’cause I read all the freaking time. But, anyway. Here are some books that I’ve been reading, for those that wish to delve into my demented soul.

Fear & Loathing in Las Vegas by HST

If you haven’t read it, it’s worth it. The interviews always talk about his search for the “American Dream” but it’s really a travelogue for me. A breeze to get through. Lots of great lines that you can look forward to using in the future.

The Brief Wondrous Life of Oscar Wao by Junot Diaz

If you are Hispanic, or not. If you are a geek, or not. A multi-generational tale. It helps to be Hispanic (or are married to one). It helps to be a geek and an outcast. Living characters. And I learned more about the DR then I ever had. It deserves the prizes it received.

The Martian by Andy Weir

Even though I’ve been a nerd since day one, Sci-Fi has never really interested me much. Can’t say why. Just never got into it (like I never got into “gaming”). Probably because I spent too much time in front of a computer. But this is a great hard Sci-Fi book. Sure, the guy is smarter than anyone should be, but it’s a great tale and an interesting read. Didn’t want to put it down.

Mr. Bones by Paul Theroux

Known for his travel writing, he really shines in the short story. To my taste, the first half is better than the last. Mainly because I got a little sick of the stories about love. But, that’s just my hangup. If you haven’t read his travel stuff, do so. Fantastic stuff.

Strange Stones by Peter Hessler

Another travel writer. Also check out River Town, his earlier experiences. If you want to learn more about living in China, he’s a great place to start. Interesting stuff.

The Time Traveler’s Guide to Medieval England by Ian Mortimer

See what life was really like in medieval times. Gives you a much better perspective of what it was like to live during that period. A history that doesn’t feel like you’re trudging through a history book.