Day of the Week Clock

by RandomTatBuilder in Circuits > Clocks

1143 Views, 9 Favorites, 0 Comments

Day of the Week Clock

Day of the Week Clock

Hi, this is a day of the week clock. I made it, as once you're retired, every day is a Saturday, and this helps you keep track of the day as they can often be similar. I've made a couple as retirement gifts.

Supplies

IMG_0825.png

2 x Tactile Switches

1 x Neodymium magnet (10mm diameter, 3mm thick)

1 x A3144 Hall effect sensor

1 x Wemos D1 Mini

1 x 28BYJ-48 Stepper motor

1 x ULN2003 Stepper driver

You will also need access to

Soldering iron, solder, heat shrink, Vera board, hot glue, and access to a 3D printer.

3D Print the Components

IMG_0810.png
IMG_0838.png
IMG_0872.png
IMG_0841.png

I printed the main body, end caps and base in black PLA.

The body was printed open end upwards, and tree supports were used. The layer height was 0.2 mm, 3 walls 10% infill.

The cylinder with the days on it was printed in white PLA.

Tree supports were used. The layer height was 0.2 mm, 6 walls and 10% infill.

After printing the supports were removed, and the objects cleaned up carefully with a knife, and a waft of a heat gun to smooth any minor surface defects.

I then used a sharpie to make the text on the cylinder black, don't hold the sharpie still in one position, otherwise the ink will bleed into the plastic. If you have a multicolour printer, then you could 'paint' the text in the slicer to avoid this step.

Prototype the Circuit and Software

IMG_0825d.png

Using a breadboard prototype the circuit.

The connections made were as follows

Wemos pins

D1 -> ULN2003 IN1

D2 -> ULN2003 IN2

D3 -> ULN2003 IN3

D4 -> ULN2003 IN4

5V -> ULN2003 5-12V

G -> ULN2003 -


With A3144 flat face uppermost

3.3V -> A3144 Right leg

G -> A3144 Centre leg

D7 -> A3144 Left leg


D5 -> switch1

D6 -> switch2


G -> switch1

G -> switch2


Connect the stepper motor to the ULN2003

Upload the code from https://github.com/randomtatbuilder/DotW-Clock using the Arduino IDE and run it. Turn on the serial monitor for debugging.

Pressing the switches should rotate the stepper motor. One of the switches will turn it a short amount (D6, advance 1 day), the other will turn it until the hall effect sensor detects a magnet (D5, advance to Sunday). With the advance to Sunday switch pressed, the motor should be rotating, make sure it stops when a magnet is passed close to the hall effect sensor.





Assemble the Clock

IMG_0871.png
IMG_0834.png
IMG_0884.png

Insert the magnet into the hole in the day cylinder in the same relative orientation to the flat side of the sensor as was working during prototyping.

Test fit the stepper motor shaft into the cylinder, it should be a tight fit, if not, then you can either file it to fit, or I heated the shaft of a broken motor sufficient to melt the plastic, and inserted it into the hole. By doing so I got a good fit. The end of the cylinder was made flat if any melted plastic protruded to ensure free rotation of the cylinder.

Place the stepper motor in the clock, and ensure its drive shaft is central and the motor body lies flat against the plastic wall. Feed it's wire through the hole in the base. Hot glue it into position.

Solder the wires from the working prototype to the A3144, and add some heat shrink to them, then run the wires through the hole in the base. Place the A3144 flat face down against the plastic wall, in line with where the magnet would rotate past it, approx 1cm in from the outer body wall. Hot glue it into position.


Solder the switches to the vera board, and solder the wires to them as in the breadboard version. Solder all wires between the wemos D1 mini and the ULN2003, and the A3144 as per the breadboard version. Note, you can save yourself 4 wires by sliding the wemos D1 mini onto the ULN2003 pins, making sure you do so with the pins connected


D1 -> ULN2003 IN1

D2 -> ULN2003 IN2

D3 -> ULN2003 IN3

D4 -> ULN2003 IN4


Ensure you have sufficient gap below the Wemos D1 mini to avoid shorts to the ULN2003 board if you do this, otherwise you can continue using the 4 wires as prototyped instead.

Trim as much as possible at the base of the ULN2003 board, and vera board, to ensure sufficient clearance in the body to allow the base to be connected flush. To gain just a little more room, it is possible to remove the plastic alignment piece from the ULN2003 to allow the stepper connector to get a little more clearance, though you will have to note its correct orientation prior to doing this.

Configure the Clock

As the A3144 position is variable, it is necessary to calibrate the detection of the magnet by the Hall effect sensor in the software to ensure that the day of the week lines up in the viewing window of the body.

This can be achieved by changing the SundayOffset value on line 80 of the code

int SundayOffset = -260;


You will have to achieve this by trial and error, then uploading the code and testing it by either unplugging and then plugging in the usb, this will trigger a 'Advance to Sunday', or by manually pressing the 'Advance to Sunday' button after code uploading.

The SundayOffset value may be a positive or negative integer, depending on where you glued the Hall effect sensor.

Clock Operation Modes

webpage.png

The clock has 2 operation modes.

Basic mode advances the day and reboots the clock every 24 hours. This is very basic, and to get it to advance at midnight the clock should be set at or just after noon (the first reboot happens 12 hours after a day selection button is pressed, then it subsequently reboots every 24 hours).

Advanced mode uses a wifi manager, to allow you to enter your Wifi credentials, and to set your location/timezone.

To enter your details, look for an access point called

DoW Clock Settings 192.168.4.1

Connect to it (default password is saturday, but you can change this in the code)

Using a browser go to http://192.168.4.1 and you will see the form above, enter your details, and save them. The clock will reboot, find the time from the internet, and then advance to the correct day of the week. If the clock is unplugged, then reconnected, it will determine the correct time and then advance to the correct day automatically (this does not happen in basic mode).


The access point will be generated if the supplied Wifi details fail to allow a connection after 30 failed attempts - this allows you to reenter details in case of a typo.


To overwrite saved wifi details with empty values, press and hold both of the buttons for approx 60 seconds (at least until the clock advances past Sunday).

Acceptance Testing and Final Assembly

Ensure the clock is working well. Then once you are happy you can lubricate the plastic axle of the cylinder with a dry lubricant, eg candle wax or graphite, then glue the end caps in place with a couple of drops of superglue, this will stop the end caps rotating. but still allow entry if ever needed.

Adjustments

They should not be necessary if you're using Advanced mode, as on each Sunday, the Hall effect sensor will realign the days of the week with the view port window. However, if using basic mode there is no such check, so if the days becomes misaligned, the alignment can be corrected by pressing the Advance to Sunday button, followed by the Day Advance button, as required.

Summing Up

You should now have a working clock. If you are unsure of anything then check out the accompanying video

https://www.youtube.com/watch?v=u2YcKe2Kwwc

which goes into more detailed discussion than these instructions, especially about how the code works, together with the other online resources for this project.

https://github.com/randomtatbuilder/DotW-Clock

https://www.thingiverse.com/thing:6347703


RandomTatBuilder signing out