Technology

Off-The-Shelf Hacker: Steampunk Eyeball Frame, Servos and Software (Part Four)

7 May 2016 4:05am, by

In last week’s edition of Off-The-Shelf Hacker, I started constructing a Steampunk Eyeball, a device that will “watch” me as I’m on stage making a presentation (see Part One and Part Two). I built the hinges and cut out the removable rear door, but had not completed the half hoop, installed the servos or mounted the Pixy camera, yet. The half hoop now solidly supports the eyeball assembly, the servos turn under their own power, and the Pixy inconspicuously peers through the “pupil” on the front.

Best part: The eyeball actually tracks me, as I move around the room, in my blue shirt.

This week, we’ll look at the fabrication techniques, design decisions and engineering challenges faced to make the Steampunk Eyeball work. I had to laugh when my daughter saw me testing the thing and remarked, “It’s pretty simple, right?”

Building on the Half Hoop

The half hoop turned out to be one of the easiest parts of the whole build. I considered angling the sides, for a streamlined look. Lining everything up and soldering it together, so it looked right would have taken quite a bit more time, so I settled on a simple square frame, with the horizontal (tilt) pivots at the top and the vertical (pan) pivot at the bottom.

Bottom Of The Half Hoop, Pan Servo And Pivot

Bottom of the half hoop, pan servo and pivot.

I built the hoop in stages using big spring clamps and alligator clips to hold pieces in place as I went. Clamping the ¼ inch brass tubing to my workbench, then soldering the joints first on one side, then the other, worked well. Be sure to work quickly when soldering the reverse side. Otherwise, the joint won’t stay rigid and may move out of alignment.

Locating and Mounting the Servos

Many times you just can’t know if something will work until you try it. This is the motivation behind my “build, hack, mod, repeat” fabrication methodology. It’s possible to make educated guesses based your hands-on experience.

Such was the case with choosing the micro-servos used for this project. They were readily available at Colonial Photo and Hobby (for around $17 apiece), rated at 17.2 oz/in of torque (at 4.8 volts) with a rotational speed of 0.12 seconds/60 degrees (at 4.8 volts). I might go bigger on version 2.0 although these servos were adequate for the MVP (minimum viable product).

I decided to use ½-inch copper tubing for the pivot with a ½-inch copper union, split into two rings as the tilt pivot bushings, on each side of the eyeball.

Tilt Pivot Detail

Tilt pivot detail

It’s important to design certain parts that are removable, so it’s easy to assemble/disassemble/service your device. The tilt pivots are fastened in place using 4-40 brass nuts, bolts and washers, as opposed to just soldering the bushing to the half hoop frame.

Highlights – Tilt Servo

I ended up putting the tilt servo inside the eyeball using a drive shaft through one pivot with an attachment point to the top of the half hoop. This added a little more mass for the pan servo to turn. I figured it was less than putting the tilt servo out at the end of the tilt pivot bushing.

Drive Shaft Attachment Point

Driveshaft attachment point

Inside the ball, I fashioned a removable tilt servo bracket. There has to be a way to service the Pixy camera, so I made tabs to allow bolting the tilt servo bracket at the top and bottom of the copper sphere.

Tilt Servo Mounting Bracket

Tilt servo mounting bracket

It was difficult to hold and solder the bracket and tabs for correct tilt servo alignment.

I secured the tilt pivot tubing with brass angle brackets soldered to the copper sphere. Again, the heat needed to make a good joint on the ½-inch copper tubing, which was marginal. I also found that cutting the tilt pivot shaft was a huge, awkward job with the Dremel and a cut-off wheel. There will have to be more cutting and smoothing to make it look neat. Version 2.0 might use a different tilt pivot set up.

Tilt Pivot Attachment To The Copper Sphere Lip

Tilt pivot attachment to the copper sphere lip

I decided to use a hollow tilt pivot shaft because I needed to run the USB and pan pivot servo wires out of the eyeball. Using an internal tilt servo also required a driveshaft for the arm to more against, causing the eyeball to rotate around the horizontal axis. The other end of the drive shaft attaches to the top of the half hoop and goes through one of the pivot tubes.

Challenge: Servo alignment is tough. Any binding results in a jerky motion and servo-feedback problems.

I tested the alignment and adjusted the servo arm for correct orientation. This happened before the final tilt servo placement to see that the arm moved in the right direction according to firmware program (it would have to be changed in the default pan/tilt demo program). During initial testing, I also found that the tilt servo became warm when there was some major binding with the drive shaft. Be ready to unplug USB or power quickly if your servos bind badly or hit their stops hard.

Highlights – Pan Pivot

The mounting was fairly simple, just a ½-inch copper union soldered to the bottom of the half hoop. The ½-inch copper tubing is soldered to a flat piece of copper, used as a mounting plate that will attach to a decorative base.

Challenge: Getting smooth operation.

Copper tubing isn’t perfectly round, so there was quite a bit of polishing to eliminate sticking points. Any resistance in the pivots will cause jerky operation as the servos and software try to overcome any stickiness.

One problem that illustrates how all the little parts interact with each other was the vertical (pan) pivot. I used the ½-inch copper union as the bushing and ½-inch copper tubing as the pivot. I also made a ½-inch hole in a flat piece of copper so I could mount the pivot in the base. Since the pan servo arm would attach to the end of the pivot and drive the half hoop around the vertical axis, I had to decide how far out of the bushing the pivot had to go. There also needed to be a pin through the pivot, to prevent the half hoop from coming off the pivot, if somebody picked up the ball from the top.

I ended up leaving about 3/8-inch sticking out, so there was enough room for the servo arm engagement notch and a thin cotter pin below it. The pin will go through the ½-inch copper tube, right above the ½-inch copper bushing.

Pan Pivot Detail

Pan pivot detail

Squaring away the Pixy Camera

I mounted the Pixy inside the eyeball before constructing the tilt servo mounting assembly.

Camera Mounting Brackets Inside The Eye Ball

Camera mounting brackets inside the eyeball

It’s just a simple bracket that uses three 4-40 round head screws to attach the camera. I bolted the bracket to the camera, then soldered the bracket to the lip on the copper sphere, once the lens was aligned in the middle of the front hole.

Challenge: Alignment of the lens in the center of the “pupil” was tough. Version 2.0 might use some kind of tool to orient the camera while attaching the bracket to the copper sphere lip.

Software and Firmware

The Pixy, by default, has two different programs available on power up. Everything is fully configurable in the Pixy’s software/firmware, and you can find complete coverage on the CharmedLabs site. One program just detects whatever color signatures have been previously assigned through the Pixymon application. It can also run a pan and tilt demo, again tracking objects with whatever color signatures were previously assigned.

The USB cable is plugged into the back of the Pixy camera and the other end into a Linux notebook, to configure the Pixy’s firmware. For the eyeball, I stripped the outer covering and braid from a spare USB cable so the wire would be flexible enough to go through the tilt pivot and not cause any resistance when the pan and tilt servos moved.

The Pixy software (including the latest firmware) is available for download. Just follow the directions to load it on your Linux notebook. Windows and Mac versions are also available.

Once the software is installed, you can then open a terminal, travel to the ~/pixy/build/pixymon/bin directory and run the Pixymon program using the following command line.

PixyMon Main Screen Detecting My Blue Spiral Notebook

PixyMon main screen detecting my blue spiral notebook.

I next clicked the “Action” tab and selected “clear all color signatures” toward the bottom of the menu.

Back at the “Action” tab, I then sat in front of the camera, wearing a blue shirt, selected “set signature 1…” and used the mouse to draw a box, on top of my blue shirt. This selects the color of the object I’d like to track. Remember, the whole idea of the Steampunk eyeball is to have a moving, physical computing device that tracks me as I walk around during one of my conference tech talks.

Next, I hit the “Action” tab one more time and selected “run pan/tilt demo”.

The Pixy’s default color detection settings recognized my blue shirt pretty well, and the eyeball tracked me as I walked around in front of the device out to able 8 feet, with roughly a 120-degree field of view. Certainly, I’ll need to play around with the settings to optimize eyeball tracking performance.

I think one of the best things about hardware hacking, particularly with current microcontrollers and specialized devices (like the Pixy), is that once you have the mechanisms, sensors and actuators in place, you can easily change your device’s behaviors just by modding the software. That ground-breaking, off-the-shelf capability, just didn’t exist only a few years ago.

Somewhere around 2003, we could save firmware in EEPROMs, then inexpensive microcontrollers (the Arduino) came along, then we had easy-to-use IDEs, then sophisticated image processing boards could be mail ordered, then…

Oh, sorry, I hardware hacker geeked out there for a minute.

Options in the Pixymon application let you adjust the color signature sensitivity, camera brightness, minimum brightness, servo response and so on.

So, How Does It Work?

The Steampunk Eyeball is up and running on the test stand. It tracks well although there is a bit of sticking, jerking and lag when objects move very quickly in front of the camera. A little bit of grease on the pivot points helped a lot. Tweaking and adjustments to the software and various mechanisms should yield great results.

Next week, we’ll wrap up the series, with analysis of the results, challenges/solutions uncovered, a few odds and ends, along with what might be fun to try in version 2.0 or beyond. Maybe additional position sensors and integration with a Raspberry Pi or an Arduino Pro Mini. Hey, an ESP8266 model 07 could easily mount on the top of a half hoop arm and stream Steampunk Eyeball generated data to other devices, which could then use the data to do interesting things.

It will be interesting to learn how the eyeball responds to my world. For example, a couple of times it would inadvertently start tracking an object, with the same color as my shirt. This caused the eyeball to swing around wildly and stop following me.

Cool! It’s pretty simple, right?

A newsletter digest of the week’s most important stories & analyses.