element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Smart Security and Surveillance
  • Challenges & Projects
  • Design Challenges
  • Smart Security and Surveillance
  • More
  • Cancel
Smart Security and Surveillance
Forum Sentinel Box - Part III - Stepper Motor and Vault lock mechanism
  • News
  • Projects
  • Forum
  • DC
  • Leaderboard
  • Files
  • Members
  • More
  • Cancel
  • New
Join Smart Security and Surveillance to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 1 reply
  • Subscribers 50 subscribers
  • Views 105 views
  • Users 0 members are here
  • security-challenge
  • stepper-motor
  • design-challenge
  • MAX32630FTHR#
Related

Sentinel Box - Part III - Stepper Motor and Vault lock mechanism

saramic
saramic 24 days ago

Time is running out and I need a locking Closed lock with key mechanism Gear️ for my smart lock box.

Recap

The idea is to build a smart lock box for digital devices to help control digital addiction, more on the idea can be found in part I and a switch back to coding with LPSDK and accessing a fingerprint scanner in part II

  • Sentinel Box - Part I - the plan
  • Sentinel Box - Part II - back to C

Acrylic as a build medium

I have limited resources on the mechanical side, some hand tools and no 3D printer yet. I do have a mechanical engineering degree so maybe I do know what is possible but hand cutting intricate parts is hard and a limitation. My most recent build medium choice has been 3mm acrylic sheet, it is relatively easy to cut and with a heat gun I can also shape it. Finally it gives things a very “skeletonized” see-through tech aesthetic.

As the core of my device is a “lock box” I looked around for some inspiration and found some vault door designs out there. I decided to come up with my own. First I drew a couple of ideas, then I extended it to what a full 5 pin vault door would look like with a simple HTML animation (I am sure there are some good engineering tools for this, keen to hear people’s thoughts) and finally to make sure I get my head around any tolerances and interferences I built a prototype of one arm.

vault door design

Above are 5 “T-shaped” pins running through the motion of lock and unlock driven by a central round piece.

perspex model

A perspex model to iron out tolerances and my construction limitations.

Stepper motor

I presume there are a number of ways I could power my vault door, but as I have never actually used a stepper motor, nothing like now being the right time. I got some ULN2003 based 28BYJ-48 4-Phase Stepper Motor running at 5V. The ULN2003 input threshold is 2.4 V so the MAX32630FTHR GPIO outputs 3.3 V should be fine. As each input draws ~1 mA through the built-in 2.7 kΩ base resistor — no translator required.

The other good thing is, the stepper is geared down, which means it will prevent being “forced open” ie the gears are 1 way and the vault door will stay shut unless the decision is made by the device to power the stepper. This is the case if I used a motor with a worm drive but not the case with most servos and they can be pushed into position.

As I am deep in C-land with LPSDK, I don’t get the benefit of just including a library like

// Includes the Arduino Stepper Library
#include <Stepper.h>

// Defines the number of steps per rotation
const int stepsPerRevolution = 2038;

// Creates an instance of stepper class
// Pins entered in sequence IN1-IN3-IN2-IN4 for proper step sequence
Stepper myStepper = Stepper(stepsPerRevolution, 8, 10, 9, 11);

Fortunately the library is open source so looking at the code

  • https://github.com/arduino-libraries/Stepper/blob/master/src/Stepper.h

shows me the details of controlling the various coils in the stepper motor. This is good as initially my guesses were wrong and I had it erratically turning in 1 direction and just buzzing on the spot when directed in reverse. Fortunately no smoke left the devices.

Finally I got the motor working once I worked out the delay to take between steps, 3 ms, and the correct coils to power at the correct time.

/* -------------------------------------------------------------------------
 * 28BYJ-48 stepper via ULN2003 driver board.
 *
 * Gear ratio: 32 internal steps × 63.68 ≈ 2037.9 → use 2038 full / 4076 half.
 * Reverse (-steps): table index retreats instead of advances.
 * Coils stay energised after a move — holds gearbox meshed for clean reversal.
 * ------------------------------------------------------------------------- */

static const uint8_t wave_step[4][4] = {
    { 1, 0, 0, 0 },   /* IN1        */
    { 0, 1, 0, 0 },   /* IN2        */
    { 0, 0, 1, 0 },   /* IN3        */
    { 0, 0, 0, 1 },   /* IN4        */
};

static const uint8_t half_step[8][4] = {
    { 1, 0, 0, 0 },   /* IN1        */
    { 1, 1, 0, 0 },   /* IN1+IN2    */
    { 0, 1, 0, 0 },   /* IN2        */
    { 0, 1, 1, 0 },   /* IN2+IN3    */
    { 0, 0, 1, 0 },   /* IN3        */
    { 0, 0, 1, 1 },   /* IN3+IN4    */
    { 0, 0, 0, 1 },   /* IN4        */
    { 1, 0, 0, 1 },   /* IN4+IN1    */
};

static const uint8_t (*active_table)[4] = half_step;
static int      table_len     = 8;
static uint32_t step_delay_us  = 2944;   /* 5 RPM – 60,000,000 / 4076 / 5 */
static int      steps_per_rev  = 4076;   /* 32 × 63.68 × 2 */

also some fine tuning on the delay settings based on the Stepper.cpp file

  • Half-step: 2,944 µs → 5 RPM (60,000,000 / 4076 / 5)
  • Wave drive: 1,963 µs → 15 RPM (60,000,000 / 2038 / 15)

and success

stepper test

Next

I am starting to bring a bunch of things together, the MAX32630FTHR connecting to a fingerprint reader, powering a stepper motor, being configured with a rotary encoder and displaying things on an LED matrix. Still I am not sure if that will be enough to enable a lock box that needs more than 1 person to verify for it to be unlocked. For that I am hoping to investigate BLE (Bluetooth Low Energy) and maybe a phone app to help configure it, that said the phone is likely to be locked into the lock box, so maybe only for configuring the lock box. Then there is connecting the stepper motor to the vault mechanism and only a few weeks left in the competition — 24th May 2026.

Source

https://github.com/saramic/sentinel-box

  • Sign in to reply
  • Cancel
  • DAB
    DAB 24 days ago

    You are making good progress.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube