DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Keeping Two Multi-Master Databases Aligned With a Vector Clock
  • Event-Driven Order Processing Program
  • Time Synchronization in Distributed Systems: TiDB's Timestamp Oracle
  • Deep Dive Into Apache Flink's TumblingWindow — Part 2

Trending

  • How Large Tech Companies Architect Resilient Systems for Millions of Users
  • Medallion Architecture: Why You Need It and How To Implement It With ClickHouse
  • Event-Driven Architectures: Designing Scalable and Resilient Cloud Solutions
  • A Developer's Guide to Mastering Agentic AI: From Theory to Practice

DIY Stepper Motor Clock With NXP LPC845-BRK

Build your own stepper moto clock with your NXP board.

By 
Erich Styger user avatar
Erich Styger
·
Aug. 28, 19 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
13.2K Views

Join the DZone community and get the full member experience.

Join For Free

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!

Clock (cryptography) Gears (software)

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

Opinions expressed by DZone contributors are their own.

Related

  • Keeping Two Multi-Master Databases Aligned With a Vector Clock
  • Event-Driven Order Processing Program
  • Time Synchronization in Distributed Systems: TiDB's Timestamp Oracle
  • Deep Dive Into Apache Flink's TumblingWindow — Part 2

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!