Modern 3D Printed Tide Clock

by rabbitcreek in Circuits > Microcontrollers

839 Views, 8 Favorites, 0 Comments

Modern 3D Printed Tide Clock

IMG_1880.jpeg
1024px-099-tpm3-sk.jpg
tidal-bulge.jpg

Sir William Thomson (Lord Kelvin) devised the method of reduction of tides by harmonic analysis about the year 1867. It relied upon any resolving a series of periodic movements into the sum of a series of simple harmonic motions. His analysis became the basis of design for the first tide clocks. The photo above shows the complicated nature of early clocks. The multiple periodic movements are not only based on the gravitational enhancements of the Sun and the moon on the ocean but a variety (over 60) of other periodic influences. I was just introduced to a totally new factor by my friend who told me the section under his coastal house floods whenever high tide hits with a low atmospheric pressure!

The easiest graphic to explain tides portrays the earth with water bulges on it sides. The earth rotates daily through these two bulges dragging its coastal occupants through two periodic highs and lows. I designed this tide clock to simulate in graphical form the movement through these watery distortions. The tide clock is totally 3D printed, battery operated and can be made for less than $15 so a great project for kids. The design is modern and you can quickly ascertain the local tide level with a quick glance from across the room. The clock gets it time and tide levels from the internet; looking up the tide heights from the NOAA API. The wifi credentials as well as the nearest local tide station are input through your phone and the whole thing can be set up and working in a minute. Charging is done with a USB-C connection and the large built in lipo battery should last for weeks as the enclosed ESP32S3 unit sleeps and wakes up to adjust wheel only every 30 minutes.

Supplies

XIAO_ESP32S3_Sence_Pinout.webp.png
61sTZizwLUL._AC_SL1500_.jpg

You need a 3D printer. The microcontroller for this project is a Xaio ESP32S3 which works great because of its small size and great software help. I used the above Servo for several projects and found it works fine with the lower voltage of the lipo battery.

  1. Xaio ESP32S3 $5
  2. Diymore DM90S Servo $3
  3. Switch ON/OFF $1
  4. Pushbutton $0
  5. LipoBattery $3
  6. P-channel MOSFET $1

Wire It

IMG_1675.jpeg
IMG_1657.jpeg
IMG_1680.jpeg
IMG_1679.jpeg
IMG_1836.jpeg
IMG_1872.jpeg
IMG_1849.jpeg

The wiring is straightforward; basically a few GPIO pins off of the main xaioESP32S3 to control the servo and the servo power. The Lipo battery POS is connected to the ON/OFF switch. The other side of the switch is connected to the POS on the back of the MCU as well as the Source on the P-MOSFET. (Term 3) The battery ground is connected directly to the rear battery NEG terminal on the MCU. P-MOSFET Gate (Terminal 1) is connected to GPIO D7 and Drain (Terminal 2) is connected to servo power (Red Wire). One side of the push button is connected to GPIO D9 and the other side to ground from the MCU. The ground from the Servo is also connected to GND either on the board or shared with the pushbutton. The yellow control wire from the Servo is connected to GPIO D8. The way the wiring control works is GPIO D7 is held high by the software until power is needed by the servo when D7 is brought low providing power through the MOSFET to the servo. When servo action is completed servo is disconnected and power is turned off by raising D7. Charging of the battery is through the MCU and the ON/OF switch must be on for this to occur.

Print It

IMG_1863.jpeg
base.png
fancyTideClock v2.png
fancyTideClock4.png
fancyTideClock5.png

All pieces are printed with a Bambu P1S printer at the usual settings for flat PLA. The main colors for the control planet were done by stopping the print right above the junction between the background and the planet shape and changing colors. Supports were needed for most parts.

Build It

IMG_1850.jpeg
IMG_1649.jpeg
IMG_1672.jpeg
IMG_1658.jpeg
IMG_1832.jpeg
IMG_1650.jpeg
IMG_1659.jpeg

The back plate has openings for all the major parts so after soldering it's only a matter of glueing them in with some hot glue. The rod that holds the tiny moon support is about 30mm x 4mm stainless and is lubricated in its holder with some teflon spray. The Servo horn in the kit with both vert and horizontal supports is glued into the center of the holder with superglue. The servo has to be positioned and programmed for 0, 90 and 180 to select its correct positioning in the horn. The servo itself sets in the planet recess and doesn't have to be glued. The tiny screw that holds the horn in position is placed through the hole in the bottom of the servo plate. Glue the rod end into the moon holder at a position that allows full movement in the vertical direction as the water rim moves along the contact groove. Insert the other end of the rod into its holder on the servo plate. The servo plate is then superglued onto the back. Cut the black connector end off of the servo wiring a send it through the hole in the back. Attach the servo wiring to its appropriate connections in the wiring diagram. Hot glue the XiaoEsp32S3 into its slot in the back holder making sure its USB-C connector is well placed to allow outside wiring to mate with the end. Hot glue the MOSFET into its holder on the back plate. Superglue the momentary switch to it hole in the back being careful not to glue the black pin shut. Superglue the ON/OFF switch into its hole in the side. Hot glue the battery into its large holder. Make sure all of the wiring does not interfere with placement of the back plate and superglue it together. The ON/OFF and charging port should be placed inferior to the moon holder which should be in the 12 o'clock position. Place the Planet over its servo. It should hold its position. The unit can then be placed on its holder.

Program It

IMG_1869.jpeg
IMG_1870.jpeg

Most of the programming was done with Gemini. The program uses the NOAA api to get the next couple days of tidal levels and times for a requested tide site. It puts these values into permanent memory using preference variables. It then requests the current time from the internet and finds the next hi/low tide and finds the number of hours/minutes until the next hi or low tide and sets the Servo accordingly. Initially when setting up the tide station and your wifi credentials you push the button on the back which clears out all the preferences and any old tide data and your tide station. This sets up its own connection point through your phone with wifi and enables you to change wifi credentials and tide location at will. The program polls for a LOW on D9 on startup and enters a function to get new credentials. If time/or NOAA data becomes corrupted or not found it enters into a new sleep cycle and tries again. The limited data presented by this clock can be supplemented with a screen if you want to present the complete tide cycle if you want.

Using It

IMG_1907.jpeg
IMG_1908.jpeg
IMG_1909.jpeg
IMG_1911.jpeg

Using the clock anywhere in the country is simple. When you power it on (push the ON/OFF button in...) hold the momentary switch closed at the back for a second. At this point the unit will be connectable by your phone Wifi as tideClockSetup...choose that wifi and if it asks for a password type "password" and it will build a web page for you to enter the Wifi credentials, the requested tide station and your hour offset from GMT. Here in Alaska it is -8. Tell it to save your credentials and the tide clock will take your credentials and connect to your wifi and parse your first NOAA data and move your servo. The servo moves the disc that ride in a groove under the red moon and every 30 minutes it will check the change in the next tide cycle and move the height of the red moon. The disc always moves counterclockwise presenting first High tide (0) then low tide(90) and finally high tide again (180). The servo will then reset itself by turning clockwise back to (0) position to repeat. In between checks it deep sleeps for 30 minutes and then checks on the data and the time. In the software there is a delay() for 20 seconds which can be eliminated. As anyone who has programmed in deep sleep you want a delay so that you can upload new programs without being stuck trying to communicate with a sleeping microcontroller. There is a relatively large battery so the unit may last for weeks before recharging is necessary. Make sure you leave the ON/OFF switch to ON position to enable it to charge.