<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dilshan R Jayakody on Medium]]></title>
        <description><![CDATA[Stories by Dilshan R Jayakody on Medium]]></description>
        <link>https://medium.com/@jayakody2000lk?source=rss-132a98bb6beb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Ak3gAKDtdiIRjYzJhk9pow.jpeg</url>
            <title>Stories by Dilshan R Jayakody on Medium</title>
            <link>https://medium.com/@jayakody2000lk?source=rss-132a98bb6beb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 12:16:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jayakody2000lk/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Flash C — Compiler]]></title>
            <link>https://jayakody2000lk.medium.com/flash-c-compiler-4b69fd70a445?source=rss-132a98bb6beb------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b69fd70a445</guid>
            <category><![CDATA[compilers]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[ide]]></category>
            <category><![CDATA[c]]></category>
            <category><![CDATA[elf]]></category>
            <dc:creator><![CDATA[Dilshan R Jayakody]]></dc:creator>
            <pubDate>Tue, 27 Oct 2026 16:28:44 GMT</pubDate>
            <atom:updated>2026-10-28T04:46:08.037Z</atom:updated>
            <content:encoded><![CDATA[<p>Flash C is a small C compiler with a full-screen, text-mode IDE. Both are written from scratch and both run on Linux. The compiler, fcc, reads C source code and writes a native x86-64 Linux executable directly. No assembler, linker or C library is used at any point. The IDE, fc, wraps the same compiler in pull-down menus, overlapping edit windows, an <em>error window</em>, <em>option dialogs</em>, a source-level debugger and hyper-linked online help. Its layout follows the <a href="https://en.wikipedia.org/wiki/Turbo_Vision">classic <em>Turbo Vision</em> style</a> IDEs. This post shows what is in the project and how it works inside.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ZT5tdYXI15tM4m63BDnPCw.png" /><figcaption>The Flash C IDE.</figcaption></figure><p>The whole toolchain lives in one repository: the lexer and preprocessor, the parser and type checker, an optimizer, the x86–64 code generator, an ELF writer, a run-time library written in C, the IDE, a debugger and the help system. Flash C compiles C89 with a few C99 conveniences, such as // comments. C++ is deliberately not supported.</p><p>Two programs come out of the build. fcc is the command-line compiler. Running fcc hello.c produces a static ELF executable called hello in a few tens of milliseconds. fc is the IDE. It uses the very same compiler code, so the two always behave the same way.</p><p>This project comes from personal history. I have used <a href="https://en.wikipedia.org/wiki/Borland">Borland</a> products for many years, and <a href="https://en.wikipedia.org/wiki/Turbo_C">Borland Turbo C</a>, <a href="https://en.wikipedia.org/wiki/Turbo_C%2B%2B">Turbo C++</a> and <a href="https://en.wikipedia.org/wiki/Turbo_Pascal">Turbo Pascal</a> were the compilers I used when I started programming. That fast, friendly, all-in-one environment, with its blue editor, pull-down menus and F-key shortcuts, is where I learned. One of the main goals of Flash C is to bring that experience back on Linux, where nothing quite like it exists today. The second goal is to learn compiler construction by building a whole compiler, from the lexer to the machine code, instead of only reading about one.</p><p>To bring the experience back, I first had to answer a question: how does a classic IDE of that era behave, in enough detail to rebuild it? To find out, I studied the executable of <a href="https://en.wikipedia.org/wiki/Turbo_C%2B%2B">Turbo C++ 3.1</a>, which is available from the <a href="https://archive.org/details/turboc3.1_202112">Internet Archive</a>. The study was purely static. I read the executable headers and segments, and I extracted the text tables: menu items, dialog controls, status-line hints, the diagnostic messages, the command-line switches and the color table from the settings file. Nothing was executed, and no code, library, header, help text or other file from the original product is used in Flash C. The result of the study is only a description of how the IDE looks and behaves: which menus exist and in what order, which options each dialog holds, how the <em>Message window</em> tracks errors, and what the diagnostics say. The method and findings are written up in <a href="https://github.com/dilshan/flash-c/blob/main/analysis/EVIDENCE.md">analysis/EVIDENCE.md</a> in the repository. The script that rebuilds the raw extracts is included, but the extracts themselves are not distributed.</p><p>With that as a guide, I built the compiler first. It follows a conventional pipeline. The source goes through the lexer and preprocessor, then a parser that builds a typed syntax tree, then the optimizer, and finally the code generator, which writes the ELF file.</p><p>All compiler data lives in a memory arena that is freed in one step at the start of the next compile. This lets the IDE call the compiler again and again without leaking memory. The preprocessor first splits the source into tokens, runs the directives on them, and expands macros recursively with a “ <em>busy</em>” flag instead of hide-sets. The parser is recursive descent and builds the typed tree in a single pass. Every node already knows its C type, implicit conversions are explicit cast nodes, pointer arithmetic is already scaled, and constants are folded. Errors use the classic wording, for example Error hello.c 5: Undefined symbol &#39;x&#39; in function main. The parser recovers at statement boundaries, so one run can report many errors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*34U9Cd_yklfOWy2RppkjrQ.png" /><figcaption>Code generation options.</figcaption></figure><p>The code generator is a simple accumulator machine. Each expression leaves its value in rax, and binary operators push the left operand first. Floating-point values use SSE2. The calling convention is private to Flash C: arguments are pushed right to left, the caller removes them, and the result comes back in rax. This makes va_arg almost trivial. It also means Flash C needs no ABI compatibility with a host C library, because there is no host C library in the picture.</p><p>The ELF writer emits one loadable segment at 0x400000 that holds code, data and bss. With -lw it emits a read-execute segment and a separate read-write segment, so no segment is both writable and executable. The entry stub calls a start-up function from the run-time library, which calls main and then exit. The library talks to the kernel through one intrinsic, __syscall(n, ...).</p><p>That run-time library is written in Flash C itself, as many small modules ( stdio, string, stdlib, ctype, math and so on). A tool embeds their source in the compiler, and on every compile the enabled modules are parsed together with your program, which takes a few milliseconds. Linking simply means reachability: only the functions that main and the start-up code can reach are emitted, so a program pays only for what it uses. Even floating-point support is detected, not declared. printf and scanf reach their float converters through function pointers, and these are installed only if the program uses float or double. An integer-only program therefore carries no floating-point code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*mDnO04QMayj4esFAWMyiIA.png" /><figcaption>Optimization Options dialog box.</figcaption></figure><p>The optimizer is the largest part of the compiler. It has 48 passes, and each one can be switched on or off, either on the command line (-O:name) or with a check box in the IDE. It works in layers. First come simple passes on expressions, such as <a href="https://en.wikipedia.org/wiki/Constant_folding">constant folding</a> and <a href="https://en.wikipedia.org/wiki/Dead_store">removing dead stores</a>. Next come analyses on the control-flow graph and on loops, such as <a href="https://en.wikipedia.org/wiki/Loop-invariant_code_motion">moving invariant code out of loops</a>. At the top are whole-program passes, such as inlining. SSA form, register allocation and <a href="https://en.wikipedia.org/wiki/Profile-guided_optimization">profile-guided optimization</a> are also included. The full description is in the <a href="https://github.com/dilshan/flash-c/blob/main/docs/ARCHITECTURE.md#4-the-optimizer">architecture notes</a>.</p><p>Optimization and debugging have to work together, so the optimizer skips every pass that could change statements, variable values or the call stack when debug information is on. What you see in the debugger is what you wrote.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*RXsJxwuoa4o0pdSrMTXCAg.png" /><figcaption>Stopped at a breakpoint with a watch expression.</figcaption></figure><p>The debugger uses that debug information. When it is requested, the compiler records a line table, the user’s functions with their variables (frame offsets and scope lines), and the globals, and hands them to the IDE. The debugger runs the executable under ptrace with its standard input and output on a pseudo-terminal. Breakpoints are int3 bytes, inserted only while the program runs freely. Stepping runs single instructions until the source line changes. A call instruction is recognized from its opcode and stepped over with a temporary breakpoint at the return address. The stack pointer is checked as well, so recursion works. Frames are found by walking the rbp chain, and local variables are read at [rbp+offset]. An expression evaluator understands C operators over typed values read from /proc/&lt;pid&gt;/mem. It drives the <em>Watch window</em>, the <em>Inspect</em> and <em>Evaluate</em> dialogs, and the <em>call stack</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*APFmSqkmwmWNYsDPIE-XKg.png" /><figcaption>Errors and warnings are listed in the Message window.</figcaption></figure><p>The IDE is the last piece. It talks to the terminal directly. It switches to the alternate screen, keeps an off-screen buffer of character cells, and sends only the changes to the terminal. It uses 24-bit color when the terminal supports it and 16 ANSI colors otherwise, and it decodes keys and mouse events itself. Drawing is immediate-mode: every event repaints the whole desktop into the buffer, and menus and dialogs paint on top of it. When you run a program, the IDE leaves the alternate screen, runs the program on the normal screen and comes back. Alt+F5 shows the program’s screen again.</p><p>On top of this sit a window manager with movable, resizable windows, a menu system and a dialog engine. The editor has undo and redo, block commands, <em>WordStar </em>style keys, syntax highlighting and a search with a small regular-expression engine. The IDE also supports project files and a saved desktop, and every compiler option has a dialog. Each dialog has a <em>Help</em> button that opens the matching help page.</p><p>The help system is hyper-linked and covers the IDE, the language and every library function. The pages include example programs that you can copy into the editor, and Ctrl+F1 opens the topic for the word under the cursor. The pages are plain text files (*.fch) with a small markup language. The library pages are generated from the headers and module sources, and the build tests compile and run every example in them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*cIE7sg1oQkdjDvhnkahFfQ.png" /><figcaption>Online Help.</figcaption></figure><p>To try it, download the tarball for Linux x86–64 from the <a href="https://github.com/dilshan/flash-c/releases">releases page</a> and unpack it. You can run ./install.sh, which installs under ~/.local or under any prefix you choose. You can also skip the install and run ./bin/fc and ./bin/fcc straight from the unpacked folder, because the IDE finds its help files relative to the binary. Building from source needs only a C compiler and make.</p><p>In the IDE, F2 saves, F9 builds and Ctrl+F9 runs. If the build fails, the <em>Message</em> <em>window</em> lists the errors, and Enter on one jumps to that line. F1 opens help, Ctrl+F8 sets a breakpoint, and F7 and F8 trace into and step over.</p><p>Flash C has limits. It targets x86–64 Linux only and produces static executables. It does not implement compound literals, variable-length arrays, a distinct long long or long double, and there is no C++. Its calling convention is private, so you cannot link its output with object files from other compilers. Profile-guided optimization is available only from the command line. These gaps are listed in the architecture notes, together with planned improvements.</p><p>The source is on GitHub at <a href="https://github.com/dilshan/flash-c">https://github.com/dilshan/flash-c</a>. The repository includes a <a href="https://github.com/dilshan/flash-c/blob/main/docs/USER_GUIDE.md">user guide</a>, a <a href="https://github.com/dilshan/flash-c/blob/main/docs/COMPILER.md">compiler reference</a>, a <a href="https://github.com/dilshan/flash-c/blob/main/docs/LIBRARY.md">library reference</a>, <a href="https://github.com/dilshan/flash-c/blob/main/docs/ARCHITECTURE.md">architecture notes</a> for contributors and the study of the reference product. Precompiled release builds are at <a href="https://github.com/dilshan/flash-c/releases">releases page</a>. Bug reports, feature requests and contributions are welcome once the repository is public.</p><p>Flash C is an independent project. It uses <em>Turbo C++</em> only as a reference for behavior and contains none of its code or resources.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b69fd70a445" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tiny Basic for Arduino]]></title>
            <link>https://jayakody2000lk.medium.com/tiny-basic-for-arduino-3b5bff281cd7?source=rss-132a98bb6beb------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b5bff281cd7</guid>
            <category><![CDATA[compilers]]></category>
            <category><![CDATA[interpreters]]></category>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[basics]]></category>
            <category><![CDATA[arduino-due]]></category>
            <dc:creator><![CDATA[Dilshan R Jayakody]]></dc:creator>
            <pubDate>Fri, 10 Jul 2026 15:56:27 GMT</pubDate>
            <atom:updated>2026-07-10T20:45:21.579Z</atom:updated>
            <content:encoded><![CDATA[<p>The primary objective of the <a href="https://dilshan.github.io/tiny-basic/"><em>Tiny Basic for Arduino</em></a> project is to replicate that nostalgic <a href="https://en.wikipedia.org/wiki/Commodore_64">C64</a> style programming environment utilizing modern, low-power MCU platforms. Present-day microcontrollers offer significantly higher processing power and memory capacity than the vintage systems of yesteryear, whilst being available at a fraction of the cost.</p><p>I envisioned an environment where students and hobbyists alike could experience retro-style computing without the need to source rare, expensive vintage hardware, and completely avoiding any assembly or soldering hassles. By simply connecting a standard, off-the-shelf development board to a PC and launching a serial terminal, one can immediately commence coding in <a href="https://en.wikipedia.org/wiki/BASIC">BASIC</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YYoVBRugyt-F9QPbQb-cEA.jpeg" /><figcaption>Arduino Due: The primary development and testing board.</figcaption></figure><p>To maintain an authentic and lightweight footprint, the interpreter is built upon the <a href="https://en.wikipedia.org/wiki/Tiny_BASIC">original <em>Tiny Basic</em></a> language grammar. It accurately parses and executes standard Tiny Basic syntax, making it highly familiar to anyone who has previously worked with vintage systems.</p><p>As this initial phase focuses primarily on establishing a stable core interpreter, certain advanced features are currently omitted which including string and array processing.</p><p>However, the interpreter fully accommodates standard integer mathematics, control loops (<em>FOR/NEXT</em>), conditional statements (<em>IF/THEN</em>), and direct hardware I/O. This provides ample functionality for essential tasks, such as toggling GPIO pins or reading sensor data in a retro environment.</p><p>At present, the interpreter has been successfully deployed and validated on the <a href="https://docs.arduino.cc/hardware/due/">Arduino Due</a> and <a href="https://docs.arduino.cc/hardware/uno-r4-wifi/">Arduino Uno R4 WiFi</a> boards.</p><p>While these boards provide excellent performance and memory overhead, the architecture has been structured with portability in mind. I intend to expand compatibility to various other MCUs and development boards in subsequent updates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*_xdpOb5fuqbTSEg-_O8b9Q.png" /><figcaption>Tiny Basic sample code and output on Arduino Due.</figcaption></figure><p>To ensure a reliable and streamlined build environment, the project utilizes <a href="https://platformio.org/">PlatformIO</a>. Please follow the steps below to flash the interpreter onto your hardware.</p><p>1. Source Code Acquisition</p><p>Clone or download the repository from the official GitHub page: <a href="https://github.com/dilshan/tiny-basic">https://github.com/dilshan/tiny-basic</a>.</p><p>2. Compilation and Uploading</p><ul><li>Open the downloaded project folder inside <em>Visual Studio Code</em> (ensuring the <a href="https://platformio.org/install/ide?install=vscode">PlatformIO extension</a> is installed).</li><li>PlatformIO will automatically evaluate the platformio.ini configuration file and retrieve the required toolchains and framework dependencies.</li><li>Connect your Arduino board to the computer via a USB cable.</li><li>Select your specific target environment (either due or uno_r4) from the PlatformIO project tasks panel.</li><li>Execute the <em>Build</em> task, followed by the <em>Upload</em> task to flash the binary onto the MCU.</li><li>Launch the <em>PlatformIO Serial Monitor</em> or any preferred terminal application (such as <em>PuTTY</em> or <em>minicom</em>).</li><li>Configure the serial connection parameters to a baud rate of 9600.</li><li>Upon a successful connection, the Tiny Basic prompt will appear on your screen. You may then execute scripts as follows:</li></ul><pre>10 PRINT &quot;HELLO FROM Tiny Basic!&quot;<br>20 END <br>RUN</pre><p>Developing this interpreter has been an excellent exercise in compiler design, effectively bridging vintage computing paradigms with modern embedded systems. Moving forward, I plan to further enhance the feature set, including the more communication protocols and broadening the scope of supported MCUs.</p><p>The project is completely open-source and open for collaboration. Should you wish to experiment with it or contribute to its development, please visit the <a href="https://github.com/dilshan/tiny-basic">GitHub repository</a>. Your feedback and pull requests are highly appreciated. The and <a href="https://dilshan.github.io/tiny-basic/manual/language-reference/"><em>language reference</em></a> for Tiny BASIC for Arduino is available on its <a href="https://dilshan.github.io/tiny-basic/">homepage</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b5bff281cd7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building the TD4 4-Bit CPU]]></title>
            <link>https://jayakody2000lk.medium.com/building-the-td4-4-bit-cpu-6dea0a77641b?source=rss-132a98bb6beb------2</link>
            <guid isPermaLink="false">https://medium.com/p/6dea0a77641b</guid>
            <category><![CDATA[cpu]]></category>
            <category><![CDATA[rom]]></category>
            <category><![CDATA[4-bit]]></category>
            <category><![CDATA[ttl]]></category>
            <category><![CDATA[td4]]></category>
            <dc:creator><![CDATA[Dilshan R Jayakody]]></dc:creator>
            <pubDate>Mon, 04 May 2026 13:54:50 GMT</pubDate>
            <atom:updated>2026-05-04T14:58:10.117Z</atom:updated>
            <content:encoded><![CDATA[<p>The TD4 is a famous 4-bit CPU featured in the book <a href="https://book.mynavi.jp/ec/products/detail/id=22065"><em>How to Build a CPU</em></a> by <em>Kaoru Tonami</em>. The book focuses on constructing a functional processor entirely from basic 74-series TTL logic ICs. While the book is unfortunately only available in Japanese, a friend from Japan sent me a copy along with a TD4 PCB. I believe the PCB is based on the open-source design files available on <a href="https://github.com/wuxx/TD4-4BIT-CPU">BG5DIW’s GitHub repository</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xqZRQUIqeGN7jLIXmPVm2g.jpeg" /><figcaption>“How to Build CPU” book and the PCB.</figcaption></figure><p>Recently, I finally found the time to build and experiment with it. The project took a few months, as I had to translate the book myself to grasp the core concepts. The overall design is simple and elegant, offering a set of 12 instructions and a 16-byte ROM (implemented via DIP switches) for programming. The board operates on 5V and can be powered via USB. Most components were sourced from local shops, though I had to order a few 74HC-series ICs online. Later, I tested the circuit by replacing some 74HC components with 74LS series chips, and it worked without any issues.</p><p>The PCB is straightforward to solder. The only SMD components are four LEDs and a Micro-USB socket. If you haven’t done SMD soldering before, the USB socket might look intimidating, but you only need to solder pins 1 and 5 (the remaining pins are not used in this design).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DQx73btK1790TxKhWtX84w.jpeg" /><figcaption>Assembled TD4 CPU.</figcaption></figure><p>The most time-consuming part of the assembly was soldering the <a href="https://www.vishay.com/docs/81857/1n4148.pdf">1N4148</a> diodes. The book suggests using a <a href="https://datasheet4u.com/datasheets/Toshiba-Semiconductor/1S1588/95212">1S1588</a> or a <a href="http://www.datasheet.hk/download.php?id=1910162&amp;pdfid=855BD1ACFD341F9660BB1CAE12491DA4&amp;file=0456%5Cd83c_6227371.pdf">D8–1A</a> diode network, but these are difficult to source locally or online. Therefore, I opted for individual 1N4148 diodes. In the TD4 architecture, these diodes function as a Diode Matrix ROM. Since the “program” is stored via physical DIP switches, the diodes act as one-way gates. They prevent current from back-feeding into other parts of the circuit when multiple switches are flipped, effectively creating the logic gates necessary to decode the 16-byte memory addresses into specific 4-bit instructions for the CPU to execute.</p><p>Once assembly is complete, the TD4 is ready for immediate use; it requires no firmware or calibration. The PCB offers two power options: the easiest is via the Micro-USB port, while the second is a 2.54mm pin header. I used the pin header to attach the power leads for my logic probe, which was essential while I studied the circuit’s operation alongside the book.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dMAT0IObhd3asaeB-u4mQg.jpeg" /><figcaption>Functional TD4 CPU.</figcaption></figure><p>The TD4 is a hard-wired logic CPU, meaning it doesn’t use a microprogram; every instruction is executed by direct electrical paths through the logic gates. The chipset typically consists of:</p><ul><li><a href="https://www.ti.com/lit/ds/symlink/cd74hc161.pdf">74HC161</a>: Used for the A and B registers and the Output port.</li><li><a href="https://www.ti.com/lit/ds/symlink/cd74hc161.pdf">74HC161</a>: Another 4-bit counter used for the Program Counter (PC).</li><li><a href="https://www.ti.com/lit/ds/symlink/sn74hc153.pdf">74HC153</a>: Multiplexers that act as the selector for the ALU inputs.</li><li><a href="https://www.ti.com/lit/ds/symlink/cd74hc283.pdf">74HC283</a>: Configured as 4-bit ALU.</li><li><a href="https://www.ti.com/lit/ds/symlink/cd74hc10.pdf">74HC10</a> and <a href="https://www.ti.com/lit/ds/symlink/sn74hc32.pdf">74HC32</a>: NAND/AND gates used for the instruction decoder.</li></ul><p>The clock is generated by a simple 74HC14 oscillator circuit, allowing you to step through instructions manually or run them at a very low frequency to watch the LEDs toggle as data moves between registers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HBEz15PSkt85iyPhUuJZgw.jpeg" /><figcaption>System clock can monitor from pin 2 of any 74HC161 counter.</figcaption></figure><p>The most interesting part of this project is programming the system. Due to the limited address space, the tasks you can perform are modest. I experimented with various counter systems, and all worked as expected. I initially wrote the code on paper and calculated the DIP switch positions manually based on the book’s instruction set.</p><p>To simplify this process, I developed a small web-based utility using JavaScript that converts assembler source code directly into DIP switch positions. This allowed me to iterate quickly and try out more complex logic. You can find this TD4 Assembler utility here: <a href="https://github.com/dilshan/td4-assembler">github.com/dilshan/td4-assembler</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MOBNXSq5dAoRqjiRVtyjwg.jpeg" /><figcaption>The logic levels of this system can easily monitor using logic probe.</figcaption></figure><p>This is one of the counter programs I tested with the CPU. This specific routine reads the input from the DIP switches and increments the value with every clock cycle. Once the counter reaches 0xF, it resets back to the user-specified starting value and resumes counting.:</p><pre>in b <br>out b <br>add b, 1 <br>jnc 1 <br>jmp 0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c4msXsOmcBncqGQYMCPqag.jpeg" /><figcaption>Address bus and C-flag states of above code listing when input = 0x8.</figcaption></figure><p>The TD4 is the perfect “Hello World” for computer architecture because it strips away the complexity of modern processors. There are no hidden layers-no microcode, no complex cache, and no operating system. By building it, you see exactly how a bit moves from a switch, through a multiplexer, and into a register. It demystifies the relationship between physical hardware and software logic, making it an invaluable educational tool for anyone interested in embedded systems or electronic engineering.</p><p>Details for <em>How to Build a CPU</em> can be found at the <a href="https://book.mynavi.jp/supportsite/detail/4839909865.html">publisher’s support site</a>. A TD4 emulator ( <em>Windows</em> only) is also available for download at the same link.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6dea0a77641b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TDA2005 as a DC-to-DC Converter]]></title>
            <link>https://jayakody2000lk.medium.com/tda2005-as-a-dc-to-dc-converter-be1a4a6fdb02?source=rss-132a98bb6beb------2</link>
            <guid isPermaLink="false">https://medium.com/p/be1a4a6fdb02</guid>
            <category><![CDATA[voltage-booster]]></category>
            <category><![CDATA[tda2005]]></category>
            <category><![CDATA[dctodcconverter]]></category>
            <dc:creator><![CDATA[Dilshan R Jayakody]]></dc:creator>
            <pubDate>Sun, 05 Apr 2026 14:27:56 GMT</pubDate>
            <atom:updated>2026-04-05T14:44:25.736Z</atom:updated>
            <content:encoded><![CDATA[<p>The <a href="https://www.st.com/resource/en/datasheet/tda2005.pdf">TDA2005</a> is a very popular audio amplifier chip that many of us have used for years in car stereos and home DIY amplifiers. While it is mainly built to amplify AF signals, its internal design is actually strong enough to be used for other interesting projects like this DC-to-DC converter. By using the two amplifier channels inside the chip to create a high-frequency signal, we can turn the IC into a power driver that works with a rectifier circuit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JWFDOs_9vvg683z1PS1TBQ.jpeg" /><figcaption>Prototype version of TDA2005 DC-to-DC converter.</figcaption></figure><p>The way this circuit works is quite simple. The TDA2005 stages ( <em>U1A</em> and <em>U1B</em>) are set up to produce a high-frequency AC signal. This signal goes through 2200µF coupling capacitors and then into a full-bridge rectifier made of 1N5822 Schottky diodes. I chose these specific diodes because they have a very low voltage drop, which helps keep the efficiency high. To keep the TDA2005 stable while it drives this kind of load, I included 1Ω resistors and 0.1µF capacitors as stability networks. This stops the chip from oscillating at very high frequencies, which could otherwise cause it to overheat or fail. The final output is cleaned up by a 4700µF filter capacitor and a small RC snubber to give a steady DC voltage.</p><p>Even with this design, there are a few things to keep in mind. Since the circuit does not have a feedback loop, the output voltage will change a bit depending on how much load you connect or how the input voltage varies. Also, heat is a major factor. In my testing, I found the overall efficiency to be around 80%, but the TDA2005 will still get hot during long use. Because of this, use a proper heatsink and make sure the 1Ω stability resistors are 1W rated so they don’t burn out under stress.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X1t3n14ABlBM5ZdaQWNG8Q.jpeg" /><figcaption>Test setup with approximately 50Ω load.</figcaption></figure><p>When assembling the PCB, start by soldering the smaller parts like the 1W carbon film resistors and ceramic capacitors first. Then, you can add the larger electrolytic capacitors. Please make sure all capacitors are rated for 35V or higher just to be safe. Finally, always bolt the <a href="https://s.click.aliexpress.com/e/_c4FOWBLP">TDA2005</a> to a good heatsink with some thermal paste before you turn it on.</p><p>Schematic and PCB files of this project are available in <a href="https://drive.google.com/file/d/1E62GuQReIj8oJk_xLQ5TO9__FibkbdJ-/view?usp=sharing">this Google drive location</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be1a4a6fdb02" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ZZRX-40 Receiver build]]></title>
            <link>https://jayakody2000lk.medium.com/zzrx-40-receiver-build-6fa8b737aa45?source=rss-132a98bb6beb------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fa8b737aa45</guid>
            <category><![CDATA[ne602]]></category>
            <category><![CDATA[radio]]></category>
            <category><![CDATA[direct-conversion]]></category>
            <category><![CDATA[lm386]]></category>
            <category><![CDATA[shortwave]]></category>
            <dc:creator><![CDATA[Dilshan R Jayakody]]></dc:creator>
            <pubDate>Sat, 21 Mar 2026 13:12:29 GMT</pubDate>
            <atom:updated>2026-03-21T14:20:01.917Z</atom:updated>
            <content:encoded><![CDATA[<p>I found the <a href="https://aa0zz.com/ZZRX-40/QST-July2016Pg36-37.pdf">ZZRX-40</a> receiver while going through some old issues of <em>QEX magazine</em>. Designed by <a href="https://aa0zz.com/">Craig Johnson (AA0ZZ)</a>, this is a very simple and easy-to-build 40m direct conversion receiver. Even though it is a simple circuit, it performs quite well for its size.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zh0Kb9hEIK3rnssBh_CI5w.jpeg" /><figcaption>Prototype version of extended ZZRX-40 receiver.</figcaption></figure><p>For this project, I decided to make my own PCB design because I wanted to use components that I could easily find in our local shops. Since I couldn’t find any PCB files online, I drew the schematic in KiCad and designed a custom board. If you are interested in building this, I have shared the Gerber files and KiCad project files here: <a href="https://github.com/dilshan/zzrx40-clone">https://github.com/dilshan/zzrx40-clone</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aK9fSCOtm9buVZtK88LoUA.jpeg" /><figcaption>Antenna connector and external VFO headers (JP101 and JP102).</figcaption></figure><p>The heart of this receiver is the popular <a href="https://s.click.aliexpress.com/e/_c4t2b9zd">NE602</a> (or <a href="https://s.click.aliexpress.com/e/_c4bSBoQT">SA602</a>) mixer chip. This single chip handles both the local oscillator and the product detector, which makes the whole circuit very compact. Although it is designed for the 40-meter (7 MHz) ham band, my prototype was also able to pick up 41-meter band shortwave stations, especially strong signals from <em>China Radio International</em> (CRI).</p><p>The receiver has two oscillator modes. The Crystal-Controlled (VXO) mode is definitely the most stable way to use it. By using the tuning potentiometer, I could shift the frequency a few kHz up or down from the crystal’s main frequency. I tested this with many different crystals from <a href="https://www.xtals.co.uk/product-page/20-30-40-meter-amateur-quartz-crystal-pack-15-crystals">2E0HQU Lester Russell’s collection</a>, including 7.000, 7.020, 7.030, 7.040, 7.050, 7.1424, 7.159, and 7.200 MHz, and they all worked perfectly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8jQcTJ8PnHNuzuao32hQIg.jpeg" /><figcaption>Crystal connection for VXO mode.</figcaption></figure><p>There is also a VFO mode, which uses a 50pF trimmer capacitor for calibration. In my experience, this mode is a bit “drifty” compared to the crystals. You have to do a lot of fine-tuning to keep the station locked in. After the mixer, the signal goes through a low-pass filter and then to an <a href="https://s.click.aliexpress.com/e/_c4pXzNOB">LM386</a> audio amplifier. I tested both LM386N-1 and LM386N-4 versions, and both worked fine. You can use a small 8Ω speaker, but using low-impedance headphones gives much better audio when listening for weak stations.</p><p>What I really like about the ZZRX-40 is that it’s not just a receiver, but a great tool for learning radio design. I added on-board jumpers to my PCB so I can bypass the internal oscillator. This is very useful because you can plug in an external oscillator, like a <a href="https://s.click.aliexpress.com/e/_c3XMswYr">Si5351 VFO</a> or an Arduino signal generator, to see how it performs.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F-BHrTTuOY1A%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D-BHrTTuOY1A&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F-BHrTTuOY1A%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0881ee6200ed92266ed9a0386bafff75/href">https://medium.com/media/0881ee6200ed92266ed9a0386bafff75/href</a></iframe><p>The PCB for this project was fabricated by <a href="https://www.pcbway.com/">PCBWay</a>, the project’s generous sponsor, which provides comprehensive manufacturing, assembly, CNC, and 3D printing services. The PCB for this project is also available on <a href="https://www.pcbway.com/project/shareproject/ZZRX_40_Receiver_build_b511d42d.html">PCBWay for direct ordering</a>. Check out the <a href="https://www.pcbway.com/">PCBWay website</a> for its manufacturing capabilities and pricing.</p><p>For my testing, I used a 9V DC power supply and my 50Ω outdoor wire antenna. Since I used the 1A version of the 7806 regulator in this design, it is safe to feed a 12V or 15V DC input to the circuit. For voltages under 12V, no heatsink is required for the 7806. Like the original ZZRX-40, this design also supports battery power, but it switches to battery only if the DC jack is removed (the manual power source selection switch was removed in my design).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4X5Zo0cTZHvG1XpNQ00Q0A.jpeg" /><figcaption>Top view of the assembled receiver.</figcaption></figure><p>The receiver is excellent for listening to CW and shortwave broadcasts. However, like many simple direct-conversion designs, SSB signals proved a bit more difficult to tune, and the audio was less intelligible in the 7.040–7.060 MHz range compared to CW.</p><p>Building the ZZRX-40 was a great experience. It shows that you don’t need a very complicated circuit to start listening to the shortwave radio bands. Even with a few limitations in SSB mode and VFO drift, the ability to experiment with different crystals and external oscillators makes this a perfect project for any electronics hobbyist.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fa8b737aa45" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A DIY build of a two-tube FM receiver kit]]></title>
            <link>https://jayakody2000lk.medium.com/a-diy-build-of-a-two-tube-fm-receiver-kit-4fd0c33bd445?source=rss-132a98bb6beb------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fd0c33bd445</guid>
            <category><![CDATA[diy-kit]]></category>
            <category><![CDATA[fm-radio]]></category>
            <category><![CDATA[receiver]]></category>
            <category><![CDATA[vacuum-tubes]]></category>
            <category><![CDATA[regenerative]]></category>
            <dc:creator><![CDATA[Dilshan R Jayakody]]></dc:creator>
            <pubDate>Wed, 11 Mar 2026 12:55:20 GMT</pubDate>
            <atom:updated>2026-03-11T13:39:19.411Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently received a <a href="https://www.aliexpress.com/item/1005008620212096.html">DIY two-tube FM receiver kit</a> from one of my Chinese component suppliers for review. The circuit is elegantly simple, designed around a <a href="https://tube-data.com/sheets/112/1/1A2P.pdf">1A2 heptode</a> and a <a href="https://tube-data.com/sheets/112/2/2P2P.pdf">2P2 pentode</a>. The kit includes all the necessary components for the build, featuring a single-sided FR4 PCB with dimensions of 100mm × 100mm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xcFideERuJ-6TD2T9ZkA5g.jpeg" /><figcaption>Assembled PCB with tubes.</figcaption></figure><p>The primary hurdle when starting this project was the complete lack of proper assembly instructions. To assist others, this article documents the exact steps I took to assemble and test the receiver. I have also reverse-engineered the schematic based on the PCB layout; a high-resolution <a href="https://drive.google.com/file/d/1B9ZOyRGdAuUPfQfJVZMpv_dEbVE70lbH/view?usp=sharing">PDF version is available for download here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FBadwXDrlJ4Hrnm5sBS3NA.jpeg" /><figcaption>Top view of the PCB.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dvGDBst9G8Vh9AI4KbCn2w.jpeg" /><figcaption>Bottom view of the PCB.</figcaption></figure><p>The radio is designed around two main stages to handle frequency conversion and audio amplification: The <a href="https://s.click.aliexpress.com/e/_c3BYuJPD">1A2 heptode</a> — functions as a super-regenerative detector. The <a href="https://s.click.aliexpress.com/e/_c3BYuJPD">2P2 pentode</a> acts as the audio power amplifier, which receives the demodulated signal and drives the headphones via an output transformer.</p><p>I began by soldering the resistors, capacitors, and 33µH inductors. During assembly, I noticed that several component footprints did not perfectly match the provided parts, specifically regarding lead spacing and component boundaries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lN7GmGMRe1eOguoOX4T8pg.jpeg" /><figcaption>Content of the kit.</figcaption></figure><p>The most significant mechanical issue was mounting the tuning capacitor. The capacitor pins did not align with the PCB holes, requiring me to slightly trim the sides of the pins to fit. To secure the capacitor firmly to the board, I used two <a href="https://s.click.aliexpress.com/e/_c4qsBgbV">M2.5 × 5mm screws</a>, which were not included in the kit.</p><p>For the inductors L1 and L2, I used 22 SWG enameled copper wire. Both are wound on a 14mm former: L1–2 turns and L2–4 turns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/217/1*ZUjuzNsujlHzUYIBDB5IGg.jpeg" /></figure><p>Interestingly, the kit utilizes a standard 230V to 6V step-down transformer as the AF output transformer. The primary (230V) winding connects to the 2P2 pentode, while the secondary (6V) winding connects to the audio output jack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i-aRqTN0Y5L3fFUZ2oAt_A.jpeg" /><figcaption>A 220V-6V step-down transformer serves as the AF output transformer.</figcaption></figure><p>The circuit operates on two distinct power supplies: a 1.35V DC source for the filaments and a 67V DC source for the anode/plate. Power consumption is notably low, with the filaments drawing about 80mA — 85mA and the 67V line using under 10mA.</p><p>For the audio output, I used standard low-impedance (32Ω) <a href="https://s.click.aliexpress.com/e/_c4BbSFiP">stereo earphones</a>.</p><p>Tuning this receiver is not a straightforward task. I used an RF signal generator to calibrate it to known frequencies. Overall, the performance is modest; it struggles to clearly receive standard FM broadcast stations. Achieving the best possible results requires a “ <em>balancing act</em>” between the <em>C2</em> variable capacitor and the <em>R2</em> potentiometer. The potentiometer adjusts the regeneration level, effectively acting as a sensitivity control.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4A7re545pAnLn4PiFhUxRA.jpeg" /><figcaption>A completed two-tube FM receiver kit.</figcaption></figure><p>During my tests, I could only pick up a few stations, even when coupled with a 50Ω outdoor FM antenna. However, the receiver performed well with FM microphones and low-power FM transmitters over short distances. A notable limitation is the frequency coverage; sensitivity deteriorates significantly at the higher end of the band. While it performs adequately between 75MHz and 99MHz, it fails to cover the full 88MHz — 108MHz broadcast range effectively.</p><p>I would not recommend this kit for those looking for a reliable way to listen to FM broadcasts. However, it is an excellent choice for educational or experimental purposes. It successfully demonstrates the principles of FM reception with a minimal component count, though it understandably trades sensitivity and stability for simplicity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fd0c33bd445" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OpenHamClock Kiosk]]></title>
            <link>https://jayakody2000lk.medium.com/openhamclock-kiosk-10bb2e8ffbcf?source=rss-132a98bb6beb------2</link>
            <guid isPermaLink="false">https://medium.com/p/10bb2e8ffbcf</guid>
            <category><![CDATA[kiosk]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[banana-pi]]></category>
            <category><![CDATA[ham-radio]]></category>
            <category><![CDATA[openhamclock]]></category>
            <dc:creator><![CDATA[Dilshan R Jayakody]]></dc:creator>
            <pubDate>Sun, 22 Feb 2026 14:45:56 GMT</pubDate>
            <atom:updated>2026-02-22T16:11:31.964Z</atom:updated>
            <content:encoded><![CDATA[<p>For an amateur radio operator, having a real-time dashboard is essential for monitoring band conditions and identifying DX opportunities. While several solutions exist, I recently completed a project centered on <a href="https://github.com/accius/openhamclock">OpenHamClock</a>, an open-source, web-based successor to <a href="https://www.qrz.com/db/WB0OEW/SK2026">Elwood Downey’s (WB0OEW)</a> original <a href="https://xarc.us/2025/02/hamclock/">HamClock</a>. My goal was to move beyond simply opening a browser tab and instead create a dedicated, always-on kiosk for my workshop/shack. This setup allows me to monitor live DX cluster spots, PSKReporter reception, and satellite X-ray flux in real-time, helping me decide exactly when to jump into a radio session.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3F2gz_bCNJJea43sDPFrlA.jpeg" /><figcaption>Prototype build of OpenHamClock kiosk.</figcaption></figure><p>The heart of this project is a two-component system: a centralized server and a remote kiosk unit. For the server, I utilized a PC equipped with an <em>AMD Ryzen</em> 7 series CPU and 32GB of RAM. While this machine hosts multiple other services, it serves as the perfect, reliable host for the OpenHamClock backend.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FimchnlhspA0%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DimchnlhspA0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FimchnlhspA0%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4a02aa2cabef506b9b5fd3b7d0f2c428/href">https://medium.com/media/4a02aa2cabef506b9b5fd3b7d0f2c428/href</a></iframe><p>The installation process is straightforward, following the <a href="https://github.com/accius/openhamclock/blob/main/README.md">official repository guidelines</a> to get the software running on <a href="https://nodejs.org/en/download">Node.js</a>. To tailor the dashboard to my specific needs, I configured a .env file in the root directory with my preferred settings. Once I verified the deployment was accessible via the default port 3000, I transitioned the application into a formal system service to ensure it runs continuously and resumes automatically after system restarts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ffWLUgOe2UdK5bYn-OkEvQ.jpeg" /><figcaption>Live traffic updates in local OpenHamClock deployment.</figcaption></figure><p>When creating the custom openhamclock.service script, it is vital to update the Environment, WorkingDirectory, and ExecStart paths to match your specific installation. If you use a Node.js version manager other than <a href="https://github.com/nvm-sh/nvm">NVM</a> (such as <a href="https://github.com/Schniz/fnm">fnm</a> or <a href="https://brew.sh/">brew</a>), ensure you modify the service file accordingly. Additionally, update the User and Group variables to reflect your Linux credentials. After a quick daemon-reload and enabling the service via systemctl (check the commands in below), the backend was up and running without any issues:</p><pre>sudo systemctl daemon-reload <br>sudo systemctl enable openhamclock.service <br>sudo systemctl restart openhamclock.service</pre><p>With the server established, I turned my attention to the kiosk hardware. I chose the <a href="https://s.click.aliexpress.com/e/_c4rMopaT">Banana Pi M4 Zero</a>, based on the <em>Allwinner H618</em> with 2GB of DDR4 RAM — paired with a <a href="https://s.click.aliexpress.com/e/_c3bpsain">10.1-inch display</a>. This SBC provides ample power for a dedicated web interface while maintaining a tiny footprint. Because the kiosk is intended for long-term operation, thermal management and power stability were my primary hardware priorities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CR6oTjvL0WMBcYkpKz30_g.jpeg" /><figcaption>Banana Pi M4 Zero setup.</figcaption></figure><p>I am running this unit in a workshop environment where ambient temperatures typically stay between 29°C and 31°C. To prevent overheating during extended uptime, I installed a commonly available <a href="https://www.aliexpress.com/item/1005007848438530.html">Banana Pi M4 Zero heatsink kit</a>. After 24 hours of continuous operation, the board temperature stabilized at approximately 38°C, which is a very safe range for this chipset. Powering the unit requires a reliable source to avoid mid-session crashes; I used a <a href="https://s.click.aliexpress.com/e/_c305yXwF">5V 3A power supply unit</a> to drive the board.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*BAavTGMd1GeNQuUBtdFSjg.jpeg" /><figcaption>Heat map of the Banana Pi M4 Zero after 24 hours of continuous operation.</figcaption></figure><p>The software side of the kiosk required a “ <em>set it and forget it</em>” approach. I used <a href="https://www.armbian.com/">Armbian</a> to craft a minimal OS image built on the <a href="https://www.x.org/wiki">X Window System</a> using the <a href="https://openbox.org/">Openbox</a> window manager and <a href="https://www.chromium.org/chromium-projects">Chromium</a>. This image requires no keyboard or mouse and boots directly into the dashboard. To protect against SD card wear and file system corruption, the OS is designed to launch with a read-only rootfs. While the initial launch takes a moment, subsequent boots are impressively fast, typically reaching the dashboard within 30 to 35 seconds.</p><p>Integrating the Banana Pi into the display unit involved some custom fabrication. I designed a mounting unit using a 2mm acrylic sheet to securely attach the SBC to the back of the 10.1-inch display. Using a laser cutter, I precision-cut the sheet and all necessary mounting holes. This mounting panel drawing available in the download pack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1nUQ1Aup_TRxfyfavHYfxw.jpeg" /><figcaption>Mounting structure.</figcaption></figure><p>The final touch was optimizing the UI for the hardware. Given the display’s 1024×600 resolution, I configured OpenHamClock to run in “ <em>tablet mode</em>”, which scales the information perfectly for this screen size. The unit has been running continuously in my workshop for a few weeks now, allowing me to monitor the ionosphere, HF band traffic, and track SOTA/POTA activators in real-time.</p><p>All mentioned service scripts, environment files, and mounting drawings are available in <a href="https://drive.google.com/file/d/1Mg1Q_58gvcKQc9oTcvhEIHQUwwJRs45C/view?usp=sharing">my Google drive</a>, and the OS build system can be found on <a href="https://github.com/dilshan/openhamclock-kiosk">https://github.com/dilshan/openhamclock-kiosk</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10bb2e8ffbcf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discrete CMOS digital desk clock]]></title>
            <link>https://jayakody2000lk.medium.com/discrete-cmos-digital-desk-clock-20f9b0c3a85d?source=rss-132a98bb6beb------2</link>
            <guid isPermaLink="false">https://medium.com/p/20f9b0c3a85d</guid>
            <category><![CDATA[digital-clock]]></category>
            <category><![CDATA[retro]]></category>
            <category><![CDATA[clock]]></category>
            <category><![CDATA[perfboard]]></category>
            <category><![CDATA[cmo]]></category>
            <dc:creator><![CDATA[Dilshan R Jayakody]]></dc:creator>
            <pubDate>Fri, 30 Jan 2026 14:42:20 GMT</pubDate>
            <atom:updated>2026-02-01T00:21:35.379Z</atom:updated>
            <content:encoded><![CDATA[<p>This project began with a simple idea: to build a fully functional digital desk clock using only classic <a href="https://en.wikipedia.org/wiki/CMOS">CMOS logic ICs</a> that are still readily available in local electronics markets. No microcontrollers, no firmware, no programmable logic — just counters, flip-flops, logic gates, and seven-segment decoders doing exactly what they were designed to do. The result is a 24-hour digital clock powered from a 5V, 1A supply, drawing roughly 200mA, and assembled entirely by hand on a <a href="https://s.click.aliexpress.com/e/_c3J8BstV">perfboard</a> using point-to-point wiring.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0-rwXfnaG2CrJs4Vcwo4Fg.jpeg" /><figcaption>Fully assembled CMOS desk clock.</figcaption></figure><p>At the heart of the clock is a traditional timebase derived from a 32.768kHz crystal oscillator. This frequency is widely used in timekeeping because it can be divided cleanly to exactly 1Hz. A CMOS frequency divider, such as the <a href="https://www.ti.com/lit/gpn/cd4060b">CD4060</a> and <a href="https://www.ti.com/lit/gpn/cd4013b">CD4013</a>, performs this task, producing a precise one-second pulse that serves as the master clock for the entire system. From this point onward, time is counted purely in hardware, one pulse at a time, just as early digital clocks did.</p><p>The one-second pulses are fed into a cascade of <a href="https://www.ti.com/lit/gpn/cd4518b">CMOS BCD counters</a>. The first pair of counters handles the seconds, counting from 00 to 59. Once the count reaches 60, additional logic resets the seconds counters back to zero and generates a carry pulse for the minutes section. This same structure repeats for minutes, which again count from 00 to 59 before rolling over and advancing the hours counters. For the hours, the logic is slightly different, as the clock operates in a 24-hour format. Dedicated reset logic ensures that the count wraps correctly from 23 back to 00.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hd3Fg8tkF-m5-PE8C2WoIw.jpeg" /><figcaption>Top view of the perfboard.</figcaption></figure><p>Each digit of the clock is displayed using a seven-segment LED module driven by a <a href="https://www.ti.com/lit/gpn/cd4511b">BCD-to-seven-segment decoder</a>. These decoder ICs take the four-bit BCD output from the counters and translate it into the appropriate segment pattern. This greatly simplifies the design, as there is no need to generate segment patterns manually using discrete logic. Current-limiting resistors are placed on each segment line to protect the LEDs and keep the brightness consistent across all digits.</p><p>User interaction is also handled entirely in hardware. Push buttons allow manual setting of minutes and hours. When pressed, these buttons temporarily override the normal 1Hz clock signal and inject faster pulses into the relevant counters, allowing the time to be adjusted quickly. A stop/run control lets the clock be paused during setting, preventing accidental increments while adjustments are being made. All switch inputs are conditioned with simple RC networks and <a href="https://www.ti.com/lit/gpn/cd40106b">Schmitt-trigger inverters</a> to ensure clean, bounce-free transitions. The clock is designed to allow time adjustment while running, and when setting minutes, the seconds are automatically reset to zero.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fTnOl6ltUgUKP8LkRFIXkQ.jpeg" /><figcaption>Bottom side of the perfboard with PVC frame.</figcaption></figure><p>Powering the clock is straightforward. The entire circuit runs from a regulated 5V supply, with local decoupling capacitors placed near every IC to maintain signal integrity and suppress noise. Despite the number of chips involved, the total current consumption stays around 200mA, well within the capability of a 1A power adapter. This makes the clock reliable for continuous operation without excessive heat or stress on components.</p><p>One of the most enjoyable aspects of this project is how it was physically constructed. Instead of using a printed circuit board, the entire design was built on a perfboard using point-to-point wiring. While this approach requires patience and careful planning, it offers tremendous flexibility and a very satisfying hands-on experience. Once completed, the finished circuit was mounted inside a homemade picture frame built from <em>molded PVC picture frame bars</em>, giving the clock a unique, personal enclosure that blends electronics with DIY fabrication.</p><p>Using discrete CMOS logic for a clock like this comes with clear advantages. The design is fully transparent — every function can be understood by following the signals from one IC to the next. There is no firmware, no debugging tools required, and no dependency on proprietary development environments. The components are inexpensive, widely available, and electrically robust. From an educational perspective, this approach provides deep insight into digital design fundamentals such as counting, decoding, gating, and timing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6FwWYgHjebj_FIXKiJzadA.jpeg" /><figcaption>Home-made PVC frame.</figcaption></figure><p>At the same time, this style of design has its limitations. Compared to a microcontroller-based clock, the circuit is physically large and component-heavy. Adding features like alarms, date display, or power-saving modes would significantly increase complexity. Power consumption is also higher than that of a modern low-power MCU solution, especially due to the continuously driven LED displays. Any functional change requires hardware modification rather than a simple firmware update.</p><p>Despite these trade-offs, this CMOS digital desk clock succeeds exactly at what it set out to do. It demonstrates that reliable, accurate timekeeping is possible using nothing more than classic logic ICs and careful design. Beyond the technical aspects, the main motivation behind this project is its retro-style design and construction technique. I primarily designed it as a fully handmade piece to decorate my home workshop and to celebrate traditional, hands-on electronics.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FXlsWY_nPnCY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2FXlsWY_nPnCY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FXlsWY_nPnCY%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b88cd18c6c6ac8ddc2f73b798b8dd277/href">https://medium.com/media/b88cd18c6c6ac8ddc2f73b798b8dd277/href</a></iframe><p>Schematic of this project is available in <a href="https://github.com/dilshan/cmos-clock">https://github.com/dilshan/cmos-clock</a>. This project is released as an open hardware design under the <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International (CC BY 4.0)</a> license. You are free to use, modify, and share the design with proper attribution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20f9b0c3a85d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FA-5 VizControl]]></title>
            <link>https://jayakody2000lk.medium.com/fa-5-vizcontrol-b86c3e61f8f8?source=rss-132a98bb6beb------2</link>
            <guid isPermaLink="false">https://medium.com/p/b86c3e61f8f8</guid>
            <category><![CDATA[gui]]></category>
            <category><![CDATA[frequency-counter]]></category>
            <category><![CDATA[cross-platform]]></category>
            <category><![CDATA[bg7tbl]]></category>
            <category><![CDATA[fa-5]]></category>
            <dc:creator><![CDATA[Dilshan R Jayakody]]></dc:creator>
            <pubDate>Fri, 28 Nov 2025 01:49:57 GMT</pubDate>
            <atom:updated>2025-11-28T02:46:52.681Z</atom:updated>
            <content:encoded><![CDATA[<p>The <em>BG7TBL FA-5</em> frequency counter has become recognized as an excellent choice for experimenters and radio enthusiasts, offering high-spec performance comparable to branded units. But it remains remarkably accessible due to its low cost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-8VF2aWevOg6tzg-Wwnnlw.jpeg" /><figcaption>FA-5 Frequency counter.</figcaption></figure><p>The <em>FA-5</em> has powerful hardware. However, most existing control applications lack a good user experience. <a href="https://www.eevblog.com/forum/testgear/bg7tbl-fa-5-6gp-frequency-counter-inside-and-some-tests/">Many of them rely on scripting languages, such as Python, while others utilise simple command-line interfaces</a>. These limitations inspired us to create <em>FA-5 VizControl</em>. This native application provides a comprehensive, intuitive, and portable desktop experience for managing the <em>FA-5</em>.</p><p>We developed <em>FA-5 VizControl</em> using <a href="https://www.lazarus-ide.org/">Lazarus</a> and the <a href="https://www.freepascal.org/">FPC</a> ( <em>Free Pascal Compiler</em>). This choice ensures maximum compatibility and portability. The application functions as a standalone, portable executable on both Linux and Windows operating systems. There is no need for complex installation routines. Users simply download and launch it. Connectivity with the <em>FA-5</em> uses virtual serial port emulation over USB. Usually, no specialized device drivers are needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*LolzFdfoZuxDJmRt8xb5tQ.png" /><figcaption>FA-5 VizControl in Linux.</figcaption></figure><p>The GUI provides clear access to all <em>FA-5</em> control options. Users can select the input source (including the internal 10MHz reference), configure input impedance, and set gate time. Additional toggles are available for essential device parameters, such as input impedance and LPF settings. The GUI also allows users to directly program the default configuration to the FA-5’s internal EEPROM via a dedicated menu option.</p><p>The lower portion of the <em>FA-5</em> UI features a real-time data plotting graph, which maps the frequency over sampled points. This immediate graphical feedback is useful for analyzing signal stability or drifts. The user can also view measurements in different scales, ranging from Hz to GHz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*--QZ_CTSH50sZ5Is57BVVg.png" /><figcaption>FA-5 VizControl in Windows.</figcaption></figure><p><em>FA-5 VizControl</em> is an open source application. The source code and <a href="https://github.com/dilshan/fa5-vizcontrol/releases">compiled binaries</a> are available at <a href="https://github.com/dilshan/fa5-vizcontrol">https://github.com/dilshan/fa5-vizcontrol</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b86c3e61f8f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Surge arrester array]]></title>
            <link>https://jayakody2000lk.medium.com/surge-arrester-array-f8c722e9dcd3?source=rss-132a98bb6beb------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8c722e9dcd3</guid>
            <category><![CDATA[lightning-arresters]]></category>
            <category><![CDATA[ham-radio]]></category>
            <category><![CDATA[earth]]></category>
            <category><![CDATA[bl-2000]]></category>
            <category><![CDATA[grounding]]></category>
            <dc:creator><![CDATA[Dilshan R Jayakody]]></dc:creator>
            <pubDate>Sat, 15 Nov 2025 02:04:18 GMT</pubDate>
            <atom:updated>2025-11-15T02:22:05.776Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a simple surge arrester array that I made in my free time. Built using readily available components, the array provides effective shielding against lightning-induced surges and static discharges that can damage sensitive transmitting and receiving systems.</p><p>The primary goal of this project was to create a robust, low-loss surge protection unit that can handle multiple RF lines simultaneously. By integrating gas-discharge based lightning arresters with a solid grounding infrastructure, the array ensures that transient over-voltages are safely diverted to ground without affecting normal signal transmission.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d_3O_jYBHw0DV3VPoTfOLg.jpeg" /><figcaption>Installed surge arrester array.</figcaption></figure><p>The core of this project relies on a few key components:</p><p>At the heart of the design are eight <a href="https://s.click.aliexpress.com/e/_c3Z6vhbF">BL-2000 Lightning Arresters</a>, each incorporating a GDT ( <em>Gas Discharge Tube</em>). These units are designed to conduct high-voltage transients from the coaxial line directly to ground within microseconds of a surge event. The BL-2000 series is available in several barrel configurations; for this build, PL259 <em>female-to-female</em> models were selected for compatibility with standard coaxial systems.</p><p>Each arrester is rated for 50Ω impedance and 400 W power handling, supporting a frequency range from DC to 1000 MHz, making it suitable for most HF to UHF amateur radio applications.</p><p>Technical specification of the BL-2000 is listed below ( <em>copied from supplied datasheet</em>):</p><ul><li><strong>Frequency range:</strong> DC ~ 1000MHz</li><li><strong>VSWR:</strong> 1.1 or less</li><li><strong>Loss:</strong> Below 0.2dB</li><li><strong>Rated power: </strong>400W PEP</li><li><strong>Minimum discharge voltage:</strong> DC230V ±15%</li><li><strong>Discharge voltage: </strong>1000V</li><li><strong>Maximum discharge current:</strong> 6000A</li><li><strong>Repeated discharge capability:</strong> DC230V ±20%</li><li><strong>Insulation resistance: </strong>10000MΩ and above</li><li><strong>External dimensions:</strong> 77×41×21 (W×H×D) mm</li><li><strong>Weight:</strong> 114g</li></ul><p>Two <a href="https://s.click.aliexpress.com/e/_c2JOkbyN">2.5 mm-thick copper bus bars</a> are used as the main conductive path of the array. These copper strips — commonly used in electrical distribution and lightning protection systems-provide a low-impedance route for surge currents. The arresters are mounted such that their metal bodies are both mechanically and electrically bonded to the bus bars using <a href="https://s.click.aliexpress.com/e/_c3Bav7gl">12mm stainless steel M6 screws</a>. To minimize corrosion and ensure long-term conductivity, a <em>battery terminal protection compound</em> is applied to all connection points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8d-F0mqZfmMTCdlunrGpmw.jpeg" /><figcaption>Top view of the surge arrester installation.</figcaption></figure><p>The entire assembly is mounted on a galvanized metal or aluminum plate, which serves both as a mechanical support and as an additional conductive surface. In this setup, the mounting plate from a panel board enclosure was repurposed to provide structural stability and grounding continuity.</p><p>A 7/1.70 gauge grounding conductor connects the copper bus assembly directly to a dedicated earth ground. This ensures that surge energy is rapidly and safely dissipated into the earth during a lightning or static discharge event.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jqboqb_DROE6KP3GnEh73A.jpeg" /><figcaption>Bottom view of the surge arrester installation.</figcaption></figure><p>During normal operation, the GDTs inside the BL-2000 arresters remain in a non-conductive state, maintaining the integrity of the RF signal path. However, when a surge or high-voltage transient occurs, the GDTs ionize instantly, creating a conductive path that shunts the voltage spike from the coaxial center conductor to the arrester body. The surge current is then conducted through the copper bus and grounding wire into the earth, effectively bypassing and protecting the connected transceivers and receivers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eNCF8Y99oAxfmFYAdbux_A.jpeg" /><figcaption>ground conductor measurements and installation.</figcaption></figure><p>The array was tested with several HF transceivers across multiple frequency bands. No measurable change in S.W.R. was observed, indicating minimal signal loss and excellent impedance matching.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8c722e9dcd3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>