diff options
| -rw-r--r-- | _log/fpm-door-lock-lp.md | 60 | ||||
| -rw-r--r-- | _log/fpm-door-lock-lp/breadboard.jpg (renamed from _log/fpm-door-lock/breadboard.jpg) | bin | 46771 -> 46771 bytes | |||
| -rw-r--r-- | _log/fpm-door-lock-lp/footprint.png (renamed from _log/fpm-door-lock/footprint.png) | bin | 198127 -> 198127 bytes | |||
| -rw-r--r-- | _log/fpm-door-lock-lp/gerber.zip (renamed from _log/fpm-door-lock/gerber.zip) | bin | 89431 -> 89431 bytes | |||
| -rw-r--r-- | _log/fpm-door-lock-lp/pcb.jpg (renamed from _log/fpm-door-lock/pcb.jpg) | bin | 68237 -> 68237 bytes | |||
| -rw-r--r-- | _log/fpm-door-lock-lp/pcb1.jpg (renamed from _log/fpm-door-lock/pcb1.jpg) | bin | 37068 -> 37068 bytes | |||
| -rw-r--r-- | _log/fpm-door-lock-lp/source.tar.gz (renamed from _log/fpm-door-lock/source.tar.gz) | bin | 29473 -> 29473 bytes | |||
| -rw-r--r-- | _log/fpm-door-lock-lp/thumb_sm.jpg (renamed from _log/fpm-door-lock/thumb_sm.jpg) | bin | 18380 -> 18380 bytes | |||
| -rw-r--r-- | _log/fpm-door-lock-lp/video.mp4 (renamed from _log/fpm-door-lock/video.mp4) | bin | 13264594 -> 13264594 bytes | |||
| -rw-r--r-- | _log/fpm-door-lock-rf.md (renamed from _log/my-first-pcb.md) | 2 | ||||
| -rw-r--r-- | _log/fpm-door-lock-rf/back.jpeg (renamed from _log/my-first-pcb/back.jpeg) | bin | 34023 -> 34023 bytes | |||
| -rw-r--r-- | _log/fpm-door-lock-rf/back_design.jpeg (renamed from _log/my-first-pcb/back_design.jpeg) | bin | 31946 -> 31946 bytes | |||
| -rw-r--r-- | _log/fpm-door-lock-rf/front.jpeg (renamed from _log/my-first-pcb/front.jpeg) | bin | 28997 -> 28997 bytes | |||
| -rw-r--r-- | _log/fpm-door-lock-rf/front_design.jpeg (renamed from _log/my-first-pcb/front_design.jpeg) | bin | 32174 -> 32174 bytes | |||
| -rw-r--r-- | _log/fpm-door-lock-rf/gerber_back.zip (renamed from _log/my-first-pcb/gerber_back.zip) | bin | 48217 -> 48217 bytes | |||
| -rw-r--r-- | _log/fpm-door-lock-rf/gerber_front.zip (renamed from _log/my-first-pcb/gerber_front.zip) | bin | 49605 -> 49605 bytes | |||
| -rw-r--r-- | _log/fpm-door-lock-rf/source.tar.gz (renamed from _log/my-first-pcb/source.tar.gz) | bin | 6660 -> 6660 bytes | |||
| -rw-r--r-- | _log/fpm-door-lock-rf/thumb_sm.jpeg (renamed from _log/my-first-pcb/thumb_sm.jpeg) | bin | 6181 -> 6181 bytes | |||
| -rw-r--r-- | _log/fpm-door-lock.md | 113 | ||||
| -rw-r--r-- | _log/matrix-digital-rain.md | 38 | ||||
| -rw-r--r-- | _site/feed.xml | 2 | ||||
| -rw-r--r-- | _site/index.html | 4 | ||||
| -rw-r--r-- | _site/log/fpm-door-lock-lp/breadboard.jpg (renamed from _site/log/fpm-door-lock/breadboard.jpg) | bin | 46771 -> 46771 bytes | |||
| -rw-r--r-- | _site/log/fpm-door-lock-lp/footprint.png (renamed from _site/log/fpm-door-lock/footprint.png) | bin | 198127 -> 198127 bytes | |||
| -rw-r--r-- | _site/log/fpm-door-lock-lp/gerber.zip (renamed from _site/log/fpm-door-lock/gerber.zip) | bin | 89431 -> 89431 bytes | |||
| -rw-r--r-- | _site/log/fpm-door-lock-lp/index.html | 115 | ||||
| -rw-r--r-- | _site/log/fpm-door-lock-lp/pcb.jpg (renamed from _site/log/fpm-door-lock/pcb.jpg) | bin | 68237 -> 68237 bytes | |||
| -rw-r--r-- | _site/log/fpm-door-lock-lp/pcb1.jpg (renamed from _site/log/fpm-door-lock/pcb1.jpg) | bin | 37068 -> 37068 bytes | |||
| -rw-r--r-- | _site/log/fpm-door-lock-lp/source.tar.gz (renamed from _site/log/fpm-door-lock/source.tar.gz) | bin | 29473 -> 29473 bytes | |||
| -rw-r--r-- | _site/log/fpm-door-lock-lp/thumb_sm.jpg (renamed from _site/log/fpm-door-lock/thumb_sm.jpg) | bin | 18380 -> 18380 bytes | |||
| -rw-r--r-- | _site/log/fpm-door-lock-lp/video.mp4 (renamed from _site/log/fpm-door-lock/video.mp4) | bin | 13264594 -> 13264594 bytes | |||
| -rw-r--r-- | _site/log/fpm-door-lock-rf/back.jpeg (renamed from _site/log/my-first-pcb/back.jpeg) | bin | 34023 -> 34023 bytes | |||
| -rw-r--r-- | _site/log/fpm-door-lock-rf/back_design.jpeg (renamed from _site/log/my-first-pcb/back_design.jpeg) | bin | 31946 -> 31946 bytes | |||
| -rw-r--r-- | _site/log/fpm-door-lock-rf/front.jpeg (renamed from _site/log/my-first-pcb/front.jpeg) | bin | 28997 -> 28997 bytes | |||
| -rw-r--r-- | _site/log/fpm-door-lock-rf/front_design.jpeg (renamed from _site/log/my-first-pcb/front_design.jpeg) | bin | 32174 -> 32174 bytes | |||
| -rw-r--r-- | _site/log/fpm-door-lock-rf/gerber_back.zip (renamed from _site/log/my-first-pcb/gerber_back.zip) | bin | 48217 -> 48217 bytes | |||
| -rw-r--r-- | _site/log/fpm-door-lock-rf/gerber_front.zip (renamed from _site/log/my-first-pcb/gerber_front.zip) | bin | 49605 -> 49605 bytes | |||
| -rw-r--r-- | _site/log/fpm-door-lock-rf/index.html (renamed from _site/log/my-first-pcb/index.html) | 6 | ||||
| -rw-r--r-- | _site/log/fpm-door-lock-rf/source.tar.gz (renamed from _site/log/my-first-pcb/source.tar.gz) | bin | 6660 -> 6660 bytes | |||
| -rw-r--r-- | _site/log/fpm-door-lock-rf/thumb_sm.jpeg (renamed from _site/log/my-first-pcb/thumb_sm.jpeg) | bin | 6181 -> 6181 bytes | |||
| -rw-r--r-- | _site/log/fpm-door-lock/index.html | 168 | ||||
| -rw-r--r-- | _site/log/index.html | 4 | ||||
| -rw-r--r-- | _site/log/matrix-digital-rain/index.html | 39 | ||||
| -rw-r--r-- | _site/posts.xml | 2 | ||||
| -rw-r--r-- | _site/projects/index.html | 6 | ||||
| -rw-r--r-- | _site/sitemap.xml | 4 |
46 files changed, 231 insertions, 332 deletions
diff --git a/_log/fpm-door-lock-lp.md b/_log/fpm-door-lock-lp.md new file mode 100644 index 0000000..1be2b76 --- /dev/null +++ b/_log/fpm-door-lock-lp.md @@ -0,0 +1,60 @@ +--- +title: Fingerprint door lock (LP) +date: 2025-08-18 +layout: post +project: true +thumbnail: thumb_sm.jpg +--- + +Second iteration of the [RF door lock](../fpm-door-lock-rf). Old version worked +but drew too much quiescent current. Sensor and servo pulled 13.8mA and 4.6mA +idle. Linear regulators were a disaster. Battery didn't last 24 hours. + +<video style="max-width:100%;" controls="" poster="pcb.jpg"> + <source src="video.mp4" type="video/mp4"> +</video> + +Redesigned the PCB completely. Tossed the RF modules and the second MCU. +Connected R503 sensor directly to the ATmega328P. Sensor now mounts on door +exterior, servo attaches to interior knob, MCU stays on the back to prevent +tampering. + +<table style="border: none; width: 100%"> + <tr style="border: none;"> + <td style="border: none; width: 49.9%; background-color: transparent; text-align: center;"> + <img src="breadboard.jpg" alt="PCB" style="width: 100%"> + </td> + <td style="border: none; background-color: transparent; text-align: center;"> + <img src="pcb1.jpg" alt="Design" style="width: 100%"> + </td> + </tr> + <tr style="border: none;"> + <td colspan="2" style="border: none; background-color: transparent; text-align: center;"> + <img src="footprint.png" alt="PCB footprint" style="width: 100%"> + </td> + </tr> +</table> + +PCB specs: 2-layer, 1oz copper, 0.3mm traces (1mm for power and servo). Ground +plane on bottom layer. + +Solved idle power draw with MOSFETs. 2N7000 and NDP6020P cut power to sensor +and servo before deep sleep. Through-hole MOSFETs that switch at 3.3V are +getting harder to find. NDP6020P already obsolete. + +Replaced linear regulators with MP1584EN DC-DC buck converters. No RF, noise +isn't a big concern. Buck's pin breakout not great--wouldn't fit most +commercial dev boards. + +Squeezed more power savings from the MCU by running it at 3.3V/8MHz. Combined +with buck converters: 56% total power savings. + +Wake sequence: MCU activates sensor MOSFET, unlocks sensor over UART, scans and +matches fingerprint. Match triggers blue LED, servo MOSFET, PWM signal to +unlock. No match triggers red LED. MOSFETs off, back to sleep. + +Total power savings: 99.9% (30.6mA → 2.9μA). Verdict: Fixed. + +Commit: +[7529094](https://git.asciimx.com/fpm-door-lock/commit/?id=75290945b2fd84b3bc108fd46419ee478eaac3ca) +| Gerber: [gerber.zip](gerber.zip) diff --git a/_log/fpm-door-lock/breadboard.jpg b/_log/fpm-door-lock-lp/breadboard.jpg Binary files differindex 2bf47a9..2bf47a9 100644 --- a/_log/fpm-door-lock/breadboard.jpg +++ b/_log/fpm-door-lock-lp/breadboard.jpg diff --git a/_log/fpm-door-lock/footprint.png b/_log/fpm-door-lock-lp/footprint.png Binary files differindex 5511bf1..5511bf1 100644 --- a/_log/fpm-door-lock/footprint.png +++ b/_log/fpm-door-lock-lp/footprint.png diff --git a/_log/fpm-door-lock/gerber.zip b/_log/fpm-door-lock-lp/gerber.zip Binary files differindex 19a9d19..19a9d19 100644 --- a/_log/fpm-door-lock/gerber.zip +++ b/_log/fpm-door-lock-lp/gerber.zip diff --git a/_log/fpm-door-lock/pcb.jpg b/_log/fpm-door-lock-lp/pcb.jpg Binary files differindex fbd800b..fbd800b 100644 --- a/_log/fpm-door-lock/pcb.jpg +++ b/_log/fpm-door-lock-lp/pcb.jpg diff --git a/_log/fpm-door-lock/pcb1.jpg b/_log/fpm-door-lock-lp/pcb1.jpg Binary files differindex 367187d..367187d 100644 --- a/_log/fpm-door-lock/pcb1.jpg +++ b/_log/fpm-door-lock-lp/pcb1.jpg diff --git a/_log/fpm-door-lock/source.tar.gz b/_log/fpm-door-lock-lp/source.tar.gz Binary files differindex ef23422..ef23422 100644 --- a/_log/fpm-door-lock/source.tar.gz +++ b/_log/fpm-door-lock-lp/source.tar.gz diff --git a/_log/fpm-door-lock/thumb_sm.jpg b/_log/fpm-door-lock-lp/thumb_sm.jpg Binary files differindex a8fa534..a8fa534 100644 --- a/_log/fpm-door-lock/thumb_sm.jpg +++ b/_log/fpm-door-lock-lp/thumb_sm.jpg diff --git a/_log/fpm-door-lock/video.mp4 b/_log/fpm-door-lock-lp/video.mp4 Binary files differindex a907a9b..a907a9b 100644 --- a/_log/fpm-door-lock/video.mp4 +++ b/_log/fpm-door-lock-lp/video.mp4 diff --git a/_log/my-first-pcb.md b/_log/fpm-door-lock-rf.md index eced7e4..b677591 100644 --- a/_log/my-first-pcb.md +++ b/_log/fpm-door-lock-rf.md @@ -1,5 +1,5 @@ --- -title: My first PCB +title: Fingerprint door lock (RF) date: 2025-04-26 layout: post --- diff --git a/_log/my-first-pcb/back.jpeg b/_log/fpm-door-lock-rf/back.jpeg Binary files differindex f458e69..f458e69 100644 --- a/_log/my-first-pcb/back.jpeg +++ b/_log/fpm-door-lock-rf/back.jpeg diff --git a/_log/my-first-pcb/back_design.jpeg b/_log/fpm-door-lock-rf/back_design.jpeg Binary files differindex b6c0f5d..b6c0f5d 100644 --- a/_log/my-first-pcb/back_design.jpeg +++ b/_log/fpm-door-lock-rf/back_design.jpeg diff --git a/_log/my-first-pcb/front.jpeg b/_log/fpm-door-lock-rf/front.jpeg Binary files differindex 2b2931f..2b2931f 100644 --- a/_log/my-first-pcb/front.jpeg +++ b/_log/fpm-door-lock-rf/front.jpeg diff --git a/_log/my-first-pcb/front_design.jpeg b/_log/fpm-door-lock-rf/front_design.jpeg Binary files differindex f81f09c..f81f09c 100644 --- a/_log/my-first-pcb/front_design.jpeg +++ b/_log/fpm-door-lock-rf/front_design.jpeg diff --git a/_log/my-first-pcb/gerber_back.zip b/_log/fpm-door-lock-rf/gerber_back.zip Binary files differindex 26659ad..26659ad 100644 --- a/_log/my-first-pcb/gerber_back.zip +++ b/_log/fpm-door-lock-rf/gerber_back.zip diff --git a/_log/my-first-pcb/gerber_front.zip b/_log/fpm-door-lock-rf/gerber_front.zip Binary files differindex 864334e..864334e 100644 --- a/_log/my-first-pcb/gerber_front.zip +++ b/_log/fpm-door-lock-rf/gerber_front.zip diff --git a/_log/my-first-pcb/source.tar.gz b/_log/fpm-door-lock-rf/source.tar.gz Binary files differindex c31aa22..c31aa22 100644 --- a/_log/my-first-pcb/source.tar.gz +++ b/_log/fpm-door-lock-rf/source.tar.gz diff --git a/_log/my-first-pcb/thumb_sm.jpeg b/_log/fpm-door-lock-rf/thumb_sm.jpeg Binary files differindex c275b12..c275b12 100644 --- a/_log/my-first-pcb/thumb_sm.jpeg +++ b/_log/fpm-door-lock-rf/thumb_sm.jpeg diff --git a/_log/fpm-door-lock.md b/_log/fpm-door-lock.md deleted file mode 100644 index 5b78b3e..0000000 --- a/_log/fpm-door-lock.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -title: Fingerprint door lock -date: 2025-08-18 -layout: post -project: true -thumbnail: thumb_sm.jpg ---- - -This project features a fingerprint door lock powered by an ATmega328P -microcontroller. - -<video style="max-width:100%;" controls="" poster="pcb.jpg"> - <source src="video.mp4" type="video/mp4"> -</video> - -## Overview - -The lock comprises three subsystems: the ATmega328P microcontroller, an R503 -fingerprint sensor, and an FS5106B high-torque servo. The sensor mounted on the -front surface of the door enables users to unlock it from the outside. The -servo is attached to the interior door knob. The MCU must be installed at the -back of the door to prevent unauthorized users from tampering with it. - -When no one is interacting with the lock, the MCU is in deep sleep. The sensor -and the servo each draw 13.8mA and 4.6mA of quiescent currents. To prevent this -idle current draw, the MCU employs MOSFETs to cut off power to them before -entering deep sleep. Doing so is crucial for conserving the battery. - -Without power, the sensor remains in a low-power state, drawing approximately -2.9μA through a separate power rail. When a finger comes into contact with the -sensor, the sensor triggers a pin change interrupt, waking up the MCU. The MCU -activates a MOSFET, which in turn activates the sensor. Over UART, the MCU -unlocks the sensor and issues commands to scan and match the fingerprint. - -If the fingerprint matches an enrolled fingerprint, the MCU activates the blue -LED on the sensor, turns on the MOSFET connected to the servo, and sends a PWM -signal to the servo to unlock the door. Otherwise, the MCU activates the red -LED on the sensor. Finally, the MCU deactivates the MOSFETS and goes back to -sleep. - -## Embedded software - -The embedded software, written in C, includes a driver for the sensor, servo -control routines, and a battery monitoring system. - -In addition to controlling the sensor and the servo, the program strives to -maintain precise control over the microcontroller's sleep modes, as well as -when the peripherals are activated and for how long they remain active. I -thoroughly enjoyed writing the embedded software. There's something magical -about being able to alter the physical world around you by uttering a few lines -of C code. - -The source code of the project, which includes a driver for the R503 -fingerprint sensor module, is enclosed in the tarball linked at the end of the -page. - -## The PCB - -For this project, I designed a custom PCB and had it fabricated by JLCPCB. Like -the software, the circuit is primarily concerned with optimizing power -consumption and extending battery life. - -<table style="border: none; width: 100%"> - <tr style="border: none;"> - <td style="border: none; width: 49.9%; background-color: transparent; text-align: center;"> - <img src="breadboard.jpg" alt="PCB" style="width: 100%"> - </td> - <td style="border: none; background-color: transparent; text-align: center;"> - <img src="pcb1.jpg" alt="Design" style="width: 100%"> - </td> - </tr> - <tr style="border: none;"> - <td colspan="2" style="border: none; background-color: transparent; text-align: center;"> - <img src="footprint.png" alt="PCB footprint" style="width: 100%"> - </td> - </tr> -</table> - -Consequently, the principal components of the circuit are the 2N7000 and -NDP6020P field-effect transistors. They switch power electronically to the -servo and the fingerprint sensor, the two most power-hungry parts of the -circuit. The two MP1584EN buck converters play an axial role in efficiently -regulating power to the MCU and the sensor. - -The ATmega328P typically operates at 5V with a 16MHz crystal oscillator. To -further reduce power consumption, I modified the ATmega328P's fuses to run at -3.3V with an 8MHz crystal oscillator. - -The bottom right area of the PCB isolates the power supply of the servo from -the rest of the circuit. This shields components such as the MCU from the -servo's high current draw, which can exceed 1A. The IN4007 diode in slot U2 -serves as a flyback diode, protecting the MOSFET from reverse currents -generated by the servo. - -Lastly, the 56kΩ and 10kΩ resistors in slots R10 and R11 form a voltage divider -circuit. Its output is fed to the ADC of the MCU, which measures the supply -voltage by comparing it to the internal bandgap reference voltage. - -## Epilogue - -This project began nearly a year ago when I attempted to unlock our door -wirelessly by writing to the UART ports of two MCUs connected to inexpensive -433MHz RF transceivers. Although I failed, it led me down a rabbit hole of RF -communications, MOSFETs, PCB design, and low-power circuits. - -During the project, I reinvented the wheel many times. I implemented a -low-level network stack using only RF modules and an 8-bit microcontroller, -designed my first PCB, and developed drivers from scratch. The project was far -from a smooth sail. Bad electrical connections, soldering and desoldering, and -the heartache of purchasing the wrong parts were routine. It was a long but -rewarding journey from the messy breadboard to the shiny PCB. - -Files: [source.tar.gz](source.tar.gz), [gerber.zip](gerber.zip) diff --git a/_log/matrix-digital-rain.md b/_log/matrix-digital-rain.md index 8512208..f1553e1 100644 --- a/_log/matrix-digital-rain.md +++ b/_log/matrix-digital-rain.md @@ -16,44 +16,46 @@ than it needed to be. </video> Moved phosphor decay into the 4th byte of the RGB union--should’ve done this -in 2022. What was I thinking. +in 2022; What was I thinking. Keeping the RGB union despite portability concerns. All my systems are little-endian and the code is cleaner this way. Fixed Unicode by introducing a charset array. UNICODE(min, max) packs Unicode -ranges into uint64--low four bytes for start, high four bytes for end. +ranges into uint64: low four bytes for start, high four bytes for end. insert_code() unpacks a random block and picks a character from it: ``` +#define UNICODE(min, max) (((uint64_t)max << 32) | min) + static uint64_t glyphs[] = { UNICODE(0x0021, 0x007E), /* ASCII */ UNICODE(0xFF65, 0xFF9F), /* Half-width Katakana */ }; -``` - -Full-width Katakana breaks column alignment. Stick to half-width -(U+FF61-U+FF9F) range. Compile with -DNOKANA to disable Katakana altogether. - -blend() simulates phosphor decay by eroding RGB channels toward -background color: -``` -static inline void blend(matrix *mat, size_t row, size_t col) +static inline void insert_code(matrix *mat, + size_t row, size_t col) { - unsigned char *color = mat->rgb[index(mat, row, col)].color; - color[R] = color[R] - (color[R] - RGB_BG_RED) / DECAY_MPLIER; - color[G] = color[G] - (color[G] - RGB_BG_GRN) / DECAY_MPLIER; - color[B] = color[B] - (color[B] - RGB_BG_BLU) / DECAY_MPLIER; + uint64_t blk; + uint32_t min, max; + + blk = glyphs[(rand() % glyphlen)]; + min = (uint32_t)blk; + max = (uint32_t)(blk >> 32); + mat->code[index(mat, row, col)] = rand() % (max - min) + min; } ``` -That's still good. Leaving it alone. +Full-width Katakana breaks column alignment. Stick to half-width +(U+FF61-U+FF9F) range. Compile with -DNOKANA to disable Katakana altogether. + +blend() is still good. Leaving it alone. Tossed license and automake cruft. Just `cc -O3 main.c -o matrix` now. Don't need the ceremony. -Runs at 2-3% CPU on OpenBSD (T490). No regressions. Fans are quiet. +Runs at 2-3% CPU on OpenBSD (T490). No cause to measure performance more +precisely. No regressions. Fans are quiet. Commit: -[03f8d87](https://git.asciimx.com/matrix-digital-rain/commit/?id=03f8d87ba7c2e46bd3f3cc4c772fb3a2ac740c92) +[69a888a](https://git.asciimx.com/matrix-digital-rain/commit/main.c?id=69a888a5b0bc4ef4bce4f86c1556a06f0f131fda) diff --git a/_site/feed.xml b/_site/feed.xml index 1b81c18..c57a03e 100644 --- a/_site/feed.xml +++ b/_site/feed.xml @@ -1 +1 @@ -<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2025-12-26T12:29:33+08:00</updated><id>/feed.xml</id><title type="html">ASCIIMX | Log</title><author><name>W. D. Sadeep Madurange</name></author><entry><title type="html">Matrix Rain: 2025 refactor</title><link href="/log/matrix-digital-rain/" rel="alternate" type="text/html" title="Matrix Rain: 2025 refactor" /><published>2025-12-21T00:00:00+08:00</published><updated>2025-12-21T00:00:00+08:00</updated><id>/log/matrix-digital-rain</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[The 2022 version worked but had some loose ends. Unicode support was inflexible–couldn’t mix ASCII with Katakana; Phosphor decay was stored in a separate array when it should’ve been packed with RGB; Code was harder to read than it needed to be.]]></summary></entry><entry><title type="html">Fingerprint door lock</title><link href="/log/fpm-door-lock/" rel="alternate" type="text/html" title="Fingerprint door lock" /><published>2025-08-18T00:00:00+08:00</published><updated>2025-08-18T00:00:00+08:00</updated><id>/log/fpm-door-lock</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[This project features a fingerprint door lock powered by an ATmega328P microcontroller.]]></summary></entry><entry><title type="html">On the use of MOSFETs as electronic switches</title><link href="/log/mosfet-switches/" rel="alternate" type="text/html" title="On the use of MOSFETs as electronic switches" /><published>2025-06-22T00:00:00+08:00</published><updated>2025-06-22T00:00:00+08:00</updated><id>/log/mosfet-switches</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[Recently, I needed a low-power circuit for one of my battery-operated projects. Much of the system’s power savings depended on its ability to electronically switch off components, such as servos, that draw high levels of quiescent currents. My search for a solution led me to MOSFETs, transistors capable of controlling circuits operating at voltages far above their own.]]></summary></entry><entry><title type="html">How to configure ATmega328P microcontrollers to run at 3.3V and 5V</title><link href="/log/arduino-uno/" rel="alternate" type="text/html" title="How to configure ATmega328P microcontrollers to run at 3.3V and 5V" /><published>2025-06-10T00:00:00+08:00</published><updated>2025-06-10T00:00:00+08:00</updated><id>/log/arduino-uno</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[This is a quick reference for wiring up ATmega328P ICs to run at 5V and 3.3V. While the 5V configuration is common, the 3.3V configuration can be useful in low-power applications and when interfacing with parts that themselves run at 3.3V. In this guide, the 5V setup is configured with a 16MHz crystal oscillator, while the 3.3V configuration makes use of an 8MHz crystal oscillator.]]></summary></entry><entry><title type="html">My first PCB</title><link href="/log/my-first-pcb/" rel="alternate" type="text/html" title="My first PCB" /><published>2025-04-26T00:00:00+08:00</published><updated>2025-04-26T00:00:00+08:00</updated><id>/log/my-first-pcb</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[In 2023, I started tinkering with DIY electronics as a hobby. Until now, I’ve been using development boards like the Arduino Uno and ESP-32-WROOM so that I can focus on the software. Recently, I decided to step outside of my comfort zone and design a PCB from scratch for a door lock I’m working on.]]></summary></entry><entry><title type="html">Bumblebee: browser automation</title><link href="/log/bumblebee/" rel="alternate" type="text/html" title="Bumblebee: browser automation" /><published>2025-04-02T00:00:00+08:00</published><updated>2025-04-02T00:00:00+08:00</updated><id>/log/bumblebee</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[Bumblebee is a tool I built for one of my employers to automate the generation of web scraping scripts.]]></summary></entry><entry><title type="html">How to set up ATSAM3X8E microcontrollers for bare-metal programming in C</title><link href="/log/arduino-due/" rel="alternate" type="text/html" title="How to set up ATSAM3X8E microcontrollers for bare-metal programming in C" /><published>2024-09-16T00:00:00+08:00</published><updated>2024-09-16T00:00:00+08:00</updated><id>/log/arduino-due</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[This article is a step-by-step guide for programming bare-metal ATSAM3X8E chips found on Arduino Due boards. It also includes notes on the chip’s memory layout relevant for writing linker scripts. The steps described in this article were tested on an OpenBSD workstation.]]></summary></entry><entry><title type="html">Etlas: e-paper dashboard</title><link href="/log/etlas/" rel="alternate" type="text/html" title="Etlas: e-paper dashboard" /><published>2024-09-05T00:00:00+08:00</published><updated>2024-09-05T00:00:00+08:00</updated><id>/log/etlas</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[Etlas is a news, stock market, and weather tracker powered by an ESP32 NodeMCU D1, featuring a 7.5-inch Waveshare e-paper display and a DHT22 sensor module.]]></summary></entry><entry><title type="html">Experimental e-reader</title><link href="/log/e-reader/" rel="alternate" type="text/html" title="Experimental e-reader" /><published>2023-10-24T00:00:00+08:00</published><updated>2023-10-24T00:00:00+08:00</updated><id>/log/e-reader</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[This project features an experimental e-reader powered by an ESP-WROOM-32 development board and a 7.5-inch Waveshare e-paper display built with the intention of learning about e-paper displays.]]></summary></entry><entry><title type="html">Neo4J A* search</title><link href="/log/neo4j-a-star-search/" rel="alternate" type="text/html" title="Neo4J A* search" /><published>2018-03-06T00:00:00+08:00</published><updated>2018-03-06T00:00:00+08:00</updated><id>/log/neo4j-a-star-search</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[Back in 2018, we used Neo4J graph database to track the movement of marine vessels. We were interested in the shortest path a ship could take through a network of about 13,000 route points. Graph theoretic algorithms provide optimal solutions to such problems, and the set of route points lends itself well to graph-based modelling.]]></summary></entry></feed>
\ No newline at end of file +<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2025-12-26T21:43:25+08:00</updated><id>/feed.xml</id><title type="html">ASCIIMX | Log</title><author><name>W. D. Sadeep Madurange</name></author><entry><title type="html">Matrix Rain: 2025 refactor</title><link href="/log/matrix-digital-rain/" rel="alternate" type="text/html" title="Matrix Rain: 2025 refactor" /><published>2025-12-21T00:00:00+08:00</published><updated>2025-12-21T00:00:00+08:00</updated><id>/log/matrix-digital-rain</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[The 2022 version worked but had some loose ends. Unicode support was inflexible–couldn’t mix ASCII with Katakana; Phosphor decay was stored in a separate array when it should’ve been packed with RGB; Code was harder to read than it needed to be.]]></summary></entry><entry><title type="html">Fingerprint door lock (LP)</title><link href="/log/fpm-door-lock-lp/" rel="alternate" type="text/html" title="Fingerprint door lock (LP)" /><published>2025-08-18T00:00:00+08:00</published><updated>2025-08-18T00:00:00+08:00</updated><id>/log/fpm-door-lock-lp</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[Second iteration of the RF door lock. Old version worked but drew too much quiescent current. Sensor and servo pulled 13.8mA and 4.6mA idle. Linear regulators were a disaster. Battery didn’t last 24 hours.]]></summary></entry><entry><title type="html">On the use of MOSFETs as electronic switches</title><link href="/log/mosfet-switches/" rel="alternate" type="text/html" title="On the use of MOSFETs as electronic switches" /><published>2025-06-22T00:00:00+08:00</published><updated>2025-06-22T00:00:00+08:00</updated><id>/log/mosfet-switches</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[Recently, I needed a low-power circuit for one of my battery-operated projects. Much of the system’s power savings depended on its ability to electronically switch off components, such as servos, that draw high levels of quiescent currents. My search for a solution led me to MOSFETs, transistors capable of controlling circuits operating at voltages far above their own.]]></summary></entry><entry><title type="html">How to configure ATmega328P microcontrollers to run at 3.3V and 5V</title><link href="/log/arduino-uno/" rel="alternate" type="text/html" title="How to configure ATmega328P microcontrollers to run at 3.3V and 5V" /><published>2025-06-10T00:00:00+08:00</published><updated>2025-06-10T00:00:00+08:00</updated><id>/log/arduino-uno</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[This is a quick reference for wiring up ATmega328P ICs to run at 5V and 3.3V. While the 5V configuration is common, the 3.3V configuration can be useful in low-power applications and when interfacing with parts that themselves run at 3.3V. In this guide, the 5V setup is configured with a 16MHz crystal oscillator, while the 3.3V configuration makes use of an 8MHz crystal oscillator.]]></summary></entry><entry><title type="html">Fingerprint door lock (RF)</title><link href="/log/fpm-door-lock-rf/" rel="alternate" type="text/html" title="Fingerprint door lock (RF)" /><published>2025-04-26T00:00:00+08:00</published><updated>2025-04-26T00:00:00+08:00</updated><id>/log/fpm-door-lock-rf</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[In 2023, I started tinkering with DIY electronics as a hobby. Until now, I’ve been using development boards like the Arduino Uno and ESP-32-WROOM so that I can focus on the software. Recently, I decided to step outside of my comfort zone and design a PCB from scratch for a door lock I’m working on.]]></summary></entry><entry><title type="html">Bumblebee: browser automation</title><link href="/log/bumblebee/" rel="alternate" type="text/html" title="Bumblebee: browser automation" /><published>2025-04-02T00:00:00+08:00</published><updated>2025-04-02T00:00:00+08:00</updated><id>/log/bumblebee</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[Bumblebee is a tool I built for one of my employers to automate the generation of web scraping scripts.]]></summary></entry><entry><title type="html">How to set up ATSAM3X8E microcontrollers for bare-metal programming in C</title><link href="/log/arduino-due/" rel="alternate" type="text/html" title="How to set up ATSAM3X8E microcontrollers for bare-metal programming in C" /><published>2024-09-16T00:00:00+08:00</published><updated>2024-09-16T00:00:00+08:00</updated><id>/log/arduino-due</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[This article is a step-by-step guide for programming bare-metal ATSAM3X8E chips found on Arduino Due boards. It also includes notes on the chip’s memory layout relevant for writing linker scripts. The steps described in this article were tested on an OpenBSD workstation.]]></summary></entry><entry><title type="html">Etlas: e-paper dashboard</title><link href="/log/etlas/" rel="alternate" type="text/html" title="Etlas: e-paper dashboard" /><published>2024-09-05T00:00:00+08:00</published><updated>2024-09-05T00:00:00+08:00</updated><id>/log/etlas</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[Etlas is a news, stock market, and weather tracker powered by an ESP32 NodeMCU D1, featuring a 7.5-inch Waveshare e-paper display and a DHT22 sensor module.]]></summary></entry><entry><title type="html">Experimental e-reader</title><link href="/log/e-reader/" rel="alternate" type="text/html" title="Experimental e-reader" /><published>2023-10-24T00:00:00+08:00</published><updated>2023-10-24T00:00:00+08:00</updated><id>/log/e-reader</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[This project features an experimental e-reader powered by an ESP-WROOM-32 development board and a 7.5-inch Waveshare e-paper display built with the intention of learning about e-paper displays.]]></summary></entry><entry><title type="html">Neo4J A* search</title><link href="/log/neo4j-a-star-search/" rel="alternate" type="text/html" title="Neo4J A* search" /><published>2018-03-06T00:00:00+08:00</published><updated>2018-03-06T00:00:00+08:00</updated><id>/log/neo4j-a-star-search</id><author><name>W. D. Sadeep Madurange</name></author><summary type="html"><![CDATA[Back in 2018, we used Neo4J graph database to track the movement of marine vessels. We were interested in the shortest path a ship could take through a network of about 13,000 route points. Graph theoretic algorithms provide optimal solutions to such problems, and the set of route points lends itself well to graph-based modelling.]]></summary></entry></feed>
\ No newline at end of file diff --git a/_site/index.html b/_site/index.html index 68750d3..08d3663 100644 --- a/_site/index.html +++ b/_site/index.html @@ -69,7 +69,7 @@ <tr> <td class="posts-td posts-td-link"> - <a href="/log/fpm-door-lock/" class="link-decor-none">Fingerprint door lock</a> + <a href="/log/fpm-door-lock-lp/" class="link-decor-none">Fingerprint door lock (LP)</a> </td> <td class="posts-td posts-td-time"> <span class="post-meta"> @@ -108,7 +108,7 @@ <tr> <td class="posts-td posts-td-link"> - <a href="/log/my-first-pcb/" class="link-decor-none">My first PCB</a> + <a href="/log/fpm-door-lock-rf/" class="link-decor-none">Fingerprint door lock (RF)</a> </td> <td class="posts-td posts-td-time"> <span class="post-meta"> diff --git a/_site/log/fpm-door-lock/breadboard.jpg b/_site/log/fpm-door-lock-lp/breadboard.jpg Binary files differindex 2bf47a9..2bf47a9 100644 --- a/_site/log/fpm-door-lock/breadboard.jpg +++ b/_site/log/fpm-door-lock-lp/breadboard.jpg diff --git a/_site/log/fpm-door-lock/footprint.png b/_site/log/fpm-door-lock-lp/footprint.png Binary files differindex 5511bf1..5511bf1 100644 --- a/_site/log/fpm-door-lock/footprint.png +++ b/_site/log/fpm-door-lock-lp/footprint.png diff --git a/_site/log/fpm-door-lock/gerber.zip b/_site/log/fpm-door-lock-lp/gerber.zip Binary files differindex 19a9d19..19a9d19 100644 --- a/_site/log/fpm-door-lock/gerber.zip +++ b/_site/log/fpm-door-lock-lp/gerber.zip diff --git a/_site/log/fpm-door-lock-lp/index.html b/_site/log/fpm-door-lock-lp/index.html new file mode 100644 index 0000000..76715d7 --- /dev/null +++ b/_site/log/fpm-door-lock-lp/index.html @@ -0,0 +1,115 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>Fingerprint door lock (LP)</title> + + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>Fingerprint door lock (LP)</title> + <link rel="stylesheet" href="/assets/css/main.css"> + <link rel="stylesheet" href="/assets/css/skeleton.css"> +</head> + + + + </head> + <body> + + <div id="nav-container" class="container"> + <ul id="navlist" class="left"> + + <li > + <a href="/" class="link-decor-none">hme</a> + </li> + <li class="active"> + <a href="/log/" class="link-decor-none">log</a> + </li> + <li > + <a href="/projects/" class="link-decor-none">poc</a> + </li> + <li > + <a href="/about/" class="link-decor-none">abt</a> + </li> + <li><a href="/feed.xml" class="link-decor-none">rss</a></li> + </ul> +</div> + + + + <main> + <div class="container"> + <div class="container-2"> + <h2 class="center" id="title">FINGERPRINT DOOR LOCK (LP)</h2> + <h6 class="center">18 AUGUST 2025</h5> + <br> + <div class="twocol justify"><p>Second iteration of the <a href="../fpm-door-lock-rf">RF door lock</a>. Old version worked +but drew too much quiescent current. Sensor and servo pulled 13.8mA and 4.6mA +idle. Linear regulators were a disaster. Battery didn’t last 24 hours.</p> + +<video style="max-width:100%;" controls="" poster="pcb.jpg"> + <source src="video.mp4" type="video/mp4" /> +</video> + +<p>Redesigned the PCB completely. Tossed the RF modules and the second MCU. +Connected R503 sensor directly to the ATmega328P. Sensor now mounts on door +exterior, servo attaches to interior knob, MCU stays on the back to prevent +tampering.</p> + +<table style="border: none; width: 100%"> + <tr style="border: none;"> + <td style="border: none; width: 49.9%; background-color: transparent; text-align: center;"> + <img src="breadboard.jpg" alt="PCB" style="width: 100%" /> + </td> + <td style="border: none; background-color: transparent; text-align: center;"> + <img src="pcb1.jpg" alt="Design" style="width: 100%" /> + </td> + </tr> + <tr style="border: none;"> + <td colspan="2" style="border: none; background-color: transparent; text-align: center;"> + <img src="footprint.png" alt="PCB footprint" style="width: 100%" /> + </td> + </tr> +</table> + +<p>PCB specs: 2-layer, 1oz copper, 0.3mm traces (1mm for power and servo). Ground +plane on bottom layer.</p> + +<p>Solved idle power draw with MOSFETs. 2N7000 and NDP6020P cut power to sensor +and servo before deep sleep. Through-hole MOSFETs that switch at 3.3V are +getting harder to find. NDP6020P already obsolete.</p> + +<p>Replaced linear regulators with MP1584EN DC-DC buck converters. No RF, noise +isn’t a big concern. Buck’s pin breakout not great–wouldn’t fit most +commercial dev boards.</p> + +<p>Squeezed more power savings from the MCU by running it at 3.3V/8MHz. Combined +with buck converters: 56% total power savings.</p> + +<p>Wake sequence: MCU activates sensor MOSFET, unlocks sensor over UART, scans and +matches fingerprint. Match triggers blue LED, servo MOSFET, PWM signal to +unlock. No match triggers red LED. MOSFETs off, back to sleep.</p> + +<p>Total power savings: 99.9% (30.6mA → 2.9μA). Verdict: Fixed.</p> + +<p>Commit: +<a href="https://git.asciimx.com/fpm-door-lock/commit/?id=75290945b2fd84b3bc108fd46419ee478eaac3ca">7529094</a> +| Gerber: <a href="gerber.zip">gerber.zip</a></p> +</div> + <p class="post-author right">by W. D. Sadeep Madurange</p> + </div> + </div> + </main> + + <div class="footer"> + <div class="container"> + <div class="twelve columns right container-2"> + <p id="footer-text">© ASCIIMX - 2025</p> + </div> + </div> +</div> + + + </body> +</html> diff --git a/_site/log/fpm-door-lock/pcb.jpg b/_site/log/fpm-door-lock-lp/pcb.jpg Binary files differindex fbd800b..fbd800b 100644 --- a/_site/log/fpm-door-lock/pcb.jpg +++ b/_site/log/fpm-door-lock-lp/pcb.jpg diff --git a/_site/log/fpm-door-lock/pcb1.jpg b/_site/log/fpm-door-lock-lp/pcb1.jpg Binary files differindex 367187d..367187d 100644 --- a/_site/log/fpm-door-lock/pcb1.jpg +++ b/_site/log/fpm-door-lock-lp/pcb1.jpg diff --git a/_site/log/fpm-door-lock/source.tar.gz b/_site/log/fpm-door-lock-lp/source.tar.gz Binary files differindex ef23422..ef23422 100644 --- a/_site/log/fpm-door-lock/source.tar.gz +++ b/_site/log/fpm-door-lock-lp/source.tar.gz diff --git a/_site/log/fpm-door-lock/thumb_sm.jpg b/_site/log/fpm-door-lock-lp/thumb_sm.jpg Binary files differindex a8fa534..a8fa534 100644 --- a/_site/log/fpm-door-lock/thumb_sm.jpg +++ b/_site/log/fpm-door-lock-lp/thumb_sm.jpg diff --git a/_site/log/fpm-door-lock/video.mp4 b/_site/log/fpm-door-lock-lp/video.mp4 Binary files differindex a907a9b..a907a9b 100644 --- a/_site/log/fpm-door-lock/video.mp4 +++ b/_site/log/fpm-door-lock-lp/video.mp4 diff --git a/_site/log/my-first-pcb/back.jpeg b/_site/log/fpm-door-lock-rf/back.jpeg Binary files differindex f458e69..f458e69 100644 --- a/_site/log/my-first-pcb/back.jpeg +++ b/_site/log/fpm-door-lock-rf/back.jpeg diff --git a/_site/log/my-first-pcb/back_design.jpeg b/_site/log/fpm-door-lock-rf/back_design.jpeg Binary files differindex b6c0f5d..b6c0f5d 100644 --- a/_site/log/my-first-pcb/back_design.jpeg +++ b/_site/log/fpm-door-lock-rf/back_design.jpeg diff --git a/_site/log/my-first-pcb/front.jpeg b/_site/log/fpm-door-lock-rf/front.jpeg Binary files differindex 2b2931f..2b2931f 100644 --- a/_site/log/my-first-pcb/front.jpeg +++ b/_site/log/fpm-door-lock-rf/front.jpeg diff --git a/_site/log/my-first-pcb/front_design.jpeg b/_site/log/fpm-door-lock-rf/front_design.jpeg Binary files differindex f81f09c..f81f09c 100644 --- a/_site/log/my-first-pcb/front_design.jpeg +++ b/_site/log/fpm-door-lock-rf/front_design.jpeg diff --git a/_site/log/my-first-pcb/gerber_back.zip b/_site/log/fpm-door-lock-rf/gerber_back.zip Binary files differindex 26659ad..26659ad 100644 --- a/_site/log/my-first-pcb/gerber_back.zip +++ b/_site/log/fpm-door-lock-rf/gerber_back.zip diff --git a/_site/log/my-first-pcb/gerber_front.zip b/_site/log/fpm-door-lock-rf/gerber_front.zip Binary files differindex 864334e..864334e 100644 --- a/_site/log/my-first-pcb/gerber_front.zip +++ b/_site/log/fpm-door-lock-rf/gerber_front.zip diff --git a/_site/log/my-first-pcb/index.html b/_site/log/fpm-door-lock-rf/index.html index 735a1da..c12d808 100644 --- a/_site/log/my-first-pcb/index.html +++ b/_site/log/fpm-door-lock-rf/index.html @@ -2,12 +2,12 @@ <html> <head> <meta charset="utf-8"> - <title>My first PCB</title> + <title>Fingerprint door lock (RF)</title> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> - <title>My first PCB</title> + <title>Fingerprint door lock (RF)</title> <link rel="stylesheet" href="/assets/css/main.css"> <link rel="stylesheet" href="/assets/css/skeleton.css"> </head> @@ -41,7 +41,7 @@ <main> <div class="container"> <div class="container-2"> - <h2 class="center" id="title">MY FIRST PCB</h2> + <h2 class="center" id="title">FINGERPRINT DOOR LOCK (RF)</h2> <h6 class="center">26 APRIL 2025</h5> <br> <div class="twocol justify"><p>In 2023, I started tinkering with DIY electronics as a hobby. Until now, I’ve diff --git a/_site/log/my-first-pcb/source.tar.gz b/_site/log/fpm-door-lock-rf/source.tar.gz Binary files differindex c31aa22..c31aa22 100644 --- a/_site/log/my-first-pcb/source.tar.gz +++ b/_site/log/fpm-door-lock-rf/source.tar.gz diff --git a/_site/log/my-first-pcb/thumb_sm.jpeg b/_site/log/fpm-door-lock-rf/thumb_sm.jpeg Binary files differindex c275b12..c275b12 100644 --- a/_site/log/my-first-pcb/thumb_sm.jpeg +++ b/_site/log/fpm-door-lock-rf/thumb_sm.jpeg diff --git a/_site/log/fpm-door-lock/index.html b/_site/log/fpm-door-lock/index.html deleted file mode 100644 index 1460053..0000000 --- a/_site/log/fpm-door-lock/index.html +++ /dev/null @@ -1,168 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8"> - <title>Fingerprint door lock</title> - - <head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <title>Fingerprint door lock</title> - <link rel="stylesheet" href="/assets/css/main.css"> - <link rel="stylesheet" href="/assets/css/skeleton.css"> -</head> - - - - </head> - <body> - - <div id="nav-container" class="container"> - <ul id="navlist" class="left"> - - <li > - <a href="/" class="link-decor-none">hme</a> - </li> - <li class="active"> - <a href="/log/" class="link-decor-none">log</a> - </li> - <li > - <a href="/projects/" class="link-decor-none">poc</a> - </li> - <li > - <a href="/about/" class="link-decor-none">abt</a> - </li> - <li><a href="/feed.xml" class="link-decor-none">rss</a></li> - </ul> -</div> - - - - <main> - <div class="container"> - <div class="container-2"> - <h2 class="center" id="title">FINGERPRINT DOOR LOCK</h2> - <h6 class="center">18 AUGUST 2025</h5> - <br> - <div class="twocol justify"><p>This project features a fingerprint door lock powered by an ATmega328P -microcontroller.</p> - -<video style="max-width:100%;" controls="" poster="pcb.jpg"> - <source src="video.mp4" type="video/mp4" /> -</video> - -<h2 id="overview">Overview</h2> - -<p>The lock comprises three subsystems: the ATmega328P microcontroller, an R503 -fingerprint sensor, and an FS5106B high-torque servo. The sensor mounted on the -front surface of the door enables users to unlock it from the outside. The -servo is attached to the interior door knob. The MCU must be installed at the -back of the door to prevent unauthorized users from tampering with it.</p> - -<p>When no one is interacting with the lock, the MCU is in deep sleep. The sensor -and the servo each draw 13.8mA and 4.6mA of quiescent currents. To prevent this -idle current draw, the MCU employs MOSFETs to cut off power to them before -entering deep sleep. Doing so is crucial for conserving the battery.</p> - -<p>Without power, the sensor remains in a low-power state, drawing approximately -2.9μA through a separate power rail. When a finger comes into contact with the -sensor, the sensor triggers a pin change interrupt, waking up the MCU. The MCU -activates a MOSFET, which in turn activates the sensor. Over UART, the MCU -unlocks the sensor and issues commands to scan and match the fingerprint.</p> - -<p>If the fingerprint matches an enrolled fingerprint, the MCU activates the blue -LED on the sensor, turns on the MOSFET connected to the servo, and sends a PWM -signal to the servo to unlock the door. Otherwise, the MCU activates the red -LED on the sensor. Finally, the MCU deactivates the MOSFETS and goes back to -sleep.</p> - -<h2 id="embedded-software">Embedded software</h2> - -<p>The embedded software, written in C, includes a driver for the sensor, servo -control routines, and a battery monitoring system.</p> - -<p>In addition to controlling the sensor and the servo, the program strives to -maintain precise control over the microcontroller’s sleep modes, as well as -when the peripherals are activated and for how long they remain active. I -thoroughly enjoyed writing the embedded software. There’s something magical -about being able to alter the physical world around you by uttering a few lines -of C code.</p> - -<p>The source code of the project, which includes a driver for the R503 -fingerprint sensor module, is enclosed in the tarball linked at the end of the -page.</p> - -<h2 id="the-pcb">The PCB</h2> - -<p>For this project, I designed a custom PCB and had it fabricated by JLCPCB. Like -the software, the circuit is primarily concerned with optimizing power -consumption and extending battery life.</p> - -<table style="border: none; width: 100%"> - <tr style="border: none;"> - <td style="border: none; width: 49.9%; background-color: transparent; text-align: center;"> - <img src="breadboard.jpg" alt="PCB" style="width: 100%" /> - </td> - <td style="border: none; background-color: transparent; text-align: center;"> - <img src="pcb1.jpg" alt="Design" style="width: 100%" /> - </td> - </tr> - <tr style="border: none;"> - <td colspan="2" style="border: none; background-color: transparent; text-align: center;"> - <img src="footprint.png" alt="PCB footprint" style="width: 100%" /> - </td> - </tr> -</table> - -<p>Consequently, the principal components of the circuit are the 2N7000 and -NDP6020P field-effect transistors. They switch power electronically to the -servo and the fingerprint sensor, the two most power-hungry parts of the -circuit. The two MP1584EN buck converters play an axial role in efficiently -regulating power to the MCU and the sensor.</p> - -<p>The ATmega328P typically operates at 5V with a 16MHz crystal oscillator. To -further reduce power consumption, I modified the ATmega328P’s fuses to run at -3.3V with an 8MHz crystal oscillator.</p> - -<p>The bottom right area of the PCB isolates the power supply of the servo from -the rest of the circuit. This shields components such as the MCU from the -servo’s high current draw, which can exceed 1A. The IN4007 diode in slot U2 -serves as a flyback diode, protecting the MOSFET from reverse currents -generated by the servo.</p> - -<p>Lastly, the 56kΩ and 10kΩ resistors in slots R10 and R11 form a voltage divider -circuit. Its output is fed to the ADC of the MCU, which measures the supply -voltage by comparing it to the internal bandgap reference voltage.</p> - -<h2 id="epilogue">Epilogue</h2> - -<p>This project began nearly a year ago when I attempted to unlock our door -wirelessly by writing to the UART ports of two MCUs connected to inexpensive -433MHz RF transceivers. Although I failed, it led me down a rabbit hole of RF -communications, MOSFETs, PCB design, and low-power circuits.</p> - -<p>During the project, I reinvented the wheel many times. I implemented a -low-level network stack using only RF modules and an 8-bit microcontroller, -designed my first PCB, and developed drivers from scratch. The project was far -from a smooth sail. Bad electrical connections, soldering and desoldering, and -the heartache of purchasing the wrong parts were routine. It was a long but -rewarding journey from the messy breadboard to the shiny PCB.</p> - -<p>Files: <a href="source.tar.gz">source.tar.gz</a>, <a href="gerber.zip">gerber.zip</a></p> -</div> - <p class="post-author right">by W. D. Sadeep Madurange</p> - </div> - </div> - </main> - - <div class="footer"> - <div class="container"> - <div class="twelve columns right container-2"> - <p id="footer-text">© ASCIIMX - 2025</p> - </div> - </div> -</div> - - - </body> -</html> diff --git a/_site/log/index.html b/_site/log/index.html index 8074ae3..bcc001e 100644 --- a/_site/log/index.html +++ b/_site/log/index.html @@ -59,7 +59,7 @@ <tr> <td class="posts-td posts-td-link"> - <a href="/log/fpm-door-lock/" class="link-decor-none">Fingerprint door lock</a> + <a href="/log/fpm-door-lock-lp/" class="link-decor-none">Fingerprint door lock (LP)</a> </td> <td class="posts-td posts-td-time"> <span class="post-meta"> @@ -98,7 +98,7 @@ <tr> <td class="posts-td posts-td-link"> - <a href="/log/my-first-pcb/" class="link-decor-none">My first PCB</a> + <a href="/log/fpm-door-lock-rf/" class="link-decor-none">Fingerprint door lock (RF)</a> </td> <td class="posts-td posts-td-time"> <span class="post-meta"> diff --git a/_site/log/matrix-digital-rain/index.html b/_site/log/matrix-digital-rain/index.html index f254ed2..8383776 100644 --- a/_site/log/matrix-digital-rain/index.html +++ b/_site/log/matrix-digital-rain/index.html @@ -54,45 +54,48 @@ than it needed to be.</p> </video> <p>Moved phosphor decay into the 4th byte of the RGB union–should’ve done this -in 2022. What was I thinking.</p> +in 2022; What was I thinking.</p> <p>Keeping the RGB union despite portability concerns. All my systems are little-endian and the code is cleaner this way.</p> <p>Fixed Unicode by introducing a charset array. UNICODE(min, max) packs Unicode -ranges into uint64–low four bytes for start, high four bytes for end. +ranges into uint64: low four bytes for start, high four bytes for end. insert_code() unpacks a random block and picks a character from it:</p> -<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>static uint64_t glyphs[] = { +<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>#define UNICODE(min, max) (((uint64_t)max << 32) | min) + +static uint64_t glyphs[] = { UNICODE(0x0021, 0x007E), /* ASCII */ UNICODE(0xFF65, 0xFF9F), /* Half-width Katakana */ }; -</code></pre></div></div> - -<p>Full-width Katakana breaks column alignment. Stick to half-width -(U+FF61-U+FF9F) range. Compile with -DNOKANA to disable Katakana altogether.</p> -<p>blend() simulates phosphor decay by eroding RGB channels toward -background color:</p> - -<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>static inline void blend(matrix *mat, size_t row, size_t col) +static inline void insert_code(matrix *mat, + size_t row, size_t col) { - unsigned char *color = mat->rgb[index(mat, row, col)].color; - color[R] = color[R] - (color[R] - RGB_BG_RED) / DECAY_MPLIER; - color[G] = color[G] - (color[G] - RGB_BG_GRN) / DECAY_MPLIER; - color[B] = color[B] - (color[B] - RGB_BG_BLU) / DECAY_MPLIER; + uint64_t blk; + uint32_t min, max; + + blk = glyphs[(rand() % glyphlen)]; + min = (uint32_t)blk; + max = (uint32_t)(blk >> 32); + mat->code[index(mat, row, col)] = rand() % (max - min) + min; } </code></pre></div></div> -<p>That’s still good. Leaving it alone.</p> +<p>Full-width Katakana breaks column alignment. Stick to half-width +(U+FF61-U+FF9F) range. Compile with -DNOKANA to disable Katakana altogether.</p> + +<p>blend() is still good. Leaving it alone.</p> <p>Tossed license and automake cruft. Just <code class="language-plaintext highlighter-rouge">cc -O3 main.c -o matrix</code> now. Don’t need the ceremony.</p> -<p>Runs at 2-3% CPU on OpenBSD (T490). No regressions. Fans are quiet.</p> +<p>Runs at 2-3% CPU on OpenBSD (T490). No cause to measure performance more +precisely. No regressions. Fans are quiet.</p> <p>Commit: -<a href="https://git.asciimx.com/matrix-digital-rain/commit/?id=03f8d87ba7c2e46bd3f3cc4c772fb3a2ac740c92">03f8d87</a></p> +<a href="https://git.asciimx.com/matrix-digital-rain/commit/main.c?id=69a888a5b0bc4ef4bce4f86c1556a06f0f131fda">69a888a</a></p> </div> <p class="post-author right">by W. D. Sadeep Madurange</p> </div> diff --git a/_site/posts.xml b/_site/posts.xml index dc403d2..037ca77 100644 --- a/_site/posts.xml +++ b/_site/posts.xml @@ -1 +1 @@ -<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="/posts.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2025-12-26T12:29:33+08:00</updated><id>/posts.xml</id><title type="html">ASCIIMX</title><author><name>W. D. Sadeep Madurange</name></author></feed>
\ No newline at end of file +<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="/posts.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2025-12-26T21:43:25+08:00</updated><id>/posts.xml</id><title type="html">ASCIIMX</title><author><name>W. D. Sadeep Madurange</name></author></feed>
\ No newline at end of file diff --git a/_site/projects/index.html b/_site/projects/index.html index 4fae8d8..8891836 100644 --- a/_site/projects/index.html +++ b/_site/projects/index.html @@ -58,9 +58,9 @@ <td class="project-item"> - <a href="../log/fpm-door-lock" class="link-decor-none"> - <img src="../log/fpm-door-lock/thumb_sm.jpg" alt="Fingerprint door lock"> - <h5>Fingerprint door lock</h5> + <a href="../log/fpm-door-lock-lp" class="link-decor-none"> + <img src="../log/fpm-door-lock-lp/thumb_sm.jpg" alt="Fingerprint door lock (LP)"> + <h5>Fingerprint door lock (LP)</h5> </a> </td> diff --git a/_site/sitemap.xml b/_site/sitemap.xml index c999ab9..fc2c59e 100644 --- a/_site/sitemap.xml +++ b/_site/sitemap.xml @@ -21,7 +21,7 @@ <lastmod>2025-04-02T00:00:00+08:00</lastmod> </url> <url> -<loc>/log/my-first-pcb/</loc> +<loc>/log/fpm-door-lock-rf/</loc> <lastmod>2025-04-26T00:00:00+08:00</lastmod> </url> <url> @@ -33,7 +33,7 @@ <lastmod>2025-06-22T00:00:00+08:00</lastmod> </url> <url> -<loc>/log/fpm-door-lock/</loc> +<loc>/log/fpm-door-lock-lp/</loc> <lastmod>2025-08-18T00:00:00+08:00</lastmod> </url> <url> |
