Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Make Your Own Sea Shell Sand Clock

DZone's Guide to

Make Your Own Sea Shell Sand Clock

This comprehensive project guide blends servos, a stylus, sand, and C (as well as some 3-D printed bits) to make your own beach-themed clock.

· IoT Zone
Free Resource

Build an open IoT platform with Red Hat—keep it flexible with open source software.

The year is coming to an end, and 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:

Sandclock


If you are interested in building your own version, I have documented the different steps with tips and tricks.

Plotclock

The idea is based on the famous ‘Plotclock’ by the Fab Lab Nürnberg. That Plotclock is using a whiteboard marker to write the time and erases it with a wiper ever minute: very cool idea!

Materials

There is a lot of flexibility. I have used the following materials:

  • 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 I have used in another clock project.
  • For battery power: 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.
  • 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 don't get quite as clean. So, instead of using a wiper, I wanted to use a stylus to write the time into sand. The computer magazine C’t published an idea like that as PlotClock 2.0 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!):

Sand Clock Prototype

Sand clock prototype

The bottom servo is responsible for lifting the pen and the drawing servos:

Lifting Servo

Lifting servo

3D Printed Parts

I have printed the needed extra parts with an Ultimaker on PLA. Below are all the parts used:

3D-Printed Parts

3D-printed parts

For some parts, several iterations were needed:

a bunch of 3D printed left overs

A bunch of 3D-printed leftovers

TinyK20 Board

As the microcontroller, I used the tinyK20 board (NXP Kinetis K20), an ARM Cortex-M4 running at 50 MHz:

tinyK20 on a breadboard

TinyK20 on a breadboard

Adafruit 16-Channel 12-bit PWM/Servo Driver

To drive the servos (and more!) I used the NXP PCA9685, which is a really cool device: I can use it to drive up to 16 PWM or servos with a single I²C connection:

Adafruit 12-Channel PWM Servo Driver

Adafruit 12-channel PWM servo driver

Breadboarding

In the first phase, I experimented with various components and used breadboards 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:

3D Printed Arms

3D-printed arms

Vibration Motors

I used small vibration motors from Seedstudio: They are small and can be attached with small screws to the sandbox. I have used motors.

Small Vibration Motor

Small vibration motor

Initially, I used normal GPIO pins to drive the motors:

Vibration Motors with GPIO Pins


Because this was not flexible enough for leveling the sand, I switched to using the PCA9685 for the motors, too.

Sandbox

With a rectangular sandbox, my sand was building hills and valleys. So I printed a round sandbox:

3D Printed Sandbox


The sandbox is held in place by four springs for better vibration and decoupling from the rest of the chassis:

Spring


That worked pretty well, as shown in the following video:

Larger Sand Box

Well, that first sandbox was too small: The digits are very close together. So the next iteration was printing a larger box:

larger-sand-box


That one worked better:

Real-Time Clock

To keep the time and date, I added an I²C-based real-time clock: the DS1307 from DX.com, which I have used in another clock project.

Sandclock with RTC

Sandclock with RTC

Chassis

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:

added-rtc

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:

Clock mounted on base plate with one LED attached.

Clock mounted on the base plate with one LED attached.

Then it gets placed into the box below a top cover built out of wood:

Clock placed in box with cover


Sand Look

To cover the 3D printed plastic parts, I experimented with glue and sand:

Sand Box Border with glued Sand

Sandbox border with glued sand

It's simple enough.Put some glue on the parts, then cover them with sand. From here, sand started to spill around everywhere. To lessen the mess, I tried to keep the sand in a plastic box:

Sanding Box


With the sand, I’m able to cover most of the plastic parts:

Cover in Sand


Battery

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, which can charge and give power the same time.

Adafruit Power Boost 500

Adafruit Power Boost 500

I added headers to the module. And with that module, I added an ON/OFF switch to completely turn off the clock.

LEDs

The clock digits are more visible if there is good lighting with shadow. For this, I added four white LEDs, two on each side:

Sand Clock with LEDs wired

Sand clock with LEDs wired

The microcontroller board gets a 3D printed enclosure.

tinyk20 mounted inside clock

Tinyk20 mounted inside the clock

Both the microcontroller board and the battery charging unit get placed on the underside:

tinyK20 and Battery Module

TinyK20 and battery module

Sea Shells

I have found various sea shells in local stores. The LEDs get placed into sea shells and illuminate the sandy 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:

LEDs inside Shells

LEDs inside shells

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:

Clock Box Open with Shells

Clock box open with shells

The top of the wooden box has a glass window:

DIY Sand Clock in a Box


Here's a video of the clock in the box, but the vibration motor sequence still needs some tuning:

Getting toward the end, the writing implement is using a pointy shell:

Sea Shell Pen

Sea shell stylus detail

Sea Shell Clock Pen

Sea shell clock stylus in action

Good Vibrations

One of the most challenging problems was to get the sand vibrations right: depending on motor placement, the frequency, and duration of vibration, the sand was building mountains and valleys, up to the point where I had to add more sand. Oh, and I think I will have sand all over the place for the next few 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've found is a package of decoration sand found in a nearby store:

Sand Samples for Testing

Sand samples for testing

I tried to find good patterns with a small amount of sand, then filled up the sandbox and adjusted the settings. The following pictures and videos show some of the patterns I have observed:

Other Sand Vibration Patterns

Other sand vibration patterns

With some motor/frequency combination, the sand was moving to one or the other end:

Sand Vibration Patterns


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.

Software

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:

Image title

Sandclock Eclipse project

The original code is in ‘Plotclock.c’ and has been greatly extended and is using FreeRTOS for scalability:

Image title

Sandclock project components

It includes a USB CDC stack and command line interface: I have a lot of commands and configuration options:

Sand Clock Command Line Shell

Sand Clock command line shell

That way, I can drive all the servos, lights, and functions of the clock with a command line interface, as well as check the status.

sandclock status output

Sand clock status output

Summary

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. The most challenging part was getting the sand vibrating in a way that it levels out properly. This clock has a “beach” theme, but there are plenty of other ideas. For a “Halloween” theme, you could try small pumpkins, and a bleeding finger writing the time into black seeds, or a dedicated Christmas theme with glittering balls and a Christmas tree writing the time into a bed of wax, erased with a Peltier element. Or something. Post a comment if you have more ideas.

Happy clocking!

PS: I deeply apologize for all the sand flying around the office and at home. I would use wanting to have a beach feeling in the Swiss Mountains as an excuse

Download Red Hat’s blueprint for building an open IoT platform—open source from cloud to gateways to devices.

Topics:
iot ,breadboard ,plotclock ,adafruit

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}