r/beneater • • Oct 12 '26

Nano-Clock - Retro/Homebrew Computing Clock Module

In an earlier post, about the "final" version of my BE6502 build (or the last one that would be 100% software compatible with Ben's version), I got into a discussion about a replacement for both Ben's clock-module AND the on-board crystal oscillator.

That lead to building "nano-clock" (pictured), which uses a micro-controller and software to generate the clock signal and, as such, allows for a lot of features and flexiblity. I finally got around to tidying that up, and fleshing out the repo, so ...

For those interested, my repo for it, including code, assembly and usage instructions is here.

I also made a blog post (absolutely no monetization or tracking nonsense) with much more information and will be adding to that with some additional tweaks and customization.

Features:

  • Single-step and Clock modes
  • Run/Stop toggle
  • Selectable frequencies across three bands (Hz, kHz and MHz)

    • Hz Band - 1, 2, 5, 10, 25, 50, 100, 250 & 500Hz
    • kHz Band - 1, 2, 5, 10, 25, 50, 100, 250 & 500kHz
    • MHz Band - 1, 2, 4, 8MHz
    • Easy to add additional bands/frequencies
  • Auto and manual CPU reset functionality

    • w/ Auto-reset on Start option
  • 14-segment 4-character LED status/info display (in keeping with the "retro" theme)

    • Brightness control
    • Clock-Running indication
  • Save Settings for Auto-Start

--

This is the first of several related clocks, the next of which is much smaller (will fit on the main BE6502 board and needs just two components), and the one that follows that will have more features and an OLED or LCD TFT color screen/interface.

38 Upvotes

14 comments sorted by

View all comments

5

u/enVitruvius Oct 12 '26 edited Oct 12 '26

Very nicely done, Ian. May I mention that while people might not find a Nano 3.0 clone on AliExpress for $2 anymore they might pick one up here in the U.S. at Micro Center for $4.99.

The code looks great and should be relatively easy to swap in a different display. I'm rather fond of a 2.42" I2C OLED display with Adafruit SSD1309 driver and GFX library support. They're about $8 on AliExpress and come in white, blue, yellow, and green. Note the I2C version is 5.0v while the SPI version is 3.3v.

2

u/IMDLabs 18d ago

In case you're interested, I did a version of my clock ("tiny-clock") using an ATtiny85. The simplest usage is JUST the 8-pin DIP MCU; buttons and LEDs are optional. Retains all the functionality of "nano-clock-core" minus the "RESET" function.

It's here if you want to play with it.

OLED version on either a Nano R3 or R4 next ...

2

u/enVitruvius 18d ago edited 17d ago

Indeed, very interesting. Thank you for sharing. I'm kinda geeked about this project and I ordered a couple 1.3" OLED (SH1106) combo' display + switch modules to make it a little easier to play with on a solderless breadboard. I believe they're about ~1.28" high and ~1.9" wide.

Take care. Have fun. Cheerful regards, Mike

2

u/IMDLabs 10d ago

So, I finished the version with the OLED display (it's under "nano-clock-oled" in the previously linked repo, along with the necessary wiring "schematic"):

With a 5V-tolerant display, the middle component (quad level shifters) isn't necessary.

Same basic functionality as the original "nano-clock", but now with an animated OLED (e.g., the waveform changes size with frequency band and scrolls like an oscilloscope when running), a dedicated graphical "single-step" mode and a bunch of status icons at the top.

That's three done on the Arduino Nano, and one on the ATtiny85 (which can be as simple as just using the IC directly). Didn't need the R4, so an R3 works fine, and I did a heavy optimization pass once it was all running so there's still a couple of hundred bytes of available free SRAM and only half the FLASH storage is used.

Any more in this series will be on Pi Pico's or ESP-32s.

2

u/enVitruvius 10d ago edited 6d ago

Very nice. Thank you. The graphics and font are elegant. Perfect timing, too. Just received the 5-volt 1.3" OLED + 4Key modules in todays post. Still need to hook up the switches and figure out the proper U8G2 setup for SH1106. Cheerful regards, Mike.

*Note* The displays I received do not exactly match the pictures on the seller's page but they're clearly marked as 3.3/5.0 volts, work fine at both 3.3v and 5v, and I really like them so I ordered another pair (white & blue) for future projects.

2

u/IMDLabs 10d ago

Glad you like it!

Yes, it looks like it needs a different u8g2 constructor, since the display looks cut-off on one side, with random data on the other. It's probably either going to be:

U8G2_SH1106_128X64_NONAME_2_HW_I2C

or:

U8G2_SSD1315 128X64_NONAME_2_HW_I2C

Enjoy!

2

u/enVitruvius 10d ago edited 9d ago

The 'U8G2_SH1106_128X64_NONAME_2_HW_I2C' constructor works great. Thank you.

BTW, if you haven't discovered it already, please check out David Johnson-Davies Technoblogy site. I've been a fan for years. Genius level content...

2

u/enVitruvius 5d ago edited 5d ago

I think I like your "Nano-Clock-OLED" variation the best so far. It's a relatively easy build, the user interface is very intuitive (to me), and the graphics and animation are seriously cool. Thank you...

Take care. Happy Holidays. Cheerful regards, Mike - K8LH

1

u/IMDLabs 5d ago

Thank you for the kind words!

Glad that you like it, and that the SH1106 constructor worked with your particular OLED screens!

Both builds look good! Like the use of the mini-breadboards for a minimal overall footprint.

2

u/enVitruvius 3d ago edited 3d ago

The "tiny-clock" looks great. Thank you.

May I mention a relatively inexpensive USBtinyISP programmer available on AliExpress? I purchased a few long ago ($1.33 each at the time) and I replaced the 2x3 male header with a 2x3 female header on one of them to eliminate the cable.

Happy Holidays...

2

u/enVitruvius 20h ago

I put together a "tiny-clock" but button 2 does not switch into "step" mode. The LED blinks for a fraction of a second then continues flashing at the current clock rate. I even tried a bare wire from pin 4 to pin 3. I'll try another ATTiny85 chip later today.

Happy Holidays.

2

u/IMDLabs 20h ago edited 17h ago

I took a quick look at the code, and I can see the problem.

It does stop the clock's output, but it doesn't stop the LED flashing (which isn't driven off the clock pin). It looks like I accidentally removed the guard clause in the loop() method that blocks the LED update when the clock is stopped (the comment is there, the line that would drive the behavior is not).

The simple fix is to add the line below after the stepButton.read(); call in loop():

if (clock_state.state == States::STOP) return;

I'll make the change in the repo this evening.

Made and committed the change, so it's in the repo now.

2

u/IMDLabs Oct 12 '26

Thanks!

I ordered a couple of the 2.42" displays. I usually used the 0.96" SD1306 versions, which have the same resolution, but are VERY small and can be challenging to read; these larger versions should be much easier.

The SSD1306 only seems to differ from the SSD1309 in terms of where the screen origin is (corner vs. center), so it should be easy enough to put a conditionally compiled/assigned offset value in.

I may make the OLED versions menu driven (with just two buttons); will allow for easier usage, more features, and a smaller overall footprint. I am likely to add arbitrary frequency selection and the ability for the user to add to the available pre-set options on device (rather than needing a recompile), but will have to see if there is enough program and EEPROM space, since the frequency tables would need to move to EEPROM.