Introduction: Steampunk Clepsydra
This is my steampunk clepsydra ("water thief") clock. A steady stream of water fills a chamber, and a siphon periodically drains it. This action moves a float up and down, and some type of connected mechanism displays the time.
This type of clock dates back to the 3rd century BC . Here's a link to a drawing of an ancient clock:
I'm using an electric pump to continuously supply the siphon. A float in the siphon is connected by a lever to a ratchet and pawl mechanism. The ratchet wheel has 60 teeth, and the siphon cycle is one minute, so the ratchet directly drives the minute hand. A set of gears drive the hour hand. A microcontroller monitors and adjusts the flow of the pump to maintain an exact one minute cycle and keep accurate time.
I've linked a short, speeded-up video to demonstrate the mechanism.
This is not a set of plans for building the exact clock that I made; rather, a how-to to design and build your own.
I used a Carvewright CNC to cut the non-metallic parts and Carvewright Designer software to design these parts. Carvewright uses proprietary file formats, so the files are not useful unless you have a Carvewright machine. In place of proprietary files, I'm including pfd plans for the wheels and pinions that could be cut out using a band saw or scroll saw. If you have a CNC machine or a 3D printer, there are free gear designer applications on the web that would allow you to design gears with the number of teeth that I used for this project.
I carved many of the other parts with my Carvewright, but these need not be so fancy. I'm providing critical dimensions so that you can fabricate similar parts any way you choose. Of course you can alter the dimensions to suit your needs.
This project exercises several disciplines: woodworking, electronics, programming, math, metalworking, and even a bit of plumbing! I've done the math, essentially all of the progrogramming, and electronics design work for you, but you will need the other skills to build this Instructable.
Here is a list of materials that I used for my clock, and where I sourced the parts:
- 1/2" diameter copper tubing and fittings, solder, and flux - hardware store
- Small diameter brass and/or copper tubing and brass sheet - hobby shop
- 90 degree 1/4" copper elbows - eBay
- Acrylic cylinders - eBay
- O rings and vinyl tubing - hardware store
- Brass threaded rod and brass acorn nuts - eBay
- 3/4" hardwood and 1/4" Baltic birch plywood - home center
- Pump - eBay
- 12V DC adapter - eBay
- Launchpad and electronic parts - DigiKey
- Brass screws - hardware store
- Spray and acrylic paint - hobby store
Of course when designing your own clock you may use many different materials particularly for decoration - gears, pulleys, hoses, whatever. I think my next version is going to be elegant, natural-finished wood, with polished copper and brass plumbing.
Step 1: Frame and Base
Start by designing a frame to hold everything in place. I used 1/2" copper pipe and fittings, and one wood part, for my clock's basic framework. You may do the same or choose something different. I used 3/4" hardwood for a base.
The photo shows some critical dimensions for locating the lever arms and their pivot points which are shafts on the frame. Watch the video to note the moving parts and the shaft locations. Of course you can modify these, but I provide them as a proven example.
Step 2: Water Chambers
To make the water chambers, I used 2" diameter acrylic cylinders. End caps were cut out of wood and painted with metallic paint. Then, I applied black acrylic paint and rubbed it with a paper towel to yield a distressed effect. This is the technique that I used for all of the finishes.
I cut discs out of brass sheet and soldered brass tubing to the discs for the water connections. O rings from the local hardware store seal the acrylic to the brass. The end caps are held together with brass threaded rod and acorn nuts.
Note the breather hole in the brass disc and corresponding top cap on each chamber top.
Step 3: Lever and Pawls
The lever is on a pivot at one end and rests on the top of the float shaft at the other end. It does three things.
- The lever reduces the amount of motion of the float to a smaller movement of the moving pawl via unequal length arms.
- The lever changes direction of motion from vertical to horizontal.
- The lever triggers a hidden Hall effect sensor via a hidden magnet to let the microprocessor know cycle timing. (Of course, these do not need to be hidden - maybe your design includes some crazy coiled wires connecting things.)
The moving pawl advances the ratchet wheel 1 tooth on each 1-minute cycle.
The fixed pawl prevents the ratchet wheel from moving backwards.
Note that the moving pawl's tip is attached with a screw, making the tip adjustable . This is essential to coordinate the movement of the moving pawl relative to the fixed pawl.
Also note, and it is hard to see, there is a 7/16" diameter sleeve on the 3/8" diameter float shaft. This sleeve limits the stroke of the float so that the moving pawl moves only one tooth.
I carved some intricate pieces for the lever arm and pawls, but you can make them simpler if you like. I've included the critical dimensions for these parts in the Frame and Base step. Of course these dimensions can be varied; I'm including the dimensions of mine as one working, proven example.
Step 4: Float
The float was made with three 3 3/4" thick sections of wood, then coated with clear epoxy. Other materials such as styrofoam could also be used.
Step 5: Float Support and Upper Disc
The float support is at the top of the upper chamber, and allows the float to ride up and down on its shaft. Use a 3/8" diameter brass tube for the shaft of the float. Cut short sections of 7/16" diameter tubing for bushings. Glue the bushings into 1/4" diameter tubing to make the support for the float shaft. Solder the support shaft into the upper brass disc.
Step 6: Siphon
I made the siphon and other plumbing with 1/4" diameter brass and copper tubing and 90-degree elbows. These were soldered together. Critical dimensions include the length of the left siphon tube, which must be long enough for gravity to pull water up the right side. Again, these dimensions can be altered, but I am showing what worked for me as a good starting point.
Step 7: Gears
I designed the small gears (pinions) and large gears (wheels) using Carvewright Designer software. Unfortunately the file format is proprietary and of no use unless you have a Carvewright machine. I've included pdf plans to cut gears using a scroll saw. After printing the pages, check the ruler at the top of each page to ensure no unintended scaling has taken place.
If you have a CNC machine or 3D printer, there are free software tools for designing gears that you could use to make your own gears.
Step 8: Shafts
I used brass threaded rod for the shafts of my clock. The gears are mounted to brass tubing that slips over the shafts, and are secured with brass acorn nuts.
If you use the same size wheels and pinions that I did, the main shaft and auxiliary shaft will be 3" apart. You'll need that dimension when designing your frame. Note that the auxiliary shaft can be placed anywhere around the bottom half of the clock, not just offset to the left a bit as I did..
Step 9: Ratchet Wheel
The minutes shaft is on the ratchet wheel which is attached attached to the 10-tooth pinion. I use super glue to secure these parts. The brass tubing is long enough to allow the hours shaft to slide over it.
Step 10: Intermediate Wheel and Pinion
The intermediate wheel and pinion uses the 30-tooth wheel and 8-tooth pinion mounted on a brass tube. The wheel, pinion, and shaft are aligned as shown in the side view photo.
Step 11: Hours Hand
The hours hand is attached to the 32 tooth wheel. A short brass tube serves as the shaft. It slides over the minutes hand shaft. The side view photo shows how everything goes together.
Step 12: Minutes Hand
Once the hours hand and wheel are in place, the minute hand is press fit onto the minute hand shaft. Secure the parts with brass nuts. Rotate the minutes hand until the hour hand is at 12 o'clock, then hold the ratchet wheel steady while rotating the hour hand to 12 o'clock also.
Step 13: Pump
I'm using a small 12V DC diaphragm pump sourced from China for about $4. It will run slower on lower voltage, but at a certain voltage it quits altogether, and there is not enough range or variation in flow to regulate the siphon cycle by varying the voltage. So I'm pulsing a full 12V on and off 10 times a second, with the duration of the on time adjusting the flow rate. This pulsing is fast enough to give the illusion of continuous flow.
I'm using a 12V DC power supply (wall adapter) for power.
I connected the pump to the brass plumbing with vinyl tubing. I rested the pump on a bit of foam.
Step 14: Add Water
I put a short brass tube in the lower chamber breather hole to facilitate filling with water. Connect a temporary vinyl tube to the breather and a squeeze bottle or funnel to the other end to fill.
Step 15: Microcontroller and Hardware
I'm using a Texas Instruments MSP430 microcontroller. To develop the hardware and software, I used an MSP430 Launchpad board (about $20). The software development system, called Code Composer Studio, is included and can be downloaded from a Texas Instruments website.
The complete use of Code Composer Studio is beyond the scope of this Instructable, but there are tutorials and learning information from other sources, notably Texas Instruments. You don't have to become super proficient with Code Composer or be a programmer, as I provide all the needed files and code, and steps to install and run Code Composer Studio for this project. You may have to change some constants using the editor, and learn how to build and download code to the microcontroller. More on this later.
I'm still using a quite old version of Code Composer Studio, Version 5.1.0.09000. The reason is that I used a plug-in tool called GRACE to configure the peripherals, and this tool was dropped in later versions. Version 5.1.0.09000 is still available from TI.
The Launchpad connects to a PC via USB. I wrote the software on the PC, download it to the Launchpad, and used various debug tools such as single step, breakpoints, examine variables, etc. I added a few extra components via a breadboard to develop the hardware before committing to a standalone circuit board.
There is a MOSFET transistor to drive the pump and some LEDS to help debug (more on that later). The gate of the MOSFET is connected to an output port of the microcontroller via a resistor. Two LEDs are bidirectional red/green, with a resistor on one lead and the other lead and resistor each connected to their own output port. Activating one port lights the LED red and the other port green.
Additionally there is a Hall effect sensor hidden in the frame, triggered by a magnet on the arm that is moved by the float. It is connected to an input port.
On the Launchpad is a watch crystal running a timer/counter to provide an accurate timebase. The timer/counter is used to both measure siphon time and deliver the desired length of pulse to the pump (pulse width modulation or PWM). An optional LED connected to the motor indicates the PWM in action.
The LEDS and their corresponding current-limiting resistors are useful to debug and adjust some software constants, but are not required to run the clock. I did not include them in my proptype standalone board; I just used them on the breadboard.
Step 16: Software
The software is written in C. It uses a modified PID - proportional, integral, differential - control algorithm, commonly used. You can find a lot of information on this algorithm online. At each cycle, the time that the cycle actually took is compared to the ideal time which is 60 seconds. The difference is called the error. The error and the integral of the error are used to adjust the duration of the pulse.
Here is the equation that makes the adjustment, taken right out of the code:
pumpPWM = pumpPWM - (Kp*error + Ki*i_error)
Kp and Ki are empirically derived constants - that is, by experimentation. When first started, the error will likely be large. You choose Kp and Ki to reduce the error in a reasonable amount of time without overshooting or undershooting, then maintain zero or near zero error. To aid in determining these constants, I used two red/green LEDs. At the end of each cycle, I flash one LED red or green to indicate the number of seconds that the cycle was fast or slow, each flash representing a second. For example, 10 red flashes means it was slow by 10 seconds. The other LED displays the integral of the error in seconds. The LEDs are optional and can be removed after developing the software.
Due to possible differences in pumps, size of chambers, and plumbing, you may have to adjust the values of Kp and Ki. But you don't need to know C to do that. You also may need to adjust the nominal PWM value (constant NominalPWM). Do this by running the system until error is near zero, then stop and examine the value of pumpPWM.
I've included a screenshot of Code Composer Studio to illustrate the process. The software was downloaded to the Launchpad with breadboarded additional parts and run for about 14 minutes. Then the run was paused so that Code Composer Studio could capture variables and registers from the microcontroller. The first thing to look at in the upper right corner of the screen is the errorhist array. It shows that the first cycle was fast by 5.2 seconds (52 counts of the 100 mS interrrupt), then slow by 1.3 seconds, etc. What we are looking for here is what you see - numbers not much more than 5 seconds (50 counts), maybe going + then - like this, but within a few minutes declining towards zero. (We expect variation at the outset because the upper chamber might be empty or partially filled, so it takes a bit to get a rhythm going.) The next thing to notice is the i_error value of 38 or 3.8 seconds. This means that in 14 minutes our clock is off by only 3.8 seconds. This number should be small, and the Ki term of the equation will ensure that it does not grow but will actually approach zero the longer the clock runs. Finally, note the value of pumpPWM, which determines the amount of time the pump is running each cycle. That value is 1498. As we are at very low error and low i_error after 13 minutes, we would expect the pumpPWM value to remain in this ballpark. So, as you can see in the main.c window, we have set the nominal PWM value to 1500. This gives us the best starting point for the system.
I've included the files that can be imported into Code Composer Studio to duplicate the software. I've also included a source code listing so that you can look over the algorithm and code without the Studio. And, I've included a screenshot of the GRACE page to configure the timer. You can see that the timer is drive by the 32.768kHz crystal, is set to a period of 100 mS or 10 Hz, and other characteristics. I don't know why TI dropped this useful tool.
Step 17: Install and Run Code Composer Studio
- Download and install Code Composer Studio Version 5.1.0.09000 from TI. This link was active at time of this writing: http://software-dl.ti.com/ccs/esd/documents/ccs_downloads.html
- Download the file Steampunk.zip and unzip it.
- Launch Code Composer Studio.
- Click on View - Project Explorer.
- Click on Project - Import Existing CCS/CCE Eclipse Project. Browse to and select the root folder Steampunk than you unzipped. Click on Copy projects into workspace. Click Finish.
- At the upper left, click as shown in the screenshot to open the Project Explorer window. Click to select the project Steampunk to expand it and make it the active project. Double click main.cfg and main.c. You should have windows open as shown in the screenshot.
- Connect your Launchpad via USB. Click on Run - Debug. The code should be compiled and downloaded.
- Click on Expressions in the upper right window. Click + Add new expression and type in the variables you'll want to monitor (in the Software Step screenshot).
- Click on Run - Resume to start the microcontroller.
- Observe the LEDs if you installed them. After 5-10 minutes, click on Run - Suspend. Check your variables and decide on any adjustments needed (it may help to keep a log of constant values and results for each run).
- Click on Run - Terminate.
- Go to the main.c window and make changes to the constants.
- Repeat as need from Step 9.
(If you want to get some experience with Code Composer studio and examine the code and peripheral configuration, you can do Steps 1-6 with no hardware.)
I used the Launchpad with breadboard and LEDS for this step. I counted LED pulses for several cycles to see the trends. After several cycles, as described in the Software Step, I paused to check variables and the error history. I made adjustments to Kp, Ki, and NominalPWM, and ran again.
Depending upon your pump and configuration, it is possible to run the pump so fast that the siphon can't compete. As long as you start with a decent NominalPWM constant, that should not happen. But as a failsafe, MaxPMW will prevent this. Similarly, the pump can run so slowly that the upper chamber never fills. Use MinPMW as a failsafe.
Step 18: Final Electronics Hardware
When I was satisfied with the performance, I built my prototype electronics hardware on a breadboard PC board. The microcontroller chip plugs into a socket on the Launchpad. The last version of download software remains in the chip, so unplugging the chip from the Launchpad and using that chip in the prototype transfers the software too.
When putting your clock on display, simply rotate the minute hand clockwise to set the correct time.
Time to sit back and enjoy!
Judges Prize in the