Posts

Showing posts from April, 2011

Functioning Clock

Image
I got the clock together and functioning today. It gets the data wirelessly over the Arduino Ethernet shield and wireless AP that I bought. The servos have been calibrated and it checks every minute for any new updates on the server and moves the hands to the proper location. There's still a long list of stuff to do before I consider it completed, but today really marks a milestone in the project.

Servo calibration

I'm working some more with the servos and with the gearing I have the servos will move the hands 540 degrees (1-1/2 turns). The Arduino servo class takes inputs between 0 and 180. On my clock, this translates to 3 o'clock position being 0, 12 o'clock as 90 and 9 o'clock as 180 going around clockwise. I needed a method to make sure that each of the 5 servos: start and end at the same positions can reliably hit each of the 12 clock positions reliably The first one is pretty easy. When attaching a Servo object to a pin you specify the minimum and maximum time (in us) that the servo will use. Most servos use 1000us as a minimum and 2000us as a maximum. By altering this slightly for each servo I could get all the servos to start and end at the same position. The second one was a little tougher. It turns out that a 10 degree Arduino input corresponds to one clock face position (30 degrees) for all the servos, but one servo would not reliably move to a position if the ...

Wireless Bridge

I picked up a 3Com Wireless b/g access point off of Amazon for $20 used. I want the clock to get its data over the home wireless network and not have to run one more cable for this thing. It took a bit of messing around with the access point to get it into a working bridge mode, but I did finally get it to work. Hooray! I can move the clock around the house now.

Alternative Drive Idea

Before I embarked on the build of the project I was torn between using servo motors or using stepper motors. I had originally opted for the servos because an Arduino can only control 2 steppers with the motor shield, and up to 3 with the EasyDriver Stepper controller. I need 5 motors, so each of these options was out and I went with servos instead. After some frustration with the servos, I started to reconsider how I might control more steppers with the Arduino. I remembered back to my college days of basic circuit design and remembered a device called a demuxer that could control multiple output lines with fewer input lines triggered by a binary pattern. I checked out the EasyDriver again, and it has an "enable" pin that "enables" the board and the motor. If I could take 3 digital lines from the Arduino through a demux I should be able to control up to 8 stepper motors (each with their own EasyDriver). I took down some notes (which I will add later) to detai...

Some Servo Problems

I ran into some servo problems a while back that I haven't had time to try to fix. The first one turned out to be a programming error where I was using a byte data type to hold too much data. I'm finding that the C-like programming of the Arduino is very limited, and it's taking some getting used to from my experience with more fully featured Perl/PHP languages that I'm used to. The second thing was that one of the servo motor brass gear shafts kept popping off the plastic servo output shaft. I fit the 1/4" o.d. brass tubing over the slightly less than 1/4" servo drive shaft by expanding the brass tubing slightly. The problem was that the alignment between the servo and the end of the brass tubing was off slightly causing the tube to "walk" off of the plastic shaft as it rotated. I took my micrometer and measured the vertical and horizontal variations from back to front on all the servos. Most of them were off by .02" at most (which is ab...

Adding some error checking

I figured that it would be nice for the Arduino to be able to indicate that there was a problem without having to have it connected to a PC. I added a single LED to an unused pin and created a routine to blink it on and off based on an error condition. Works pretty well. Well enough to tell me that for some reason the Arduino w/ Ethernet shield doesn't like to work without being plugged into USB as well as the external power. It could be that my power supply isn't clean enough or enough voltage to operate everything at once. More investigation is needed. I was hoping to only have a single power cord for this clock.

Positioning Code and First Breakage

Tonight I was able to work on some of the positioning code for the clock. Yesterday I was able to get all 12 positions working, but the servos allow for up to 540 degrees of movement in the configuration I have. I want the hands to randomly move to the location if more than one direction is possible. I was able to do just that right before one of the drive shafts came off the servo. I'll have to repair it to get back on track. It does concern me that these may come off fairly easy. I don't want to glue them to the servo, but I may have to find an alternative to pressure fitting them.

First Arduino Clock Code

Image
Tonight I hooked up the possibly completed clock movement to the Arduino and started to assemble the network fetching code with the servo movement code to actually make the clock be a clock. I think I have the twelve locations that I want the clock to have. I chose all of the locations mentioned in the book along with a few of my own to round out twelve. It turns out that the 30 degrees between clock points is almost exactly 10 degrees in the Arduino servo code when using these sail-winch servos. With the gearing I have in the clock I get a little more than 540 degrees out of each servo. I will eventually add some code that will make the servo move in the most optimum direction to get to the location. That'll have to be part of LOTS of other optimizing I will need to do to polish this thing up. For now, I have a paper dial with the 12 locations and small zip ties for each of the five hands. Here's a sample pic:

Movement Almost Finished

Image
I was able to run by the hobby shop after church today to pick up more servo mounting screws, and I was able to get the last of the servos mounted on the backplane. I also was able to complete the nested shafts for the hands of the clock. I had 5 sizes of brass tubing that all nested nicely into each other, but all my gears have 1/4" holes. I had to cut small spacers of each of the necessary sizes to make the small diameter shafts fit snugly with each drive gear. Here's a picture of the finished hand shafts: I used 5 min epoxy to glue the brass tubing together. I know that most glues won't work on metal (it's non-porous). Epoxy should do the trick. It's not like any part of this clock requires lots of torque or has lots of pressure on it. I was able to attach the brass drive shafts to the servos by expanding the tubing slightly and pressing them onto the plastic shaft of the servo. So far, it's holding well and aligns perfectly. Here are some more p...

Build Started

Image
I stopped by the hobby shop on Friday and picked up some more hardware to work on the Whereabouts clock. I've been working with Sketchup to model the clock in 3D before I start cutting brass tubing and plywood. I was able to model the servos and gears and got a good top-view of the mechanism. I printed it out full-scale and was able to use my drill press to drill the 6 holes for each servo shaft and the center shaft. I then used the scroll saw to open up the holes in one piece of plywood to make the holes where the servos mount. For the brass tubing, I was planning on using a regular tubing cutter, as the guy at themagicclock.com had used, but I must say it was a dismal failure. I knew that the cutter would leave a bit of a lip on the inside of the tubing that would need to be filed off, but it actually resized the end of the tube slightly smaller where the next smaller tube would no longer fit. I quickly abandoned the tubing cutter and went with a Dremel tool fitted with a ...