The year is coming to an end, the Holiday season is approaching. In case you are looking for a nice present: I have completed my version of a sand clock: a clock writing the time into sand:
If you are interested to build your own version, I have documented the different steps with tips and tricks…
The idea is based on the famous ‘Plotclock’ by the Fab Lab Nürnberg (https://wiki.fablab-nuernberg.de/w/Ding:Plotclock). That Plotclock is using a whiteboard marker to write the time and erases it with a wiper ever minute: very cool idea!
There is a lot of flexibility. I have used the following material:
- Microcontroller board, I have used the tinyK20 using the NXP Kinetis K20DX128 microcontroller (ARM Cortex-M4 running at 50 MHz)
- 3 Micro servos e.g. from Dx.com.
- RTC (Realtime Clock) to keep the time with battery backup. I used the DS1307 from DX.com which have used in another clock project.
- For battery operation: battery and DC-DC converter. I’m using the Adafruit power boost 500 charger.
- Vibration motors to erase the writing, e.g. the one from SeedStudio (DX.com).
- Adafruit 16-Channel PWM/Servo Driver: https://www.adafruit.com/product/815
- 3D Printer or laser cutter: something to construct the chassis.
- Decoration: sand, sea shells or whatever you like, plus a box or something similar to put everything into place
- Cables, nuts and bolts
From Plotclock to Sandclock
The original concept is using a wiper to erase the writing, but after a while things are not cleaned much any more. So instead using a wiper, I wanted to use a stylo to write the time into sand. The c’t computer magazine published that idea as PlotClock 2.0 (see https://github.com/heise/SandUhrZweiNull) using a laser cutter. Based on that design I have created my first prototype based on laser-cut wood (many thanks to Claudio for helping me with that!):
The bottom servo is responsible to lift the pen and the drawing servos:
3D Printed Parts
I have printed the needed extra parts with a Ultimaker on PLA. Below are all the parts used:
For some parts, several iterations were needed:
As microcontroller I used the tinyK20 board (NXP Kinetis K20), an ARM Cortex-M4 running at 50 MHz:
Adafruit 16-Channel 12-bit PWM/Servo Driver
In the first phase I have experimented with various components and used bread boards to connect the parts.
Because the original laser-cut arms did not work well, I designed them for 3D-printing: that way I can change the size and cut the weight:
I used small vibration motors from Seedstudio (http://www.dx.com/p/seeedstudio-vibration-motor-motor-driver-module-blue-392463#.WCncWiST7Ng): they are small and can be attached with small screws to the sand box. I have used motors.
Initially I used normal GPIO pins to drive the motors:
Because this was not flexible enough for leveling the sand, I switched using the PCA9685 for the motors too.
With a rectangular sand box I had issues that the send is building hills and valleys. So I printed a round shaped sand box:
The sand box is hold in place by four springs for better vibration and decoupling from the rest of the chassis:
That worked pretty well as shown it the following video:
Larger Sand Box
Well, that first sandbox was a too small: the digits are very close together. So the next iteration was printing a larger box:
That one worked better:
To have things look nice, everything gets placed into a wooden box with a glass cover. Space is tight, so the servos, RTC and the NXP PCA9685 module all get placed inside the base chassis:
That one gets screwed on a base plate which then gets inserted into the wooden box. the 4 white LEDs get connected to the PCA9685 module as well so I can control and dim them over I²C:
Then it gets placed into the box below a top cover but out of wood:
To cover the 3D printed plastic parts, I experimented with glue and sand:
Parts get glue and then covered with sand. From here on sand started to spill around everywhere. To lower the mess I tried to keep the sand in a plastic box:
With the sand I’m able to cover most of the plastic parts:
The motors and electronics can be powered with the tinyK20 USB port. I have added a LiPo battery (1000 mAh to last for several days) combined with a battery charger. Here again I used an Adafruit 500 mA Power Boost (https://www.adafruit.com/product/1944) which can charge and give power the same time.
I added headers to the module. With that module I have added an ON/OFF switch to completely turn off the clock.
The clock digits are better visible if there is a good light with shadow. For this I added four white LEDs, two on each side:
The microcontroller board gets a 3D printed enclosure.
Both the microcontroller board and the battery charging unit get placed under the side:
I have found various sea shells in the local stores. The LEDs get placed into sea shells and illuminate the sand drawing area. Shells are used to cover the power switch and the two hooks on each side which are needed to get the clock out of the wood box:
To cover the other areas, more shells are added and glued to the ground. A small cover is covering the part where the servo arms are coming out:
The top of the wooden box has a glass window:
Here another picture with more shells added:
Video of the clock in the box, the vibration motor sequence still needs some tuning:
The writing pen finally is using a pointy shell:
One of the most challenging problems was to get the sand vibrations right: depending on motor place, the frequency and duration of vibration, the sand was building mountains and valleys, up to the point to swap the sand outside the sand box. Oh, I tink I will have sound all over the place for the next weeks and months :-(.
The sand has to be like a powder: small and round grains. I tried several kinds, including ‘cleaning sand’ for small animals ;-). The best one I have found is a package of decoration sand found in a nearby store:
I tried to find good patterns with small amount of sand, and then filled up the sand box and adjusted the settings. The following pictures and videos show some of the patterns I have observed:
With some motor/frequency combination the sand was moving to one or the other end:
A video of the sand moving around:
Research indicated that this is a complex problem to solve and influenced by many factors. With the help of my colleagues I have built a ‘sweeping’ table stimulating the sand with a sequence of frequency/duration patterns. With this the sand was leveling properly without spilling out of the designated area.
The project and sources are available on GitHub. I have used the original ‘Plotclock’ code from the FabLab Nürnberg and ported it to ARM Cortex/NXP Kinetis, using the free Eclipse based Kinetis Design Studio and GNU build tools:
The original code is in ‘Plotclock.c’ and has been greatly extended and is using FreeRTOS for scalability:
It includes a USB CDC stack and command line interface: I have many commands and configuration options:
That way I can drive all servos, lights and functions of the clock with a command line interface and can check the status.
I’m happy with the result, and the clock is working well:
It took me a while to get it done, but now I have a nice gift. Most challenging was to get the sand vibrated in a way that it levels out properly. This clock has a “beach” theme, but other ideas for “Halloween” theme (small pumpkins, and a bleeding finger writing the time into black seeds?) or dedicated Christmas theme (glitter balls, a christmas tree writing the time into a bed of wax, erased with a Peltier element?). Post a comment if you have more ideas :-).
Happy Clocking 🙂
PS: I deeply apologize for all the sand flying around in the office and at home. Beach feeling in the Swiss Mountains I would use as an excuse 😉
- Project on GitHub: https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/tinyK20/tinyK20_SandClock
- Adafruit PowerBoost 500 Charger: https://www.adafruit.com/product/1944
- tinyK20 board: https://mcuoneclipse.com/2015/11/17/production-tinyk20-boards-arrived/
- DS1307 RTC clock: http://www.dx.com/p/i2c-rtc-ds1307-24c32-real-time-clock-module-for-arduino-blue-149493#.WCnbcCST7Ng (careful, this one is using pull-ups to 5V which needs to be removed!)
- Micro Servos from DX.com: http://www.dx.com/p/mg90s-metal-geared-micro-servo-for-plane-helicopter-car-boat-red-orange-black-274655#.WCncWCST7Ng
- SeedStudio vibration motors: http://www.dx.com/p/seeedstudio-vibration-motor-motor-driver-module-blue-392463#.WCncWiST7Ng
- Adafruit 16-Channel PWM/Servo Driver: https://www.adafruit.com/product/815
- NXP PCA9685: http://www.nxp.com/products/power-management/lighting-driver-and-controller-ics/i2c-led-display-control/16-channel-12-bit-pwm-fm-plus-ic-bus-led-controller:PCA9685