DIY Stepper Motor Clock With NXP LPC845-BRK

uriotnews

This project is about building a stepper motor clock around the NXP LPC845-BRK board. The design is using a combination of 3D printed and laser-cut parts and costs below $15.

Image title

Below a video of the clock in action:

The GitHub repository includes an Excel file with the Bill-Of-Material (BOM). For this project, you need:

  • NXP MUCXpresso IDE (I have used the V11.0.0)
  • NXP LPC845-BRK board
  • 2 28BYJ-48 5V Stepper Motors with ULN2003 driver
  • 2 Neodymium magnets (e.g. 5x2mm)
  • Realtime clock with battery (DS3231)
  • 2 Bearings 10x15x4mm
  • 2 hall sensors (AH3572)
  • Strand wires
  • 12 M3 nuts and bolts
  • 8 small (2×10 mm) wood
  • Shrink-wrap tubing
  • Soldering station and a few extra wires for power connection
  • Plywood or PMMA/Acrylic material and access to a laser cutter
  • Access to a 3D printer (I used an Ultimaker 2 with white PLA material)
  • Optional: OpenSCAD to change the gears
  • Optional: 3D modeling software to change the 3D models (I used 123Design from AutoDesc)
  • Optional: wireless charging receiver module and charging station (see links at the end of the article for options)

The clock is designed around the very inexpensive 28BYJ-48 stepper motors (you can get 5 of them including the stepper motor driver board for less than $10).

The idea is to use the two stepper motors to drive each clock hand using a simple gear. The motors are placed in reverse to minimize space. The gears with shaft are 3D printed.

Image title

It is using the 28BYJ-48 5V stepper motors, which come with a driver board with a ULN2003 on it:

Image title

Below shows an early prototype using the LPC845-BRK on a breadboard:

Image title

Gears

The gears are designed with OpenSCAD:

Image title

Using OpenSCAD, the design can be parametrized and changed for a different gear factor.

3D-Printed Parts

The 3D files are available on GitHub as STL and 123D files:

  • Minute inner shaft and gear
  • Hour outer shaft and gear
  • Minute and Second clock hand
  • 2 stepper motor gears
  • RTC holder
  • Hall sensor holder
  • 4 spacer
  • Microcontroller board holder
  • Small spacer for inner hand gear

The spacer and gear parts should be printed with 100 percent infill.

To get a zero position, the design uses hall sensors to detect the hand zero position. For this, magnets get pressed into both clock hands:

Image title

The laser-cut parts are designed with Inkscape (.svg):

Image title

Optionally, the parts could be 3D printed too, but this will take much longer. Different materials (plywood, PMMA/Acrylic) could be used, but usually, plywood is the least expensive.

5V Motor Power Supply

Because the NXP LPC845-BRK does not expose the 5V on the pin rows, you can get to get it from pin 3 of U3 or from the positive side of C8:

Image title

Both locations are easily accessible, and I have used it from pin 3 Vin of the XC6206:

Image title

Create two pin headers for each motor power supply:

Image title

LPC845-BRK Pin Headers

The board comes with nice and breadboard-friendly headers. Because the pins are thinner than normal ones, I recommend using ‘normal’ 2.54mm pin rows instead. Because the K1 switch is placed too close on to the pin row, cut them out so the row can fit on the top side:

Image title

Wiring

The wiring is pretty simple. If needed, different pins on the microcontroller board could be used (see next section).

GND, magnet sensors, and both motor connections are from the left side. Vdd/3.3v and the I2C for the RTC are from the right side:

Image title

Use shorter wires to connect to the DS3131 (RTC) module:

Image title

  • Black: GND
  • Red: 3.3V
  • Green: SCL
  • Yellow: SDA

Image title

Have the GND and 3.3V wires extended to the hall sensors, or use the extra pin connections on the RTC module. The module gets placed in its holder and attached with a screw below the microcontroller:

Image title

Solder the two hall sensor (GND, 3.3V, and signal) to a cable, isolate with shrink tubing, and put them into the holder, as shown below:

Image title

The two stepper motor driver boards get attached on the other side:

Image title

Glue/place the small distance holder on the lower enclosure:

Image title

The bearings get placed into the lower and top holder plates. The small plywood rings are glued to the inside to prevent the bearings from falling inside.

Image title

With the bearing inserted:

Image title

Below shows the lower side with the shaft inserted into the bearing:

Image title

The four distance holders are used to press the top and bottom enclosure parts together. At the same time, they keep the side walls in place, so there is no glue needed.

Image title

Below is a picture with the top face attached:

Image title

Wireless Charging

Instead, power the clock with the USB cable, optionally a wireless charging receiver can be placed inside the enclosure. Connect the receiver output to the 5V, e.g. at the stepper motor drive boards.

Image title

Software

The software is written with NXP MCUXpresso IDE and SDK.

Image title

The project is using the MCULib library, which includes FreeRTOS and hardware, high-level drivers. The system features a command-line interface using the LPC845-BRK serial port.

Image title

The system is running with FreeRTOS:

Image title

At power-up, the clock moves the hands to the zero position using the hall sensors. Then, the hand positions get updated every minute.

Customization

The advantage of laser cutting and 3D printing is that the clock can be customized. Below are a few material and color combinations I tried.

Image title

Stepper Clock Acrylic Face White Hands

Image title

Stepper Clock Wood White Hands
Image title

Stepper Clock Wood Silver Hands

Image title

Stepper Clock Wood Black Hands

Image title

Stepper Clock Black Face White Hands

I will probably build another one with white hands, blackface, whiteface front, and everything else in black.

It took me a while to get the design implemented, with multiple iterations. The clock is working fine. The gear play could be better, but for a 3D printed one, I’m happy with it. The clock nicely shows the time, and the stepper motors are silent and working fine. And I think I need to try a few more color combinations!

Happy clocking!

This UrIoTNews article is syndicated fromDzone