MikroLeo, A 4-Bit Retro Learning Platform

MikroLeo is a discrete TTL logic-based microcomputer intended for educational purposes created by [Edson Junior Acordi], an Electronics Professor at the Brazilian Federal Institute of Paraná, Brazil. The 4-bit CPU has a Harvard RISC architecture built entirely from 74HCT series logic mounted on a two-sided PCB using only through-hole parts. With 2K words of instruction RAM and 2K words of addressable RAM, the CPU has a similar resource level to comparable machines of old, giving students a feel for how to work within tight constraints.

Simulation of the circuit is possible with digital, with the dedicated PCB designed with KiCAD, so there should be enough there to get cracking with it. Four 4-bit IO ports make interfacing easy, with dedicated INput and OUTput instructions for the purpose. An assembler, compiler, and emulator are all being worked on (as far as we can tell) so keep an eye out for that, if this project is of interest to you.

We like computers a bit around these parts, the “hackier” and weirder the better. Even just in the 4-bit retro space, we’ve seen so many, from those built around ancient ALU chips to those built from discrete transistors and diodes, but you don’t need to go down that road, an emulation platform can scratch that retro itch, without the same level of pain.

Create A Compiler Step-By-Step

While JavaScript might not be the ideal language to write a production compiler, you might enjoy the “Create Your Own Compiler” tutorial that does an annotated walkthrough of “The Super Tiny Compiler” and teaches you the basics of writing a compiler from scratch.

The super tiny compiler itself is about 200 lines of code. The source code is well, over 1,000 but that’s because of the literate programming comments. The fancy title comments are about half as large as the actual compiler.

The compiler’s goal is to take Lisp-style functions and convert them to equivalent C-style function calls. For example: (add 5 (subtract 3 1) would become add(5,subtract(3,1)).

Of course, there are several shortcut methods you could use to do this pretty easily, but the compiler uses a structure like most full-blown modern compilers. There is a parser, an abstract representation phase, and code generation.

Continue reading “Create A Compiler Step-By-Step”

Here’s A Plain C/C++ Implementation Of AI Speech Recognition, So Get Hackin’

[Georgi Gerganov] recently shared a great resource for running high-quality AI-driven speech recognition in a plain C/C++ implementation on a variety of platforms. The automatic speech recognition (ASR) model is fully implemented using only two source files and requires no dependencies. As a result, the high-quality speech recognition doesn’t involve calling remote APIs, and can run locally on different devices in a fairly straightforward manner. The image above shows it running locally on an iPhone 13, but it can do more than that.

Implementing a robust speech transcription that runs locally on a variety of devices is much easier with [Georgi]’s port of OpenAI’s Whisper.
[Georgi]’s work is a port of OpenAI’s Whisper model, a remarkably-robust piece of software that does a truly impressive job of turning human speech into text. Whisper is easy to set up and play with, but this port makes it easier to get the system working in other ways. Having such a lightweight implementation of the model means it can be more easily integrated over a variety of different platforms and projects.

The usual way that OpenAI’s Whisper works is to feed it an audio file, and it spits out a transcription. But [Georgi] shows off something else that might start giving hackers ideas: a simple real-time audio input example.

By using a tool to stream audio and feed it to the system every half-second, one can obtain pretty good (sort of) real-time results! This of course isn’t an ideal method, but the robustness and accuracy of Whisper is such that the results look pretty great nevertheless.

You can watch a quick demo of that in the video just under the page break. If it gives you some ideas, head over to the project’s GitHub repository and get hackin’!

Continue reading “Here’s A Plain C/C++ Implementation Of AI Speech Recognition, So Get Hackin’”

Showing a new generation ATTiny on an SMD breakout plugged into a breadboard, being programmed

Come Learn About New ATtiny Generations

As the chip shortage hit, a lot of the familiar ATtiny chips have become unavailable and overpriced, and it mostly stayed the same since then. If you ever searched for “ATtiny” on your favourite electronics component retailer website, however, you’d notice that there’s quite a few ATtiny chips in stock most of the time – just that they’re from a much newer generation than we commonly see, with incompatible pinouts, slightly different architecture and longer model numbers like 412 and 3227. [David Johnson-Davies] from [technoblogy] is here to clarify things, and provide a summary of what the new ATtiny generations have to offer.

In 2019, he posted about 0- and 1-series ATtiny chips, comparing them to the ATtiny series we knew, decyphering the part numbering scheme for us, and providing a comparison table. Now, he’s returned to tell us about the 2- series ATtiny chips, merging the comparison tables together so that you can quickly evaluate available parts by their ROM/RAM size and the SMD package used. He also describes which peripherals are available on which series, as well as nuances in peripheral operation between the three generations. In the end, he reminds us of a simple way to program all these new parts – as it stands, you only need a USB-UART adapter and a 4.7K resistor.

Over the last decades, we’ve seen plenty of inspiring ATtiny projects – squeezing out everything we could out of 5 GPIOs, or slightly more for larger-package ATtiny chips. [David] has been setting an example for us, bringing projects like this function generator, this continuity tester, or an IR receiver with an OLED screen for diagnostics – all with an ATtiny85. It’s not the just pin count that’s a constraint, but the RAM and flash amounts as well – nevertheless, people have fit machine learning and an entire graphics stack into these chips before. If you’re stuck at home unable to do anything, like many of us were during lockdowns, you can always breadboard an ATtiny and see just how much you can get done with it.

I’ve Got Two Turntables And A Laser Engraver

Digital media provides us with a lot of advantages. For something like recording and playing back music, digital copies don’t degrade, they can have arbitrarily high quality, and they can be played in a number of different ways including through digital streaming services. That being said, a number of people don’t feel like the digital experience is as faithful to the original sound as it could be and opt for analog methods instead. Creating analog copies of music is a much tougher matter though, as [Marco] demonstrates by using a laser engraver to produce vinyl records.

[Marco] started this month-long project by assembling and calibrating the laser engraver. It has fine enough resolution to encode analog data onto a piece of vinyl, but he had to create the software. The first step was to generate the audio sample, then process it through a filter to remove some of the unwanted frequencies. From there, the waveform gets made into a spiral, accounting for the changing speed of the needle on the record as it moves to the center. Then the data is finally ready to be sent to the laser engraver.

[Marco] did practice a few times using wood with excellent success before moving on to vinyl, and after some calibration of the laser engraver he has a nearly flawless 45 rpm record ready to hit the turntable. It’s an excellent watch if not for anything than seeing a working wood record. We’ve actually seen a similar project before (without the wood prototyping), and one to play records from an image, but it’s been quite a while.

Thanks to [ZioTibia81] for the tip!

Continue reading “I’ve Got Two Turntables And A Laser Engraver”

I Need A Hackation

In recent times, the “staycation” became a popular alternative to forays far afield: you could take time off and enjoy your local surroundings without having to get stamps in your passport. But I don’t need to go to a museum or visit an amusement park, much less catch up on Stranger Things. I’ve got a project burning in my brain, and what I need is a few days of good solid time in the basement workshop to make some headway. What I need is a Hackation.

Some projects make great after-work distractions, but this one is hard and requires my full brainpower. It’s just not a beer-and-a-project project. So during the week is out. That leaves weekends, but that’s prime time for hanging out with the family. Sure, I can get work in a few hours of good mid-day think/work time in on a Saturday or Sunday when my son is out playing with friends, but there’s something about devoting a whole day or more to cracking a tough nut.

Of course, I’m fully aware that I’ll probably not get it finished in just a day, and that I’ll want another day, or yet another. So be it. Isn’t that the way it is when you’re at the beach in the summer as well? Shouldn’t hacking be at least as high on the priority list as a trip to Disneyland?

Have you ever taken a Hackation? Because that’s what I need. And please tell me there’s a better name for it.

A Practical Discrete 386

There are some chips that no matter how much the industry moves away from them still remain, exerting a hold decades after the ranges they once sat alongside have left the building. Such a chip is the 386, not the 80386 microprocessor you were expecting but the LM386, a small 8-pin DIP audio amplifier that’s as old as the Ark. the ‘386 can still be found in places where a small loudspeaker needs to be powered from a battery. SolderSmoke listener [Dave] undertook an interesting exercise with the LM386, reproducing it from discrete components. It’s a handy small discrete audio amplifier if you want one, but it’s also an interesting exercise in understanding analogue circuits even if you don’t work with them every day.

A basic circuit can be found in the LM386 data sheet (PDF), but as is always the case with such things it contains some simplifications. The discrete circuit has a few differences in the biasing arrangements particularly when it comes to replacing a pair of diodes with a transistor, and to make up for not being on the same chip it requires that the biasing transistors must be thermally coupled. Circuit configurations such as this one were once commonplace but have been replaced first by linear ICs such as the LM386 and more recently by IC-based switching amplifiers. It’s thus instructive to take a look at it and gain some understanding. If you’d like to know more, it’s a chip we’ve covered in detail.