GithubHelp home page GithubHelp logo

hw-demo-alarm-clock's Introduction

HW-Demo-Alarm-Clock

Hardware Development Demonstration - STM32 Powered Alarm Clock

Introduction

The purpose of this project was to demonstrate hardware development capabilities using an STMicroelectronics STM32 ARM powered microcontroller.

PCB Layout (3D render) screen capture Tim White - Alarm Clock PCB Layout 3D

Functional Overview

The Alarm Clock gadget takes user inputs of time and alarming-time and outputs these values through an LCD character display and buzzer.

Currently implemented software functions include:

  • Display interfacing through through 6-button user interface
  • Set current time (hardware RTC; currently 24-hour display format)
  • Set alarm time
  • Alarm when current time and alarm time equal
  • Snooze alarm (5-minute intervals)
  • Disable alarm (auto-recurring next-day)

Hardware Overview

Power is supplied to the device through a surface-mounted micro-USB connector (5 Vdc, SELV). 3.3 Vdc is supplied to the microcontroller from the fixed-output of a 5-3.3v LDO regulator.

Six through-hole momentary push button switches provide a conventional interface with OK/Enter, Back, Up, Down, Left, and Right mappings. Some of the buttons serve multiple functions, e.g. Back acts to return from menus and to disable the alarm once active.

The microcontroller and buttons are interfaced via an asynchronous parallel-in, serial-out shift register. While the STM32 microcontroller offers more than enough GPIO to handle the buttons and display, the use of the shift register IC was a separate learning opportunity.

An 8-bit (parallel), 20x2 LCD character display assembly (with on-board display controller) is used as the primary user display. This display is driven in parallel directly from the microcontroller.

The 5V buzzer is driven by an NPN transistor which is switched by a bit-banged square wave from the uC's GPIO.

The microcontroller is programmed via serial-wire debug through an ST-Link V3 programmer.

The internal high-speed clock is utilized, and a low-speed external 32.768 quartz-crystal oscillator circuit is used for the RTC time keeping.

A USB ESD protection diode array IC is used to prevent damage to the microcontroller during handling.

Prototyping

The shift register and STM32 microcontroller were each installed onto their own breakout boards. A 5V-3.3V regulator was connected to the breadboard's power rail. Decoupling capacitors were installed directly on the power rail. Jumpers were connected as necessary - and thus the Alarm Clock came alive:

Tim White - Alarm Clock Breadboarding video

Schematic Capture

Schematic capture using EasyEDA: Tim White - Alarm Clock Schematic Capture

PCB Layout

Since the Schematic Capture was conducted in EasyEDA, the trace layout was also formed in EasyEDA. Generally, the order of operations was to place:

  • Microcontroller dead center,
  • Edge-mounted headers and USB,
  • Push button switches mounted in standard-layout on reverse-side,
  • Power components placed near power input connector,
  • Decoupling capacitors placed near Vdd/Vss pins of MCU,
  • Shift register placed,
  • All other hardware - routes connected.

PCB Layout screen capture Tim White - Alarm Clock PCB Layout 2D

Production

The Gerber files, BOM, and pick-and-place files were generated through EasyEDA, uploaded to JLCPCB, and any part orientations were corrected in JLCPCB's online board viewer.

Two assembled boards, and three bare boards were received from the manufacturer in short order. They looked and functioned great!

Hardware Mistakes in V1.0

The first batch of PCBs had a few minor mistakes:

  • MCU BOOT0 pin was routed in series with NRST pin, but the MCU requires a certain order of operations to program to internal Flash memory. I had to cut the NRST trace and route a jumper wire to the SWD header (leaving the BOOT0 pin floating). Luckily, this has allowed for suitable firmware flashing.
  • Size of mounting holes: The mounting holes are too small - this should be fine for a prototype. In the future, I'll enlarge them.
  • Reliance on bit-banging the buzzer. In the future, it would be nice to rely on the hardware clock, or an external oscillator, to drive the buzzer instead of GPIO toggling.
  • Missing decoupling capacitor on one power port of the MCU. So far this has not seemed to create an issue. I manually added the capacitor during the internal flash/BOOT0 pin debug, but results were identical.
  • LCD contrast resistances: From breadboard to prototype, I miscalculated the voltage divider for the display contrast. For this prototype, I simply trimed the resistance as needed.
  • Generally, I could have used much smaller SMD parts to avoid crowding, especially in the LSE RTC circuit.

Firmware Development

See src/main.c for all relevant code with embedded comments

Programming Language: C Flash size: 13.55 KB / 64 KB available (21% used / 79% avail.)

hw-demo-alarm-clock's People

Contributors

twwhite avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.